diff --git a/source/blender/functions/FN_lazy_function_graph.hh b/source/blender/functions/FN_lazy_function_graph.hh index 6c5090adb63..80a46c95f9b 100644 --- a/source/blender/functions/FN_lazy_function_graph.hh +++ b/source/blender/functions/FN_lazy_function_graph.hh @@ -208,6 +208,10 @@ class Graph : NonCopyable, NonMovable { * Used to allocate nodes and sockets in the graph. */ LinearAllocator<> allocator_; + /** + * Name of the graph for debugging purposes. + */ + StringRefNull name_; /** * Contains all nodes in the graph so that it is efficient to iterate over them. * The first two nodes are the interface input and output nodes. @@ -227,9 +231,11 @@ class Graph : NonCopyable, NonMovable { int socket_num_ = 0; public: - Graph(); + Graph(StringRef name = "unkown"); ~Graph(); + StringRefNull name() const; + /** * Get all nodes in the graph. The index in the span corresponds to #Node::index_in_graph. */ @@ -489,6 +495,11 @@ inline const LazyFunction &FunctionNode::function() const /** \name #Graph Inline Methods * \{ */ +inline StringRefNull Graph::name() const +{ + return name_; +} + inline Span Graph::nodes() const { return nodes_; diff --git a/source/blender/functions/intern/lazy_function_graph.cc b/source/blender/functions/intern/lazy_function_graph.cc index 6f2d30fa5d6..430c899ab40 100644 --- a/source/blender/functions/intern/lazy_function_graph.cc +++ b/source/blender/functions/intern/lazy_function_graph.cc @@ -10,8 +10,9 @@ namespace blender::fn::lazy_function { -Graph::Graph() +Graph::Graph(const StringRef name) { + name_ = allocator_.copy_string(name); graph_input_node_ = allocator_.construct().release(); graph_output_node_ = allocator_.construct().release(); nodes_.append(graph_input_node_); diff --git a/source/blender/functions/intern/lazy_function_graph_executor.cc b/source/blender/functions/intern/lazy_function_graph_executor.cc index 47e74979d36..362b5323927 100644 --- a/source/blender/functions/intern/lazy_function_graph_executor.cc +++ b/source/blender/functions/intern/lazy_function_graph_executor.cc @@ -1475,6 +1475,8 @@ GraphExecutor::GraphExecutor(const Graph &graph, side_effect_provider_(side_effect_provider), node_execute_wrapper_(node_execute_wrapper) { + debug_name_ = graph.name().c_str(); + /* The graph executor can handle partial execution when there are still missing inputs. */ allow_missing_requested_inputs_ = true; diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc index 8f70a4e7fda..65d69133e6d 100644 --- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc +++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc @@ -1860,11 +1860,11 @@ class LazyFunctionForRepeatZone : public LazyFunction { for (const int i : inputs_.index_range()) { const lf::Input &input = inputs_[i]; - lf_inputs.append(&lf_graph.add_input(*input.type, input.debug_name)); + lf_inputs.append(&lf_graph.add_input(*input.type, this->input_name(i))); } for (const int i : outputs_.index_range()) { const lf::Output &output = outputs_[i]; - lf_outputs.append(&lf_graph.add_output(*output.type, output.debug_name)); + lf_outputs.append(&lf_graph.add_output(*output.type, this->output_name(i))); } /* Create body nodes. */ @@ -2474,7 +2474,7 @@ struct GeometryNodesLazyFunctionBuilder { */ ZoneBodyFunction &build_zone_body_function(const bNodeTreeZone &zone) { - lf::Graph &lf_body_graph = scope_.construct(); + lf::Graph &lf_body_graph = scope_.construct("Repeat Body"); BuildGraphParams graph_params{lf_body_graph};