This commit is contained in:
Nicolas Predella 2026-06-08 13:11:32 +03:00
parent 9c144a7465
commit 5f2eccee4b
4 changed files with 21 additions and 12 deletions

View file

@ -53,6 +53,10 @@ class SLICENODE_JoinMeshGroups(SliceNodeJoiner):
bl_label = "Join Mesh Groups" bl_label = "Join Mesh Groups"
socket_type = "SLICESOCK_Mesh" socket_type = "SLICESOCK_Mesh"
def init(self, context):
self.add_output(self.output_socket_type or self.socket_type, display_shape='LIST')
self.add_multi_socket_group(self.socket_type)
def evaluate_output(self, socket_name: str, **_kwargs) -> SlicingGroup: def evaluate_output(self, socket_name: str, **_kwargs) -> SlicingGroup:
from ....infra.blender.blender_slice_nodes_generic import resolve_input from ....infra.blender.blender_slice_nodes_generic import resolve_input
group: SlicingGroup = SlicingGroup([]) group: SlicingGroup = SlicingGroup([])
@ -198,6 +202,7 @@ class SLICENODE_SeparateMeshByRange(SliceNode):
self.outputs.move(current_index, i) self.outputs.move(current_index, i)
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
assert layout
col = layout.column(align=True) col = layout.column(align=True)
col.prop(self, "start_val") col.prop(self, "start_val")
col.prop(self, "end_val") col.prop(self, "end_val")

View file

@ -83,7 +83,7 @@ class SLICENODE_PrusaslicerSlice(SliceNode):
def init(self, context): def init(self, context):
self.add_input("SLICESOCK_PrusaslicerConf", "Config") self.add_input("SLICESOCK_PrusaslicerConf", "Config")
self.add_input("SLICESOCK_Settings", "Settings") self.add_input("SLICESOCK_Settings", "Settings")
self.add_multi_socket_group("SLICESOCK_Mesh", "SLICESOCK_GcodeRo", name="Slicing Group", in_name="Mesh", out_name="Gcode") self.add_multi_socket_group("SLICESOCK_Mesh", "SLICESOCK_GcodeRo", name="Slicing Group", in_name="Mesh", out_name="Gcode", in_display_shape='LIST')
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
assert layout assert layout

View file

@ -36,19 +36,23 @@ class SliceNode(Node, AutoBlIdName):
visited = getattr(self, "_current_visited", None) visited = getattr(self, "_current_visited", None)
return resolve_input(self.inputs.get(fieldname), cache=cache, visited=visited) return resolve_input(self.inputs.get(fieldname), cache=cache, visited=visited)
def add_output(self, bl_idname: str, name: str = "", identifier: str = "", hide: bool = False): def add_output(self, bl_idname: str, name: str = "", identifier: str = "", hide: bool = False, display_shape: str = ""):
eval_name = name or get_label_by_name(bl_idname) eval_name = name or get_label_by_name(bl_idname)
sock = self.outputs.new(bl_idname, eval_name, identifier=identifier or eval_name) sock = self.outputs.new(bl_idname, eval_name, identifier=identifier or eval_name)
sock.hide = hide sock.hide = hide
if display_shape:
sock.display_shape = display_shape
return sock return sock
def add_input(self, bl_idname: str, name: str = "", identifier: str = "", hide: bool = False): def add_input(self, bl_idname: str, name: str = "", identifier: str = "", hide: bool = False, display_shape: str = ""):
eval_name = name or get_label_by_name(bl_idname) eval_name = name or get_label_by_name(bl_idname)
sock = self.inputs.new(bl_idname, eval_name, identifier=identifier or eval_name) sock = self.inputs.new(bl_idname, eval_name, identifier=identifier or eval_name)
sock.hide = hide sock.hide = hide
if display_shape:
sock.display_shape = display_shape
return sock return sock
def add_multi_socket_group(self, in_type: str, out_type: str = "", name: str = "", in_name: str = "", out_name: str = ""): def add_multi_socket_group(self, in_type: str, out_type: str = "", name: str = "", in_name: str = "", out_name: str = "", in_display_shape: str = "", out_display_shape: str = ""):
if not self.get('multi_groups'): self['multi_groups'] = {} if not self.get('multi_groups'): self['multi_groups'] = {}
group_id = name or in_name or out_name or in_type group_id = name or in_name or out_name or in_type
self['multi_groups'][group_id] = { self['multi_groups'][group_id] = {
@ -56,6 +60,8 @@ class SliceNode(Node, AutoBlIdName):
'out_type': out_type, 'out_type': out_type,
'in_name': in_name or name or get_label_by_name(in_type), 'in_name': in_name or name or get_label_by_name(in_type),
'out_name': out_name or name or (get_label_by_name(out_type) if out_type else ""), 'out_name': out_name or name or (get_label_by_name(out_type) if out_type else ""),
'in_display_shape': in_display_shape,
'out_display_shape': out_display_shape,
} }
self._update_multi_groups() self._update_multi_groups()
@ -74,6 +80,8 @@ class SliceNode(Node, AutoBlIdName):
out_type = cfg.get('out_type', '') out_type = cfg.get('out_type', '')
in_name = cfg['in_name'] in_name = cfg['in_name']
out_name = cfg['out_name'] out_name = cfg['out_name']
in_display_shape = cfg.get('in_display_shape', '')
out_display_shape = cfg.get('out_display_shape', '')
def get_ins(): return [i for i in self.inputs if i.identifier.startswith(f"{group_id}_ms_in_")] def get_ins(): return [i for i in self.inputs if i.identifier.startswith(f"{group_id}_ms_in_")]
def get_outs(): return [o for o in self.outputs if o.identifier.startswith(f"{group_id}_ms_out_")] def get_outs(): return [o for o in self.outputs if o.identifier.startswith(f"{group_id}_ms_out_")]
@ -82,16 +90,16 @@ class SliceNode(Node, AutoBlIdName):
ins = get_ins() ins = get_ins()
if not ins: if not ins:
self.add_input(in_type, in_name, identifier=f"{group_id}_ms_in_0") self.add_input(in_type, in_name, identifier=f"{group_id}_ms_in_0", display_shape=in_display_shape)
if out_type: if out_type:
self.add_output(out_type, out_name, identifier=f"{group_id}_ms_out_0") self.add_output(out_type, out_name, identifier=f"{group_id}_ms_out_0", display_shape=out_display_shape)
ins = get_ins() ins = get_ins()
if is_active(ins[-1]): if is_active(ins[-1]):
idx = len(ins) idx = len(ins)
self.add_input(in_type, in_name, identifier=f"{group_id}_ms_in_{idx}") self.add_input(in_type, in_name, identifier=f"{group_id}_ms_in_{idx}", display_shape=in_display_shape)
if out_type: if out_type:
self.add_output(out_type, out_name, identifier=f"{group_id}_ms_out_{idx}") self.add_output(out_type, out_name, identifier=f"{group_id}_ms_out_{idx}", display_shape=out_display_shape)
ins = get_ins() ins = get_ins()
while len(ins) > 1: while len(ins) > 1:

View file

@ -1,4 +0,0 @@
; printer_model = MK3S
; printer_notes =
; total filament used [g] = 0
G1 X10