mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 23:23:57 -06:00
Merge branch 'feature_intent_container_tree' of github.com:Ultimaker/Cura into feature_intent_upgrade
This commit is contained in:
commit
d6d06fb85b
190 changed files with 13989 additions and 1140 deletions
|
@ -67,6 +67,7 @@ from cura.Scene.BuildPlateDecorator import BuildPlateDecorator
|
|||
from cura.Scene.ConvexHullDecorator import ConvexHullDecorator
|
||||
from cura.Scene.CuraSceneController import CuraSceneController
|
||||
from cura.Scene.CuraSceneNode import CuraSceneNode
|
||||
from cura.Scene.GCodeListDecorator import GCodeListDecorator
|
||||
from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator
|
||||
from cura.Scene import ZOffsetDecorator
|
||||
|
||||
|
@ -979,13 +980,13 @@ class CuraApplication(QtApplication):
|
|||
return self._machine_action_manager
|
||||
|
||||
@pyqtSlot(result = QObject)
|
||||
def getMaterialManagementModel(self):
|
||||
def getMaterialManagementModel(self) -> MaterialManagementModel:
|
||||
if not self._material_management_model:
|
||||
self._material_management_model = MaterialManagementModel(parent = self)
|
||||
return self._material_management_model
|
||||
|
||||
@pyqtSlot(result = QObject)
|
||||
def getQualityManagementModel(self):
|
||||
def getQualityManagementModel(self) -> QualityManagementModel:
|
||||
if not self._quality_management_model:
|
||||
self._quality_management_model = QualityManagementModel(parent = self)
|
||||
return self._quality_management_model
|
||||
|
@ -1347,7 +1348,13 @@ class CuraApplication(QtApplication):
|
|||
Logger.log("i", "Reloading all loaded mesh data.")
|
||||
nodes = []
|
||||
has_merged_nodes = False
|
||||
gcode_filename = None # type: Optional[str]
|
||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||
# Objects loaded from Gcode should also be included.
|
||||
gcode_filename = node.callDecoration("getGcodeFileName")
|
||||
if gcode_filename is not None:
|
||||
break
|
||||
|
||||
if not isinstance(node, CuraSceneNode) or not node.getMeshData():
|
||||
if node.getName() == "MergedMesh":
|
||||
has_merged_nodes = True
|
||||
|
@ -1355,6 +1362,11 @@ class CuraApplication(QtApplication):
|
|||
|
||||
nodes.append(node)
|
||||
|
||||
# We can open only one gcode file at the same time. If the current view has a gcode file open, just reopen it
|
||||
# for reloading.
|
||||
if gcode_filename:
|
||||
self._openFile(gcode_filename)
|
||||
|
||||
if not nodes:
|
||||
return
|
||||
|
||||
|
@ -1829,3 +1841,40 @@ class CuraApplication(QtApplication):
|
|||
return main_window.height()
|
||||
else:
|
||||
return 0
|
||||
|
||||
@pyqtSlot()
|
||||
def deleteAll(self, only_selectable: bool = True) -> None:
|
||||
super().deleteAll(only_selectable = only_selectable)
|
||||
|
||||
# Also remove nodes with LayerData
|
||||
self._removeNodesWithLayerData(only_selectable = only_selectable)
|
||||
|
||||
def _removeNodesWithLayerData(self, only_selectable: bool = True) -> None:
|
||||
Logger.log("i", "Clearing scene")
|
||||
nodes = []
|
||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||
if not isinstance(node, SceneNode):
|
||||
continue
|
||||
if not node.isEnabled():
|
||||
continue
|
||||
if (not node.getMeshData() and not node.callDecoration("getLayerData")) and not node.callDecoration("isGroup"):
|
||||
continue # Node that doesnt have a mesh and is not a group.
|
||||
if only_selectable and not node.isSelectable():
|
||||
continue # Only remove nodes that are selectable.
|
||||
if not node.callDecoration("isSliceable") and not node.callDecoration("getLayerData") and not node.callDecoration("isGroup"):
|
||||
continue # Grouped nodes don't need resetting as their parent (the group) is resetted)
|
||||
nodes.append(node)
|
||||
if nodes:
|
||||
from UM.Operations.GroupedOperation import GroupedOperation
|
||||
op = GroupedOperation()
|
||||
|
||||
for node in nodes:
|
||||
from UM.Operations.RemoveSceneNodeOperation import RemoveSceneNodeOperation
|
||||
op.addOperation(RemoveSceneNodeOperation(node))
|
||||
|
||||
# Reset the print information
|
||||
self.getController().getScene().sceneChanged.emit(node)
|
||||
|
||||
op.push()
|
||||
from UM.Scene.Selection import Selection
|
||||
Selection.clear()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue