ref
This commit is contained in:
parent
d2bb1b5cb0
commit
e01e1d2e94
1 changed files with 21 additions and 20 deletions
|
|
@ -140,24 +140,8 @@ class SLICENODE_OverrideItem(bpy.types.PropertyGroup):
|
|||
def is_active(self):
|
||||
return bool(self.field) or bool(self.value_str)
|
||||
|
||||
@register_class
|
||||
class SLICESOCK_Overrides(InputNodeSocket):
|
||||
bl_label = "Overrides"
|
||||
|
||||
items: CollectionProperty(type=SLICENODE_OverrideItem) # pyright: ignore[reportInvalidTypeForm]
|
||||
|
||||
bl_color = (1.0, 1.0, 0.0, 1.0) # Yellow
|
||||
|
||||
def draw(self, context, layout, node, text):
|
||||
if self.is_output or self.is_linked:
|
||||
layout.label(text=text or self.name)
|
||||
return
|
||||
|
||||
col = layout.column(align=True)
|
||||
for item in self.items:
|
||||
row = col.row(align=True)
|
||||
row.prop(item, "field", text="")
|
||||
row.prop(item, "value_str", text="")
|
||||
class CollectionInputNodeSocket(InputNodeSocket):
|
||||
items: Any
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
@ -165,8 +149,6 @@ class SLICESOCK_Overrides(InputNodeSocket):
|
|||
self.items.add()
|
||||
|
||||
def update(self):
|
||||
|
||||
|
||||
if self.items[-1].is_active:
|
||||
self.items.add()
|
||||
|
||||
|
|
@ -176,6 +158,25 @@ class SLICESOCK_Overrides(InputNodeSocket):
|
|||
else:
|
||||
break
|
||||
|
||||
@register_class
|
||||
class SLICESOCK_Overrides(CollectionInputNodeSocket):
|
||||
bl_label = "Overrides"
|
||||
|
||||
items: CollectionProperty(type=SLICENODE_OverrideItem) # pyright: ignore[reportInvalidTypeForm]
|
||||
|
||||
bl_color = (1.0, 1.0, 0.0, 1.0) # Yellow
|
||||
|
||||
def draw(self, context, layout, node, text):
|
||||
if not self.is_output and self.is_linked:
|
||||
layout.label(text=text or self.name)
|
||||
return
|
||||
|
||||
col = layout.column(align=True)
|
||||
for item in self.items:
|
||||
row = col.row(align=True)
|
||||
row.prop(item, "field", text="")
|
||||
row.prop(item, "value_str", text="")
|
||||
|
||||
@property
|
||||
def value(self) -> dict[str, str]:
|
||||
overrides = {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue