mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
T466: Removed cube, Changed label, Added clearing of scene
This commit is contained in:
parent
0a75c3d19b
commit
333e501268
5 changed files with 34 additions and 14 deletions
|
@ -581,7 +581,7 @@ class CuraApplication(QtApplication):
|
|||
count = 0
|
||||
scene_bounding_box = None
|
||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||
if type(node) is not SceneNode or not node.getMeshData():
|
||||
if type(node) is not SceneNode or (not node.getMeshData() and not hasattr(node, "gcode")):
|
||||
continue
|
||||
|
||||
count += 1
|
||||
|
@ -712,7 +712,7 @@ class CuraApplication(QtApplication):
|
|||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||
if type(node) is not SceneNode:
|
||||
continue
|
||||
if not node.getMeshData() and not node.callDecoration("isGroup"):
|
||||
if (not node.getMeshData() and not hasattr(node, "gcode")) and not node.callDecoration("isGroup"):
|
||||
continue # Node that doesnt have a mesh and is not a group.
|
||||
if node.getParent() and node.getParent().callDecoration("isGroup"):
|
||||
continue # Grouped nodes don't need resetting as their parent (the group) is resetted)
|
||||
|
|
|
@ -60,7 +60,7 @@ class ProcessSlicedLayersJob(Job):
|
|||
for node in DepthFirstIterator(self._scene.getRoot()):
|
||||
if node.callDecoration("getLayerData"):
|
||||
node.getParent().removeChild(node)
|
||||
break
|
||||
# break
|
||||
if self._abort_requested:
|
||||
if self._progress:
|
||||
self._progress.hide()
|
||||
|
|
|
@ -4,11 +4,15 @@
|
|||
|
||||
from UM.Mesh.MeshReader import MeshReader
|
||||
from UM.Mesh.MeshBuilder import MeshBuilder
|
||||
from UM.Mesh.MeshData import MeshData
|
||||
import os
|
||||
from UM.Scene.SceneNode import SceneNode
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
from UM.Math.Vector import Vector
|
||||
from UM.Math.Color import Color
|
||||
from UM.Math.AxisAlignedBox import AxisAlignedBox
|
||||
from UM.Application import Application
|
||||
from UM.Preferences import Preferences
|
||||
|
||||
from cura import LayerDataBuilder
|
||||
from cura import LayerDataDecorator
|
||||
|
@ -59,6 +63,14 @@ class GCODEReader(MeshReader):
|
|||
|
||||
extension = os.path.splitext(file_name)[1]
|
||||
if extension.lower() in self._supported_extensions:
|
||||
scene = Application.getInstance().getController().getScene()
|
||||
if getattr(scene, "gcode_list"):
|
||||
setattr(scene, "gcode_list", None)
|
||||
for node in DepthFirstIterator(scene.getRoot()):
|
||||
if node.callDecoration("getLayerData"):
|
||||
node.getParent().removeChild(node)
|
||||
Application.getInstance().deleteAll()
|
||||
|
||||
scene_node = SceneNode()
|
||||
|
||||
# mesh_builder = MeshBuilder()
|
||||
|
@ -73,11 +85,14 @@ class GCODEReader(MeshReader):
|
|||
#
|
||||
# scene_node.setMeshData(mesh_builder.build())
|
||||
|
||||
# scene_node.getBoundingBox = getBoundingBox
|
||||
def getBoundingBox():
|
||||
return AxisAlignedBox(minimum=Vector(0, 0, 0), maximum=Vector(10, 10, 10))
|
||||
|
||||
scene_node.getBoundingBox = getBoundingBox
|
||||
scene_node.gcode = True
|
||||
backend = Application.getInstance().getBackend()
|
||||
backend._pauseSlicing = True
|
||||
backend.backendStateChange.emit(0)
|
||||
# backend = Application.getInstance().getBackend()
|
||||
# backend._pauseSlicing = True
|
||||
# backend.backendStateChange.emit(0)
|
||||
|
||||
file = open(file_name, "r")
|
||||
|
||||
|
@ -183,12 +198,17 @@ class GCODEReader(MeshReader):
|
|||
scene_node_parent = Application.getInstance().getBuildVolume()
|
||||
scene_node.setParent(scene_node_parent)
|
||||
|
||||
mesh_builder = MeshBuilder()
|
||||
mesh_builder.setFileName(file_name)
|
||||
# mesh_builder = MeshBuilder()
|
||||
# mesh_builder.setFileName(file_name)
|
||||
#
|
||||
# mesh_builder.addCube(10, 10, 10, Vector(0, -5, 0))
|
||||
|
||||
mesh_builder.addCube(10, 10, 10, Vector(0, -5, 0))
|
||||
# scene_node.setMeshData(mesh_builder.build())
|
||||
# scene_node.setMeshData(MeshData(file_name=file_name))
|
||||
|
||||
scene_node.setMeshData(mesh_builder.build())
|
||||
# Application.getInstance().getPrintInformation().JobName(file_name)
|
||||
|
||||
Preferences.getInstance().setValue("cura/jobname_prefix", False)
|
||||
|
||||
settings = Application.getInstance().getGlobalContainerStack()
|
||||
machine_width = settings.getProperty("machine_width", "value")
|
||||
|
@ -200,7 +220,7 @@ class GCODEReader(MeshReader):
|
|||
if view.getPluginId() == "LayerView":
|
||||
view.resetLayerData()
|
||||
|
||||
scene_node.setEnabled(False)
|
||||
# scene_node.setEnabled(False)
|
||||
#scene_node.setSelectable(False)
|
||||
|
||||
return scene_node
|
||||
|
|
|
@ -49,7 +49,7 @@ class LayerPass(RenderPass):
|
|||
if isinstance(node, ToolHandle):
|
||||
tool_handle_batch.addItem(node.getWorldTransformation(), mesh = node.getSolidMesh())
|
||||
|
||||
elif isinstance(node, SceneNode) and (node.getMeshData()) and node.isVisible():
|
||||
elif isinstance(node, SceneNode) and (node.getMeshData() or hasattr(node, "gcode")) and node.isVisible():
|
||||
layer_data = node.callDecoration("getLayerData")
|
||||
if not layer_data:
|
||||
continue
|
||||
|
|
|
@ -119,7 +119,7 @@ class LayerView(View):
|
|||
continue
|
||||
|
||||
if not node.render(renderer):
|
||||
if node.getMeshData() and node.isVisible():
|
||||
if (node.getMeshData()) and node.isVisible():
|
||||
renderer.queueNode(node, transparent = True, shader = self._ghost_shader)
|
||||
|
||||
def setLayer(self, value):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue