Page MenuHome

Geometry Nodes: Attribute Search Buttons
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Feb 24 2021, 12:34 AM.
Tokens
"Love" token, awarded by damian."Love" token, awarded by franMarz."Love" token, awarded by 14AUDDIN."Love" token, awarded by someuser."Love" token, awarded by TimBrown.

Details

Summary

This patch adds a search for existing attributes when you click
on an attribute field. It also adds the necessary changes to allow
any string to be entered from the search button.

This is only an initial implementation. It should be enough of an
improvement to add to master, but later versions will expose the
data type and domain of the attributes.

Ref T85658

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Feb 24 2021, 12:34 AM
Hans Goudey (HooglyBoogly) created this revision.

Also, I can split the change to the search button into a separate patch.

Overall this looks very nice!

  • Right now this is a bit tricky to test in master, because D10462 is not in yet. I suggest we merge that first and then you update this patch on top of that.
  • I'd prefer to split the attribute search specific parts from the internal ui code changes.
  • One thing that does not seem to work is to click on one of the suggestions to insert it into the text box.
  • In the long run, we should probably generalize "attribute search" on string sockets a bit. E.g. a string socket shouldn't know that it has an attribute search. It should just know that there is a hints for possible values. I'm not sure how to do that exactly yet.
source/blender/editors/interface/interface_handlers.c
174 ↗(On Diff #34351)

Clang format

3411 ↗(On Diff #34351)

Seems like it would make sense to put the assert before the type cast.

source/blender/editors/space_node/drawnode.c
3394

It would probably be good to only do this change for geometry node trees for now. Otherwise we might accidentally change addons using this socket.

source/blender/editors/space_node/node_geometry_attribute_search.cc
111

It's not important right now (and not worth the complexity), but I wonder if there is the possibility that this allocation is only done when the button becomes active.

source/blender/editors/space_node/node_intern.h
321

Do we have to pass the block separately or can it be derived from uiBut?

i did a mocap for built-in attributes:

Hans Goudey (HooglyBoogly) marked an inline comment as done.
  • Merge branch 'master' into temp-geometry-nodes-attribute-search
  • Merge branch 'search-button-allow-all' into temp-geometry-nodes-attribute-search
  • Cleanup, check for node tree type
  • Cleanup: Remove unused variable
  • Attribute Search: Always display search string with + icon
  • Cleanup: Add comment
  • Add todo comment
  • Use exposed "is first search" boolean
  • Merge branch 'search-button-first-search' into temp-geometry-nodes-attribute-search
Hans Goudey (HooglyBoogly) marked 2 inline comments as done.Feb 25 2021, 4:00 AM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/editors/space_node/drawnode.c
3393

Accessing the context in here is not great. This function could get a node tree argument if you agreed @Jacques Lucke (JacquesLucke)

source/blender/editors/space_node/node_geometry_attribute_search.cc
111

Yeah, the UI code is full of this unnecessary allocation. I don't see any way to avoid it in the context of the current code though, all of the interaction happens after the new layout is built. I did look though : P

source/blender/editors/space_node/drawnode.c
3393

I think you can extract the node tree from the PointerRNA arguments.

source/blender/editors/space_node/drawnode.c
3393

Ah, owner_id, of course.

  • Merge branch 'master' into temp-geometry-nodes-attribute-search
  • Adjust behavior for "add attribute" item
  • Use RNA pointer to get node tree
This revision is now accepted and ready to land.Feb 26 2021, 1:50 PM