mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 16:45:56 +08:00
Merge pull request #17518 from Ultimaker/CURA-11166-importing-model-translations
Model translations while changing build plates
This commit is contained in:
commit
bd1c2af3e4
@ -179,6 +179,7 @@ class CuraApplication(QtApplication):
|
|||||||
self._use_single_instance = False
|
self._use_single_instance = False
|
||||||
|
|
||||||
self._single_instance = None
|
self._single_instance = None
|
||||||
|
self._open_project_mode: Optional[str] = None
|
||||||
|
|
||||||
self._cura_formula_functions = None # type: Optional[CuraFormulaFunctions]
|
self._cura_formula_functions = None # type: Optional[CuraFormulaFunctions]
|
||||||
|
|
||||||
@ -1845,7 +1846,7 @@ class CuraApplication(QtApplication):
|
|||||||
Logger.log("i", "Attempting to read file %s", file.toString())
|
Logger.log("i", "Attempting to read file %s", file.toString())
|
||||||
if not file.isValid():
|
if not file.isValid():
|
||||||
return
|
return
|
||||||
|
self._open_project_mode = project_mode
|
||||||
scene = self.getController().getScene()
|
scene = self.getController().getScene()
|
||||||
|
|
||||||
for node in DepthFirstIterator(scene.getRoot()):
|
for node in DepthFirstIterator(scene.getRoot()):
|
||||||
@ -1855,16 +1856,16 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
is_project_file = self.checkIsValidProjectFile(file)
|
is_project_file = self.checkIsValidProjectFile(file)
|
||||||
|
|
||||||
if project_mode is None:
|
if self._open_project_mode is None:
|
||||||
project_mode = self.getPreferences().getValue("cura/choice_on_open_project")
|
self._open_project_mode = self.getPreferences().getValue("cura/choice_on_open_project")
|
||||||
|
|
||||||
if is_project_file and project_mode == "open_as_project":
|
if is_project_file and self._open_project_mode == "open_as_project":
|
||||||
# open as project immediately without presenting a dialog
|
# open as project immediately without presenting a dialog
|
||||||
workspace_handler = self.getWorkspaceFileHandler()
|
workspace_handler = self.getWorkspaceFileHandler()
|
||||||
workspace_handler.readLocalFile(file, add_to_recent_files_hint = add_to_recent_files)
|
workspace_handler.readLocalFile(file, add_to_recent_files_hint = add_to_recent_files)
|
||||||
return
|
return
|
||||||
|
|
||||||
if is_project_file and project_mode == "always_ask":
|
if is_project_file and self._open_project_mode == "always_ask":
|
||||||
# present a dialog asking to open as project or import models
|
# present a dialog asking to open as project or import models
|
||||||
self.callLater(self.openProjectFile.emit, file, add_to_recent_files)
|
self.callLater(self.openProjectFile.emit, file, add_to_recent_files)
|
||||||
return
|
return
|
||||||
@ -1999,8 +2000,11 @@ class CuraApplication(QtApplication):
|
|||||||
center_y = 0
|
center_y = 0
|
||||||
|
|
||||||
node.translate(Vector(0, center_y, 0))
|
node.translate(Vector(0, center_y, 0))
|
||||||
|
|
||||||
nodes_to_arrange.append(node)
|
nodes_to_arrange.append(node)
|
||||||
|
# If the file is a project,and models are to be loaded from a that project,
|
||||||
|
# models inside file should be arranged in buildplate.
|
||||||
|
elif self._open_project_mode == "open_as_model":
|
||||||
|
nodes_to_arrange.append(node)
|
||||||
|
|
||||||
# This node is deep copied from some other node which already has a BuildPlateDecorator, but the deepcopy
|
# This node is deep copied from some other node which already has a BuildPlateDecorator, but the deepcopy
|
||||||
# of BuildPlateDecorator produces one that's associated with build plate -1. So, here we need to check if
|
# of BuildPlateDecorator produces one that's associated with build plate -1. So, here we need to check if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user