I have some animation fcurve data provided for the case of inherit scale unchecked for pose bones.
Example: Bone03 is a child of Bone02. Inherit scale is unchecked for Bone03. At frame 1, Bone02 is not scaled (i.e. Sx, Sy, Sz = 1.0000). At frame 30, Bone02 is scaled on Y with a factor of 2 (Sy = 2.0000; Sx, Sz = 1.0000).
Since inherit scale is not checked for Bone03, it is not affected by it's parent scaling at frame 30. This is the intended result.
Problem: I need to import the blend file in Jmonkey which scales the child regardless of it's setting in Blender. The animation hence appears scaled wrongly in Jmonkey. Basically, I need to check inherit scale on the child bone and then reverse the inherit scale operation on the child bone via a python script in Blender before loading it in Jmonkey.
I've tried to copy the matrix of the child pose bone (before setting use_inherit_scale to True on the child edit bone) and then reassign it to the child pose bone. The result looks like it ignores the reassign of the original matrix and scales the child anyway. Here's the code:
import bpy obj = bpy.context.object scene = bpy.context.scene bpy.ops.object.mode_set(mode='POSE') scene.frame_set(30.0) pb = obj.pose.bones['Bone03'] start_matrix = pb.matrix.copy() #copy the initial pose bone matrix print(start_matrix) bpy.ops.object.mode_set(mode='EDIT') eb = obj.data.edit_bones['Bone03'] eb.use_inherit_scale = True bpy.ops.object.mode_set(mode='POSE') print(pb.matrix) pb.matrix = start_matrix #try to force reassign the start matrix print(pb.matrix)
Here is a file with the problem demonstrated (I hope much clearer). When you open it the animation is correct (but with inherit scale unchecked). As soon as you run the script, Bone03 get's scaled wrongly.
The question: how can I force reassign the initial matrix to the pose bone, after programmatically setting use_inherit_scale = True on the edit bone?