This commit is contained in:
Nicolas Predella 2026-05-16 18:49:32 +03:00
parent d2bb1b5cb0
commit e01e1d2e94

View file

@ -140,33 +140,15 @@ class SLICENODE_OverrideItem(bpy.types.PropertyGroup):
def is_active(self): def is_active(self):
return bool(self.field) or bool(self.value_str) return bool(self.field) or bool(self.value_str)
@register_class class CollectionInputNodeSocket(InputNodeSocket):
class SLICESOCK_Overrides(InputNodeSocket): items: Any
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="")
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
if len(self.items) == 0: if len(self.items) == 0:
self.items.add() self.items.add()
def update(self): def update(self):
if self.items[-1].is_active: if self.items[-1].is_active:
self.items.add() self.items.add()
@ -176,6 +158,25 @@ class SLICESOCK_Overrides(InputNodeSocket):
else: else:
break 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 @property
def value(self) -> dict[str, str]: def value(self) -> dict[str, str]:
overrides = {} overrides = {}