setRoll question

i’m planning a script for automated rigging - bases on the working rigs i built so far.

i want first to create a rig-guide, consisting of objects which define joints like elbow, shoulder, knee etc. the user can move those objects to match the proportions of his character and finally hit “create” to get the armature and bones created.

the basics work so far, the armature is being created, but setting the roll value to zero doesn’t work. see the code (so far almost original from documentation)

import Blender
from Blender import *
from Blender.Armature import *
from Blender.Armature.Bone import *

#get the position of rig-guide objects
sh_L=Blender.Object.Get('sh_L')
sh_L_loc = sh_L.getLocation()

el_L=Blender.Object.Get('el_L')
el_L_loc = el_L.getLocation()

ha_L=Blender.Object.Get('ha_L')
ha_L_loc = ha_L.getLocation()

#create armature
armObj = Object.New('Armature', "Armature_obj")
armData = Armature.New()

#add bones at positions determined by positions of guide-objects
bn1=Blender.Armature.Bone.New("bone1")
bn1.setHead(sh_L_loc)
bn1.setTail(el_L_loc)

bn2=Blender.Armature.Bone.New("bone2")
bn2.setHead(el_L_loc)
bn2.setTail(ha_L_loc)
bn2.setParent(bn1)

#set roll-values to zero
bn2.setRoll(0)
bn1.setRoll(0)
armData.addBone(bn1)
armData.addBone(bn2)
armData.drawAxes(1)
armObj.link(armData)

scn = Blender.Scene.getCurrent()
scn.link(armObj)

armObj.makeDisplayList()
Blender.Window.RedrawAll()

not a big deal, but i was just wondering why? hitting ctrl+n in edit mode solves the problem.

don’t expect too much, i have other work to do, too. but still i hope that with some help i can build something useful, especially for a time-comsuming task like rigging humanoids.

best regards

marin

For some reason rolls are always ‘localspace’. This is sorta pain in the @. So setting the roll to 0 on the 1st bone sets it to 0 - seting it to 0 on the second bone sets it to whatever the localspace roll is on the second. If you set the first to +20 then both would be +20. If you set the second to -20 The first would be +20 the second would be 0.
This needs fixing in the API. We need to deconstruct the matrix of the child bone back to axis/angle (which isn’t done yet) based on the nested parent transforms to fix the rolling prob. :x

ok. is this a “well-known” issue or is a bug-report needed?

marin

It’s well know to me :slight_smile: and is being worked on.

Has anything been done on this?

cheers,

Bob

First of all bump. I am having the same problem with setRoll.

Second, I wanted to ask why the numbers shown for roll in the UI vary from those returned by the PythonAPI? I would assume these numbers are the actual deconstructed values you’re referring to?