diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-02 03:18:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-02 03:19:41 +0300 |
commit | 01370f8794eb19ed651b9bfe317de6525944bb50 (patch) | |
tree | ecb2c06090e698955f73421d9ab1afff350b8474 | |
parent | 15cf78e2a525cca3f650f7af45e9c4213303005f (diff) |
Print3D: use annotations
-rw-r--r-- | object_print3d_utils/__init__.py | 118 | ||||
-rw-r--r-- | object_print3d_utils/operators.py | 72 |
2 files changed, 96 insertions, 94 deletions
diff --git a/object_print3d_utils/__init__.py b/object_print3d_utils/__init__.py index 5666d057..68fe48ea 100644 --- a/object_print3d_utils/__init__.py +++ b/object_print3d_utils/__init__.py @@ -59,64 +59,66 @@ else: class Print3D_Scene_Props(PropertyGroup): - export_format = EnumProperty( - name="Format", - description="Format type to export to", - items=(('STL', "STL", ""), - ('PLY', "PLY", ""), - ('WRL', "VRML2", ""), - ('X3D', "X3D", ""), - ('OBJ', "OBJ", "")), - default='STL', - ) - use_export_texture = BoolProperty( - name="Copy Textures", - description="Copy textures on export to the output path", - default=False, - ) - use_apply_scale = BoolProperty( - name="Apply Scale", - description="Apply scene scale setting on export", - default=False, - ) - export_path = StringProperty( - name="Export Directory", - description="Path to directory where the files are created", - default="//", maxlen=1024, subtype="DIR_PATH", - ) - thickness_min = FloatProperty( - name="Thickness", - description="Minimum thickness", - subtype='DISTANCE', - default=0.001, # 1mm - min=0.0, max=10.0, - ) - threshold_zero = FloatProperty( - name="Threshold", - description="Limit for checking zero area/length", - default=0.0001, - precision=5, - min=0.0, max=0.2, - ) - angle_distort = FloatProperty( - 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( - name="Angle", - subtype='ANGLE', - default=math.radians(160.0), - min=0.0, max=math.radians(180.0), - ) - angle_overhang = FloatProperty( - name="Angle", - subtype='ANGLE', - default=math.radians(45.0), - min=0.0, max=math.radians(90.0), - ) + export_format: EnumProperty( + name="Format", + description="Format type to export to", + items=( + ('STL', "STL", ""), + ('PLY', "PLY", ""), + ('WRL', "VRML2", ""), + ('X3D', "X3D", ""), + ('OBJ', "OBJ", ""), + ), + default='STL', + ) + use_export_texture: BoolProperty( + name="Copy Textures", + description="Copy textures on export to the output path", + default=False, + ) + use_apply_scale: BoolProperty( + name="Apply Scale", + description="Apply scene scale setting on export", + default=False, + ) + export_path: StringProperty( + name="Export Directory", + description="Path to directory where the files are created", + default="//", maxlen=1024, subtype="DIR_PATH", + ) + thickness_min: FloatProperty( + name="Thickness", + description="Minimum thickness", + subtype='DISTANCE', + default=0.001, # 1mm + min=0.0, max=10.0, + ) + threshold_zero: FloatProperty( + name="Threshold", + description="Limit for checking zero area/length", + default=0.0001, + precision=5, + min=0.0, max=0.2, + ) + angle_distort: FloatProperty( + 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( + name="Angle", + subtype='ANGLE', + default=math.radians(160.0), + min=0.0, max=math.radians(180.0), + ) + angle_overhang: FloatProperty( + name="Angle", + subtype='ANGLE', + default=math.radians(45.0), + min=0.0, max=math.radians(90.0), + ) # Update panel category name diff --git a/object_print3d_utils/operators.py b/object_print3d_utils/operators.py index af8a29e8..ebc1a730 100644 --- a/object_print3d_utils/operators.py +++ b/object_print3d_utils/operators.py @@ -23,15 +23,15 @@ import bpy from bpy.types import Operator from bpy.props import ( - IntProperty, - FloatProperty, - ) + IntProperty, + FloatProperty, +) import bmesh from . import ( - mesh_helpers, - report, - ) + mesh_helpers, + report, +) def clean_float(text): @@ -430,16 +430,16 @@ class MESH_OT_Print3D_Clean_Non_Manifold(Operator): bl_label = "Print3D Clean Non-Manifold and Inverted" bl_options = {'REGISTER', 'UNDO'} - threshold = bpy.props.FloatProperty( - name="threshold", - description="Minimum distance between elements to merge", - default=0.0001, - ) - sides = bpy.props.IntProperty( - name="sides", - description="Number of sides in hole required to fill", - default=4, - ) + threshold: bpy.props.FloatProperty( + name="threshold", + description="Minimum distance between elements to merge", + default=0.0001, + ) + sides: bpy.props.IntProperty( + name="sides", + description="Number of sides in hole required to fill", + default=4, + ) def execute(self, context): self.context = context @@ -600,7 +600,7 @@ class MESH_OT_Print3D_Select_Report(Operator): bl_label = "Print3D Select Report" bl_options = {'INTERNAL'} - index = IntProperty() + index: IntProperty() _type_to_mode = { bmesh.types.BMVert: 'VERT', @@ -659,14 +659,14 @@ class MESH_OT_Print3D_Scale_To_Volume(Operator): bl_label = "Scale to Volume" bl_options = {'REGISTER', 'UNDO'} - volume_init = FloatProperty( - options={'HIDDEN'}, - ) - volume = FloatProperty( - name="Volume", - unit='VOLUME', - min=0.0, max=100000.0, - ) + volume_init: FloatProperty( + options={'HIDDEN'}, + ) + volume: FloatProperty( + name="Volume", + unit='VOLUME', + min=0.0, max=100000.0, + ) def execute(self, context): import math @@ -705,17 +705,17 @@ class MESH_OT_Print3D_Scale_To_Bounds(Operator): bl_label = "Scale to Bounds" bl_options = {'REGISTER', 'UNDO'} - length_init = FloatProperty( - options={'HIDDEN'}, - ) - axis_init = IntProperty( - options={'HIDDEN'}, - ) - length = FloatProperty( - name="Length Limit", - unit='LENGTH', - min=0.0, max=100000.0, - ) + length_init: FloatProperty( + options={'HIDDEN'}, + ) + axis_init: IntProperty( + options={'HIDDEN'}, + ) + length: FloatProperty( + name="Length Limit", + unit='LENGTH', + min=0.0, max=100000.0, + ) def execute(self, context): scale = self.length / self.length_init |