Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds functionality to 'Rotation Input' nodes that allows the User to … #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

GitGub58
Copy link

@GitGub58 GitGub58 commented Jul 28, 2024

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.

…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.
@GitGub58 GitGub58 closed this Jul 28, 2024
@GitGub58 GitGub58 reopened this Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant