From 0ebc6dafbd82bce1102d72e28969ddb938b0c2ef Mon Sep 17 00:00:00 2001 From: Ma Nan Date: Fri, 13 Sep 2024 17:00:00 +0800 Subject: [PATCH] fix cannot extract wire --- bioxelnodes/menus.py | 6 ++---- bioxelnodes/operators/container.py | 28 +++++++++++----------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/bioxelnodes/menus.py b/bioxelnodes/menus.py index 393ffe6..396e9de 100644 --- a/bioxelnodes/menus.py +++ b/bioxelnodes/menus.py @@ -15,8 +15,8 @@ SaveContainer, LoadContainer, AddPieCutter, AddPlaneCutter, AddCylinderCutter, AddCubeCutter, AddSphereCutter, - ExtractBboxWire, ExtractMesh, ExtractVolume, ExtractShapeWire, - ExtractNodeMesh, ExtractNodeBboxWire, ExtractNodeVolume, ExtractNodeShapeWire) + ExtractBboxWire, ExtractMesh, ExtractShapeWire, + ExtractNodeMesh, ExtractNodeBboxWire, ExtractNodeShapeWire) from .operators.io import (ImportAsLabel, ImportAsScalar, ImportAsColor) from .operators.misc import (CleanTemp, @@ -80,7 +80,6 @@ class ExtractFromContainerMenu(bpy.types.Menu): def draw(self, context): layout = self.layout layout.operator(ExtractMesh.bl_idname) - layout.operator(ExtractVolume.bl_idname) layout.operator(ExtractShapeWire.bl_idname) layout.operator(ExtractBboxWire.bl_idname) @@ -261,7 +260,6 @@ class NodeContextMenu(bpy.types.Menu): def draw(self, context): layout = self.layout layout.operator(ExtractNodeMesh.bl_idname) - layout.operator(ExtractNodeVolume.bl_idname) layout.operator(ExtractNodeShapeWire.bl_idname) layout.operator(ExtractNodeBboxWire.bl_idname) diff --git a/bioxelnodes/operators/container.py b/bioxelnodes/operators/container.py index 580190e..5c523ac 100644 --- a/bioxelnodes/operators/container.py +++ b/bioxelnodes/operators/container.py @@ -152,14 +152,6 @@ class ExtractNodeMesh(bpy.types.Operator, ExtractNodeObject): object_type = "Mesh" -class ExtractNodeVolume(bpy.types.Operator, ExtractNodeObject): - bl_idname = "bioxelnodes.extract_node_volume" - bl_label = "Extract Volume" - bl_description = "Extract Volume" - bl_icon = "OUTLINER_OB_VOLUME" - object_type = "Volume" - - class ExtractNodeShapeWire(bpy.types.Operator, ExtractNodeObject): bl_idname = "bioxelnodes.extract_node_shape_wire" bl_label = "Extract Shape Wire" @@ -204,7 +196,17 @@ def execute(self, context): use_link=get_use_link()) fetch_mesh_node.inputs[0].default_value = container_obj - node_group.links.new(fetch_mesh_node.outputs[0], output_node.inputs[0]) + + if self.object_type == "Mesh": + node_group.links.new( + fetch_mesh_node.outputs[0], output_node.inputs[0]) + else: + curve_to_mesh_node = node_group.nodes.new( + "GeometryNodeCurveToMesh") + node_group.links.new( + fetch_mesh_node.outputs[0], curve_to_mesh_node.inputs[0]) + node_group.links.new( + curve_to_mesh_node.outputs[0], output_node.inputs[0]) for modifier in obj.modifiers: bpy.ops.object.modifier_apply(modifier=modifier.name) @@ -226,14 +228,6 @@ class ExtractMesh(bpy.types.Operator, ExtractObject): object_type = "Mesh" -class ExtractVolume(bpy.types.Operator, ExtractObject): - bl_idname = "bioxelnodes.extract_volume" - bl_label = "Extract Volume" - bl_description = "Extract Volume" - bl_icon = "OUTLINER_OB_VOLUME" - object_type = "Volume" - - class ExtractShapeWire(bpy.types.Operator, ExtractObject): bl_idname = "bioxelnodes.extract_shape_wire" bl_label = "Extract Shape Wire"