Biomedical researcher needs help!

I am a biomedical engineer and I am currently working in using Blender 2.49 with a script to animate a model from MakeHuman according to LocX,Y,Z and RotX,Y,Z it imports from a .str file.

Right now, the script I have written so far allows the user to match each object (armature) in the model with a body from the .str file. What I’m struggling with is how to select each bone in pose mode then keyframming and rendering the final animation. I should probably mention that the bones don’t belong to the same armature, as I want each of them to have three degrees of freedom when it comes to its Loc. The only reason I’m using them is to makre it easier to deform an exterior mesh (skin).

Does anyone know how to do this? If anyone has a code that performs part of the functions I need and doesn’t mind sharing it, it would be most helpful. Also, if you know of a better approach I’m all ears :slight_smile:

Cheers

I suppose you know names of your armatures (armature + object_armature like in this thread here), the name of the bone you’d like to manipulate. Then the following will set-up bone’s rotations as per the given Euler angles (eu variable) at fNumber frame-number.

def Set_pBone_rot(aName,oaName,bName,eu,fNumber):
    arma = Armature.Get(aName)
    ob_arma = Object.Get(oaName)
    bones = arma.bones
    pose = ob_arma.getPose()
    arma.makeEditable()
    posebone = pose.bones[bName]
    posebone.quat = eu.toQuat()
    posebone.insertKey(ob,fNumber,Object.Pose.ROT)
    arma.update()
    return

At the end of bones manipulations, you should have

Window.RedrawAll()

which will make your changes visible in ALL window areas in Blender.

May be, if you publish your script, you will get more specific help…

Regards,

I’m not very familiar with quaternions. Because previously, I was thinking of doing it more like this:

                obj = Object.Get(object_names[i])
                obj.RotX = theta
                obj.RotY = phi
                obj.RotZ = psi

                obj.LocY = -1*float(transf_list[12])
                obj.LocX = float(transf_list[13])
                obj.LocZ = float(transf_list[14])
                Redraw()

where object_names is a list with all thee objects names and transf_list is a list with Euler coordinates read from a .str file.

Of course that’s for still for objects in object mode. Do you know how to do this with armatures in pose mode, keeping eulerian coordinates?

Thanks a lot

My previously published code (posting # 2 above) deals exactly with this - sets values for rotation of a bone from an armature at certain frame-number in bone’s corresponding IPO which then used while Blender render is animating the scene.

Regards,

Right! My bad.

Select Your Armature
Suppose there are 3 Bones
Bone1. Create a Empty on the Starting Point that Bone named eBone1
Bone2. Create a Empty on the Starting Point of that Bone named eBone2
Bone3. Create a Empty on the Starting Point of that Bone named eBone3

Select Armature->Pose Mode
Bone1->copy Location ->eBone1
Bone2->copy Location ->eBone2
Bone3->copy Location->eBone3

Now do your type of programming on these empties like OBJ you are doing.
Hope this will work.

I am having a problem with Copy Location because all bones in an armature have their Loc set as the Loc of the armature. Do you know if there’s any way of making the recalculate it?

Armature->Edit- Mode
Select Bone ->In the Edit Window->Uncheck CO button, By doing this your this Bone will be disconnected from the parent bone and it will still be child of the parent bone.

Dont Use this for the Master Bone. All other Bone you can do this. I have putup a Blend file here
http://blenderartists.org/forum/showthread.php?p=1706045#post1706045
You can download. Open this Bone.Blend and Pres ALT+A

Great! Thanks for your help. Where’s that CO button? :eek:

found it!:smiley:

I’ve tried it and it didn’t seem to help. :frowning:

I’ve moved this question to another thread where I can attach my model. Feel free to drop by :wink:

I’ve figured out a way using copy location and rotation and a a script link to make the armature update its position every frame but I can’t make the mesh deform itself along the way. It’s weird because it moves alright when I grab or rotate each bone manually. Do you know why that may be?