[Bf-extensions-cvs] [5c0205e9] master: 3D-Print: make sure all UI panels have poll method

Mikhail Rachinskiy noreply at git.blender.org
Wed Oct 9 17:58:43 CEST 2019


Commit: 5c0205e95e15c94504834a495c232bab0d6a9ab8
Author: Mikhail Rachinskiy
Date:   Wed Oct 9 19:58:36 2019 +0400
Branches: master
https://developer.blender.org/rBA5c0205e95e15c94504834a495c232bab0d6a9ab8

3D-Print: make sure all UI panels have poll method

===================================================================

M	object_print3d_utils/operators.py
M	object_print3d_utils/ui.py

===================================================================

diff --git a/object_print3d_utils/operators.py b/object_print3d_utils/operators.py
index 17f6cb8e..68343b03 100644
--- a/object_print3d_utils/operators.py
+++ b/object_print3d_utils/operators.py
@@ -344,7 +344,7 @@ class MESH_OT_print3d_clean_distorted(Operator):
     bl_description = "Tessellate distorted faces"
     bl_options = {'REGISTER', 'UNDO'}
 
-    angle_distort: FloatProperty(
+    angle: FloatProperty(
         name="Angle",
         description="Limit for checking distorted faces",
         subtype='ANGLE',
@@ -357,7 +357,7 @@ class MESH_OT_print3d_clean_distorted(Operator):
         obj = context.active_object
         bm = mesh_helpers.bmesh_from_object(obj)
         bm.normal_update()
-        elems_triangulate = [ele for ele in bm.faces if mesh_helpers.face_is_distorted(ele, self.angle_distort)]
+        elems_triangulate = [ele for ele in bm.faces if mesh_helpers.face_is_distorted(ele, self.angle)]
 
         if elems_triangulate:
             bmesh.ops.triangulate(bm, faces=elems_triangulate)
@@ -369,7 +369,7 @@ class MESH_OT_print3d_clean_distorted(Operator):
 
     def invoke(self, context, event):
         print_3d = context.scene.print_3d
-        self.angle_distort = print_3d.angle_distort
+        self.angle = print_3d.angle_distort
 
         return self.execute(context)
 
diff --git a/object_print3d_utils/ui.py b/object_print3d_utils/ui.py
index e43f5ef1..2ca771e6 100644
--- a/object_print3d_utils/ui.py
+++ b/object_print3d_utils/ui.py
@@ -31,6 +31,11 @@ class Setup:
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'UI'
 
+    @classmethod
+    def poll(cls, context):
+        obj = context.active_object
+        return obj is not None and obj.type == 'MESH' and obj.mode in {'OBJECT', 'EDIT'}
+
 
 class VIEW3D_PT_print3d_analyze(Panel, Setup):
     bl_label = "Analyze"
@@ -41,11 +46,6 @@ class VIEW3D_PT_print3d_analyze(Panel, Setup):
         bmesh.types.BMFace: 'FACESEL',
     }
 
-    @classmethod
-    def poll(cls, context):
-        obj = context.active_object
-        return obj is not None and obj.type == 'MESH' and obj.mode in {'OBJECT', 'EDIT'}
-
     def draw_report(self, context):
         layout = self.layout
         info = report.info()



More information about the Bf-extensions-cvs mailing list