Adds functionality to 'Rotation Input' nodes that allows the User to … #5
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.
Greetings, thanks for creating and sharing your amazing RBF nodes code!
I've been using it for rigging human characters, but needed some extra functionality. I've edited your code (version 1.2.0) and am here sharing my changes in case you find it relevant to include them.
The changes i've added are to allow the user to use a pose bone's inherited or external rotations, instead of limiting to the current code that only uses explicitly and directly set rotations to the Euler or Quaternion bone properties. By 'inherited or external rotations to a bone', I mean the rotations that can be caused by constraints or other external events other than the ones directly set by user by setting Euler/Quaternion properties (while still including those rotations in the end result).
A use case for this change is, for example, driving shoulder deforms (either mesh shapekeys or deform pose bones) driven by a bone NOT manually rotated by the user, but by a bone driven by another constraint such as an ik target chain. In this case, we want to use the local rotation of the 'humerus' arm bone (the bone that is at the start of the ik chain, usually between the forearm and the shoulder bone), which is not driven by the user but by the ik chain. The user would want to extract that bone's rotation as an rbf driver for the shoulder deforms (rotation which would previously be 0 if we don't extract it's rotation caused by the ik target constraint).
What I am doing is extracting the local rotation applied to a pose bone (using math directly from the pose bone's matrices), ignoring any parent rotations, but combining user input rotations (directly changing the 'rotation_quaternion' or 'euler' properties of the bone) with the rotations caused by constraints (and any other external sources that transform the rotation).
For my code changes, I've added code for the 'rotation_input.py' node to add a checkbox to allow the user to enable this, making this change work for all selectable modes of rotations (euler, quaternion, etc), and added code to the 'common.py' file to add the matrix mathematics extraction of the local accumulated rotation for that bone. I've also added locales for the languages I'm comfortable with (english, portuguese and spanish).
This code can probably can be extended to location and scale nodes but I haven't explored that yet, maybe wait for input from users if they request this.
TODO: locales in other languages other than english, portuguese and spanish for variable
'strings.INCLUDE_EXTERNAL_ROTATIONS_LABEL'
Thank you, hope this is helpful, clear and not buggy :)
Changes:
Adds functionality to 'Rotation Input' nodes that allows the User to access the combined (implied) rotations for a pose bone, instead of previously only having access to the deliberately set by the user 'rotation_euler' or 'rotation_quaternion' pose bone properties, which ignore external rotations. This allows the user access to rotations to the bone caused by Constraints or other external sources, while also combining them to directly set 'rotation_*' properties.
This is useful, for example, when using a rotation as the RBF driver input, and taking the rotation applied by an IK constraint to a humerus bone in that IK chain, to assist in rigging a character's shoulder mesh shapekeys or helper bone transforms.
Changed the 'rotation_input' node to have a new checkbox that allows the user to use the accumulated rotations to a bone.
Edited the 'common' file to include functions that perform the math matrix transforms to accesss these relevant rotations.
Created new variable in 'strings' file: 'INCLUDE_EXTERNAL_ROTATIONS_LABEL', and introduced locale translations for that variable in english, portuguese and spanish.