[Bf-extensions-cvs] [4de32a8d] blender2.8: BoltFactory (0, 4, 0) Now works with Blender 2.8

Aaron Keith noreply at git.blender.org
Thu Dec 13 09:13:36 CET 2018


Commit: 4de32a8d7c1b494e9cfd93f87d97477a26d8a55e
Author: Aaron Keith
Date:   Thu Dec 13 21:12:46 2018 +1300
Branches: blender2.8
https://developer.blender.org/rBA4de32a8d7c1b494e9cfd93f87d97477a26d8a55e

BoltFactory (0,4,0)
Now works with Blender 2.8

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

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 25d90706..0b405f3c 100644
--- a/add_mesh_BoltFactory/Boltfactory.py
+++ b/add_mesh_BoltFactory/Boltfactory.py
@@ -330,3 +330,29 @@ class add_mesh_bolt(Operator, AddObjectHelper):
         self.execute(context)
 
         return {'FINISHED'}
+
+# Register:
+def menu_func_bolt(self, context):
+    self.layout.operator(
+        add_mesh_bolt.bl_idname,
+        text="Bolt",
+        icon="MOD_SCREW")
+
+classes = (
+    add_mesh_bolt,
+)
+
+		
+		
+def register():
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
+    bpy.types.VIEW3D_MT_mesh_add.append(menu_func_bolt)
+
+
+def unregister():
+    from bpy.utils import unregister_class
+    for cls in reversed(classes):
+        unregister_class(cls)
+    bpy.types.VIEW3D_MT_mesh_add.remove(menu_func_bolt)
\ No newline at end of file
diff --git a/add_mesh_BoltFactory/__init__.py b/add_mesh_BoltFactory/__init__.py
index d441a0e8..383ddc36 100644
--- a/add_mesh_BoltFactory/__init__.py
+++ b/add_mesh_BoltFactory/__init__.py
@@ -19,8 +19,8 @@
 bl_info = {
     "name": "BoltFactory",
     "author": "Aaron Keith",
-    "version": (0, 3, 4),
-    "blender": (2, 78, 0),
+    "version": (0, 4, 0),
+    "blender":  (2, 80, 0),
     "location": "View3D > Add > Mesh",
     "description": "Add a bolt or nut",
     "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
@@ -42,22 +42,15 @@ import bpy
 
 # ### REGISTER ###
 
-def add_mesh_bolt_button(self, context):
-    self.layout.operator(Boltfactory.add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
 
 
 def register():
-    bpy.utils.register_module(__name__)
-
-    bpy.types.VIEW3D_MT_mesh_add.append(add_mesh_bolt_button)
-    # bpy.types.VIEW3D_PT_tools_objectmode.prepend(add_mesh_bolt_button)  # just for testing
+	Boltfactory.register()
+   
 
 
 def unregister():
-    bpy.utils.unregister_module(__name__)
-
-    bpy.types.VIEW3D_MT_mesh_add.remove(add_mesh_bolt_button)
-    # bpy.types.VIEW3D_PT_tools_objectmode.remove(add_mesh_bolt_button)  # just for testing
+    Boltfactory.unregister()
 
 
 if __name__ == "__main__":
diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py
index c59c9939..71f22bf7 100644
--- a/add_mesh_BoltFactory/createMesh.py
+++ b/add_mesh_BoltFactory/createMesh.py
@@ -169,7 +169,7 @@ def Get_Phillips_Bit_Height(Bit_Dia):
 # Returns a list of verts rotated by the given matrix. Used by SpinDup
 def Rot_Mesh(verts, matrix):
     from mathutils import Vector
-    return [(matrix * Vector(v))[:] for v in verts]
+    return [(matrix @ Vector(v))[:] for v in verts]
 
 
 # Returns a list of faces that has there index incremented by offset



More information about the Bf-extensions-cvs mailing list