diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2021-10-30 22:37:05 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2021-10-30 22:37:05 +0300 |
commit | e9bbfd0c8c7a508d220bf355722ff03f91e93183 (patch) | |
tree | 1230f26bc82f24547aeccbaa7fcd6d3db2655fd3 /source/blender/nodes/NOD_node_tree_ref.hh | |
parent | 1aa953bd1913c81b22c80a00edbf4ad88a32c52f (diff) | |
parent | 03a962d8cab44221650f59eb223cb0a767e05b2b (diff) |
Merge branch 'master' into soc-2020-io-performancesoc-2020-io-performance
Diffstat (limited to 'source/blender/nodes/NOD_node_tree_ref.hh')
-rw-r--r-- | source/blender/nodes/NOD_node_tree_ref.hh | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh index b6e372470c8..e04dd7f41bd 100644 --- a/source/blender/nodes/NOD_node_tree_ref.hh +++ b/source/blender/nodes/NOD_node_tree_ref.hh @@ -200,6 +200,8 @@ class NodeRef : NonCopyable, NonMovable { PointerRNA *rna() const; StringRefNull idname() const; StringRefNull name() const; + StringRefNull label() const; + StringRefNull label_or_name() const; bNodeType *typeinfo() const; const NodeDeclaration *declaration() const; @@ -285,7 +287,17 @@ class NodeTreeRef : NonCopyable, NonMovable { RightToLeft, }; - Vector<const NodeRef *> toposort(ToposortDirection direction) const; + struct ToposortResult { + Vector<const NodeRef *> sorted_nodes; + /** + * There can't be a correct topologycal sort of the nodes when there is a cycle. The nodes will + * still be sorted to some degree. The caller has to decide whether it can handle non-perfect + * sorts or not. + */ + bool has_cycle = false; + }; + + ToposortResult toposort(ToposortDirection direction) const; bNodeTree *btree() const; StringRefNull name() const; @@ -575,6 +587,20 @@ inline StringRefNull NodeRef::name() const return bnode_->name; } +inline StringRefNull NodeRef::label() const +{ + return bnode_->label; +} + +inline StringRefNull NodeRef::label_or_name() const +{ + const StringRefNull label = this->label(); + if (!label.is_empty()) { + return label; + } + return this->name(); +} + inline bNodeType *NodeRef::typeinfo() const { return bnode_->typeinfo; |