Archived
1
0
Fork 0

Support blender 2.93

This commit is contained in:
sup39 2022-02-01 20:29:10 +09:00
parent f7e03ce679
commit 015b169b9b

View file

@ -1,13 +1,15 @@
isReload = "bl_info" in locals()
bl_info = {
"name": "Export COL for Super Mario Sunshine",
"author": "Blank",
"version": (1, 0, 0),
"blender": (2, 71, 0),
"name": "Import/Export COL for Super Mario Sunshine",
"author": "Blank (modified by sup39)",
"version": (1, 0, 1),
"blender": (2, 93, 0),
"location": "File > Export > Collision (.col)",
"description": "This script allows you do export col files directly from blender. Based on Blank's obj2col",
"warning": "Runs update function every 0.2 seconds",
"category": "Import-Export"
}
import random
import bpy
import bmesh
@ -194,10 +196,9 @@ class ImportCOL(Operator, ExportHelper): #Operator that exports the collision mo
mesh = bpy.data.meshes.new("mesh") # add a new mesh
obj = bpy.data.objects.new("CollisionObj", mesh) # add a new object using the mesh
scene = bpy.context.scene
scene.objects.link(obj) # put the object into the scene (link)
scene.objects.active = obj # set as the active object in the scene
obj.select = True # select object
bpy.context.scene.collection.objects.link(obj) # put the object into the scene (link)
bpy.context.view_layer.objects.active = obj # set as the active object in the scene
obj.select_set(True) # select object
mesh = obj.data
bm = bmesh.new()
@ -352,8 +353,8 @@ def register():
for i in classes:
register_class(i)
bpy.types.Material.ColEditor = PointerProperty(type=CollisionProperties) #store in the scene
bpy.types.INFO_MT_file_export.append(menu_export) #Add to export menu
bpy.types.INFO_MT_file_import.append(menu_import) #Add to import menu
bpy.types.TOPBAR_MT_file_export.append(menu_export) #Add to export menu
bpy.types.TOPBAR_MT_file_import.append(menu_import) #Add to import menu
def menu_export(self, context):
@ -365,12 +366,20 @@ def menu_import(self, context):
def unregister():
for i in classes:
unregister_class(i)
bpy.types.INFO_MT_file_export.remove(menu_export)
bpy.types.INFO_MT_file_import.remove(menu_import)
bpy.types.TOPBAR_MT_file_export.remove(menu_export)
bpy.types.TOPBAR_MT_file_import.remove(menu_import)
# This allows you to run the script directly from blenders text editor
# to test the addon without having to install it.
if __name__ == "__main__":
register()
register()
else: # on add-on enabled
# try unregister first
if isReload:
try:
unregister()
except Exception:
import traceback
traceback.print_exc()
# call register to add option to menu
register()