From c924e2d52affcf12f23951ec7ec7adf843ac1d65 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Tue, 15 Feb 2022 16:01:40 +1100
Subject: [PATCH] Cleanup: minor changes & simplification to Align-XY

Also shorten text which didn't fit in the UI.
---
 object_print3d_utils/operators.py | 7 ++-----
 object_print3d_utils/ui.py        | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/object_print3d_utils/operators.py b/object_print3d_utils/operators.py
index 3f66f07b2..509881630 100644
--- a/object_print3d_utils/operators.py
+++ b/object_print3d_utils/operators.py
@@ -757,8 +757,7 @@ class MESH_OT_print3d_align_to_xy(Operator):
             else:
                 faces = [p for p in obj.data.polygons if p.select]
 
-            face_count = len(faces)
-            if face_count < 1:
+            if not faces:
                 skip_invalid.append(obj.name)
                 continue
 
@@ -788,9 +787,7 @@ class MESH_OT_print3d_align_to_xy(Operator):
         return {'FINISHED'}
 
     def invoke(self, context, event):
-        if context.mode in {'EDIT_MESH', 'OBJECT'}:
-            pass
-        else:
+        if context.mode not in {'EDIT_MESH', 'OBJECT'}:
             return {'CANCELLED'}
         return self.execute(context)
 
diff --git a/object_print3d_utils/ui.py b/object_print3d_utils/ui.py
index b5d69214e..e000544c3 100644
--- a/object_print3d_utils/ui.py
+++ b/object_print3d_utils/ui.py
@@ -116,7 +116,7 @@ class VIEW3D_PT_print3d_transform(View3DPrintPanel, Panel):
         row.operator("mesh.print3d_scale_to_volume", text="Volume")
         row.operator("mesh.print3d_scale_to_bounds", text="Bounds")
         row = layout.row(align=True)
-        row.operator("mesh.print3d_align_to_xy", text="Align to XY Plane")
+        row.operator("mesh.print3d_align_to_xy", text="Align XY")
         row.prop(print_3d, "use_alignxy_face_area")
 
 
-- 
GitLab