diff options
author | Mikhail Rachinskiy <mikhail.rachinskiy@gmail.com> | 2017-09-02 20:42:43 +0300 |
---|---|---|
committer | Mikhail Rachinskiy <mikhail.rachinskiy@gmail.com> | 2017-09-02 20:42:43 +0300 |
commit | 3eb4145a4cbfbd247dca3e3c1ff680b425ff2b02 (patch) | |
tree | 7103ede4a74887e31c9cb1ce3d40947069b234ff /object_print3d_utils/__init__.py | |
parent | 131ea02a4c0cc0c245c39488113fbe4b433afdee (diff) |
Print3D Cleanup: Strict namanig for classes
Diffstat (limited to 'object_print3d_utils/__init__.py')
-rw-r--r-- | object_print3d_utils/__init__.py | 88 |
1 files changed, 41 insertions, 47 deletions
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(): |