From c7bae1e8fc665ff04272dbd2ff2f3d29273bfb10 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Mon, 9 Sep 2019 23:25:16 +0200 Subject: [PATCH 1/2] Move 'lay flat by face' operation to Uranium. --- cura/CuraActions.py | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index 3a1b35d987..b92abbe706 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -75,39 +75,6 @@ class CuraActions(QObject): operation.addOperation(center_operation) operation.push() - # Rotate the selection, so that the face that the mouse-pointer is on, faces the build-plate. - @pyqtSlot() - def bottomFaceSelection(self) -> None: - selected_face = Selection.getSelectedFace() - if not selected_face: - Logger.log("e", "Bottom face operation shouldn't have been called without a selected face.") - return - - original_node, face_id = selected_face - meshdata = original_node.getMeshDataTransformed() - if not meshdata or face_id < 0 or face_id > Selection.getMaxFaceSelectionId(): - return - - rotation_point, face_normal = meshdata.getFacePlane(face_id) - rotation_point_vector = Vector(rotation_point[0], rotation_point[1], rotation_point[2]) - face_normal_vector = Vector(face_normal[0], face_normal[1], face_normal[2]) - rotation_quaternion = Quaternion.rotationTo(face_normal_vector.normalized(), Vector(0.0, -1.0, 0.0)) - - operation = GroupedOperation() - current_node = None # type: Optional[SceneNode] - for node in Selection.getAllSelectedObjects(): - current_node = node - parent_node = current_node.getParent() - while parent_node and parent_node.callDecoration("isGroup"): - current_node = parent_node - parent_node = current_node.getParent() - if current_node is None: - return - - rotate_operation = RotateOperation(current_node, rotation_quaternion, rotation_point_vector) - operation.addOperation(rotate_operation) - operation.push() - ## Multiply all objects in the selection # # \param count The number of times to multiply the selection. From e5a690e6059ee7e174535415ed54f448dc0da24a Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 10 Sep 2019 12:37:59 +0200 Subject: [PATCH 2/2] Wrap up 'lay flat by face' feature for 4.3-BETA. Icon thanks to Yi-An Lai. part of CURA-6754 --- plugins/SolidView/SolidView.py | 6 +++--- resources/shaders/overhang.shader | 2 +- .../themes/cura-light/icons/rotate_face_layflat.svg | 12 ++++++++++++ resources/themes/cura-light/styles.qml | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 resources/themes/cura-light/icons/rotate_face_layflat.svg diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index a8cff675d9..536006ffaa 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -140,9 +140,9 @@ class SolidView(View): 1.0 ] - # Color the currently selected face-id. - face = Selection.getSelectedFace() - uniforms["selected_face"] = (Selection.getMaxFaceSelectionId() + 1) if not face or node != face[0] else face[1] + # Color the currently selected face-id. (Disable for now.) + #face = Selection.getHoverFace() + uniforms["hover_face"] = -1 #if not face or node != face[0] else face[1] except ValueError: pass diff --git a/resources/shaders/overhang.shader b/resources/shaders/overhang.shader index cb34f25893..a7473177e5 100644 --- a/resources/shaders/overhang.shader +++ b/resources/shaders/overhang.shader @@ -153,7 +153,7 @@ u_normalMatrix = normal_matrix u_viewPosition = view_position u_lightPosition = light_0_position u_diffuseColor = diffuse_color -u_faceId = selected_face +u_faceId = hover_face [attributes] a_vertex = vertex diff --git a/resources/themes/cura-light/icons/rotate_face_layflat.svg b/resources/themes/cura-light/icons/rotate_face_layflat.svg new file mode 100644 index 0000000000..261a624cf0 --- /dev/null +++ b/resources/themes/cura-light/icons/rotate_face_layflat.svg @@ -0,0 +1,12 @@ + + + + select face lay flat + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 2cf3b0ed58..f2361a8604 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -240,8 +240,8 @@ QtObject } Behavior on color { ColorAnimation { duration: 50; } } - border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? Theme.getSize("default_lining").width : 0 - border.color: Theme.getColor("lining") + border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? (control.checked ? Theme.getSize("thick_lining").width : Theme.getSize("default_lining").width) : 0 + border.color: control.checked ? Theme.getColor("icon") : Theme.getColor("lining") } }