diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-03-22 17:17:16 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-03-22 17:17:16 +0400 |
commit | a00eda0835ca02c33101984718a85e803cfb4ee2 (patch) | |
tree | 7e01467691214a8c5e24ba5f03ce7d01cc93ada7 | |
parent | 309c487b966fd8e82ae5e03abf1d8e6f57d59b2b (diff) |
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.
-rw-r--r-- | release/scripts/templates_py/custom_nodes.py | 5 |
1 files changed, 3 insertions, 2 deletions
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. |