Add rotation attributes and node sockets #92967
Tasks, not necessarily in order:
- Add a basic
Quaternionclass in blenlib. More methods can be added as needed.
- Add a rotation node socket
- Expose in the UI as an XYZ order Euler (in the future, this could be a runtime option).
- Convert existing rotation nodes to have rotation inputs and outputs.
- Rename nodes "Rotate Euler" and "Align Rotation to Vector". Maybe "Modify Rotation" is the best name for the former.
- Move the nodes to a new "Rotation" category.
- Add versioning for backwards compatibility (maybe deal with forward compatibility too by just implementing new nodes?)
- Add a "quaternion" custom data type, using a specific type instead of
float4, similar to the way we refer to colors.
- Interpolations for the custom data API
- Interpolations for the
- Add as a choice for nodes with type drop-downs.
- Mix (#109084)
- Others: Capture attribute, named attribute nodes, etc.
- Nodes that generate rotations: Curve to Points, Distribute Points on Faces
- Axes to Rotation node (#104416)
Related: #92766 (Decide how rotation socket type should be stored)
One thing I'd like to point out here is that Euler to quaternion conversion is a lossy operation, since multiple Euler coordinates map to one quaternion coordinate. So if you store a value as a quaternion and show it in the UI as Euler, sometimes the value will then jump to something else. For some cases it does not matter, but an animator does not want to have their Euler coordinates completely changed when editing rotations for animation. For mechanical rigging, the sequential nature of rotation along each axis can also be information that you want to preserve.
I don't immediately know if that would cause many issues when it comes to geometry attributes. But one thing is that if you have a socket then the default value of that should be stored the same as Euler if its shown in the UI that way, and it should only be converted to quaternion for evaluation of the node.
Please also include the Animation & Rigging module in any future discussions, we kinda do things with rotations as well ;-)
Noticed some inconsistency. It's not that important right now, but it makes sense to have a final choose.
|By quaternion components||By euler rotation|
Name for enums.
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?