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_node_tree_ref.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_node_tree_ref.hh')
-rw-r--r--source/blender/nodes/NOD_node_tree_ref.hh26
1 files changed, 18 insertions, 8 deletions
diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh
index 3710bd2fe00..f4c5d277f16 100644
--- a/source/blender/nodes/NOD_node_tree_ref.hh
+++ b/source/blender/nodes/NOD_node_tree_ref.hh
@@ -81,15 +81,19 @@ class SocketRef : NonCopyable, NonMovable {
Vector<LinkRef *> directly_linked_links_;
/* These sockets are linked directly, i.e. with a single link in between. */
- MutableSpan<SocketRef *> directly_linked_sockets_;
+ MutableSpan<const SocketRef *> directly_linked_sockets_;
/* These sockets are linked when reroutes, muted links and muted nodes have been taken into
* account. */
- MutableSpan<SocketRef *> logically_linked_sockets_;
+ MutableSpan<const SocketRef *> logically_linked_sockets_;
+ /* These are the sockets that have been skipped when searching for logicaly linked sockets. That
+ * includes for example the input and output socket of an intermediate reroute node. */
+ MutableSpan<const SocketRef *> logically_linked_skipped_sockets_;
friend NodeTreeRef;
public:
Span<const SocketRef *> logically_linked_sockets() const;
+ Span<const SocketRef *> logically_linked_skipped_sockets() const;
Span<const SocketRef *> directly_linked_sockets() const;
Span<const LinkRef *> directly_linked_links() const;
@@ -132,12 +136,19 @@ class InputSocketRef final : public SocketRef {
Span<const OutputSocketRef *> directly_linked_sockets() const;
bool is_multi_input_socket() const;
+
+ void foreach_logical_origin(FunctionRef<void(const OutputSocketRef &)> origin_fn,
+ FunctionRef<void(const SocketRef &)> skipped_fn,
+ bool only_follow_first_input_link = false) const;
};
class OutputSocketRef final : public SocketRef {
public:
Span<const InputSocketRef *> logically_linked_sockets() const;
Span<const InputSocketRef *> directly_linked_sockets() const;
+
+ void foreach_logical_target(FunctionRef<void(const InputSocketRef &)> target_fn,
+ FunctionRef<void(const SocketRef &)> skipped_fn) const;
};
class NodeRef : NonCopyable, NonMovable {
@@ -257,12 +268,6 @@ class NodeTreeRef : NonCopyable, NonMovable {
bNodeSocket *bsocket);
void create_linked_socket_caches();
-
- void foreach_logical_origin(InputSocketRef &socket,
- FunctionRef<void(OutputSocketRef &)> callback,
- bool only_follow_first_input_link = false);
- void foreach_logical_target(OutputSocketRef &socket,
- FunctionRef<void(InputSocketRef &)> callback);
};
using NodeTreeRefMap = Map<bNodeTree *, std::unique_ptr<const NodeTreeRef>>;
@@ -287,6 +292,11 @@ inline Span<const SocketRef *> SocketRef::logically_linked_sockets() const
return logically_linked_sockets_;
}
+inline Span<const SocketRef *> SocketRef::logically_linked_skipped_sockets() const
+{
+ return logically_linked_skipped_sockets_;
+}
+
inline Span<const SocketRef *> SocketRef::directly_linked_sockets() const
{
return directly_linked_sockets_;