Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-07-23 00:53:35 +0300
committerHans Goudey <h.goudey@me.com>2021-07-23 00:53:35 +0300
commit49e68f15f204a18a1c983cacf535d3315d742732 (patch)
tree41018ad9fded96a15d76c311e51876577339dcd0 /source/blender/nodes
parentf76dfe8fb45c9c270c295ff76f6fd058e2b64d0d (diff)
Geometry Nodes: Display Node Warnings in Modifier
With this commit, node warnings added to nodes during evaluation (not "Info" warnings) will also draw in the modifier. In the future there could be a "search for this node" button as well. Differential Revision: https://developer.blender.org/D11983
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/NOD_geometry_nodes_eval_log.hh3
-rw-r--r--source/blender/nodes/intern/geometry_nodes_eval_log.cc18
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
index b85862a0176..00d97b24646 100644
--- a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
+++ b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
@@ -31,6 +31,7 @@
*/
#include "BLI_enumerable_thread_specific.hh"
+#include "BLI_function_ref.hh"
#include "BLI_linear_allocator.hh"
#include "BLI_map.hh"
@@ -267,6 +268,7 @@ class TreeLog {
const NodeLog *lookup_node_log(StringRef node_name) const;
const NodeLog *lookup_node_log(const bNode &node) const;
const TreeLog *lookup_child_log(StringRef node_name) const;
+ void foreach_node_log(FunctionRef<void(const NodeLog &)> fn) const;
};
/** Contains information about an entire geometry nodes evaluation. */
@@ -296,6 +298,7 @@ class ModifierLog {
const bNodeSocket &socket);
static const NodeLog *find_node_by_spreadsheet_editor_context(
const SpaceSpreadsheet &sspreadsheet);
+ void foreach_node_log(FunctionRef<void(const NodeLog &)> fn) const;
private:
using LogByTreeContext = Map<const DTreeContext *, TreeLog *>;
diff --git a/source/blender/nodes/intern/geometry_nodes_eval_log.cc b/source/blender/nodes/intern/geometry_nodes_eval_log.cc
index 3024cc51cad..7487f11d77d 100644
--- a/source/blender/nodes/intern/geometry_nodes_eval_log.cc
+++ b/source/blender/nodes/intern/geometry_nodes_eval_log.cc
@@ -99,6 +99,13 @@ SocketLog &ModifierLog::lookup_or_add_socket_log(LogByTreeContext &log_by_tree_c
return socket_log;
}
+void ModifierLog::foreach_node_log(FunctionRef<void(const NodeLog &)> fn) const
+{
+ if (root_tree_logs_) {
+ root_tree_logs_->foreach_node_log(fn);
+ }
+}
+
const NodeLog *TreeLog::lookup_node_log(StringRef node_name) const
{
const destruct_ptr<NodeLog> *node_log = node_logs_.lookup_ptr_as(node_name);
@@ -122,6 +129,17 @@ const TreeLog *TreeLog::lookup_child_log(StringRef node_name) const
return tree_log->get();
}
+void TreeLog::foreach_node_log(FunctionRef<void(const NodeLog &)> fn) const
+{
+ for (auto node_log : node_logs_.items()) {
+ fn(*node_log.value);
+ }
+
+ for (auto child : child_logs_.items()) {
+ child.value->foreach_node_log(fn);
+ }
+}
+
const SocketLog *NodeLog::lookup_socket_log(eNodeSocketInOut in_out, int index) const
{
BLI_assert(index >= 0);