Merge pull request #3848 from fieldOfView/feature_select_after_loading

Select models after loading
This commit is contained in:
Ian Paschal 2018-05-23 11:26:07 +02:00 committed by GitHub
commit 775ec91762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -377,6 +377,7 @@ class CuraApplication(QtApplication):
preferences.addPreference("cura/categories_expanded", "")
preferences.addPreference("cura/jobname_prefix", True)
preferences.addPreference("cura/select_models_on_load", False)
preferences.addPreference("view/center_on_select", False)
preferences.addPreference("mesh/scale_to_fit", False)
preferences.addPreference("mesh/scale_tiny_meshes", True)
@ -1572,6 +1573,9 @@ class CuraApplication(QtApplication):
self.callLater(self.openProjectFile.emit, file)
return
if Preferences.getInstance().getValue("cura/select_models_on_load"):
Selection.clear()
f = file.toLocalFile()
extension = os.path.splitext(f)[1]
filename = os.path.basename(f)
@ -1623,6 +1627,8 @@ class CuraApplication(QtApplication):
default_extruder_position = self.getMachineManager().defaultExtruderPosition
default_extruder_id = self._global_container_stack.extruders[default_extruder_position].getId()
select_models_on_load = Preferences.getInstance().getValue("cura/select_models_on_load")
for original_node in nodes:
# Create a CuraSceneNode just if the original node is not that type
@ -1696,6 +1702,9 @@ class CuraApplication(QtApplication):
node.callDecoration("setActiveExtruder", default_extruder_id)
scene.sceneChanged.emit(node)
if select_models_on_load:
Selection.add(node)
self.fileCompleted.emit(filename)
def addNonSliceableExtension(self, extension):

View File

@ -79,6 +79,8 @@ UM.PreferencesPage
scaleToFitCheckbox.checked = boolCheck(UM.Preferences.getValue("mesh/scale_to_fit"))
UM.Preferences.resetPreference("mesh/scale_tiny_meshes")
scaleTinyCheckbox.checked = boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes"))
UM.Preferences.resetPreference("cura/select_models_on_load")
selectModelsOnLoadCheckbox.checked = boolCheck(UM.Preferences.getValue("cura/select_models_on_load"))
UM.Preferences.resetPreference("cura/jobname_prefix")
prefixJobNameCheckbox.checked = boolCheck(UM.Preferences.getValue("cura/jobname_prefix"))
UM.Preferences.resetPreference("view/show_overhang");
@ -498,6 +500,21 @@ UM.PreferencesPage
}
}
UM.TooltipArea
{
width: childrenRect.width
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","Should models be selected after they are loaded?")
CheckBox
{
id: selectModelsOnLoadCheckbox
text: catalog.i18nc("@option:check","Select models when loaded")
checked: boolCheck(UM.Preferences.getValue("cura/select_models_on_load"))
onCheckedChanged: UM.Preferences.setValue("cura/select_models_on_load", checked)
}
}
UM.TooltipArea
{
width: childrenRect.width