For each Named Attribute loop
With the recent addition of the Geometry Attribute constraint and Bone Info node, I think it should be time to seriously consider Geometry Nodes as a possible auto rigger. This is an idea I've had for a while, but was never really able to find a feasible/reasonable implementation until like last week.
Normally, In order to make modifications to vertex weights, you enter the weight group's name and store it back with the same name. With string nodes, you can affect the mirrored vertex group by replacing the end of the string name with .L or .R. However, you'd still need to repeat the process for every vertex group "pair" of your model, and sometimes when you're working on it, the name changes, new groups are added, and overall, clutter accumulates very fast.
With the recent addition of Closures, I was somewhat able to make a workaround for general application, by splitting a string with each comma and evaluating a closure for each string.
But obviously, each vertex groups still need to be listed in a single string for it to work properly, since string arrays cannot be group inputs (like the ones found on the "join" nodes)
Additionally, overwriting an attribute value on one loop means that the next loop, sampling that same attribute will differ. To prevent this, the setup becomes even more convoluted just to get the original attribute value, and the amount of times needed to precise which domain and data type are involved is comical.
The domain is precised twice and the type at least four times.
Here's the solution that I'm proposing : a new Zone node that, at initialization, requires a domain, a type and an input geometry, nothing less, nothing more.
This filters down all named attributes found on the input Geometry, and begins to loop on the list of attributes that match the requirements.
Each beginning of a loop, there is
- The name of the current named attribute as a single string socket
- The value of the current named attribute as a field socket (of the chosen type), sampled from the original input geometry (as opposed to its potentially overwritten value).
Each end of loop, there is
- The value field socket to overwrite the current named attribute's value, similar to how you would use the "Store Named Attribute".
- A single boolean socket to skip the current named attribute, similar to how you would skip a frame in the Simulation zone. (Single boolean instead of a field boolean for performance, you could use a "Switch" node within the zone while keeping the "Skip" off to only affect certain elements).
Note that the mockup above is built with existing geometry nodes. The "For Each Attribute" input node would have a black header like its output, and the output's "value" socket would accept fields (ignore the error red cable warning) and change depending on the chosen attribute type.
I'm sure listing all attributes of a certain domain and type and do the same thing on each of them would be quite useful for many applications, such as UV mapping, on different LoDs or whatever, which is why I'd imagine the attribute type menu to also include "2D Vector" "Byte Color" and "8-Bit Integer" to further filter down which attributes are looped through.
2 Comments
Lists
What You want is lists.
Geometry Nodes: Attribute List Node #134760
Lists didnt make it into 5.1 in time, but they will land probably(i hope because its LTS) in 5.2.
Cartesian Caramel coming in clutch once more haha
Thanks, this is awesome news