diff options
Diffstat (limited to 'source/blender/nodes/NOD_derived_node_tree.hh')
-rw-r--r-- | source/blender/nodes/NOD_derived_node_tree.hh | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/nodes/NOD_derived_node_tree.hh b/source/blender/nodes/NOD_derived_node_tree.hh index c29de611e18..e294bef2ea8 100644 --- a/source/blender/nodes/NOD_derived_node_tree.hh +++ b/source/blender/nodes/NOD_derived_node_tree.hh @@ -59,6 +59,7 @@ class DTreeContext { const NodeTreeRef *tree_; /* All the children contexts of this context. */ Map<const NodeRef *, DTreeContext *> children_; + DerivedNodeTree *derived_tree_; friend DerivedNodeTree; @@ -67,6 +68,7 @@ class DTreeContext { const DTreeContext *parent_context() const; const NodeRef *parent_node() const; const DTreeContext *child_context(const NodeRef &node) const; + const DerivedNodeTree &derived_tree() const; bool is_root() const; }; @@ -117,6 +119,8 @@ class DSocket { operator bool() const; uint64_t hash() const; + + DNode node() const; }; /* A (nullable) reference to an input socket and the context it is in. */ @@ -132,7 +136,7 @@ class DInputSocket : public DSocket { DOutputSocket get_corresponding_group_node_output() const; Vector<DOutputSocket, 4> get_corresponding_group_input_sockets() const; - void foreach_origin_socket(FunctionRef<void(DSocket)> callback) const; + void foreach_origin_socket(FunctionRef<void(DSocket)> origin_fn) const; }; /* A (nullable) reference to an output socket and the context it is in. */ @@ -148,7 +152,8 @@ class DOutputSocket : public DSocket { DInputSocket get_corresponding_group_node_input() const; DInputSocket get_active_corresponding_group_output_socket() const; - void foreach_target_socket(FunctionRef<void(DInputSocket)> callback) const; + void foreach_target_socket(FunctionRef<void(DInputSocket)> target_fn, + FunctionRef<void(DSocket)> skipped_fn) const; }; class DerivedNodeTree { @@ -214,6 +219,11 @@ inline const DTreeContext *DTreeContext::child_context(const NodeRef &node) cons return children_.lookup_default(&node, nullptr); } +inline const DerivedNodeTree &DTreeContext::derived_tree() const +{ + return *derived_tree_; +} + inline bool DTreeContext::is_root() const { return parent_context_ == nullptr; @@ -319,6 +329,12 @@ inline uint64_t DSocket::hash() const return get_default_hash_2(context_, socket_ref_); } +inline DNode DSocket::node() const +{ + BLI_assert(socket_ref_ != nullptr); + return {context_, &socket_ref_->node()}; +} + /* -------------------------------------------------------------------- * DInputSocket inline methods. */ |