forked from JonnylikesJazz/Wadblender-Anim-Tool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport_anim.py
More file actions
67 lines (46 loc) · 1.85 KB
/
export_anim.py
File metadata and controls
67 lines (46 loc) · 1.85 KB
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
import bpy
from .anim import export_anim
def export(context, filepath, offset, rig_name):
export_anim(filepath, offset, rig_name)
return {'FINISHED'}
# ExportHelper is a helper class, defines filename and
# invoke() function which calls the file selector.
from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty, IntProperty
from bpy.types import Operator
class ExportSomeData(Operator, ExportHelper):
"""This appears in the tooltip of the operator and in the generated docs"""
bl_idname = "export_anim.data"
bl_label = "Export Wad Tool Animation"
# ExportHelper mixin class uses this
filename_ext = ".anim"
filter_glob: StringProperty(
default="*.anim",
options={'HIDDEN'},
maxlen=255, # Max internal buffer length, longer would be clamped.
)
rig_name: StringProperty(
default="LARA_RIG",
description="RIG name of the active action to export",
maxlen=255, # Max internal buffer length, longer would be clamped.
)
offset: IntProperty(
name="Offset",
description="Rise Lara by amount",
default=0
)
def execute(self, context):
return export(context, self.filepath, self.offset, self.rig_name)
# Only needed if you want to add into a dynamic menu
def menu_func_export(self, context):
self.layout.operator(ExportSomeData.bl_idname, text="Export Wad Tool Animation")
def register():
bpy.utils.register_class(ExportSomeData)
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
def unregister():
bpy.utils.unregister_class(ExportSomeData)
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
if __name__ == "__main__":
register()
# test call
bpy.ops.export_anim.data('INVOKE_DEFAULT')