1 # SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 "name": "Nuke Animation Format (.chan)",
7 "author": "Michael Krupa",
10 "location": "File > Import/Export > Nuke (.chan)",
11 "description": "Import/Export object's animation with nuke",
13 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/anim_nuke_chan.html",
14 "category": "Import-Export",
18 # To support reload properly, try to access a package var,
19 # if it's there, reload everything
22 if "import_nuke_chan" in locals():
23 importlib
.reload(import_nuke_chan
)
24 if "export_nuke_chan" in locals():
25 importlib
.reload(export_nuke_chan
)
29 from bpy
.types
import Operator
30 from bpy_extras
.io_utils
import ImportHelper
, ExportHelper
31 from bpy
.props
import (
38 # property shared by both operators
39 rotation_order
= EnumProperty(
40 name
="Rotation order",
41 description
="Choose the export rotation order",
42 items
=(('XYZ', "XYZ", "XYZ"),
43 ('XZY', "XZY", "XZY"),
44 ('YXZ', "YXZ", "YXZ"),
45 ('YZX', "YZX", "YZX"),
46 ('ZXY', "ZXY", "ZXY"),
47 ('ZYX', "ZYX", "ZYX"),
52 class ImportChan(Operator
, ImportHelper
):
53 """Import animation from .chan file, exported from nuke or houdini """ \
54 """(the importer uses frame numbers from the file)"""
55 bl_idname
= "import_scene.import_chan"
56 bl_label
= "Import chan file"
58 filename_ext
= ".chan"
60 filter_glob
: StringProperty(default
="*.chan", options
={'HIDDEN'})
62 rotation_order
: rotation_order
65 description
="Switch the Y and Z axis",
68 sensor_width
: FloatProperty(
69 name
="Camera sensor width",
70 description
="Imported camera sensor width",
73 sensor_height
: FloatProperty(
74 name
="Camera sensor height",
75 description
="Imported camera sensor height",
79 def poll(cls
, context
):
80 return context
.active_object
is not None
82 def execute(self
, context
):
83 from . import import_nuke_chan
84 return import_nuke_chan
.read_chan(context
,
92 class ExportChan(Operator
, ExportHelper
):
93 """Export the animation to .chan file, readable by nuke and houdini """ \
94 """(the exporter uses frames from the frames range)"""
95 bl_idname
= "export.export_chan"
96 bl_label
= "Export chan file"
98 filename_ext
= ".chan"
99 filter_glob
: StringProperty(default
="*.chan", options
={'HIDDEN'})
102 description
="Switch the Y and Z axis",
104 rotation_order
: rotation_order
107 def poll(cls
, context
):
108 return context
.active_object
is not None
110 def execute(self
, context
):
111 from . import export_nuke_chan
112 return export_nuke_chan
.save_chan(context
,
118 def menu_func_import(self
, context
):
119 self
.layout
.operator(ImportChan
.bl_idname
, text
="Nuke (.chan)")
122 def menu_func_export(self
, context
):
123 self
.layout
.operator(ExportChan
.bl_idname
, text
="Nuke (.chan)")
127 bpy
.utils
.register_class(ImportChan
)
128 bpy
.utils
.register_class(ExportChan
)
129 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import
)
130 bpy
.types
.TOPBAR_MT_file_export
.append(menu_func_export
)
134 bpy
.utils
.unregister_class(ImportChan
)
135 bpy
.utils
.unregister_class(ExportChan
)
136 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import
)
137 bpy
.types
.TOPBAR_MT_file_export
.remove(menu_func_export
)
140 if __name__
== "__main__":