From 622faf1f63b0005ac747ee8d53c7d7d7104e10b8 Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 08:06:40 -0400 Subject: [PATCH 1/9] Add identity matrix to the MatrixSocket when not connected --- node_tree.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/node_tree.py b/node_tree.py index 4bec41d21..6ebfbead2 100644 --- a/node_tree.py +++ b/node_tree.py @@ -24,6 +24,8 @@ import bpy from bpy.props import StringProperty, BoolProperty, FloatVectorProperty, IntProperty from bpy.types import NodeTree, NodeSocket, NodeSocketStandard +from mathutils import Matrix + from sverchok import data_structure from sverchok.data_structure import ( updateNode, @@ -52,6 +54,18 @@ from sverchok.core.socket_conversions import ( from sverchok.ui import color_def +socket_colors = { + "StringsSocket": (0.6, 1.0, 0.6, 1.0), + "VerticesSocket": (0.9, 0.6, 0.2, 1.0), + "QuaternionSocket": (0.9, 0.4, 0.7, 1.0), + "ColorSocket": (0.9, 0.8, 0.0, 1.0), + "MatrixSocket": (0.2, 0.8, 0.8, 1.0), + "DummySocket": (0.8, 0.8, 0.8, 0.3), + "ObjectSocket": (0.69, 0.74, 0.73, 1.0), + "TextSocket": (0.68, 0.85, 0.90, 1), +} + +identityMatrix = [[tuple(v) for v in Matrix()]] # identity matrix def process_from_socket(self, context): """Update function of exposed properties in Sockets""" @@ -138,7 +152,7 @@ class MatrixSocket(NodeSocket, SvSocketCommon): return SvGetSocket(self, deepcopy) elif default is sentinel: - raise SvNoDataError + return identityMatrix else: return default -- GitLab From 0eee4bbbf5d1dd38025248c6da524226f6f4d9c5 Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 08:09:55 -0400 Subject: [PATCH 2/9] Add expander flags to the SocketCommon These are to be used with multirow input sockets to allow displaying a expand/collapse button to expand/collapse the input socket property. Note: For now the use_expander flag is on for all nodes. This can be made False and let the individual nodes decide whether they wan their sockets to have an expander (via. self.inputs["name"].use_expander = True) --- node_tree.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node_tree.py b/node_tree.py index 6ebfbead2..8fe5e94b4 100644 --- a/node_tree.py +++ b/node_tree.py @@ -84,6 +84,9 @@ class SvColors(bpy.types.PropertyGroup): class SvSocketCommon: + use_expander = BoolProperty(default=True) + expanded = BoolProperty(default=False) + @property def other(self): return get_other_socket(self) -- GitLab From 9dbddd1f97dd396ac7fba97999044d342f6ba7b0 Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 08:11:40 -0400 Subject: [PATCH 3/9] Add expander to the Vertices Socket - WIP --- node_tree.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/node_tree.py b/node_tree.py index 8fe5e94b4..2a1b06fe9 100644 --- a/node_tree.py +++ b/node_tree.py @@ -210,12 +210,32 @@ class VerticesSocket(NodeSocket, SvSocketCommon): else: return default + def draw_prop_with_expander(self, layout, obj, prop_name): + split = layout.split(percentage=.2, align=True) + c1 = split.column(align=True) + c2 = split.column(align=True) + if self.expanded: # expand ? + c1.prop(self, "expanded", icon='TRIA_UP', text='') + c1.label(text=self.name[0]) + c2.prop(obj, prop_name, text="", expand=True) + else: # collapse + c1.prop(self, "expanded", icon='TRIA_DOWN', text="") + row = c2.row(align=True) + row.template_component_menu(obj, prop_name, name=self.name) + def draw(self, context, layout, node, text): if not self.is_output and not self.is_linked: if self.prop_name: - layout.template_component_menu(node, self.prop_name, name=self.name) + if self.use_expander: + self.draw_prop_with_expander(layout, node, self.prop_name) + else: + layout.template_component_menu(node, self.prop_name, name=self.name) + elif self.use_prop: - layout.template_component_menu(self, "prop", name=self.name) + if self.use_expander: + self.draw_prop_with_expander(layout, self, "prop") + else: + layout.template_component_menu(self, "prop", name=self.name) else: layout.label(text) elif self.is_linked: -- GitLab From c1f288cc08a461d8f4ed2c4e7809b900536851b8 Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 09:56:16 -0400 Subject: [PATCH 4/9] Update VerticeSocket draw expander code --- node_tree.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/node_tree.py b/node_tree.py index 2a1b06fe9..5afab02b4 100644 --- a/node_tree.py +++ b/node_tree.py @@ -210,36 +210,36 @@ class VerticesSocket(NodeSocket, SvSocketCommon): else: return default - def draw_prop_with_expander(self, layout, obj, prop_name): - split = layout.split(percentage=.2, align=True) - c1 = split.column(align=True) - c2 = split.column(align=True) - if self.expanded: # expand ? - c1.prop(self, "expanded", icon='TRIA_UP', text='') - c1.label(text=self.name[0]) - c2.prop(obj, prop_name, text="", expand=True) - else: # collapse - c1.prop(self, "expanded", icon='TRIA_DOWN', text="") - row = c2.row(align=True) - row.template_component_menu(obj, prop_name, name=self.name) + def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): + + if self.use_expander: + split = layout.split(percentage=.2, align=True) + c1 = split.column(align=True) + c2 = split.column(align=True) + if self.expanded: + c1.prop(self, "expanded", icon='TRIA_UP', text='') + c1.label(text=self.name[0]) + c2.prop(prop_origin, prop_name, text="", expand=True) + else: # collapsed + c1.prop(self, "expanded", icon='TRIA_DOWN', text="") + row = c2.row(align=True) + row.template_component_menu(prop_origin, prop_name, name=self.name) + else: + layout.template_component_menu(prop_origin, prop_name, name=self.name) def draw(self, context, layout, node, text): if not self.is_output and not self.is_linked: - if self.prop_name: - if self.use_expander: - self.draw_prop_with_expander(layout, node, self.prop_name) - else: - layout.template_component_menu(node, self.prop_name, name=self.name) + if self.prop_name: + self.draw_expander_template(context, layout, prop_origin=node, prop_name=self.prop_name) elif self.use_prop: - if self.use_expander: - self.draw_prop_with_expander(layout, self, "prop") - else: - layout.template_component_menu(self, "prop", name=self.name) + self.draw_expander_template(context, layout, prop_origin=self) else: layout.label(text) + elif self.is_linked: layout.label(text + '. ' + SvGetSocketInfo(self)) + else: layout.label(text) -- GitLab From d5c5ec662d821529b69705f06287a897b2209b88 Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 10:19:00 -0400 Subject: [PATCH 5/9] Add ColorSocket - WIP --- node_tree.py | 79 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 4 deletions(-) diff --git a/node_tree.py b/node_tree.py index 5afab02b4..b91962318 100644 --- a/node_tree.py +++ b/node_tree.py @@ -65,7 +65,9 @@ socket_colors = { "TextSocket": (0.68, 0.85, 0.90, 1), } -identityMatrix = [[tuple(v) for v in Matrix()]] # identity matrix +identityMatrix = [[tuple(v) for v in Matrix()]] +emptyColor = [[(0, 0, 0, 1)]] + def process_from_socket(self, context): """Update function of exposed properties in Sockets""" @@ -172,7 +174,7 @@ class MatrixSocket(NodeSocket, SvSocketCommon): '''if self.is_linked: return(.8,.3,.75,1.0) else: ''' - return (.2, .8, .8, 1.0) + return socket_colors[self.bl_idname] class VerticesSocket(NodeSocket, SvSocketCommon): @@ -220,7 +222,7 @@ class VerticesSocket(NodeSocket, SvSocketCommon): c1.prop(self, "expanded", icon='TRIA_UP', text='') c1.label(text=self.name[0]) c2.prop(prop_origin, prop_name, text="", expand=True) - else: # collapsed + else: # collapsed c1.prop(self, "expanded", icon='TRIA_DOWN', text="") row = c2.row(align=True) row.template_component_menu(prop_origin, prop_name, name=self.name) @@ -244,8 +246,76 @@ class VerticesSocket(NodeSocket, SvSocketCommon): layout.label(text) def draw_color(self, context, node): - return (0.9, 0.6, 0.2, 1.0) + return socket_colors[self.bl_idname] + + +class ColorSocket(NodeSocket, SvSocketCommon): + '''For color data''' + bl_idname = "ColorSocket" + bl_label = "Color Socket" + + prop = FloatVectorProperty(default=(0, 0, 0, 1), size=4, subtype='COLOR', min=0, max=1, update=process_from_socket) + prop_name = StringProperty(default='') + use_prop = BoolProperty(default=False) + + def get_prop_data(self): + if self.prop_name: + return {"prop_name": socket.prop_name} + elif self.use_prop: + return {"use_prop": True, + "prop": self.prop[:]} + else: + return {} + + def sv_get(self, default=sentinel, deepcopy=True): + if self.is_linked and not self.is_output: + return SvGetSocket(self, deepcopy) + + if self.prop_name: + return [[getattr(self.node, self.prop_name)[:]]] + elif self.use_prop: + return [[self.prop[:]]] + elif default is sentinel: + raise emptyColor + else: + return default + + def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): + + if self.use_expander: + split = layout.split(percentage=.2, align=True) + c1 = split.column(align=True) + c2 = split.column(align=True) + if self.expanded: + c1.prop(self, "expanded", icon='TRIA_UP', text='') + c1.label(text=self.name[0]) + c2.prop(prop_origin, prop_name, text="", expand=True) + else: # collapsed + c1.prop(self, "expanded", icon='TRIA_DOWN', text="") + row = c2.row(align=True) + row.prop(prop_origin, prop_name) + # row.template_component_menu(prop_origin, prop_name, name=self.name) + else: + layout.template_component_menu(prop_origin, prop_name, name=self.name) + + def draw(self, context, layout, node, text): + if not self.is_output and not self.is_linked: + if self.prop_name: + self.draw_expander_template(context, layout, prop_origin=node, prop_name=self.prop_name) + elif self.use_prop: + self.draw_expander_template(context, layout, prop_origin=self) + else: + layout.label(text) + + elif self.is_linked: + layout.label(text + '. ' + SvGetSocketInfo(self)) + + else: + layout.label(text) + + def draw_color(self, context, node): + return socket_colors[self.bl_idname] class SvDummySocket(NodeSocket, SvSocketCommon): '''Dummy Socket for sockets awaiting assignment of type''' @@ -455,6 +525,7 @@ class SverchCustomTree(NodeTree, SvNodeTreeCommon): class SverchCustomTreeNode: + @classmethod def poll(cls, ntree): return ntree.bl_idname in ['SverchCustomTreeType', 'SverchGroupTreeType'] -- GitLab From 608fc168f9ed446cdd5fb69dc12166288a709eaa Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 11:24:09 -0400 Subject: [PATCH 6/9] Factorize draw expander code into the common socket --- node_tree.py | 82 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/node_tree.py b/node_tree.py index b91962318..b1a2fa1ba 100644 --- a/node_tree.py +++ b/node_tree.py @@ -89,6 +89,25 @@ class SvSocketCommon: use_expander = BoolProperty(default=True) expanded = BoolProperty(default=False) + def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): + if self.use_expander: + split = layout.split(percentage=.2, align=True) + c1 = split.column(align=True) + c2 = split.column(align=True) + if self.expanded: + c1.prop(self, "expanded", icon='TRIA_UP', text='') + c1.label(text=self.name[0]) + c2.prop(prop_origin, prop_name, text="", expand=True) + else: # collapsed + c1.prop(self, "expanded", icon='TRIA_DOWN', text="") + row = c2.row(align=True) + if self.bl_idname == "ColorSocket": + row.prop(prop_origin, prop_name) + else: + row.template_component_menu(prop_origin, prop_name, name=self.name) + else: + layout.template_component_menu(prop_origin, prop_name, name=self.name) + @property def other(self): return get_other_socket(self) @@ -212,20 +231,20 @@ class VerticesSocket(NodeSocket, SvSocketCommon): else: return default - def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): - - if self.use_expander: - split = layout.split(percentage=.2, align=True) - c1 = split.column(align=True) - c2 = split.column(align=True) - if self.expanded: - c1.prop(self, "expanded", icon='TRIA_UP', text='') - c1.label(text=self.name[0]) - c2.prop(prop_origin, prop_name, text="", expand=True) - else: # collapsed - c1.prop(self, "expanded", icon='TRIA_DOWN', text="") - row = c2.row(align=True) - row.template_component_menu(prop_origin, prop_name, name=self.name) + # def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): + + # if self.use_expander: + # split = layout.split(percentage=.2, align=True) + # c1 = split.column(align=True) + # c2 = split.column(align=True) + # if self.expanded: + # c1.prop(self, "expanded", icon='TRIA_UP', text='') + # c1.label(text=self.name[0]) + # c2.prop(prop_origin, prop_name, text="", expand=True) + # else: # collapsed + # c1.prop(self, "expanded", icon='TRIA_DOWN', text="") + # row = c2.row(align=True) + # row.template_component_menu(prop_origin, prop_name, name=self.name) else: layout.template_component_menu(prop_origin, prop_name, name=self.name) @@ -280,23 +299,23 @@ class ColorSocket(NodeSocket, SvSocketCommon): else: return default - def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): - - if self.use_expander: - split = layout.split(percentage=.2, align=True) - c1 = split.column(align=True) - c2 = split.column(align=True) - if self.expanded: - c1.prop(self, "expanded", icon='TRIA_UP', text='') - c1.label(text=self.name[0]) - c2.prop(prop_origin, prop_name, text="", expand=True) - else: # collapsed - c1.prop(self, "expanded", icon='TRIA_DOWN', text="") - row = c2.row(align=True) - row.prop(prop_origin, prop_name) - # row.template_component_menu(prop_origin, prop_name, name=self.name) - else: - layout.template_component_menu(prop_origin, prop_name, name=self.name) + # def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): + + # if self.use_expander: + # split = layout.split(percentage=.2, align=True) + # c1 = split.column(align=True) + # c2 = split.column(align=True) + # if self.expanded: + # c1.prop(self, "expanded", icon='TRIA_UP', text='') + # c1.label(text=self.name[0]) + # c2.prop(prop_origin, prop_name, text="", expand=True) + # else: # collapsed + # c1.prop(self, "expanded", icon='TRIA_DOWN', text="") + # row = c2.row(align=True) + # row.prop(prop_origin, prop_name) + # # row.template_component_menu(prop_origin, prop_name, name=self.name) + # else: + # layout.template_component_menu(prop_origin, prop_name, name=self.name) def draw(self, context, layout, node, text): if not self.is_output and not self.is_linked: @@ -317,6 +336,7 @@ class ColorSocket(NodeSocket, SvSocketCommon): def draw_color(self, context, node): return socket_colors[self.bl_idname] + class SvDummySocket(NodeSocket, SvSocketCommon): '''Dummy Socket for sockets awaiting assignment of type''' bl_idname = "SvDummySocket" -- GitLab From b67d00bda15e3cb64cc28d4f4828799bdb7a3206 Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 11:27:08 -0400 Subject: [PATCH 7/9] Compact the register/unregister code --- node_tree.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/node_tree.py b/node_tree.py index b1a2fa1ba..867853be3 100644 --- a/node_tree.py +++ b/node_tree.py @@ -618,20 +618,17 @@ class SverchCustomTreeNode: else: pass +classes = [ + SvColors, SverchCustomTree, MatrixSocket, StringsSocket, + VerticesSocket, ColorSocket, SvDummySocket, +] + def register(): - bpy.utils.register_class(SvColors) - bpy.utils.register_class(SverchCustomTree) - bpy.utils.register_class(MatrixSocket) - bpy.utils.register_class(StringsSocket) - bpy.utils.register_class(VerticesSocket) - bpy.utils.register_class(SvDummySocket) + for cls in classes: + bpy.utils.register_class(cls) def unregister(): - bpy.utils.unregister_class(SvDummySocket) - bpy.utils.unregister_class(VerticesSocket) - bpy.utils.unregister_class(StringsSocket) - bpy.utils.unregister_class(MatrixSocket) - bpy.utils.unregister_class(SverchCustomTree) - bpy.utils.unregister_class(SvColors) + for cls in classes: + bpy.utils.unregister_class(cls) -- GitLab From 05a83bf76698e367e085d488ab0cfc3a3fa1ff16 Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 11:28:01 -0400 Subject: [PATCH 8/9] Add QuaternionSocket - WIP --- node_tree.py | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) diff --git a/node_tree.py b/node_tree.py index 867853be3..c39643e18 100644 --- a/node_tree.py +++ b/node_tree.py @@ -67,6 +67,7 @@ socket_colors = { identityMatrix = [[tuple(v) for v in Matrix()]] emptyColor = [[(0, 0, 0, 1)]] +emptyQuaternion = [[(1, 0, 0, 0)]] def process_from_socket(self, context): @@ -245,8 +246,83 @@ class VerticesSocket(NodeSocket, SvSocketCommon): # c1.prop(self, "expanded", icon='TRIA_DOWN', text="") # row = c2.row(align=True) # row.template_component_menu(prop_origin, prop_name, name=self.name) + # else: + # layout.template_component_menu(prop_origin, prop_name, name=self.name) + + def draw(self, context, layout, node, text): + if not self.is_output and not self.is_linked: + + if self.prop_name: + self.draw_expander_template(context, layout, prop_origin=node, prop_name=self.prop_name) + elif self.use_prop: + self.draw_expander_template(context, layout, prop_origin=self) + else: + layout.label(text) + + elif self.is_linked: + layout.label(text + '. ' + SvGetSocketInfo(self)) + else: - layout.template_component_menu(prop_origin, prop_name, name=self.name) + layout.label(text) + + def draw_color(self, context, node): + return socket_colors[self.bl_idname] + + +class QuaternionSocket(NodeSocket, SvSocketCommon): + '''For quaternion data''' + bl_idname = "QuaternionSocket" + bl_label = "Quaternion Socket" + + prop = FloatVectorProperty(default=(1, 0, 0, 0), size=4, subtype='QUATERNION', update=process_from_socket) + prop_name = StringProperty(default='') + use_prop = BoolProperty(default=False) + + def get_prop_data(self): + if self.prop_name: + return {"prop_name": socket.prop_name} + elif self.use_prop: + return {"use_prop": True, + "prop": self.prop[:]} + else: + return {} + + def sv_get(self, default=sentinel, deepcopy=True): + if self.is_linked and not self.is_output: + # if is_matrix_to_quaternion(self): + # out = matrix_to_quaternion(SvGetSocket(self, deepcopy=True)) + # return out + # if is_vector_to_quaternion(self): + # out = vector_to_quaternion(SvGetSocket(self, deepcopy=True)) + # return out + + return SvGetSocket(self, deepcopy) + + if self.prop_name: + return [[getattr(self.node, self.prop_name)[:]]] + elif self.use_prop: + return [[self.prop[:]]] + elif default is sentinel: + raise emptyQuaternion + else: + return default + + # def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): + + # if self.use_expander: + # split = layout.split(percentage=.2, align=True) + # c1 = split.column(align=True) + # c2 = split.column(align=True) + # if self.expanded: + # c1.prop(self, "expanded", icon='TRIA_UP', text='') + # c1.label(text=self.name[0]) + # c2.prop(prop_origin, prop_name, text="", expand=True) + # else: # collapsed + # c1.prop(self, "expanded", icon='TRIA_DOWN', text="") + # row = c2.row(align=True) + # row.template_component_menu(prop_origin, prop_name, name=self.name) + # else: + # layout.template_component_menu(prop_origin, prop_name, name=self.name) def draw(self, context, layout, node, text): if not self.is_output and not self.is_linked: @@ -360,7 +436,7 @@ class SvDummySocket(NodeSocket, SvSocketCommon): layout.label(text) def draw_color(self, context, node): - return (0.8, 0.8, 0.8, 0.3) + return socket_colors[self.bl_idname] class StringsSocket(NodeSocket, SvSocketCommon): @@ -620,7 +696,7 @@ class SverchCustomTreeNode: classes = [ SvColors, SverchCustomTree, MatrixSocket, StringsSocket, - VerticesSocket, ColorSocket, SvDummySocket, + VerticesSocket, ColorSocket, QuaternionSocket, SvDummySocket, ] -- GitLab From b0c3336cb97be228d96707c251ff3ef8d053fd5c Mon Sep 17 00:00:00 2001 From: Marius Giurgi Date: Thu, 20 Apr 2017 11:35:56 -0400 Subject: [PATCH 9/9] Remove old, commented out expander code --- node_tree.py | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) diff --git a/node_tree.py b/node_tree.py index c39643e18..50c895940 100644 --- a/node_tree.py +++ b/node_tree.py @@ -232,23 +232,6 @@ class VerticesSocket(NodeSocket, SvSocketCommon): else: return default - # def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): - - # if self.use_expander: - # split = layout.split(percentage=.2, align=True) - # c1 = split.column(align=True) - # c2 = split.column(align=True) - # if self.expanded: - # c1.prop(self, "expanded", icon='TRIA_UP', text='') - # c1.label(text=self.name[0]) - # c2.prop(prop_origin, prop_name, text="", expand=True) - # else: # collapsed - # c1.prop(self, "expanded", icon='TRIA_DOWN', text="") - # row = c2.row(align=True) - # row.template_component_menu(prop_origin, prop_name, name=self.name) - # else: - # layout.template_component_menu(prop_origin, prop_name, name=self.name) - def draw(self, context, layout, node, text): if not self.is_output and not self.is_linked: @@ -307,23 +290,6 @@ class QuaternionSocket(NodeSocket, SvSocketCommon): else: return default - # def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): - - # if self.use_expander: - # split = layout.split(percentage=.2, align=True) - # c1 = split.column(align=True) - # c2 = split.column(align=True) - # if self.expanded: - # c1.prop(self, "expanded", icon='TRIA_UP', text='') - # c1.label(text=self.name[0]) - # c2.prop(prop_origin, prop_name, text="", expand=True) - # else: # collapsed - # c1.prop(self, "expanded", icon='TRIA_DOWN', text="") - # row = c2.row(align=True) - # row.template_component_menu(prop_origin, prop_name, name=self.name) - # else: - # layout.template_component_menu(prop_origin, prop_name, name=self.name) - def draw(self, context, layout, node, text): if not self.is_output and not self.is_linked: @@ -375,24 +341,6 @@ class ColorSocket(NodeSocket, SvSocketCommon): else: return default - # def draw_expander_template(self, context, layout, prop_origin, prop_name="prop"): - - # if self.use_expander: - # split = layout.split(percentage=.2, align=True) - # c1 = split.column(align=True) - # c2 = split.column(align=True) - # if self.expanded: - # c1.prop(self, "expanded", icon='TRIA_UP', text='') - # c1.label(text=self.name[0]) - # c2.prop(prop_origin, prop_name, text="", expand=True) - # else: # collapsed - # c1.prop(self, "expanded", icon='TRIA_DOWN', text="") - # row = c2.row(align=True) - # row.prop(prop_origin, prop_name) - # # row.template_component_menu(prop_origin, prop_name, name=self.name) - # else: - # layout.template_component_menu(prop_origin, prop_name, name=self.name) - def draw(self, context, layout, node, text): if not self.is_output and not self.is_linked: -- GitLab