From 44db4216bcfa0b83dd464da9ad4d018fd6211600 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 3 Sep 2019 15:44:41 +0200 Subject: [PATCH 1/2] Rename to getEndFaceSelectionId() CURA-6745 --- cura/CuraActions.py | 2 +- plugins/SolidView/SolidView.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index 9338521003..1e992badc3 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -85,7 +85,7 @@ class CuraActions(QObject): original_node, face_id = selected_face meshdata = original_node.getMeshDataTransformed() - if not meshdata or face_id < 0 or face_id > Selection.endFaceSelectionId(): + if not meshdata or face_id < 0 or face_id > Selection.getEndFaceSelectionId(): return rotation_point, face_normal = meshdata.getFacePlane(face_id) diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index da18c328d1..3f70a3612d 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -142,7 +142,7 @@ class SolidView(View): # Color the currently selected face-id. face = Selection.getSelectedFace() - uniforms["selected_face"] = Selection.endFaceSelectionId() if not face or node != face[0] else face[1] + uniforms["selected_face"] = Selection.getEndFaceSelectionId() if not face or node != face[0] else face[1] except ValueError: pass From efbcdcc8ac41d91ef9ea0fc93f718725f82fb2b1 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 3 Sep 2019 15:47:18 +0200 Subject: [PATCH 2/2] Add None check in bottomFaceSelection() CURA-6745 --- cura/CuraActions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index 1e992badc3..8f60333261 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -3,7 +3,7 @@ from PyQt5.QtCore import QObject, QUrl from PyQt5.QtGui import QDesktopServices -from typing import List, cast +from typing import List, Optional, cast from UM.Event import CallFunctionEvent from UM.FlameProfiler import pyqtSlot @@ -94,12 +94,15 @@ class CuraActions(QObject): 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)