Add new roll strategy ALIGN_Z_REFERENCE_Z, for issue #310#313
Open
met4citizen wants to merge 1 commit intomakehumancommunity:masterfrom
Open
Add new roll strategy ALIGN_Z_REFERENCE_Z, for issue #310#313met4citizen wants to merge 1 commit intomakehumancommunity:masterfrom
met4citizen wants to merge 1 commit intomakehumancommunity:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for a new bone roll strategy, "ALIGN_Z_REFERENCE_Z". For a detailed discussion of the topic, see issue #310.
In short, this feature ensures that bone axes can be automatically aligned with a specified reference model. In certain use cases and runtime systems, this is necessary to enable reuse of existing poses and animations. By default, Blender determines bone axes heuristically, which is not acceptable in these scenarios, and the previously supported roll strategies are insufficient.
Rig definition
When a bone's "roll_strategy" property in the rig file (.mpfbskel) is set to "ALIGN_Z_REFERENCE_Z", the reference vector can be specified using the new "roll_reference_z" property, defined as an [x, y, z] vector in armature space.
An example section from mpfbskel rig file:
Note: In this example, the original "roll" value effectively serves as a fallback. It will be used if the new strategy is not implemented, for example when using an older MPFB version.
UI:
This PR introduces minimal UI changes. Specifically, it adds the new roll strategy to the "MPFB Bone Strategies" panel:
If the strategy is initially set to "Use Current Z-axis as Reference", the reference Z value was/will be taken from the vector specified in the rig definition file. If the user manually changes the strategy to "Use Current Z-axis as Reference", the reference vector will be set to the bone's current Z-axis.
Important
Additional Notes
bone.align_roll(ref_z)method already handles the projection internally, making an explicit implementation unnecessary.