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-09-23 23:21:31 +0300
committerHans Goudey <h.goudey@me.com>2021-09-23 23:21:31 +0300
commit61f3d4eb7c7db711f9339d05e68b8f9eac3ce167 (patch)
tree9004c577411998029bda688d5659d1a98be484f4 /source/blender/nodes/NOD_node_tree_ref.hh
parentc1b925f7fff5f8b26daa05b3105cbb10dfc175e7 (diff)
Geometry Nodes: Initial socket visualization for fields.
This implements the update logic for the vizualization of which sockets pass data or constants directly, and which pass functions. The socket shapes may still have to be updated. That should be done separately, because it might be a bit more involved, because socket shapes are currently linked to keyframe shapes. Currently the circle and diamond shapes are used with the following meanings: - Input Sockets: - Circle: Required to be a single value. - Diamond: This input supports fields. - Output Sockets: - Circle: This output is a single value. - Diamond: This output may be a field. Connecting a field to a circle input socket is an error, since a field cannot be converted to a single value. If the socket shape is a diamond with a dot in the middle, it means it is currently a single value, but could be a field. In addition to socket shapes, the intention is to draw node links differently based on the field status. However, the exact method for conveying that isn't decided yet. Differential Revision: https://developer.blender.org/D12584
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, 26 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh
index 4f2565cbbaf..1da42fb6425 100644
--- a/source/blender/nodes/NOD_node_tree_ref.hh
+++ b/source/blender/nodes/NOD_node_tree_ref.hh
@@ -182,6 +182,7 @@ class NodeRef : NonCopyable, NonMovable {
Span<const InputSocketRef *> inputs() const;
Span<const OutputSocketRef *> outputs() const;
Span<const InternalLinkRef *> internal_links() const;
+ Span<const SocketRef *> sockets(eNodeSocketInOut in_out) const;
const InputSocketRef &input(int index) const;
const OutputSocketRef &output(int index) const;
@@ -189,6 +190,10 @@ class NodeRef : NonCopyable, NonMovable {
const InputSocketRef &input_by_identifier(StringRef identifier) const;
const OutputSocketRef &output_by_identifier(StringRef identifier) const;
+ bool any_input_is_directly_linked() const;
+ bool any_output_is_directly_linked() const;
+ bool any_socket_is_directly_linked(eNodeSocketInOut in_out) const;
+
bNode *bnode() const;
bNodeTree *btree() const;
@@ -196,6 +201,7 @@ class NodeRef : NonCopyable, NonMovable {
StringRefNull idname() const;
StringRefNull name() const;
bNodeType *typeinfo() const;
+ const NodeDeclaration *declaration() const;
int id() const;
@@ -272,6 +278,13 @@ class NodeTreeRef : NonCopyable, NonMovable {
bool has_link_cycles() const;
bool has_undefined_nodes_or_sockets() const;
+ enum class ToposortDirection {
+ LeftToRight,
+ RightToLeft,
+ };
+
+ Vector<const NodeRef *> toposort(ToposortDirection direction) const;
+
bNodeTree *btree() const;
StringRefNull name() const;
@@ -496,6 +509,12 @@ inline Span<const OutputSocketRef *> NodeRef::outputs() const
return outputs_;
}
+inline Span<const SocketRef *> NodeRef::sockets(const eNodeSocketInOut in_out) const
+{
+ return in_out == SOCK_IN ? inputs_.as_span().cast<const SocketRef *>() :
+ outputs_.as_span().cast<const SocketRef *>();
+}
+
inline Span<const InternalLinkRef *> NodeRef::internal_links() const
{
return internal_links_;
@@ -553,6 +572,13 @@ inline bNodeType *NodeRef::typeinfo() const
return bnode_->typeinfo;
}
+/* Returns a pointer because not all nodes have declarations currently. */
+inline const NodeDeclaration *NodeRef::declaration() const
+{
+ nodeDeclarationEnsure(this->tree().btree(), bnode_);
+ return bnode_->declaration;
+}
+
inline int NodeRef::id() const
{
return id_;