[Bf-blender-cvs] [8eb63e9c3bf] simulation-tree: show custom label only when node is hidden

Jacques Lucke noreply at git.blender.org
Wed Feb 19 16:12:50 CET 2020


Commit: 8eb63e9c3bf5944926269c2b4f54d401fffde1e6
Author: Jacques Lucke
Date:   Wed Feb 19 14:49:25 2020 +0100
Branches: simulation-tree
https://developer.blender.org/rB8eb63e9c3bf5944926269c2b4f54d401fffde1e6

show custom label only when node is hidden

===================================================================

M	source/blender/simulations/nodes/my_test_node.cc

===================================================================

diff --git a/source/blender/simulations/nodes/my_test_node.cc b/source/blender/simulations/nodes/my_test_node.cc
index cbd45c4357b..a445b3d0d87 100644
--- a/source/blender/simulations/nodes/my_test_node.cc
+++ b/source/blender/simulations/nodes/my_test_node.cc
@@ -546,10 +546,11 @@ void register_node_type_my_test_node()
       node_builder.fixed_input("b", "B", *data_socket_float);
       node_builder.fixed_output("result", "Result", *data_socket_float);
     });
-    ntype.add_label_fn(
-        [](bNodeTree *UNUSED(ntree), bNode *UNUSED(node), char *r_label, int maxlen) {
-          BLI_strncpy(r_label, "Custom Label", maxlen);
-        });
+    ntype.add_label_fn([](bNodeTree *UNUSED(ntree), bNode *node, char *r_label, int maxlen) {
+      if (node->flag & NODE_HIDDEN) {
+        BLI_strncpy(r_label, "Custom Label", maxlen);
+      }
+    });
     ntype.register_type();
   }
 }



More information about the Bf-blender-cvs mailing list