BoltFactory (0,4,0)

Now works with Blender 2.8
This commit is contained in:
Aaron Keith 2018-12-13 21:12:46 +13:00
parent e4f4053de6
commit 4de32a8d7c
3 changed files with 32 additions and 13 deletions

View File

@ -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)

View File

@ -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__":

View File

@ -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