[Bf-extensions-cvs] [3eb4145a] master: Print3D Cleanup: Strict namanig for classes

Mikhail Rachinskiy noreply at git.blender.org
Sat Sep 2 19:43:05 CEST 2017


Commit: 3eb4145a4cbfbd247dca3e3c1ff680b425ff2b02
Author: Mikhail Rachinskiy
Date:   Sat Sep 2 21:42:43 2017 +0400
Branches: master
https://developer.blender.org/rBA3eb4145a4cbfbd247dca3e3c1ff680b425ff2b02

Print3D Cleanup: Strict namanig for classes

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

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

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

diff --git a/object_print3d_utils/__init__.py b/object_print3d_utils/__init__.py
index f665f54c..2ce219bb 100644
--- a/object_print3d_utils/__init__.py
+++ b/object_print3d_utils/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "3D Print Toolbox",
     "author": "Campbell Barton",
-    "blender": (2, 65, 0),
+    "blender": (2, 79, 0),
     "location": "3D View > Toolbox",
     "description": "Utilities for 3D printing",
     "warning": "",
@@ -37,6 +37,8 @@ if "bpy" in locals():
     importlib.reload(operators)
     importlib.reload(mesh_helpers)
 else:
+    import math
+
     import bpy
     from bpy.props import (
             StringProperty,
@@ -49,15 +51,14 @@ else:
             AddonPreferences,
             PropertyGroup,
             )
+
     from . import (
             ui,
             operators,
             )
 
-import math
-
 
-class Print3DSettings(PropertyGroup):
+class Print3D_Scene_Props(PropertyGroup):
     export_format = EnumProperty(
             name="Format",
             description="Format type to export to",
@@ -101,7 +102,6 @@ class Print3DSettings(PropertyGroup):
             name="Angle",
             description="Limit for checking distorted faces",
             subtype='ANGLE',
-            default=math.radians(45.0),
             min=0.0, max=math.radians(180.0),
             )
     angle_sharp = FloatProperty(
@@ -118,17 +118,14 @@ class Print3DSettings(PropertyGroup):
             )
 
 
-# Add-ons Preferences Update Panel
-
-# Define Panel classes for updating
+# Panels for updating
 panels = (
-    ui.Print3DToolBarObject,
-    ui.Print3DToolBarMesh,
+    ui.VIEW3D_PT_Print3D_Object,
+    ui.VIEW3D_PT_Print3D_Mesh,
     )
 
 
-def update_panel(self, context):
-    message = "3D Print Toolbox: Updating Panel locations has failed"
+def update_panels(self, context):
     try:
         for panel in panels:
             if "bl_rna" in panel.__dict__:
@@ -139,61 +136,58 @@ def update_panel(self, context):
             bpy.utils.register_class(panel)
 
     except Exception as e:
+        message = "3D Print Toolbox: Updating Panel locations has failed"
         print("\n[{}]\n{}\n\nError:\n{}".format(__name__, message, e))
-        pass
 
 
-class printpreferences(AddonPreferences):
-    # this must match the addon name, use '__package__'
-    # when defining this in a submodule of a python package.
+class Print3D_Preferences(AddonPreferences):
     bl_idname = __name__
 
     category = StringProperty(
-                name="Tab Category",
-                description="Choose a name for the category of the panel",
-                default="3D Printing",
-                update=update_panel
-                )
+            name="Tab Category",
+            description="Choose a name for the category of the panel",
+            default="3D Printing",
+            update=update_panels,
+            )
 
     def draw(self, context):
         layout = self.layout
-        row = layout.row()
-        col = row.column()
 
+        col = layout.column()
         col.label(text="Tab Category:")
         col.prop(self, "category", text="")
 
 
 classes = (
-    ui.Print3DToolBarObject,
-    ui.Print3DToolBarMesh,
+    ui.VIEW3D_PT_Print3D_Object,
+    ui.VIEW3D_PT_Print3D_Mesh,
 
-    operators.Print3DInfoVolume,
-    operators.Print3DInfoArea,
+    operators.MESH_OT_Print3D_Info_Volume,
+    operators.MESH_OT_Print3D_Info_Area,
 
-    operators.Print3DCheckDegenerate,
-    operators.Print3DCheckDistorted,
-    operators.Print3DCheckSolid,
-    operators.Print3DCheckIntersections,
-    operators.Print3DCheckThick,
-    operators.Print3DCheckSharp,
-    operators.Print3DCheckOverhang,
-    operators.Print3DCheckAll,
+    operators.MESH_OT_Print3D_Check_Degenerate,
+    operators.MESH_OT_Print3D_Check_Distorted,
+    operators.MESH_OT_Print3D_Check_Solid,
+    operators.MESH_OT_Print3D_Check_Intersections,
+    operators.MESH_OT_Print3D_Check_Thick,
+    operators.MESH_OT_Print3D_Check_Sharp,
+    operators.MESH_OT_Print3D_Check_Overhang,
+    operators.MESH_OT_Print3D_Check_All,
 
-    operators.Print3DCleanIsolated,
-    operators.Print3DCleanDistorted,
-    # operators.Print3DCleanThin,
-    operators.Print3DCleanNonManifold,
+    operators.MESH_OT_Print3D_Clean_Isolated,
+    operators.MESH_OT_Print3D_Clean_Distorted,
+    # operators.MESH_OT_Print3D_Clean_Thin,
+    operators.MESH_OT_Print3D_Clean_Non_Manifold,
 
-    operators.Print3DSelectReport,
+    operators.MESH_OT_Print3D_Select_Report,
 
-    operators.Print3DScaleToVolume,
-    operators.Print3DScaleToBounds,
+    operators.MESH_OT_Print3D_Scale_To_Volume,
+    operators.MESH_OT_Print3D_Scale_To_Bounds,
 
-    operators.Print3DExport,
+    operators.MESH_OT_Print3D_Export,
 
-    Print3DSettings,
-    printpreferences,
+    Print3D_Scene_Props,
+    Print3D_Preferences,
     )
 
 
@@ -201,9 +195,9 @@ def register():
     for cls in classes:
         bpy.utils.register_class(cls)
 
-    bpy.types.Scene.print_3d = PointerProperty(type=Print3DSettings)
+    bpy.types.Scene.print_3d = PointerProperty(type=Print3D_Scene_Props)
 
-    update_panel(None, bpy.context)
+    update_panels(None, bpy.context)
 
 
 def unregister():
diff --git a/object_print3d_utils/operators.py b/object_print3d_utils/operators.py
index 01ef62cc..484e7bb9 100644
--- a/object_print3d_utils/operators.py
+++ b/object_print3d_utils/operators.py
@@ -48,7 +48,7 @@ def clean_float(text):
 # Mesh Info
 
 
-class Print3DInfoVolume(Operator):
+class MESH_OT_Print3D_Info_Volume(Operator):
     """Report the volume of the active mesh"""
     bl_idname = "mesh.print3d_info_volume"
     bl_label = "Print3D Info Volume"
@@ -75,7 +75,7 @@ class Print3DInfoVolume(Operator):
         return {'FINISHED'}
 
 
-class Print3DInfoArea(Operator):
+class MESH_OT_Print3D_Info_Area(Operator):
     """Report the surface area of the active mesh"""
     bl_idname = "mesh.print3d_info_area"
     bl_label = "Print3D Info Area"
@@ -122,7 +122,7 @@ def multiple_obj_warning(self, context):
         self.report({"INFO"}, "Multiple selected objects. Only the active one will be evaluated")
 
 
-class Print3DCheckSolid(Operator):
+class MESH_OT_Print3D_Check_Solid(Operator):
     """Check for geometry is solid (has valid inside/outside) and correct normals"""
     bl_idname = "mesh.print3d_check_solid"
     bl_label = "Print3D Check Solid"
@@ -150,7 +150,7 @@ class Print3DCheckSolid(Operator):
         return execute_check(self, context)
 
 
-class Print3DCheckIntersections(Operator):
+class MESH_OT_Print3D_Check_Intersections(Operator):
     """Check geometry for self intersections"""
     bl_idname = "mesh.print3d_check_intersect"
     bl_label = "Print3D Check Intersections"
@@ -165,7 +165,7 @@ class Print3DCheckIntersections(Operator):
         return execute_check(self, context)
 
 
-class Print3DCheckDegenerate(Operator):
+class MESH_OT_Print3D_Check_Degenerate(Operator):
     """Check for degenerate geometry that may not print properly """ \
     """(zero area faces, zero length edges)"""
     bl_idname = "mesh.print3d_check_degenerate"
@@ -195,7 +195,7 @@ class Print3DCheckDegenerate(Operator):
         return execute_check(self, context)
 
 
-class Print3DCheckDistorted(Operator):
+class MESH_OT_Print3D_Check_Distorted(Operator):
     """Check for non-flat faces """
     bl_idname = "mesh.print3d_check_distort"
     bl_label = "Print3D Check Distorted Faces"
@@ -233,7 +233,7 @@ class Print3DCheckDistorted(Operator):
         return execute_check(self, context)
 
 
-class Print3DCheckThick(Operator):
+class MESH_OT_Print3D_Check_Thick(Operator):
     """Check geometry is above the minimum thickness preference """ \
     """(relies on correct normals)"""
     bl_idname = "mesh.print3d_check_thick"
@@ -253,7 +253,7 @@ class Print3DCheckThick(Operator):
         return execute_check(self, context)
 
 
-class Print3DCheckSharp(Operator):
+class MESH_OT_Print3D_Check_Sharp(Operator):
     """Check edges are below the sharpness preference"""
     bl_idname = "mesh.print3d_check_sharp"
     bl_label = "Print3D Check Sharp"
@@ -278,7 +278,7 @@ class Print3DCheckSharp(Operator):
         return execute_check(self, context)
 
 
-class Print3DCheckOverhang(Operator):
+class MESH_OT_Print3D_Check_Overhang(Operator):
     """Check faces don't overhang past a certain angle"""
     bl_idname = "mesh.print3d_check_overhang"
     bl_label = "Print3D Check Overhang"
@@ -314,19 +314,19 @@ class Print3DCheckOverhang(Operator):
         return execute_check(self, context)
 
 
-class Print3DCheckAll(Operator):
+class MESH_OT_Print3D_Check_All(Operator):
     """Run all checks"""
     bl_idname = "mesh.print3d_check_all"
     bl_label = "Print3D Check All"
 
     check_cls = (
-        Print3DCheckSolid,
-        Print3DCheckIntersections,
-        Print3DCheckDegenerate,
-        Print3DCheckDistorted,
-        Print3DCheckThick,
-        Print3DCheckSharp,
-        Print3DCheckOverhang,
+        MESH_OT_Print3D_Check_Solid,
+        MESH_OT_Print3D_Check_Intersections,
+        MESH_OT_Print3D_Check_Degenerate,
+        MESH_OT_Print3D_Check_Distorted,
+        MESH_OT_Print3D_Check_Thick,
+        MESH_OT_Print3D_Check_Sharp,
+        MESH_OT_Print3D_Check_Overhang,
         )
 
     def execute(self, context):
@@ -343,7 +343,7 @@ class Print3DCheckAll(Operator):
         return {'FINISHED'}
 
 
-class Print3DCleanIsolated(Operator):
+class MESH_OT_Print3D_Clean_Isolated(Operator):
     """Cleanup isolated vertices and edges"""
     bl_idname = "mesh.print3d_clean_isolated"
     bl_label = "Print3D Clean Isolated "
@@ -407,7 +407,7 @@ class Print3DCleanIsolated(Operator):
             return {'CANCELLED'}
 
 
-class Print3DCleanDistorted(Operator):
+class MESH_OT_Print3D_Clean_Distorted(Operator):
     """Tessellate distorted faces"""
     bl_idname = "mesh.print3d_clean_distorted"
     bl_label = "Print3D Clean Distorted"
@@ -440,7 +440,7 @@ class Print3DCleanDistorted(Operator):
             return {'CANCELLED'}
 
 
-class Print3DCleanNonManifold(Operator):
+class MESH_OT_Print3D_Clean_Non_Manifold(Operator):
     """Cleanup problems, like holes, non-manifold vertices, and inverted normals"""
     bl_idname = "mesh.print3d_clean_non_m

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list