-
Notifications
You must be signed in to change notification settings - Fork 29
/
__init__.py
88 lines (69 loc) · 2.26 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
bl_info = {
"name" : "GTA V Model importer",
"author" : "Lendo Keilbaum",
"description" : "Import GTA V models (.mesh)",
"location": "File > Import",
"blender" : (2, 80, 0),
"version" : (0, 0, 1),
"location" : "",
"warning" : "",
"category" : "Import"
}
if "bpy" in locals():
import importlib
if "import_mesh" in locals():
importlib.reload(import_mesh)
else:
from . import import_mesh
import bpy
from bpy.props import (
BoolProperty,
EnumProperty,
FloatProperty,
StringProperty,
)
from bpy_extras.io_utils import (
ImportHelper,
ExportHelper,
axis_conversion,
)
class ImportGTA(bpy.types.Operator, ImportHelper):
bl_idname = "import_scene.gta"
bl_label = 'Import mesh'
bl_options = {'UNDO'}
filename_ext = ".mesh"
filter_glob: StringProperty(
default="*.mesh",
options={'HIDDEN'}
)
import_armature: BoolProperty(
name="import armature",
description="Import Armatures if existing",
default=True,
)
def execute(self, context):
keywords = self.as_keywords()
return import_mesh.load(self, context, **keywords)
# Add to a menu
def menu_func_import(self, context):
self.layout.operator(ImportGTA.bl_idname, text="GTA V Model (.mesh)")
def register():
bpy.utils.register_class(ImportGTA)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
def unregister():
bpy.utils.unregister_class(ImportGTA)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
if __name__ == "__main__":
register()