up
This commit is contained in:
parent
b67a8d9755
commit
39d2530f14
4 changed files with 9 additions and 13 deletions
|
|
@ -127,10 +127,11 @@ class MathNode(SliceNode):
|
||||||
class SliceNodeJoiner(SliceNode):
|
class SliceNodeJoiner(SliceNode):
|
||||||
socket_type: str = ""
|
socket_type: str = ""
|
||||||
output_socket_type: str = ""
|
output_socket_type: str = ""
|
||||||
|
socket_label: str = ""
|
||||||
|
|
||||||
def init(self, context):
|
def init(self, context):
|
||||||
self.add_output(self.output_socket_type or self.socket_type)
|
self.add_output(self.output_socket_type or self.socket_type, name=self.socket_label)
|
||||||
self.add_multi_socket_group(self.socket_type)
|
self.add_multi_socket_group(self.socket_type, name=self.socket_label)
|
||||||
|
|
||||||
class ExecSliceNode(SliceNode):
|
class ExecSliceNode(SliceNode):
|
||||||
button_label: str = 'Execute'
|
button_label: str = 'Execute'
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ class SLICENODE_JoinGcode(SliceNodeJoiner):
|
||||||
bl_label = "Join Gcode"
|
bl_label = "Join Gcode"
|
||||||
socket_type = "NodeSocketString"
|
socket_type = "NodeSocketString"
|
||||||
output_socket_type = "NodeSocketString"
|
output_socket_type = "NodeSocketString"
|
||||||
|
socket_label = "Gcode"
|
||||||
|
|
||||||
def evaluate_output(self, socket_name: str, **_kwargs) -> str:
|
def evaluate_output(self, socket_name: str, **_kwargs) -> str:
|
||||||
from ....infra.blender.blender_slice_nodes_generic import resolve_input
|
from ....infra.blender.blender_slice_nodes_generic import resolve_input
|
||||||
|
|
@ -196,8 +197,8 @@ class SLICENODE_LoadGcode(SliceNode):
|
||||||
bl_label = "Load Gcode File"
|
bl_label = "Load Gcode File"
|
||||||
|
|
||||||
def init(self, context):
|
def init(self, context):
|
||||||
self.add_input("NodeSocketString", "Filepath")
|
self.add_input("NodeSocketStringFilePath", "Filepath")
|
||||||
self.add_output("NodeSocketString")
|
self.add_output("NodeSocketString", name= "Gcode")
|
||||||
|
|
||||||
def evaluate_output(self, socket_name: str, **_kwargs) -> str:
|
def evaluate_output(self, socket_name: str, **_kwargs) -> str:
|
||||||
path = self.resolve("Filepath")
|
path = self.resolve("Filepath")
|
||||||
|
|
|
||||||
|
|
@ -748,17 +748,11 @@ def _rename_slicing_item(geom: Any, new_name: str) -> Any:
|
||||||
class SLICENODE_RenameMesh(SliceNode):
|
class SLICENODE_RenameMesh(SliceNode):
|
||||||
bl_label = "Rename Mesh"
|
bl_label = "Rename Mesh"
|
||||||
|
|
||||||
new_name: NfStringProperty(name="Name", default="RenamedMesh") # pyright: ignore[reportInvalidTypeForm]
|
|
||||||
|
|
||||||
def init(self, context):
|
def init(self, context):
|
||||||
self.add_input("SLICESOCK_Mesh", "Geometry")
|
self.add_input("SLICESOCK_Mesh", "Geometry")
|
||||||
self.add_input("NodeSocketString", "Name")
|
self.add_input("NodeSocketString", "Name")
|
||||||
self.add_output("SLICESOCK_Mesh", "Geometry")
|
self.add_output("SLICESOCK_Mesh", "Geometry")
|
||||||
|
|
||||||
def draw_buttons(self, context, layout):
|
|
||||||
assert layout
|
|
||||||
layout.prop(self, "new_name")
|
|
||||||
|
|
||||||
def evaluate_output(self, socket_name: str, **_kwargs) -> Any:
|
def evaluate_output(self, socket_name: str, **_kwargs) -> Any:
|
||||||
if socket_name != "Geometry":
|
if socket_name != "Geometry":
|
||||||
return None
|
return None
|
||||||
|
|
@ -768,7 +762,7 @@ class SLICENODE_RenameMesh(SliceNode):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
name_socket: str | None = self.resolve("Name")
|
name_socket: str | None = self.resolve("Name")
|
||||||
target_name = name_socket if name_socket else self.new_name
|
target_name = name_socket
|
||||||
if not target_name:
|
if not target_name:
|
||||||
return geom
|
return geom
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class SLICENODE_GcodeToTextBlock(ExecSliceNode):
|
||||||
|
|
||||||
def init(self, context):
|
def init(self, context):
|
||||||
self._init_exec()
|
self._init_exec()
|
||||||
self.add_input("NodeSocketString")
|
self.add_input("NodeSocketString", "Gcode")
|
||||||
|
|
||||||
def draw_buttons(self, context, layout):
|
def draw_buttons(self, context, layout):
|
||||||
super().draw_buttons(context, layout)
|
super().draw_buttons(context, layout)
|
||||||
|
|
@ -109,7 +109,7 @@ class SLICENODE_StartPrint(ExecSliceNode):
|
||||||
|
|
||||||
def init(self, context):
|
def init(self, context):
|
||||||
self._init_exec()
|
self._init_exec()
|
||||||
self.add_input("NodeSocketString")
|
self.add_input("NodeSocketString", "Gcode")
|
||||||
self.add_input("SLICESOCK_Printer")
|
self.add_input("SLICESOCK_Printer")
|
||||||
|
|
||||||
def evaluate(self, operator=None):
|
def evaluate(self, operator=None):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue