All pastes #285570 Raw Edit

Anonymous

public python v1 · immutable
#285570 ·published 2006-12-19 22:23 UTC
rendered paste body
import Blenderfrom Blender import *boneName = 'Bone.001'arm = Armature.Get('Armature')theBone = arm.bones[boneName]parentBone = theBone.parentboneTail = theBone.tail['ARMATURESPACE']boneHead = theBone.head['ARMATURESPACE']parentBoneHead = parentBone.head['ARMATURESPACE']theNormal = Mathutils.TriangleNormal(boneTail, boneHead, parentBoneHead)theRoll = Mathutils.Vector(0, 0, 1)*theBone.matrix['BONESPACE']theAngle = Mathutils.AngleBetweenVecs(theNormal, theRoll)arm.makeEditable()arm.bones[boneName].roll = theAnglearm.update()print theAngle