I am trying to replicate the functionality of Shape Keys but in Geometry Nodes. At the core of the setup I am using the technique quellenform introduced in this answer, but I am adding the ability to chain multiple "Shape Key" Group nodes together, support for vertex groups, the ability to specify the "Relative Key", and the ability to expand the Range Min/Max to
-10 to 10. Where I am stuck though is with curve objects. Bezier handle positions are not being interpreted correctly.
(.blend file links are included further below.)
Below is a screenshot of two test objects and their deformations - on the left a mesh cube that deforms correctly and a Bezier circle that does not deform correctly. The cube has a vertex group specifying deformation on only its left half, that's why it looks the way it does. To the right of each of those objects are three other objects with matching indices, that the deformation positions are taken from - the shape key poses, basically. The problem is that although
Curve.Basis is supposed to be deforming to look like
Curve.Key1 (because the modifier's slider is at
1.0), instead it's bent in the shape of a sine wave. I believe that the curve points are in the right place, but their handles are not.
The expected behavior would be the behavior of a typical curve object that has Shape Keys, where those keys deform the handles on the curve's points.
I'll explain how this works and what is working correctly, before I go into what isn't.
Below is an overview of the node tree setup. There are two types of Group Nodes - one that specifies the "Shape Key Basis" (it gets the vert positions using a Transfer Attribute node), and another that represents a "Shape Key" and can be iterated repeatedly as many times as desired, one iteration per key.
The screenshot below shows the inside of the "Shape Key Basis" group. It gets Attribute data and passes it down the chain. The Relative Key of the "basis" get passed unchanged from the "Relative to Basis" output socket. It gets routed into the "Rel. to Basis" input socket of the next Group node. The node tree is set up so every key will be relative to the basis by default. But alternatively, Attribute data for the Relative Key can be plugged into "Rel. to Other (specify)" and it will override "Rel. to Basis". This is designed to be the equivalent to selecting a key from the Shape Key part of Blender's UI where there is a field labeled "Relative To".
Above: The contents of the frame labeled "For Handles of Curve Objects" is what is handling curve data in this group, so that's the place to focus on most.
Now let's get into the real meat of this thing - the "Shape Key" Group node:
Yes, it looks like a lot is going on here. But the only area giving trouble is inside the bottom frame labeled "For curve objects...". Also the purple vector wires getting routed through to the Group Output sockets that are associated with left and right Bezier handle vectors are something to pay attention to.
I learned about the Curve Handle Positions node from this answer by Crantisz and used the same Transfer Attribute node logic that worked for vertex positions to try to assign the handle positions iteratively. But somewhere something isn't right.
gn-shape-keys-curve-handles-incorrect.blend (Blender 3.2.1)
A simple working setup
Something encouraging is that I've managed to get curve handles working in a simplified file with no iterating Group nodes or additional features:
gn-shape-keys-curve-handles-working.blend (Blender 3.2.1)
So this leads me to believe it is possible, with some tweaking, to get this working in iterated form. And it will be quite a handy node tree to have if we can figure out how to handle the handles. Hopefully somebody can spot where I've gone wrong. Cheers.