From 5f2eccee4b6b3ed01360f1a6ca81619ca250736c Mon Sep 17 00:00:00 2001 From: Nicolas Predella Date: Mon, 8 Jun 2026 13:11:32 +0300 Subject: [PATCH] up --- core/nodeslicer/nodes/mesh.py | 5 +++++ core/nodeslicer/nodes/system.py | 2 +- infra/blender/blender_slice_nodes_generic.py | 22 +++++++++++++------- test.gcode | 4 ---- 4 files changed, 21 insertions(+), 12 deletions(-) delete mode 100644 test.gcode diff --git a/core/nodeslicer/nodes/mesh.py b/core/nodeslicer/nodes/mesh.py index 46d630e..04934e9 100644 --- a/core/nodeslicer/nodes/mesh.py +++ b/core/nodeslicer/nodes/mesh.py @@ -53,6 +53,10 @@ class SLICENODE_JoinMeshGroups(SliceNodeJoiner): bl_label = "Join Mesh Groups" 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: from ....infra.blender.blender_slice_nodes_generic import resolve_input group: SlicingGroup = SlicingGroup([]) @@ -198,6 +202,7 @@ class SLICENODE_SeparateMeshByRange(SliceNode): self.outputs.move(current_index, i) def draw_buttons(self, context, layout): + assert layout col = layout.column(align=True) col.prop(self, "start_val") col.prop(self, "end_val") diff --git a/core/nodeslicer/nodes/system.py b/core/nodeslicer/nodes/system.py index 236533a..e4526c3 100644 --- a/core/nodeslicer/nodes/system.py +++ b/core/nodeslicer/nodes/system.py @@ -83,7 +83,7 @@ class SLICENODE_PrusaslicerSlice(SliceNode): def init(self, context): self.add_input("SLICESOCK_PrusaslicerConf", "Config") 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): assert layout diff --git a/infra/blender/blender_slice_nodes_generic.py b/infra/blender/blender_slice_nodes_generic.py index f68f686..2799a15 100644 --- a/infra/blender/blender_slice_nodes_generic.py +++ b/infra/blender/blender_slice_nodes_generic.py @@ -36,19 +36,23 @@ class SliceNode(Node, AutoBlIdName): visited = getattr(self, "_current_visited", None) 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) sock = self.outputs.new(bl_idname, eval_name, identifier=identifier or eval_name) sock.hide = hide + if display_shape: + sock.display_shape = display_shape 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) sock = self.inputs.new(bl_idname, eval_name, identifier=identifier or eval_name) sock.hide = hide + if display_shape: + sock.display_shape = display_shape 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'] = {} group_id = name or in_name or out_name or in_type self['multi_groups'][group_id] = { @@ -56,6 +60,8 @@ class SliceNode(Node, AutoBlIdName): 'out_type': out_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 ""), + 'in_display_shape': in_display_shape, + 'out_display_shape': out_display_shape, } self._update_multi_groups() @@ -74,6 +80,8 @@ class SliceNode(Node, AutoBlIdName): out_type = cfg.get('out_type', '') in_name = cfg['in_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_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() 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: - 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() if is_active(ins[-1]): 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: - 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() while len(ins) > 1: diff --git a/test.gcode b/test.gcode deleted file mode 100644 index a58dc90..0000000 --- a/test.gcode +++ /dev/null @@ -1,4 +0,0 @@ -; printer_model = MK3S -; printer_notes = -; total filament used [g] = 0 -G1 X10