diff options
author | Hans Goudey <h.goudey@me.com> | 2021-02-17 02:15:08 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-17 02:15:08 +0300 |
commit | 461d4fc1aae200a6310a254b6e7c08070d9e94a7 (patch) | |
tree | f2ac642a29497855d879a022bc249a242a05b666 /source/blender/nodes/NOD_geometry_exec.hh | |
parent | c9c4802c1c26d1125d9bb41ff9187b61e167cc42 (diff) |
Geometry Nodes: Node error messages
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.
Differential Revision: https://developer.blender.org/D10290
Diffstat (limited to 'source/blender/nodes/NOD_geometry_exec.hh')
-rw-r--r-- | source/blender/nodes/NOD_geometry_exec.hh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh index 18de52ed6d4..d5fd3ff0abb 100644 --- a/source/blender/nodes/NOD_geometry_exec.hh +++ b/source/blender/nodes/NOD_geometry_exec.hh @@ -21,6 +21,7 @@ #include "BKE_attribute_access.hh" #include "BKE_geometry_set.hh" #include "BKE_geometry_set_instances.hh" +#include "BKE_node_ui_storage.hh" #include "BKE_persistent_data_handle.hh" #include "DNA_node_types.h" @@ -28,6 +29,7 @@ #include "NOD_derived_node_tree.hh" struct Depsgraph; +struct ModifierData; namespace blender::nodes { @@ -62,6 +64,7 @@ class GeoNodeExecParams { GValueMap<StringRef> &output_values_; const PersistentDataHandleMap &handle_map_; const Object *self_object_; + const ModifierData *modifier_; Depsgraph *depsgraph_; public: @@ -70,12 +73,14 @@ class GeoNodeExecParams { GValueMap<StringRef> &output_values, const PersistentDataHandleMap &handle_map, const Object *self_object, + const ModifierData *modifier, Depsgraph *depsgraph) : node_(node), input_values_(input_values), output_values_(output_values), handle_map_(handle_map), self_object_(self_object), + modifier_(modifier), depsgraph_(depsgraph) { } @@ -199,8 +204,17 @@ class GeoNodeExecParams { } /** + * Add an error message displayed at the top of the node when displaying the node tree, + * and potentially elsewhere in Blender. + */ + void error_message_add(const NodeWarningType type, std::string message) const; + + /** * Creates a read-only attribute based on node inputs. The method automatically detects which - * input with the given name is available. + * input socket with the given name is available. + * + * \note This will add an error message if the string socket is active and + * the input attribute does not exist. */ ReadAttributePtr get_input_attribute(const StringRef name, const GeometryComponent &component, |