This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
__init__.py
64 lines (49 loc) · 1.85 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import bpy
import bpy_extras.io_utils
from bpy.types import Operator, AddonPreferences
from bpy.props import *
from bpy_extras.io_utils import ExportHelper, ImportHelper
from bpy.utils import register_class
from bpy.utils import unregister_class
bl_info = {
"name": "SEModel Support",
"author": "DTZxPorter",
"version": (0, 0, 4),
"blender": (2, 80, 0),
"location": "File > Import",
"description": "Import SEModel",
"wiki_url": "https://github.com/dtzxporter/io_model_semodel",
"tracker_url": "https://github.com/dtzxporter/io_model_semodel/issues",
"category": "Import-Export"
}
class ImportSEModel(bpy.types.Operator, ImportHelper):
bl_idname = "import_scene.semodel"
bl_label = "Import SEModel"
bl_description = "Import one or more SEModel files"
bl_options = {'PRESET'}
filename_ext = ".semodel"
filter_glob: StringProperty(default="*.semodel", options={'HIDDEN'})
files: CollectionProperty(type=bpy.types.PropertyGroup)
def execute(self, context):
from . import import_semodel
result = import_semodel.load(
self, context, **self.as_keywords(ignore=("filter_glob", "files")))
if result:
self.report({'INFO'}, 'SEModel has been loaded')
return {'FINISHED'}
else:
self.report({'ERROR'}, 'Failed to load SEModel')
return {'CANCELLED'}
@classmethod
def poll(self, context):
return True
def menu_func_semodel_import(self, context):
self.layout.operator(ImportSEModel.bl_idname, text="SEModel (.semodel)")
def register():
bpy.utils.register_class(ImportSEModel)
bpy.types.TOPBAR_MT_file_import.append(menu_func_semodel_import)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_semodel_import)
if __name__ == "__main__":
register()