Page MenuHome

Geometry Nodes: Add default attribute name to field inputs/outputs
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Apr 26 2022, 12:39 AM.

Details

Summary

Geometry node group inputs and outputs get a new property that controls
the attribute name used for that field input/output when assigning the
node group to a modifier for the first time. If the default name is assigned
to an input, the default "Use attribute name" is true .

The modifier now clears its properties when the node group is cleared.

Ref T96707

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Apr 26 2022, 12:39 AM
Hans Goudey (HooglyBoogly) created this revision.
Simon Thommes (simonthommes) requested changes to this revision.Apr 26 2022, 12:29 PM

That was quick, thanks for the patch!

I have a couple of requests and comments from the user side:

  • I think for the sake of brevity we can just go with Default Attribute instead of Default Attribute Name
  • Right now it seems to me that once you set the default attribute, you cannot go back to a regular value as default, even when you remove the default attribute string. This should work differently. I'd say that either...
    • the default state is fully dependent on the string and is exactly used when it is not empty.
    • or there is an additional toggle for the default state. That would allow for a default attribute to be set even when the default state is a value.

I think we can safely go with the first option though. (Maybe that behaviour was your intention as well, but it doesn't seem to be working that way right now.)

Note:
Testing this makes me realize that we should probably add an indication in the modifier UI that an input attribute doesn't exist on the geometry. When a default is used you don't have the benefit of selecting the name from the UI list of available ones and you can't see when it's missing from the outside.
But I realize how this can be problematic when accessing attributes from geometry that is not passed in in the modifier stack, like with the object info node.

This revision now requires changes to proceed.Apr 26 2022, 12:29 PM

Thanks for the quick testing.

It looks like the issue was that I needed to check for the first character of the string being empty even when it was non-null.

I think for the sake of brevity we can just go with Default Attribute instead of Default Attribute Name

Yeah, that sounds fine to me. I guess the "Name" part is implied.

Testing this makes me realize that we should probably add an indication in the modifier UI that an input attribute doesn't exist on the geometry.

Yeah, makes sense. Maybe a regular warning for this would already be helpful.

Thanks for the updates, looks good now from my end!

This revision is now accepted and ready to land.Apr 28 2022, 12:19 PM