Complex armature with bone constraints - setting PoseBone matrix_basis may not influence another bone's matrix as expected as not calculated yet (possible bug, definite FBX export bug!) #53202

Closed
opened 2017-10-30 15:08:19 +01:00 by Tom Wilson · 7 comments

Not sure if this is a bug - the only way to get the correct PoseBone's matrix after setting another PoseBone's matrix_basis (which in some way influences the former bone) is to call scene.update() after applying matrix_basis to one or many PoseBones.
At the very least, this should be noted in the Gotchas section on docs.blender.

Taking this into account - I have spotted a definite bug in the FBX export addon.
Looking through the FBX export addon file export_fbx_bin.py, I noticed the coder had tripped up with this same misconception.
After both instances of:

if pbones_matrices is not ...:
	for pbo, mat in zip(ob.pose.bones, pbones_matrices):
		pbo.matrix_basis = mat.copy()

scene.update() needs to be called immediately afterwards.
Assuming bake_anim_force_startend_keying = False and there are multiple actions being exported, the last frame of the previous action will influence the following action if one of the keying bones was not keyframed on the first frame.
This is very noticable when exporting a rigify rig for example, and creates bad exports.

Please see attached blend file for simple example (with code).

bugfbxexportpose2.blend

Not sure if this is a bug - the only way to get the correct PoseBone's matrix after setting another PoseBone's matrix_basis (which in some way influences the former bone) is to call scene.update() after applying matrix_basis to one or many PoseBones. At the very least, this should be noted in the Gotchas section on docs.blender. Taking this into account - I have spotted a definite bug in the FBX export addon. Looking through the FBX export addon file export_fbx_bin.py, I noticed the coder had tripped up with this same misconception. After both instances of: ``` if pbones_matrices is not ...: for pbo, mat in zip(ob.pose.bones, pbones_matrices): pbo.matrix_basis = mat.copy() ``` scene.update() needs to be called immediately afterwards. Assuming bake_anim_force_startend_keying = False and there are multiple actions being exported, the last frame of the previous action will influence the following action if one of the keying bones was not keyframed on the first frame. This is very noticable when exporting a rigify rig for example, and creates bad exports. Please see attached blend file for simple example (with code). [bugfbxexportpose2.blend](https://archive.blender.org/developer/F1077357/bugfbxexportpose2.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @hedgehog90-3

Added subscriber: @hedgehog90-3

Added subscriber: @mont29

Added subscriber: @mont29
Bastien Montagne self-assigned this 2017-10-31 11:42:02 +01:00

Having to call scene.update in such cases is expected (you have same issues when e.g. manipulating meshes from bpy API, if you need actual resulting data of those manipulations, you'll have to enforce an update yourself, as the one triggered by regular scene refreshing from UI will likely not happen soon enough).

So this totally sounds like an FBX exporter bug, thanks for reporting, will check asap.

Having to call scene.update in such cases is expected (you have same issues when e.g. manipulating meshes from bpy API, if you need actual resulting data of those manipulations, you'll have to enforce an update yourself, as the one triggered by regular scene refreshing from UI will likely not happen soon enough). So this totally sounds like an FBX exporter bug, thanks for reporting, will check asap.

This issue was referenced by 4e84d14771

This issue was referenced by 4e84d14771b6c32e156469fee965e6db07e0ea84

This issue was referenced by 0b286650b3

This issue was referenced by 0b286650b3e9913196bd16874c4840165392803d

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#53202
No description provided.