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:
authorJacques Lucke <jacques@blender.org>2021-04-01 14:10:22 +0300
committerJacques Lucke <jacques@blender.org>2021-04-01 14:10:22 +0300
commit2a5c0c34914cc89efb8816edba2cf62a6299a6c1 (patch)
treee9455f45d7ead039e3877178f8d547b342e3c404 /source/blender/nodes/NOD_derived_node_tree.hh
parent328b39335ef82248eb4a8af16251247763be5a2f (diff)
Geometry Nodes: add socket value logging capability
The node tree evaluator now calls a callback for every used socket with its corresponding value(s). Right now the callback does nothing. However, we can use it to collect attribute name hints, socket values for debugging or data that will be displayed in the spreadsheet. The main difficulty here was to also call the callback for sockets in nodes that are not directly executed (such as group nodes, muted nodes and reroutes). No functional changes are expected.
Diffstat (limited to 'source/blender/nodes/NOD_derived_node_tree.hh')
-rw-r--r--source/blender/nodes/NOD_derived_node_tree.hh20
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.
*/