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