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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/nodes/NOD_node_tree_ref.hh2
-rw-r--r--source/blender/nodes/intern/node_tree_ref.cc10
2 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh
index 5337f79536b..b6e372470c8 100644
--- a/source/blender/nodes/NOD_node_tree_ref.hh
+++ b/source/blender/nodes/NOD_node_tree_ref.hh
@@ -275,6 +275,8 @@ class NodeTreeRef : NonCopyable, NonMovable {
Span<const LinkRef *> links() const;
+ const NodeRef *find_node(const bNode &bnode) const;
+
bool has_link_cycles() const;
bool has_undefined_nodes_or_sockets() const;
diff --git a/source/blender/nodes/intern/node_tree_ref.cc b/source/blender/nodes/intern/node_tree_ref.cc
index 43c7fbd2599..2ca797009da 100644
--- a/source/blender/nodes/intern/node_tree_ref.cc
+++ b/source/blender/nodes/intern/node_tree_ref.cc
@@ -576,6 +576,16 @@ Vector<const NodeRef *> NodeTreeRef::toposort(const ToposortDirection direction)
return toposort;
}
+const NodeRef *NodeTreeRef::find_node(const bNode &bnode) const
+{
+ for (const NodeRef *node : this->nodes_by_type(bnode.typeinfo)) {
+ if (node->bnode_ == &bnode) {
+ return node;
+ }
+ }
+ return nullptr;
+}
+
std::string NodeTreeRef::to_dot() const
{
dot::DirectedGraph digraph;