From a00eda0835ca02c33101984718a85e803cfb4ee2 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Fri, 22 Mar 2013 13:17:16 +0000 Subject: Fix for the custom_nodes.py template. Socket classes now return their drawing color in a callback instead of a simple property, this makes it possible to change a socket color e.g. based on data type. --- release/scripts/templates_py/custom_nodes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'release/scripts/templates_py') diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py index 485ee0ebe05..3bcc7f979b3 100644 --- a/release/scripts/templates_py/custom_nodes.py +++ b/release/scripts/templates_py/custom_nodes.py @@ -37,8 +37,6 @@ class MyCustomSocket(bpy.types.NodeSocket): bl_idname = 'CustomSocketType' # Label for nice name display bl_label = 'Custom Node Socket' - # Socket color - bl_color = (1.0, 0.4, 0.216, 0.5) # Enum items list my_items = [ @@ -54,6 +52,9 @@ class MyCustomSocket(bpy.types.NodeSocket): def draw(self, context, layout, node): layout.prop(self, "myEnumProperty", text=self.name) + # Socket color + def draw_color(self, context, node): + return (1.0, 0.4, 0.216, 0.5) # Base class for all custom nodes in this tree type. # Defines a poll function to enable instantiation. -- cgit v1.2.3