[Bf-extensions-cvs] [24e1555] master: BoltFactory: Cleanup, Remove star imports

lijenstina noreply at git.blender.org
Sun Apr 9 04:53:00 CEST 2017


Commit: 24e1555434cc2284f3c908875d04ba78e5959edd
Author: lijenstina
Date:   Sun Apr 9 04:52:03 2017 +0200
Branches: master
https://developer.blender.org/rBA24e1555434cc2284f3c908875d04ba78e5959edd

BoltFactory: Cleanup, Remove star imports

Bumped version to 0.3.2
Fix star imports
Replace the star import of the createMesh
with importlib reload in init

Pep8 cleanup

Fix crash with the Cap head type -
props.DIV_COUNT was non existing

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

M	add_mesh_BoltFactory/Boltfactory.py
M	add_mesh_BoltFactory/__init__.py
M	add_mesh_BoltFactory/createMesh.py

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

diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py
index be0ba61..89af117 100644
--- a/add_mesh_BoltFactory/Boltfactory.py
+++ b/add_mesh_BoltFactory/Boltfactory.py
@@ -18,199 +18,248 @@
 
 
 import bpy
-import mathutils
-from bpy.props import *
-from add_mesh_BoltFactory.createMesh import *
-
-##------------------------------------------------------------
-# calculates the matrix for the new object
-# depending on user pref
+from mathutils import Matrix
+from bpy.props import (
+        BoolProperty,
+        EnumProperty,
+        FloatProperty,
+        IntProperty,
+        )
+from . import createMesh
+
+
+# ------------------------------------------------------------
+# calculates the matrix for the new object depending on user pref
 def align_matrix(context):
-    loc = mathutils.Matrix.Translation(context.scene.cursor_location)
+    loc = Matrix.Translation(context.scene.cursor_location)
     obj_align = context.user_preferences.edit.object_align
-    if (context.space_data.type == 'VIEW_3D'
-        and obj_align == 'VIEW'):
+    if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'):
         rot = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
     else:
-        rot = mathutils.Matrix()
+        rot = Matrix()
     align_matrix = loc * rot
     return align_matrix
 
 
-
 class add_mesh_bolt(bpy.types.Operator):
-    """"""
     bl_idname = "mesh.bolt_add"
     bl_label = "Add Bolt"
     bl_options = {'REGISTER', 'UNDO', 'PRESET'}
-    bl_description = "adds many types of Bolts"
+    bl_description = "Construct many types of Bolts"
 
-    align_matrix = mathutils.Matrix()
+    align_matrix = Matrix()
     MAX_INPUT_NUMBER = 50
 
-  # edit - Whether to add or update.
-    edit = BoolProperty(name="",
+    # edit - Whether to add or update
+    edit = BoolProperty(
+        name="",
         description="",
         default=False,
-        options={'HIDDEN'})
-
-
-    #Model Types
-    Model_Type_List = [('bf_Model_Bolt','BOLT','Bolt Model'),
-                        ('bf_Model_Nut','NUT','Nut Model')]
-    bf_Model_Type = EnumProperty( attr='bf_Model_Type',
+        options={'HIDDEN'}
+        )
+    # Model Types
+    Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'),
+                       ('bf_Model_Nut', 'NUT', 'Nut Model')]
+    bf_Model_Type = EnumProperty(
+            attr='bf_Model_Type',
             name='Model',
             description='Choose the type off model you would like',
-            items = Model_Type_List, default = 'bf_Model_Bolt')
-
-    #Head Types
-    Model_Type_List = [('bf_Head_Hex','HEX','Hex Head'),
-                        ('bf_Head_Cap','CAP','Cap Head'),
-                        ('bf_Head_Dome','DOME','Dome Head'),
-                        ('bf_Head_Pan','PAN','Pan Head'),
-                        ('bf_Head_CounterSink','COUNTER SINK','Counter Sink Head')]
-    bf_Head_Type = EnumProperty( attr='bf_Head_Type',
+            items=Model_Type_List, default='bf_Model_Bolt'
+            )
+    # Head Types
+    Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'),
+                        ('bf_Head_Cap', 'CAP', 'Cap Head'),
+                        ('bf_Head_Dome', 'DOME', 'Dome Head'),
+                        ('bf_Head_Pan', 'PAN', 'Pan Head'),
+                        ('bf_Head_CounterSink', 'COUNTER SINK', 'Counter Sink Head')]
+    bf_Head_Type = EnumProperty(
+            attr='bf_Head_Type',
             name='Head',
             description='Choose the type off Head you would like',
-            items = Model_Type_List, default = 'bf_Head_Hex')
-
-    #Bit Types
-    Bit_Type_List = [('bf_Bit_None','NONE','No Bit Type'),
-                    ('bf_Bit_Allen','ALLEN','Allen Bit Type'),
-                    ('bf_Bit_Philips','PHILLIPS','Phillips Bit Type')]
-    bf_Bit_Type = EnumProperty( attr='bf_Bit_Type',
+            items=Model_Type_List, default='bf_Head_Hex'
+            )
+    # Bit Types
+    Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
+                    ('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
+                    ('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
+    bf_Bit_Type = EnumProperty(
+            attr='bf_Bit_Type',
             name='Bit Type',
             description='Choose the type of bit to you would like',
-            items = Bit_Type_List, default = 'bf_Bit_None')
-
-    #Nut Types
-    Nut_Type_List = [('bf_Nut_Hex','HEX','Hex Nut'),
-                    ('bf_Nut_Lock','LOCK','Lock Nut')]
-    bf_Nut_Type = EnumProperty( attr='bf_Nut_Type',
+            items=Bit_Type_List, default='bf_Bit_None'
+            )
+    # Nut Types
+    Nut_Type_List = [('bf_Nut_Hex', 'HEX', 'Hex Nut'),
+                    ('bf_Nut_Lock', 'LOCK', 'Lock Nut')]
+    bf_Nut_Type = EnumProperty(
+            attr='bf_Nut_Type',
             name='Nut Type',
             description='Choose the type of nut you would like',
-            items = Nut_Type_List, default = 'bf_Nut_Hex')
-
-    #Shank Types
-    bf_Shank_Length = FloatProperty(attr='bf_Shank_Length',
-            name='Shank Length', default = 0,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Length of the unthreaded shank')
-
-    bf_Shank_Dia = FloatProperty(attr='bf_Shank_Dia',
-            name='Shank Dia', default = 3,
-            min = 0, soft_min = 0,max = MAX_INPUT_NUMBER,
-            description='Diameter of the shank')
-
-    bf_Phillips_Bit_Depth = FloatProperty(attr='bf_Phillips_Bit_Depth',
-            name='Bit Depth', default = 1.1431535482406616,
-            min = 0, soft_min = 0,max = MAX_INPUT_NUMBER,
-            description='Depth of the Phillips Bit')
-
-    bf_Allen_Bit_Depth = FloatProperty(attr='bf_Allen_Bit_Depth',
-            name='Bit Depth', default = 1.5,
-            min = 0, soft_min = 0,max = MAX_INPUT_NUMBER,
-            description='Depth of the Allen Bit')
-
-    bf_Allen_Bit_Flat_Distance = FloatProperty( attr='bf_Allen_Bit_Flat_Distance',
-            name='Flat Dist', default = 2.5,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Flat Distance of the Allen Bit')
-
-    bf_Hex_Head_Height = FloatProperty( attr='bf_Hex_Head_Height',
-            name='Head Height', default = 2,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Height of the Hex Head')
-
-    bf_Hex_Head_Flat_Distance = FloatProperty( attr='bf_Hex_Head_Flat_Distance',
-            name='Flat Dist', default = 5.5,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Flat Distance of the Hex Head')
-
-    bf_CounterSink_Head_Dia = FloatProperty( attr='bf_CounterSink_Head_Dia',
-            name='Head Dia', default = 5.5,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Diameter of the Counter Sink Head')
-
-    bf_Cap_Head_Height = FloatProperty( attr='bf_Cap_Head_Height',
-            name='Head Height', default = 5.5,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Height of the Cap Head')
-
-    bf_Cap_Head_Dia = FloatProperty( attr='bf_Cap_Head_Dia',
-            name='Head Dia', default = 3,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Diameter of the Cap Head')
-
-    bf_Dome_Head_Dia = FloatProperty( attr='bf_Dome_Head_Dia',
-            name='Dome Head Dia', default = 5.6,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
-            description='Length of the unthreaded shank')
-
-    bf_Pan_Head_Dia = FloatProperty( attr='bf_Pan_Head_Dia',
-            name='Pan Head Dia', default = 5.6,
-            min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
+            items=Nut_Type_List, default='bf_Nut_Hex'
+            )
+    # Shank Types
+    bf_Shank_Length = FloatProperty(
+            attr='bf_Shank_Length',
+            name='Shank Length', default=0,
+            min=0, soft_min=0, max=MAX_INPUT_NUMBER,
+            description='Length of the unthreaded shank'
+            )
+    bf_Shank_Dia = FloatProperty(
+            attr='bf_Shank_Dia',
+            name='Shank Dia', default=3,
+            min=0, soft_min=0,
+            max=MAX_INPUT_NUMBER,
+            description='Diameter of the shank'
+            )
+    bf_Phillips_Bit_Depth = FloatProperty(
+            attr='bf_Phillips_Bit_Depth',
+            name='Bit Depth', default=1.1431535482406616,
+            min=0, soft_min=0,
+            max=MAX_INPUT_NUMBER,
+            description='Depth of the Phillips Bit'
+            )
+    bf_Allen_Bit_Depth = FloatProperty(
+            attr='bf_Allen_Bit_Depth',
+            name='Bit Depth', default=1.5,
+            min=0, soft_min=0,
+            max=MAX_INPUT_NUMBER,
+            description='Depth of the Allen Bit'
+            )
+    bf_Allen_Bit_Flat_Distance = FloatProperty(
+            attr='bf_Allen_Bit_Flat_Distance',
+            name='Flat Dist', default=2.5,
+            min=0, soft_min=0,
+            max=MAX_INPUT_NUMBER,
+            description='Flat Distance of the Allen Bit'
+            )
+    bf_Hex_Head_Height = FloatProperty(
+            attr='bf_Hex_Head_Height',
+            name='Head Height', default=2,
+            min=0, soft_min=0, max=MAX_INPUT_NUMBER,
+            description='Height of the Hex Head'
+            )
+    bf_Hex_Head_Flat_Distance = FloatProperty(
+            attr='bf_Hex_Head_Flat_Distance',
+            name='Flat Dist', default=5.5,
+            min=0, soft_min=0,
+            max=MAX_INPUT_NUMBER,
+            description='Flat Distance of the Hex Head'
+            )
+    bf_CounterSink_Head_Dia = FloatProperty(
+            attr='bf_CounterSink_Head_Dia',
+            name='Head Dia', default=5.5,
+            min=0, soft_min=0,
+            max=MAX_INPUT_NUMBER,
+            description='Diameter of the Counter Sink Head'
+            )
+    bf_Cap_Head_Height = FloatProperty(
+            attr='bf_Cap_Head_Height',
+            name='Head Height', default=5.5,
+            min=0, soft_min=0,
+            max=MAX_INPUT_NUMBER,
+            description='Height of the Cap Head'
+           

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list