From 336dd406b15bff2e7a530e41592ef03d60f4c2bb Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 26 Jul 2016 11:58:25 +0200 Subject: [PATCH 01/10] Add a reusable mechanism for plugins to add controls to designated areas in the GUI contributes to CURA-271 --- cura/CuraApplication.py | 22 +++++++++++++++++++++- resources/qml/SaveButton.qml | 26 +++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a6d0a3b827..9dc5987cb7 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -128,6 +128,8 @@ class CuraApplication(QtApplication): self._machine_action_manager = MachineActionManager.MachineActionManager() self._machine_manager = None # This is initialized on demand. + self._additional_components = {} # Components to add to certain areas in the interface + super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType) self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) @@ -876,4 +878,22 @@ class CuraApplication(QtApplication): self.getMainWindow().setMinimumSize(size) def getBuildVolume(self): - return self._volume \ No newline at end of file + return self._volume + + additionalComponentsChanged = pyqtSignal(str, arguments = ["areaId"]) + + @pyqtProperty("QVariantMap", notify = additionalComponentsChanged) + def additionalComponents(self): + return self._additional_components + + ## Add a component to a list of components to be reparented to another area in the GUI. + # The actual reparenting is done by the area itself. + # \param area_id \type{str} Identifying name of the area to which the component should be reparented + # \param component \type{QQuickComponent} The component that should be reparented + @pyqtSlot(str, "QVariant") + def addAdditionalComponent(self, area_id, component): + if area_id not in self._additional_components: + self._additional_components[area_id] = [] + self._additional_components[area_id].append(component) + + self.additionalComponentsChanged.emit(area_id) \ No newline at end of file diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 8b95de15ee..9ea6e181bb 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -84,6 +84,27 @@ Rectangle { anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left + Row { + id: additionalComponentsRow + anchors.top: parent.top + anchors.right: saveToButton.visible ? saveToButton.left : parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + + spacing: UM.Theme.getSize("default_margin").width + } + + Connections { + target: Printer + onAdditionalComponentsChanged: + { + if(areaId == "saveButton") { + for (var component in Printer.additionalComponents["saveButton"]) { + Printer.additionalComponents["saveButton"][component].parent = additionalComponentsRow + } + } + } + } + Button { id: saveToButton @@ -102,8 +123,7 @@ Rectangle { } style: ButtonStyle { - background: - Rectangle + background: Rectangle { border.width: UM.Theme.getSize("default_lining").width border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : @@ -126,7 +146,7 @@ Rectangle { text: control.text; } } - label: Item { } + label: Item { } } } From bac3f73e6db141554af50bf6b281c429da47c5a1 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Wed, 27 Jul 2016 17:42:15 +0200 Subject: [PATCH 02/10] Check ConvexHullHead vs ConvexHullHead collision. CURA-1776 --- cura/PlatformPhysics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index d2a848dd72..91d2b1a1ef 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -95,11 +95,11 @@ class PlatformPhysics: # Get the overlap distance for both convex hulls. If this returns None, there is no intersection. head_hull = node.callDecoration("getConvexHullHead") if head_hull: - overlap = head_hull.intersectsPolygon(other_node.callDecoration("getConvexHull")) + overlap = head_hull.intersectsPolygon(other_node.callDecoration("getConvexHullHead")) if not overlap: other_head_hull = other_node.callDecoration("getConvexHullHead") if other_head_hull: - overlap = node.callDecoration("getConvexHull").intersectsPolygon(other_head_hull) + overlap = node.callDecoration("getConvexHullHead").intersectsPolygon(other_head_hull) else: own_convex_hull = node.callDecoration("getConvexHull") other_convex_hull = other_node.callDecoration("getConvexHull") From 6af0f28f32e776e971d04cd3e15b01f75319425d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 27 Jul 2016 17:50:25 +0200 Subject: [PATCH 03/10] Only show draft shield height if draft shield enabled We must've missed that one previously. Contributes to issue CURA-1295. --- resources/definitions/fdmprinter.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index f8bd162c27..2df6c295a4 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3348,7 +3348,7 @@ "maximum_value_warning": "9999", "default_value": 0, "value": "9999 if draft_shield_height_limitation == 'full' and draft_shield_enabled else 0.0", - "enabled": "draft_shield_height_limitation == \"limited\"", + "enabled": "draft_shield_enabled and draft_shield_height_limitation == \"limited\"", "settable_per_mesh": false, "settable_per_extruder": false }, From 823ab61cc577eb072a61cb3bd7cb524e1b4561d3 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 27 Jul 2016 18:02:31 +0200 Subject: [PATCH 04/10] Tweak convex hull node and transparent object shader Now we render at least a vague hint at lighting instead of nothing at all. --- cura/ConvexHullNode.py | 2 +- resources/shaders/transparent_object.shader | 34 ++++++++------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/cura/ConvexHullNode.py b/cura/ConvexHullNode.py index 703dfb0bed..232b30e317 100644 --- a/cura/ConvexHullNode.py +++ b/cura/ConvexHullNode.py @@ -23,7 +23,7 @@ class ConvexHullNode(SceneNode): self._original_parent = parent # Color of the drawn convex hull - self._color = Color(35, 35, 35, 192) + self._color = Color(0.4, 0.4, 0.4, 1.0) # The y-coordinate of the convex hull mesh. Must not be 0, to prevent z-fighting. self._mesh_height = 0.1 diff --git a/resources/shaders/transparent_object.shader b/resources/shaders/transparent_object.shader index a3790901bc..cd27a40769 100644 --- a/resources/shaders/transparent_object.shader +++ b/resources/shaders/transparent_object.shader @@ -1,7 +1,7 @@ [shaders] vertex = - uniform highp mat4 u_viewProjectionMatrix; uniform highp mat4 u_modelMatrix; + uniform highp mat4 u_viewProjectionMatrix; uniform highp mat4 u_normalMatrix; attribute highp vec4 a_vertex; @@ -10,7 +10,6 @@ vertex = varying highp vec3 v_vertex; varying highp vec3 v_normal; - varying highp vec2 v_uvs; void main() { @@ -19,56 +18,47 @@ vertex = v_vertex = world_space_vert.xyz; v_normal = (u_normalMatrix * normalize(a_normal)).xyz; - - v_uvs = a_uvs; } fragment = uniform mediump vec4 u_ambientColor; uniform mediump vec4 u_diffuseColor; uniform highp vec3 u_lightPosition; - uniform highp vec3 u_viewPosition; + uniform mediump float u_opacity; - uniform sampler2D u_texture; varying highp vec3 v_vertex; varying highp vec3 v_normal; - varying highp vec2 v_uvs; void main() { - // Copied from platform.shader, removed texture - mediump vec4 final_color = vec4(0.0); + mediump vec4 finalColor = vec4(0.0); /* Ambient Component */ - final_color += u_ambientColor; + finalColor += u_ambientColor; highp vec3 normal = normalize(v_normal); - highp vec3 light_dir = normalize(u_lightPosition - v_vertex); + highp vec3 lightDir = normalize(u_lightPosition - v_vertex); /* Diffuse Component */ - highp float n_dot_l = clamp(dot(normal, light_dir), 0.0, 1.0); - final_color += (n_dot_l * u_diffuseColor); + highp float NdotL = clamp(abs(dot(normal, lightDir)), 0.0, 1.0); + finalColor += (NdotL * u_diffuseColor); - final_color.a = u_opacity; - - gl_FragColor = final_color; + gl_FragColor = finalColor; + gl_FragColor.a = u_opacity; } [defaults] -u_ambientColor = [0.3, 0.3, 0.3, 1.0] -u_diffuseColor = [1.0, 1.0, 1.0, 1.0] +u_ambientColor = [0.1, 0.1, 0.1, 1.0] +u_diffuseColor = [0.4, 0.4, 0.4, 1.0] u_opacity = 0.5 -u_texture = 0 [bindings] -u_viewProjectionMatrix = view_projection_matrix u_modelMatrix = model_matrix +u_viewProjectionMatrix = view_projection_matrix u_normalMatrix = normal_matrix u_lightPosition = light_0_position -u_viewPosition = camera_position [attributes] a_vertex = vertex a_normal = normal -a_uvs = uv0 From 7971ffdc0828377810e3c36fc93408a344cf8fc3 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 27 Jul 2016 18:02:50 +0200 Subject: [PATCH 05/10] Properly ignore Arcus debug messages --- plugins/CuraEngineBackend/CuraEngineBackend.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index bf68a6cb78..aa6f2b0807 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -252,6 +252,9 @@ class CuraEngineBackend(Backend): return super()._onSocketError(error) + if error.getErrorCode() == Arcus.ErrorCode.Debug: + return + self._terminate() if error.getErrorCode() not in [Arcus.ErrorCode.BindFailedError, Arcus.ErrorCode.ConnectionResetError, Arcus.ErrorCode.Debug]: From b9857a697576db4a311c792bb57130f03f7c9904 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 26 Jul 2016 17:10:17 +0200 Subject: [PATCH 06/10] Partially solve setting the UMO heated bed kit option CURA-580 --- plugins/UltimakerMachineActions/UMOUpgradeSelection.py | 3 +++ .../UMOUpgradeSelectionMachineAction.qml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py index 2e13ec50d5..5d00fd5e3a 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py @@ -12,6 +12,9 @@ class UMOUpgradeSelection(MachineAction): super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades")) self._qml_url = "UMOUpgradeSelectionMachineAction.qml" + def _reset(self): + self.heatedBedChanged.emit() + heatedBedChanged = pyqtSignal() @pyqtProperty(bool, notify = heatedBedChanged) diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml b/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml index d960bcf976..234e53c0a6 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml @@ -44,7 +44,7 @@ Cura.MachineAction text: catalog.i18nc("@label", "Heated bed (official kit or self-built)") checked: manager.hasHeatedBed - onClicked: manager.hasHeatedBed ? manager.removeHeatedBed() : manager.addHeatedBed() + onClicked: checked ? manager.addHeatedBed() : manager.removeHeatedBed() } UM.I18nCatalog { id: catalog; name: "cura"; } From dc6d415cf5b2e5a0ac49e207f4159e16fbf275fe Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 28 Jul 2016 09:13:35 +0200 Subject: [PATCH 07/10] Disabled duplicate material, because it has a lot of issues. CURA-1969. --- resources/qml/Preferences/MaterialsPage.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/Preferences/MaterialsPage.qml b/resources/qml/Preferences/MaterialsPage.qml index aaaa4f5e9d..9da5522762 100644 --- a/resources/qml/Preferences/MaterialsPage.qml +++ b/resources/qml/Preferences/MaterialsPage.qml @@ -67,6 +67,8 @@ UM.ManagementPage enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id) }, + /* + // disabled because it has a lot of issues Button { text: catalog.i18nc("@action:button", "Duplicate"); @@ -89,7 +91,7 @@ UM.ManagementPage Cura.MachineManager.setActiveMaterial(material_id) } - }, + }, */ Button { text: catalog.i18nc("@action:button", "Remove"); From 1147e915c19f033e632329df63a4174a83b45d28 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Jul 2016 09:27:20 +0200 Subject: [PATCH 08/10] Setting a instance to the same state no longer causes display to break CURA-1985 --- plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index dc0574d14d..75cf522c14 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -246,6 +246,7 @@ Item { key: model.key watchedProperties: [ "value", "enabled", "validationState" ] storeIndex: 0 + removeUnusedValue: false } } } From c6d1caaf0f0c64da1d9d2b0abcd92964847f5ba3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Jul 2016 11:47:56 +0200 Subject: [PATCH 09/10] Convex hull is no longer needlessly re-calculated CURA-2002 --- cura/ConvexHullDecorator.py | 5 +++-- cura/PlatformPhysics.py | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py index d864f4288b..783d74e41b 100644 --- a/cura/ConvexHullDecorator.py +++ b/cura/ConvexHullDecorator.py @@ -30,9 +30,10 @@ class ConvexHullDecorator(SceneNodeDecorator): def setNode(self, node): previous_node = self._node + # Disconnect from previous node signals if previous_node is not None and node is not previous_node: - previous_node.transformationChanged.connect(self._onChanged) - previous_node.parentChanged.connect(self._onChanged) + previous_node.transformationChanged.disconnect(self._onChanged) + previous_node.parentChanged.disconnect(self._onChanged) super().setNode(node) diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 91d2b1a1ef..56daaddc18 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -71,7 +71,6 @@ class PlatformPhysics: # If there is no convex hull for the node, start calculating it and continue. if not node.getDecorator(ConvexHullDecorator): node.addDecorator(ConvexHullDecorator()) - node.callDecoration("recomputeConvexHull") if Preferences.getInstance().getValue("physics/automatic_push_free"): # Check for collisions between convex hulls From cab1dc7a13416d1a72592962e1708ad365702051 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Jul 2016 12:35:36 +0200 Subject: [PATCH 10/10] Fix merge mistake --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a6d0a3b827..1142783c9c 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -98,7 +98,7 @@ class CuraApplication(QtApplication): SettingDefinition.addSupportedProperty("settable_per_meshgroup", DefinitionPropertyType.Any, default = True) SettingDefinition.addSupportedProperty("settable_globally", DefinitionPropertyType.Any, default = True) SettingDefinition.addSupportedProperty("global_inherits_stack", DefinitionPropertyType.Function, default = "-1") - SettingDefinition.addSettingType("extruder", int, str, Validator) + SettingDefinition.addSettingType("extruder", None, str, Validator) ## Add the 4 types of profiles to storage. Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality")