From 2f5dfb8e6507992a25eb03bb167a23387fe5d3c3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 20 May 2019 16:34:06 +0200 Subject: [PATCH 01/24] Remove hardcoded set perspective function CURA-5395 --- cura/CuraApplication.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 1155c67423..81a5d4fcc8 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -838,7 +838,6 @@ class CuraApplication(QtApplication): if diagonal < 1: #No printer added yet. Set a default camera distance for normal-sized printers. diagonal = 375 camera.setPosition(Vector(-80, 250, 700) * diagonal / 375) - camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") From 65a8582a1ebca50dffc5022eb2c91ee20cd06ada Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 21 May 2019 09:54:32 +0200 Subject: [PATCH 02/24] Add preference to set the camera rendering type CURA-5395 --- resources/qml/Preferences/GeneralPage.qml | 54 ++++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 47cc11632c..dd6004eae0 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -95,6 +95,10 @@ UM.PreferencesPage UM.Preferences.resetPreference("view/top_layer_count"); topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) + UM.Preferences.resetPreference("general/camera_perspective_mode") + var defaultCameraMode = UM.Preferences.getValue("general/camera_perspective_mode") + setDefaultCameraMode(defaultCameraMode) + UM.Preferences.resetPreference("cura/choice_on_profile_override") setDefaultDiscardOrKeepProfile(UM.Preferences.getValue("cura/choice_on_profile_override")) @@ -330,7 +334,8 @@ UM.PreferencesPage } } - UM.TooltipArea { + UM.TooltipArea + { width: childrenRect.width; height: childrenRect.height; text: catalog.i18nc("@info:tooltip", "Moves the camera so the model is in the center of the view when a model is selected") @@ -344,7 +349,8 @@ UM.PreferencesPage } } - UM.TooltipArea { + UM.TooltipArea + { width: childrenRect.width; height: childrenRect.height; text: catalog.i18nc("@info:tooltip", "Should the default zoom behavior of cura be inverted?") @@ -436,6 +442,50 @@ UM.PreferencesPage } } + UM.TooltipArea + { + width: childrenRect.width + height: childrenRect.height + text: catalog.i18nc("@info:tooltip", "What type of camera rendering should be used?") + Column + { + spacing: 4 * screenScaleFactor + + Label + { + text: catalog.i18nc("@window:text", "Camera rendering: ") + } + ComboBox + { + id: cameraComboBox + + model: ListModel + { + id: comboBoxList + + Component.onCompleted: { + append({ text: catalog.i18n("Perspective"), code: "perspective" }) + append({ text: catalog.i18n("Orthogonal"), code: "orthogonal" }) + } + } + + currentIndex: + { + var code = UM.Preferences.getValue("general/camera_perspective_mode"); + for(var i = 0; i < comboBoxList.count; ++i) + { + if(model.get(i).code == code) + { + return i + } + } + return 0 + } + onActivated: UM.Preferences.setValue("general/camera_perspective_mode", model.get(index).code) + } + } + } + Item { //: Spacer From 9e6263b1f19960404051b2f2c00c7d5cf62c4cdc Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 21 May 2019 14:56:00 +0200 Subject: [PATCH 03/24] Change instances of assert_called_once to assert_called_once_with Grumbles something about python 3.5 and 3.6... --- tests/API/TestAccount.py | 8 ++++---- tests/TestOAuth2.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/API/TestAccount.py b/tests/API/TestAccount.py index 7a9997c771..725028b32c 100644 --- a/tests/API/TestAccount.py +++ b/tests/API/TestAccount.py @@ -21,14 +21,14 @@ def test_login(): account._authorization_service = mocked_auth_service account.login() - mocked_auth_service.startAuthorizationFlow.assert_called_once() + mocked_auth_service.startAuthorizationFlow.assert_called_once_with() # Fake a sucesfull login account._onLoginStateChanged(True) # Attempting to log in again shouldn't change anything. account.login() - mocked_auth_service.startAuthorizationFlow.assert_called_once() + mocked_auth_service.startAuthorizationFlow.assert_called_once_with() def test_initialize(): @@ -37,7 +37,7 @@ def test_initialize(): account._authorization_service = mocked_auth_service account.initialize() - mocked_auth_service.loadAuthDataFromPreferences.assert_called_once() + mocked_auth_service.loadAuthDataFromPreferences.assert_called_once_with() def test_logout(): @@ -54,7 +54,7 @@ def test_logout(): assert account.isLoggedIn account.logout() - mocked_auth_service.deleteAuthData.assert_called_once() + mocked_auth_service.deleteAuthData.assert_called_once_with() def test_errorLoginState(): diff --git a/tests/TestOAuth2.py b/tests/TestOAuth2.py index d4af485130..358ed5afbb 100644 --- a/tests/TestOAuth2.py +++ b/tests/TestOAuth2.py @@ -101,7 +101,7 @@ def test_initialize(): initialize_preferences = MagicMock() authorization_service = AuthorizationService(OAUTH_SETTINGS, original_preference) authorization_service.initialize(initialize_preferences) - initialize_preferences.addPreference.assert_called_once() + initialize_preferences.addPreference.assert_called_once_with("test/auth_data", "{}") original_preference.addPreference.assert_not_called() From a14eb50fec674c0000ca011ce603051011ee7177 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 27 May 2019 13:40:37 +0200 Subject: [PATCH 04/24] Handle the case that resolve is undefined CURA-6490 --- resources/qml/Settings/SettingCheckBox.qml | 2 +- resources/qml/Settings/SettingComboBox.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Settings/SettingCheckBox.qml b/resources/qml/Settings/SettingCheckBox.qml index 0c7321d08a..8c0c58f371 100644 --- a/resources/qml/Settings/SettingCheckBox.qml +++ b/resources/qml/Settings/SettingCheckBox.qml @@ -29,7 +29,7 @@ SettingItem // 4: variant // 5: machine var value - if ((base.resolve != "None") && (stackLevel != 0) && (stackLevel != 1)) + if ((base.resolve !== undefined && base.resolve != "None") && (stackLevel != 0) && (stackLevel != 1)) { // We have a resolve function. Indicates that the setting is not settable per extruder and that // we have to choose between the resolved value (default) and the global value diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index 37df0bd9b9..6fcc1951a4 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -54,7 +54,7 @@ SettingItem { // FIXME this needs to go away once 'resolve' is combined with 'value' in our data model. var value = undefined - if ((base.resolve != "None") && (base.stackLevel != 0) && (base.stackLevel != 1)) + if ((base.resolve !== undefined && base.resolve != "None") && (base.stackLevel != 0) && (base.stackLevel != 1)) { // We have a resolve function. Indicates that the setting is not settable per extruder and that // we have to choose between the resolved value (default) and the global value From f9af9754c8d3c8243a769cb6e43e9626472b6bca Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 27 May 2019 13:41:31 +0200 Subject: [PATCH 05/24] Make reset button and revert stack levels configurable CURA-6490 --- resources/qml/Settings/SettingItem.qml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index a95c888176..04b601f983 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -36,6 +36,20 @@ Item property var resolve: Cura.MachineManager.activeStackId !== Cura.MachineManager.activeMachineId ? propertyProvider.properties.resolve : "None" property var stackLevels: propertyProvider.stackLevels property var stackLevel: stackLevels[0] + // A list of stack levels that will trigger to show the revert button + property var showRevertStackLevels: [0] + property bool resetButtonVisible: { + var is_revert_stack_level = false; + for (var i in base.showRevertStackLevels) + { + if (base.stackLevel == i) + { + is_revert_stack_level = true + break + } + } + return is_revert_stack_level && base.showRevertButton + } signal focusReceived() signal setActiveFocusToNextSetting(bool forward) @@ -184,7 +198,7 @@ Item { id: revertButton - visible: base.stackLevel == 0 && base.showRevertButton + visible: base.resetButtonVisible height: parent.height width: height From 8b7c95da35463a2bfc7973493ebb62540cda8dc4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 31 May 2019 11:23:44 +0200 Subject: [PATCH 06/24] ViewOrientationControls now use actions This prevents code duplication CURA-5395 --- resources/qml/Actions.qml | 56 +++++++++++------------ resources/qml/ViewOrientationControls.qml | 12 ++--- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index ce9618a560..8487ec8ee4 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -101,7 +101,7 @@ Item Action { id: redoAction; - text: catalog.i18nc("@action:inmenu menubar:edit","&Redo"); + text: catalog.i18nc("@action:inmenu menubar:edit", "&Redo"); iconName: "edit-redo"; shortcut: StandardKey.Redo; onTriggered: UM.OperationStack.redo(); @@ -110,65 +110,65 @@ Item Action { - id: quitAction; - text: catalog.i18nc("@action:inmenu menubar:file","&Quit"); - iconName: "application-exit"; - shortcut: StandardKey.Quit; + id: quitAction + text: catalog.i18nc("@action:inmenu menubar:file","&Quit") + iconName: "application-exit" + shortcut: StandardKey.Quit } Action { - id: view3DCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","3D View"); - onTriggered: UM.Controller.rotateView("3d", 0); + id: view3DCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "3D View") + onTriggered: UM.Controller.rotateView("3d", 0) } Action { - id: viewFrontCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Front View"); - onTriggered: UM.Controller.rotateView("home", 0); + id: viewFrontCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Front View") + onTriggered: UM.Controller.rotateView("home", 0) } Action { - id: viewTopCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Top View"); - onTriggered: UM.Controller.rotateView("y", 90); + id: viewTopCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Top View") + onTriggered: UM.Controller.rotateView("y", 90) } Action { - id: viewLeftSideCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Left Side View"); - onTriggered: UM.Controller.rotateView("x", 90); + id: viewLeftSideCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Left Side View") + onTriggered: UM.Controller.rotateView("x", 90) } Action { - id: viewRightSideCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Right Side View"); - onTriggered: UM.Controller.rotateView("x", -90); + id: viewRightSideCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Right Side View") + onTriggered: UM.Controller.rotateView("x", -90) } Action { - id: preferencesAction; - text: catalog.i18nc("@action:inmenu","Configure Cura..."); - iconName: "configure"; + id: preferencesAction + text: catalog.i18nc("@action:inmenu", "Configure Cura...") + iconName: "configure" } Action { - id: addMachineAction; - text: catalog.i18nc("@action:inmenu menubar:printer","&Add Printer..."); + id: addMachineAction + text: catalog.i18nc("@action:inmenu menubar:printer", "&Add Printer...") } Action { - id: settingsAction; - text: catalog.i18nc("@action:inmenu menubar:printer","Manage Pr&inters..."); - iconName: "configure"; + id: settingsAction + text: catalog.i18nc("@action:inmenu menubar:printer", "Manage Pr&inters...") + iconName: "configure" } Action diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index 51ed6e3dcb..5750e935f4 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM - +import Cura 1.1 as Cura // A row of buttons that control the view direction Row { @@ -19,30 +19,30 @@ Row ViewOrientationButton { iconSource: UM.Theme.getIcon("view_3d") - onClicked: UM.Controller.rotateView("3d", 0) + onClicked: Cura.Actions.view3DCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_front") - onClicked: UM.Controller.rotateView("home", 0) + onClicked: Cura.Actions.viewFrontCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_top") - onClicked: UM.Controller.rotateView("y", 90) + onClicked: Cura.Actions.viewTopCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_left") - onClicked: UM.Controller.rotateView("x", 90) + onClicked: Cura.Actions.viewLeftSideCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_right") - onClicked: UM.Controller.rotateView("x", -90) + onClicked: Cura.Actions.viewRightSideCamera.trigger() } } From c9f07c898c3b7ffbce12c3a8afa2d8afd6c6cad6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 31 May 2019 11:32:16 +0200 Subject: [PATCH 07/24] Refactoring the rotateView to setCameraRotation The new name actualy reflects what it was doing (it sets the rotation, it doesn't apply a new one to it!) CURA-5395 --- resources/qml/Actions.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 8487ec8ee4..71a655c664 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -120,35 +120,35 @@ Item { id: view3DCameraAction text: catalog.i18nc("@action:inmenu menubar:view", "3D View") - onTriggered: UM.Controller.rotateView("3d", 0) + onTriggered: UM.Controller.setCameraRotation("3d", 0) } Action { id: viewFrontCameraAction text: catalog.i18nc("@action:inmenu menubar:view", "Front View") - onTriggered: UM.Controller.rotateView("home", 0) + onTriggered: UM.Controller.setCameraRotation("home", 0) } Action { id: viewTopCameraAction text: catalog.i18nc("@action:inmenu menubar:view", "Top View") - onTriggered: UM.Controller.rotateView("y", 90) + onTriggered: UM.Controller.setCameraRotation("y", 90) } Action { id: viewLeftSideCameraAction text: catalog.i18nc("@action:inmenu menubar:view", "Left Side View") - onTriggered: UM.Controller.rotateView("x", 90) + onTriggered: UM.Controller.setCameraRotation("x", 90) } Action { id: viewRightSideCameraAction text: catalog.i18nc("@action:inmenu menubar:view", "Right Side View") - onTriggered: UM.Controller.rotateView("x", -90) + onTriggered: UM.Controller.setCameraRotation("x", -90) } Action From 6c64486cd61596a254d58b9b4faea808a876b48e Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 2 Jun 2019 14:50:10 +0200 Subject: [PATCH 08/24] Fix creating QUrl to EmptyViewMenuComponent.qml --- cura/CuraView.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/CuraView.py b/cura/CuraView.py index 45cd7ba61b..b358558dff 100644 --- a/cura/CuraView.py +++ b/cura/CuraView.py @@ -18,8 +18,8 @@ class CuraView(View): def __init__(self, parent = None, use_empty_menu_placeholder: bool = False) -> None: super().__init__(parent) - self._empty_menu_placeholder_url = QUrl(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - "EmptyViewMenuComponent.qml")) + self._empty_menu_placeholder_url = QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + "EmptyViewMenuComponent.qml")) self._use_empty_menu_placeholder = use_empty_menu_placeholder @pyqtProperty(QUrl, constant = True) From 2f92479db2a8a4ec28c52575e1ba7025e33c9c3e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Jun 2019 09:17:35 +0200 Subject: [PATCH 09/24] Don't use caps for log entry of firmware update Also it might be useful to show what the newly discovered version is. --- plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py index a1460cca3f..ad10a4f075 100644 --- a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py +++ b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py @@ -104,7 +104,7 @@ class FirmwareUpdateCheckerJob(Job): # because the new version of Cura will be release before the firmware and we don't want to # notify the user when no new firmware version is available. if (checked_version != "") and (checked_version != current_version): - Logger.log("i", "SHOWING FIRMWARE UPDATE MESSAGE") + Logger.log("i", "Showing firmware update message for new version: {version}".format(current_version)) message = FirmwareUpdateCheckerMessage(machine_id, self._machine_name, self._lookups.getRedirectUserUrl()) message.actionTriggered.connect(self._callback) From 163b54c441246fe0b5a73613bb50727b9fcdca53 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 3 Jun 2019 09:55:48 +0200 Subject: [PATCH 10/24] Minor fix to the FR template --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 28c3ad26d4..2a0a3e4e7b 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -16,7 +16,7 @@ assignees: '' **Describe alternatives you've considered** -**Affected users and/or printers ** +**Affected users and/or printers** **Additional context** From 24b1930b14df017741a8bf1e6f3aa13bc3f1957b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Jun 2019 11:16:47 +0200 Subject: [PATCH 11/24] Don't erase G92 commands They should only be read in order to detect travel moves properly. They don't need to be modified in any way. Fixes #4878. --- plugins/PostProcessingPlugin/scripts/Stretch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/PostProcessingPlugin/scripts/Stretch.py b/plugins/PostProcessingPlugin/scripts/Stretch.py index 9757296041..13b41eaacd 100644 --- a/plugins/PostProcessingPlugin/scripts/Stretch.py +++ b/plugins/PostProcessingPlugin/scripts/Stretch.py @@ -145,6 +145,7 @@ class Stretcher(): current.readStep(line) onestep = GCodeStep(-1, in_relative_movement) onestep.copyPosFrom(current) + onestep.comment = line else: onestep = GCodeStep(-1, in_relative_movement) onestep.copyPosFrom(current) From 228fb62e6051396a869e22098fe563b07c58a5c3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Jun 2019 14:15:40 +0200 Subject: [PATCH 12/24] Handle functions in user or user-changes profiles Normally the user hasn't got any of these unless he selected a setting to be copied for all extruders. --- cura/Settings/MachineManager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 03d0cf54e5..52906b7dbb 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -897,6 +897,8 @@ class MachineManager(QObject): continue old_value = container.getProperty(setting_key, "value") + if isinstance(old_value, SettingFunction): + old_value = old_value(self._global_container_stack) if int(old_value) < 0: continue if int(old_value) >= extruder_count or not self._global_container_stack.extruders[str(old_value)].isEnabled: From a6fea1bf40d29bd960a3e899695d34285932d37f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 4 Jun 2019 07:43:56 +0200 Subject: [PATCH 13/24] Simplify check CURA-6545 --- cura/Snapshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Snapshot.py b/cura/Snapshot.py index 0410d8670d..04e13165ef 100644 --- a/cura/Snapshot.py +++ b/cura/Snapshot.py @@ -48,7 +48,7 @@ class Snapshot: # determine zoom and look at bbox = None for node in DepthFirstIterator(root): - if hasattr(node, "_outside_buildarea") and not node._outside_buildarea: + if not getattr(node, "_outside_buildarea", False): if node.callDecoration("isSliceable") and node.getMeshData() and node.isVisible() and not node.callDecoration("isNonThumbnailVisibleMesh"): if bbox is None: bbox = node.getBoundingBox() From 6e053e0bb66e5fda8fba8574488586573531bd62 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Jun 2019 13:25:43 +0200 Subject: [PATCH 14/24] Mark objects that are completely below the buildplate as outside of the buildvolume CURA-6545 --- cura/BuildVolume.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index a07c56ac6c..8e74a81842 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -226,6 +226,8 @@ class BuildVolume(SceneNode): build_volume_bounding_box = self.getBoundingBox() if build_volume_bounding_box: # It's over 9000! + # We set this to a very low number, as we do allow models to intersect the build plate. + # This means the model gets cut off at the build plate. build_volume_bounding_box = build_volume_bounding_box.set(bottom=-9001) else: # No bounding box. This is triggered when running Cura from command line with a model for the first time @@ -245,7 +247,11 @@ class BuildVolume(SceneNode): if node.collidesWithArea(self.getDisallowedAreas()): node.setOutsideBuildArea(True) continue - + # If the entire node is below the build plate, still mark it as outside. + node_bounding_box = node.getBoundingBox() + if node_bounding_box and node_bounding_box.top < 0: + node.setOutsideBuildArea(True) + continue # Mark the node as outside build volume if the set extruder is disabled extruder_position = node.callDecoration("getActiveExtruderPosition") if extruder_position not in self._global_container_stack.extruders: From c2b866fd0577586a95b2321f166055d131fb7215 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 5 Jun 2019 13:28:03 +0200 Subject: [PATCH 15/24] Fix scale for just ungrouped objects CURA-6565 Same as in Uranium _calculateAABB() --- cura/Scene/CuraSceneNode.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cura/Scene/CuraSceneNode.py b/cura/Scene/CuraSceneNode.py index 1983bc6008..9038c12b2c 100644 --- a/cura/Scene/CuraSceneNode.py +++ b/cura/Scene/CuraSceneNode.py @@ -115,6 +115,9 @@ class CuraSceneNode(SceneNode): self._aabb = None if self._mesh_data: self._aabb = self._mesh_data.getExtents(self.getWorldTransformation()) + else: # If there is no mesh_data, use a boundingbox that encompasses the local (0,0,0) + position = self.getWorldPosition() + self._aabb = AxisAlignedBox(minimum=position, maximum=position) for child in self.getAllChildren(): if child.callDecoration("isNonPrintingMesh"): From 499e02579e03b53d4b88ca341282c51230064ab6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Jun 2019 16:36:30 +0200 Subject: [PATCH 16/24] Fix hiding settings that were not visible by default CURA-6556 --- resources/qml/Settings/SettingView.qml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 848dc7d5cb..9c964347ca 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -512,12 +512,7 @@ Item text: catalog.i18nc("@action:menu", "Hide this setting"); onTriggered: { - definitionsModel.hide(contextMenu.key); - // visible settings have changed, so we're no longer showing a preset - if (settingVisibilityPresetsModel.activePreset != "") - { - settingVisibilityPresetsModel.setActivePreset("custom"); - } + definitionsModel.hide(contextMenu.key) } } MenuItem @@ -545,11 +540,6 @@ Item { definitionsModel.show(contextMenu.key); } - // visible settings have changed, so we're no longer showing a preset - if (settingVisibilityPresetsModel.activePreset != "") - { - settingVisibilityPresetsModel.setActivePreset("custom"); - } } } MenuItem From d0cf7f04bf350a889dd02c79c5aaeeb9013004e3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Jun 2019 16:45:34 +0200 Subject: [PATCH 17/24] Don't show "Your rating" for generic materials --- plugins/Toolbox/resources/qml/ToolboxDetailPage.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml index fef2732af9..1773ef9053 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml @@ -89,6 +89,7 @@ Item Label { text: catalog.i18nc("@label", "Your rating") + ":" + visible: details.type == "plugin" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") renderType: Text.NativeRendering From 3ea68e6c7ffa13352441459b1f2c9cdd40c2679f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Jun 2019 09:44:42 +0200 Subject: [PATCH 18/24] Fix width of labels in machine settings - Elide the titles in the columns. - Give the width of a ratio so that it doesn't matter if the font renders differently or if we resize the window. Fixes #5742. --- .../MachineSettingsPrinterTab.qml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index 1535301616..2556eb3a9c 100644 --- a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -20,14 +20,14 @@ Item anchors.right: parent.right anchors.top: parent.top - property int labelWidth: 120 * screenScaleFactor - property int controlWidth: (UM.Theme.getSize("setting_control").width * 3 / 4) | 0 - property var labelFont: UM.Theme.getFont("default") - property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0 property int columnSpacing: 3 * screenScaleFactor property int propertyStoreIndex: manager ? manager.storeContainerIndex : 1 // definition_changes + property int labelWidth: (columnWidth * 2 / 3 - UM.Theme.getSize("default_margin").width * 2) | 0 + property int controlWidth: (columnWidth / 3) | 0 + property var labelFont: UM.Theme.getFont("default") + property string machineStackId: Cura.MachineManager.activeMachineId property var forceUpdateFunction: manager.forceUpdate @@ -59,6 +59,8 @@ Item font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") renderType: Text.NativeRendering + width: parent.width + elide: Text.ElideRight } Cura.NumericTextFieldWithUnit // "X (Width)" @@ -175,6 +177,8 @@ Item font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") renderType: Text.NativeRendering + width: parent.width + elide: Text.ElideRight } Cura.PrintHeadMinMaxTextField // "X min" From 37b904a3c4859e1fb01fa68c59559373152cca3c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Jun 2019 09:51:06 +0200 Subject: [PATCH 19/24] Clean up snapshot code --- cura/Snapshot.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cura/Snapshot.py b/cura/Snapshot.py index 04e13165ef..a81cfc18d5 100644 --- a/cura/Snapshot.py +++ b/cura/Snapshot.py @@ -73,10 +73,11 @@ class Snapshot: satisfied = False size = None fovy = 30 + min_x, min_y, max_x, max_y = 0, 0, 0, 0 while not satisfied: if size is not None: - satisfied = True # always be satisfied after second try + satisfied = True # Always be satisfied after second try projection_matrix = Matrix() # Somehow the aspect ratio is also influenced in reverse by the screen width/height # So you have to set it to render_width/render_height to get 1 @@ -92,16 +93,18 @@ class Snapshot: if size > 0.5 or satisfied: satisfied = True else: - # make it big and allow for some empty space around + # Make it big and allow for some empty space around fovy *= 0.5 # strangely enough this messes up the aspect ratio: fovy *= size * 1.1 - - # make it a square - if max_x - min_x >= max_y - min_y: + width = max_x - min_x + height = max_y - min_y + # Make it a square + if width >= height: # make y bigger - min_y, max_y = int((max_y + min_y) / 2 - (max_x - min_x) / 2), int((max_y + min_y) / 2 + (max_x - min_x) / 2) + min_y, max_y = int(height / 2 - width / 2), int(height / 2 + width / 2) else: # make x bigger - min_x, max_x = int((max_x + min_x) / 2 - (max_y - min_y) / 2), int((max_x + min_x) / 2 + (max_y - min_y) / 2) + min_x, max_x = int(width / 2 - height / 2), int(width / 2 + height / 2) + cropped_image = pixel_output.copy(min_x, min_y, max_x - min_x, max_y - min_y) # Scale it to the correct size From 7880c8d3f4befe42a98311192167096fdc02406e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Jun 2019 09:58:15 +0200 Subject: [PATCH 20/24] Revert "Clean up snapshot code" This reverts commit 37b904a3c4859e1fb01fa68c59559373152cca3c. --- cura/Snapshot.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cura/Snapshot.py b/cura/Snapshot.py index a81cfc18d5..04e13165ef 100644 --- a/cura/Snapshot.py +++ b/cura/Snapshot.py @@ -73,11 +73,10 @@ class Snapshot: satisfied = False size = None fovy = 30 - min_x, min_y, max_x, max_y = 0, 0, 0, 0 while not satisfied: if size is not None: - satisfied = True # Always be satisfied after second try + satisfied = True # always be satisfied after second try projection_matrix = Matrix() # Somehow the aspect ratio is also influenced in reverse by the screen width/height # So you have to set it to render_width/render_height to get 1 @@ -93,18 +92,16 @@ class Snapshot: if size > 0.5 or satisfied: satisfied = True else: - # Make it big and allow for some empty space around + # make it big and allow for some empty space around fovy *= 0.5 # strangely enough this messes up the aspect ratio: fovy *= size * 1.1 - width = max_x - min_x - height = max_y - min_y - # Make it a square - if width >= height: + + # make it a square + if max_x - min_x >= max_y - min_y: # make y bigger - min_y, max_y = int(height / 2 - width / 2), int(height / 2 + width / 2) + min_y, max_y = int((max_y + min_y) / 2 - (max_x - min_x) / 2), int((max_y + min_y) / 2 + (max_x - min_x) / 2) else: # make x bigger - min_x, max_x = int(width / 2 - height / 2), int(width / 2 + height / 2) - + min_x, max_x = int((max_x + min_x) / 2 - (max_y - min_y) / 2), int((max_x + min_x) / 2 + (max_y - min_y) / 2) cropped_image = pixel_output.copy(min_x, min_y, max_x - min_x, max_y - min_y) # Scale it to the correct size From 080cafe78ff5bcdbe165a42a2361703a03c545dc Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Jun 2019 10:01:01 +0200 Subject: [PATCH 21/24] Increase the looking from offset so model doesn't get cut off CURA-5965 --- cura/Snapshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Snapshot.py b/cura/Snapshot.py index 04e13165ef..033b453684 100644 --- a/cura/Snapshot.py +++ b/cura/Snapshot.py @@ -66,7 +66,7 @@ class Snapshot: looking_from_offset = Vector(-1, 1, 2) if size > 0: # determine the watch distance depending on the size - looking_from_offset = looking_from_offset * size * 1.3 + looking_from_offset = looking_from_offset * size * 1.75 camera.setPosition(look_at + looking_from_offset) camera.lookAt(look_at) From 81919b75df903b6e649b3eb70f8d10a5fc299708 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Jun 2019 10:15:32 +0200 Subject: [PATCH 22/24] Implement Z Hop Speed Z Hops have their own speeds now. It no longer uses the maximum feedrate, which was unknown for some printers and therefore limited only to light speed, which was too much for some printers to handle. Implements CURA-6532. --- resources/definitions/fdmprinter.def.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index ebbb6a5a3c..aaf4977e7d 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2784,6 +2784,19 @@ "settable_per_extruder": true, "limit_to_extruder": "adhesion_extruder_nr" }, + "speed_z_hop": + { + "label": "Z Hop Speed", + "description": "The speed at which the vertical Z movement is made for Z Hops. This is typically lower than the print speed since the build plate or machine's gantry is harder to move.", + "unit": "mm/s", + "type": "float", + "default_value": 10, + "minimum_value": "0", + "maximum_value": "machine_max_feedrate_z", + "enabled": "retraction_enable and retraction_hop_enabled", + "settable_per_mesh": false, + "settable_per_extruder": true + }, "max_feedrate_z_override": { "label": "Maximum Z Speed", From 280ddea1aec84f1973d57fec9f564059f0ba4445 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jun 2019 11:42:14 +0200 Subject: [PATCH 23/24] Do not redirect stdout and stderr for CLI CURA-6549 --- cura_app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cura_app.py b/cura_app.py index 1978e0f5fd..2b2accbbb6 100755 --- a/cura_app.py +++ b/cura_app.py @@ -32,7 +32,8 @@ if not known_args["debug"]: elif Platform.isOSX(): return os.path.expanduser("~/Library/Logs/" + CuraAppName) - if hasattr(sys, "frozen"): + # Do not redirect stdout and stderr to files if we are running CLI. + if hasattr(sys, "frozen") and "cli" in os.path.basename(sys.argv[0]).lower(): dirpath = get_cura_dir_path() os.makedirs(dirpath, exist_ok = True) sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w", encoding = "utf-8") From d0f1b74bd75e0372be25cb1b58427aed1ee8c9ef Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jun 2019 12:16:51 +0200 Subject: [PATCH 24/24] Fix mistake in CLI check CURA-6549 --- cura_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura_app.py b/cura_app.py index 2b2accbbb6..3599f127cc 100755 --- a/cura_app.py +++ b/cura_app.py @@ -33,7 +33,7 @@ if not known_args["debug"]: return os.path.expanduser("~/Library/Logs/" + CuraAppName) # Do not redirect stdout and stderr to files if we are running CLI. - if hasattr(sys, "frozen") and "cli" in os.path.basename(sys.argv[0]).lower(): + if hasattr(sys, "frozen") and "cli" not in os.path.basename(sys.argv[0]).lower(): dirpath = get_cura_dir_path() os.makedirs(dirpath, exist_ok = True) sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w", encoding = "utf-8")