I am writing a simple Python script that creates an animation. In order to do this, I am using the following code:
boneSelect = bpy.context.object.data.bones[boneName]
boneSelect.select = True
bpy.ops.transform.rotate(value = radians(rotDegrees),axis = rotAxis)
boneSelect.select = False
It rotates a bone and then I use lock key frame command.
My problem is that if I run it twice, it will re-apply the rotations on the animation sequence. That makes the process of development tedious. I am deleting the human model and re-loading it from disk by using the UI, then I use
Run script command.
I've also checked this answer, it does the same - relative rotation. I've also tried setting the
rotation_euler property of the bone directly, but it does not seem to do anything. Any of these might solve my problem:
- Find a command that resets all rotations in all key frames that I did.
- Set the bone rotation values in an absolute way
- Find a command that deletes an object and a command that loads
.mhxobject from disk.