Commit: 8dc6353e6017ba68474742246949b552020b6525
Author: Jacques Lucke
Date:   Thu Feb 20 12:39:30 2020 +0100
Branches: simulation-tree
https://developer.blender.org/rB8dc6353e6017ba68474742246949b552020b6525

add draw function to socket

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

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 be7815325d5..7753481f79c 100644
--- a/source/blender/simulations/nodes/my_test_node.cc
+++ b/source/blender/simulations/nodes/my_test_node.cc
@@ -423,6 +423,11 @@ class SocketTypeDefinition {
         [](void *buffer) { MEM_freeN(buffer); });
   }
 
+  void add_draw_fn(DrawInNodeFn draw_in_node_fn)
+  {
+    m_draw_in_node_fn = draw_in_node_fn;
+  }
+
   void register_type()
   {
     nodeRegisterSocketType(&m_stype);
@@ -719,6 +724,11 @@ void init_socket_data_types()
     stype.set_color({1, 1, 1, 1});
     stype.add_dna_storage<bNodeSocketValueFloat>(
         "bNodeSocketValueFloat", [](bNodeSocketValueFloat *storage) { 
storage->value = 11.5f; });
+    stype.add_draw_fn([](bContext *UNUSED(C),
+                         uiLayout *layout,
+                         PointerRNA *UNUSED(ptr),
+                         PointerRNA *UNUSED(node_ptr),
+                         const char *UNUSED(text)) { uiItemL(layout, "Hello 
World", 0); });
     stype.register_type();
   }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to