[Bf-blender-cvs] [52de232811c] temp-field-visualization: continue
Jacques Lucke
noreply at git.blender.org
Fri Sep 17 12:26:54 CEST 2021
Commit: 52de232811c16070e79975c6e3801dd7f135799e
Author: Jacques Lucke
Date: Wed Sep 15 11:45:20 2021 +0200
Branches: temp-field-visualization
https://developer.blender.org/rB52de232811c16070e79975c6e3801dd7f135799e
continue
===================================================================
M source/blender/blenkernel/intern/node.cc
M source/blender/nodes/NOD_node_declaration.hh
===================================================================
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 4d33544777b..5f8e7cb6d04 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -4467,7 +4467,28 @@ void ntreeUpdateAllUsers(Main *main, ID *id)
static void update_socket_shapes_for_fields(bNodeTree &ntree)
{
- UNUSED_VARS(ntree);
+ using namespace blender::nodes;
+ if (ntree.type != NTREE_GEOMETRY) {
+ return;
+ }
+ LISTBASE_FOREACH (bNode *, node, &ntree.nodes) {
+ nodeDeclarationEnsure(&ntree, node);
+ NodeDeclaration *declaration = node->declaration;
+ if (declaration == nullptr) {
+ continue;
+ }
+ int input_index;
+ LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &node->inputs, input_index) {
+ const SocketDeclaration &socket_decl = *declaration->inputs()[input_index];
+ bool is_field = socket_decl.get_is_field();
+ if (is_field) {
+ socket->display_shape = SOCK_DISPLAY_SHAPE_DIAMOND;
+ }
+ else {
+ socket->display_shape = SOCK_DISPLAY_SHAPE_CIRCLE;
+ }
+ }
+ }
}
void ntreeUpdateTree(Main *bmain, bNodeTree *ntree)
diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh
index 235ba5efa6d..6d828a61981 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -44,6 +44,11 @@ class SocketDeclaration {
StringRefNull name() const;
StringRefNull identifier() const;
+
+ bool get_is_field() const
+ {
+ return is_field_;
+ }
};
using SocketDeclarationPtr = std::unique_ptr<SocketDeclaration>;
More information about the Bf-blender-cvs
mailing list