提供: wiki
移動先: 案内検索
Import/export *.chan animation file
UI location Group: Import-Export
Usage Select an object and simply select the file->export->Nuke(.chan) option.
Version 1.0 Author(s) Michal Krupa
Blender 2.61 License GPL

Executable information
File name io_export_chan.py
Current version download https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/io_anim_nuke_chan/

Links http://projects.blender.org/tracker/?func=detail&atid=467&aid=28368&group_id=153


The *.chan format is used to store camera animation, including location, rotation and optionally field of view.

This addon can import and export chan files using the active object's animation.

Chan file is an ASCII file with parameter values saved in columns, one column per parameter, one line per frame i.e.

1 -0.703427 0.747595 -0.791473 -48.4942 161.026 6.02732 57.840534711
2 -0.681864 0.744656 -0.785405 -48.4888 161.043 6.06889 57.840534711
3 -0.660483 0.74154 -0.779456 -48.4442 161.095 6.06769 57.840534711
4 -0.639921 0.738876 -0.77333 -48.427 161.186 6.04798 57.840534711
5 -0.619503 0.735973 -0.767138 -48.3956 161.284 6.02043 57.840534711
6 -0.599471 0.733561 -0.760774 -48.3782 161.397 5.98574 57.840534711
7 -0.579693 0.731829 -0.754117 -48.3946 161.496 5.96938 57.840534711
8 -0.560836 0.730369 -0.747382 -48.422 161.661 5.90704 57.840534711
9 -0.54107 0.728683 -0.740694 -48.4238 161.742 5.89686 57.840534711

The properties saved and read by this script are: frame location.x location.y location.z rotation_euler.x rotation_euler.y rotation_euler.z angle_y

The file format itself is as simple as can be, but its simplicity is its greatest advantage. It's being used by softwares like Nuke and Houdini, and since it is so simple then writing an import or export tools for it softwares is fast and easy.

"angle_y" stands for vertical field of view. Used for calculation of a camera lens, only applies to the camera animations, while importing/exporting object animation this parameter is skipped.


The script gets the currently active object (works in object mode only) and saves/loads its transformations from or to the simple ASCII file, trough the whole animation range (set either on timeline or in the render settings). All you need to do is to select an object and run the script in file->export->Nuke(*.chan) (to export animation) or file->import->Nuke(*.chan) (to import animation).

One thing to be remembered. Chan saves only the raw property values (rotation_x, rotation_y, rotation_z etc.), so you have to mind the rotation order. In other words - the rotation orders during export and import must be the same (both are being set in the file selector while importing/exporting).

Another thing is the camera sensor size and its influence on camera lens. Since 2.61 you can manipulate the sensor size so you can fit a real life cameras (default in blender is 32x18), the best practice in this case is using horizontal fit for camera (Nuke is using it as a default). While importing the camera from *.chan file you have to remember to set the same sensor size as you've had in Nuke (or other software that this camera has been exported).

Blender3D FreeTip.png
File names
It's good to save the chan files with it's rotations order and sensor size stored in a file name (i.e. "camera_for_shot_ZXY_36x24.chan") so you don't have to look for those values in some long forgotten files.

Blender3D FreeTip.png
Exporting geometry to other softwares
If you want to export the objects movement to other softwares via the obj format, you have to save it with the Z-up, Y-forward setting. After loading it to the other software it'll be rotated 90 degrees, but when you apply the chan file it'll jump into its place.