Page MenuHome

Geometry Nodes: Node error messages
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Feb 3 2021, 5:06 AM.

Details

Summary

This patch adds icons to the right side of nodes when they encounter a
a problem. When hovered, a tooltip displays describing the encountered
while evaluating the node.

Some examples are: attribute doesn't exist, mesh has no faces,
incorrect attribute type, etc. Exposing more messages to the system
will be an ongoing process. Multiple warnings per node are supported.

The system is implemented somewhat generically so that the basic
structure can also be used to store more information from evaluation
for the interface, like a list of available attributes.

Currently the messages are just button tooltips. They could be styled
differently in the future. Another limitation is that every instance of
a node group in a parent node tree will have the same error messages,
the "evaluation context" used to decide when to display the tooltips
must be extended to support node tree paths.

Ref T83237

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Feb 3 2021, 5:06 AM
Hans Goudey (HooglyBoogly) created this revision.
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
  • Add context struct
  • Rewrite error message API for generality as general "UI storage"
  • Changes from review
  • Cleanup
Hans Goudey (HooglyBoogly) retitled this revision from WIP: Geometry Nodes: Node error messages to Geometry Nodes: Node error messages.
source/blender/blenkernel/BKE_node_ui_storage.hh
40

Mention in a comment that name and session ids are used instead of pointers, so that they don't become dangling pointers.

source/blender/blenkernel/intern/node_ui_storage.cc
74

nice magic number, but yeah, it's done the same everywhere..

83

remove comment

source/blender/editors/space_node/node_draw.cc
1230

(0.8f * U.widget_unit)

1265

Wanted to change "todo" to something else.

1273

typo

source/blender/modifiers/intern/MOD_nodes.cc
241

Should be btree_orig_ or btree_cow_.

source/blender/nodes/NOD_geometry_exec.hh
62

orig vs cow

source/blender/nodes/intern/node_geometry_exec.cc
79

I think the check should be !name.is_empty() instead.

source/blender/blenkernel/BKE_node_ui_storage.hh
37

It does not seem to handle node groups at all yet, does it?

Seems like this should show one or two error messages on the Attribute Randomize node.

Hans Goudey (HooglyBoogly) marked 7 inline comments as done.Feb 16 2021, 7:05 PM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/blenkernel/BKE_node_ui_storage.hh
37

I'm testing this now and I can't get it to work either. Got to check, probably the context check is failing again.

source/blender/blenkernel/intern/node_ui_storage.cc
74

Yeah, the level is sort of arbitrary, oh well.

  • Add comment explaining more about node context struct
  • Remove another TODO comment
  • Use parantheses around define value
  • Fix typo in variable name
  • Rename node tree variables
  • Working in nested node groups, multiple modifiers

I reordered the maps to be context -> string -> node UI storage

Hans Goudey (HooglyBoogly) marked 2 inline comments as done.Feb 16 2021, 9:30 PM

I've only checked this on my phone now. The latest changes make sense to me!
Good work :)

source/blender/blenkernel/BKE_node_ui_storage.hh
36

"re-allocates between allocations" doesn't sound quite right

43

private fields should use a trailing underscore.
Also consider adding an explicit private:

This revision is now accepted and ready to land.Feb 16 2021, 9:50 PM
Hans Goudey (HooglyBoogly) marked 3 inline comments as done.Feb 16 2021, 11:09 PM
This revision was automatically updated to reflect the committed changes.