1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
22 "name": "Nuke Animation Format (.chan)",
23 "author": "Michael Krupa",
25 "blender": (2, 61, 0),
26 "location": "File > Import/Export > Nuke (.chan)",
27 "description": "Import/Export object's animation with nuke",
29 "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
30 "Scripts/Import-Export/Nuke",
31 "tracker_url": "http://projects.blender.org/tracker/?"
32 "func=detail&atid=467&aid=28368&group_id=153",
33 "category": "Import-Export"}
36 # To support reload properly, try to access a package var,
37 # if it's there, reload everything
40 if "import_nuke_chan" in locals():
41 imp
.reload(import_nuke_chan
)
42 if "export_nuke_chan" in locals():
43 imp
.reload(export_nuke_chan
)
47 from bpy
.types
import Operator
48 from bpy_extras
.io_utils
import ImportHelper
, ExportHelper
49 from bpy
.props
import (StringProperty
,
54 # property shared by both operators
55 rotation_order
= EnumProperty(
56 name
="Rotation order",
57 description
="Choose the export rotation order",
58 items
=(('XYZ', "XYZ", "XYZ"),
59 ('XZY', "XZY", "XZY"),
60 ('YXZ', "YXZ", "YXZ"),
61 ('YZX', "YZX", "YZX"),
62 ('ZXY', "ZXY", "ZXY"),
63 ('ZYX', "ZYX", "ZYX"),
68 class ImportChan(Operator
, ImportHelper
):
69 """Import animation from .chan file, exported from nuke or houdini """ \
70 """(the importer uses frame numbers from the file)"""
71 bl_idname
= "import_scene.import_chan"
72 bl_label
= "Import chan file"
74 filename_ext
= ".chan"
76 filter_glob
= StringProperty(default
="*.chan", options
={'HIDDEN'})
78 rotation_order
= rotation_order
81 description
="Switch the Y and Z axis",
84 sensor_width
= FloatProperty(
85 name
="Camera sensor width",
86 description
="Imported camera sensor width",
89 sensor_height
= FloatProperty(
90 name
="Camera sensor height",
91 description
="Imported camera sensor height",
95 def poll(cls
, context
):
96 return context
.active_object
is not None
98 def execute(self
, context
):
99 from . import import_nuke_chan
100 return import_nuke_chan
.read_chan(context
,
108 class ExportChan(Operator
, ExportHelper
):
109 """Export the animation to .chan file, readable by nuke and houdini """ \
110 """(the exporter uses frames from the frames range)"""
111 bl_idname
= "export.export_chan"
112 bl_label
= "Export chan file"
114 filename_ext
= ".chan"
115 filter_glob
= StringProperty(default
="*.chan", options
={'HIDDEN'})
118 description
="Switch the Y and Z axis",
120 rotation_order
= rotation_order
123 def poll(cls
, context
):
124 return context
.active_object
is not None
126 def execute(self
, context
):
127 from . import export_nuke_chan
128 return export_nuke_chan
.save_chan(context
,
134 def menu_func_import(self
, context
):
135 self
.layout
.operator(ImportChan
.bl_idname
, text
="Nuke (.chan)")
138 def menu_func_export(self
, context
):
139 self
.layout
.operator(ExportChan
.bl_idname
, text
="Nuke (.chan)")
143 bpy
.utils
.register_class(ImportChan
)
144 bpy
.utils
.register_class(ExportChan
)
145 bpy
.types
.INFO_MT_file_import
.append(menu_func_import
)
146 bpy
.types
.INFO_MT_file_export
.append(menu_func_export
)
150 bpy
.utils
.unregister_class(ImportChan
)
151 bpy
.utils
.unregister_class(ExportChan
)
152 bpy
.types
.INFO_MT_file_import
.remove(menu_func_import
)
153 bpy
.types
.INFO_MT_file_export
.remove(menu_func_export
)
156 if __name__
== "__main__":