Fix init machine for machines loaded from project files

This commit is contained in:
Lipu Fei 2018-02-27 13:49:45 +01:00
parent a2e84bbe97
commit 2f86687320

View file

@ -1082,11 +1082,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
CuraApplication.getInstance().getMachineManager().activeQualityChanged.emit() CuraApplication.getInstance().getMachineManager().activeQualityChanged.emit()
# Actually change the active machine. # Actually change the active machine.
machine_manager = Application.getInstance().getMachineManager() CuraApplication.getInstance().callLater(self._updateActiveMachine, global_stack)
machine_manager.setActiveMachine(global_stack.getId())
# Notify everything/one that is to notify about changes.
global_stack.containersChanged.emit(global_stack.getTop())
# Load all the nodes / meshdata of the workspace # Load all the nodes / meshdata of the workspace
nodes = self._3mf_mesh_reader.read(file_name) nodes = self._3mf_mesh_reader.read(file_name)
@ -1099,6 +1095,14 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self.setWorkspaceName(base_file_name) self.setWorkspaceName(base_file_name)
return nodes return nodes
def _updateActiveMachine(self, global_stack):
# Actually change the active machine.
machine_manager = Application.getInstance().getMachineManager()
machine_manager.setActiveMachine(global_stack.getId())
# Notify everything/one that is to notify about changes.
global_stack.containersChanged.emit(global_stack.getTop())
## HACK: Replaces the material container in the given stack with a newly created material container. ## HACK: Replaces the material container in the given stack with a newly created material container.
# This function is used when the user chooses to resolve material conflicts by creating new ones. # This function is used when the user chooses to resolve material conflicts by creating new ones.
def _replaceStackMaterialWithNew(self, stack, old_new_material_dict): def _replaceStackMaterialWithNew(self, stack, old_new_material_dict):