[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2727] contrib/py/scripts/addons/ io_anim_nuke_chan: addon working again.
Campbell Barton
ideasman42 at gmail.com
Mon Dec 5 19:31:07 CET 2011
Revision: 2727
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2727
Author: campbellbarton
Date: 2011-12-05 18:31:02 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
addon working again.
Modified Paths:
--------------
contrib/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py
contrib/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py
Added Paths:
-----------
contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py
Added: contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py (rev 0)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py 2011-12-05 18:31:02 UTC (rev 2727)
@@ -0,0 +1,152 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# 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 2
+# 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
+# MERCHANTABILITY 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, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+bl_info = {
+ "name": "Nuke Animation Format (.chan)",
+ "author": "Michael Krupa",
+ "version": (1, 0),
+ "blender": (2, 6, 0),
+ "api": 36079,
+ "location": "File > Import/Export > Nuke (.chan)",
+ "description": "Import/Export object's animation with nuke",
+ "warning": "",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+ "Scripts/Import-Export/Nuke",
+ "tracker_url": "http://projects.blender.org/tracker/?"
+ "func=detail&atid=467&aid=28368&group_id=153",
+ "category": "Import-Export"}
+
+
+# To support reload properly, try to access a package var,
+# if it's there, reload everything
+if "bpy" in locals():
+ import imp
+ if "import_nuke_chan" in locals():
+ imp.reload(import_nuke_chan)
+ if "export_nuke_chan" in locals():
+ imp.reload(export_nuke_chan)
+
+
+import bpy
+from bpy_extras.io_utils import ImportHelper, ExportHelper
+from bpy.props import (StringProperty,
+ BoolProperty,
+ EnumProperty)
+
+
+class ImportChan(bpy.types.Operator, ImportHelper):
+ '''Import animation from .chan file, exported from nuke or houdini. ''' \
+ '''The importer uses frame numbers from the file'''
+ bl_idname = "import_scene.import_chan"
+ bl_label = "Import chan file"
+
+ filename_ext = ".chan"
+
+ filter_glob = StringProperty(default="*.chan", options={'HIDDEN'})
+
+ z_up = BoolProperty(
+ name="Make Z up",
+ description="Switch the Y and Z axis",
+ default=True)
+ rot_ord = EnumProperty(
+ name="Rotation order",
+ description="Choose the rotation order with whitch "
+ "the chan file has been exported",
+ items=(('XYZ', "XYZ", "XYZ"),
+ ('XZY', "XZY", "XZY"),
+ ('YXZ', "YXZ", "YXZ"),
+ ('YZX', "YZX", "YZX"),
+ ('ZXY', "ZXY", "ZXY"),
+ ('ZYX', "ZYX", "ZYX"),
+ ),
+ default='XYZ')
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object is not None
+
+ def execute(self, context):
+ from . import import_nuke_chan
+ return import_nuke_chan.read_chan(context,
+ self.filepath,
+ self.z_up,
+ self.rot_ord)
+
+
+class ExportChan(bpy.types.Operator, ExportHelper):
+ '''Export the animation to .chan file, readable by nuke and houdini. ''' \
+ '''The exporter uses frames from the frames range'''
+ bl_idname = "export.export_chan"
+ bl_label = "Export chan file"
+
+ filename_ext = ".chan"
+ filter_glob = StringProperty(default="*.chan", options={'HIDDEN'})
+ y_up = BoolProperty(
+ name="Make Y up",
+ description="Switch the Y and Z axis",
+ default=True)
+ rot_ord = EnumProperty(
+ name="Rotation order",
+ description="Choose the export rotation order",
+ items=(('XYZ', "XYZ", "XYZ"),
+ ('XZY', "XZY", "XZY"),
+ ('YXZ', "YXZ", "YXZ"),
+ ('YZX', "YZX", "YZX"),
+ ('ZXY', "ZXY", "ZXY"),
+ ('ZYX', "ZYX", "ZYX"),
+ ),
+ default='XYZ')
+
+ settings = {"y_up": y_up, "rot_ord": rot_ord}
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object is not None
+
+ def execute(self, context):
+ from . import export_nuke_chan
+ return export_nuke_chan.save_chan(context,
+ self.filepath,
+ self.y_up,
+ self.rot_ord)
+
+
+def menu_func_import(self, context):
+ self.layout.operator(ImportChan.bl_idname, text="Nuke (.chan)")
+
+
+def menu_func_export(self, context):
+ self.layout.operator(ExportChan.bl_idname, text="Nuke (.chan)")
+
+
+def register():
+ bpy.utils.register_class(ImportChan)
+ bpy.utils.register_class(ExportChan)
+ bpy.types.INFO_MT_file_import.append(menu_func_import)
+ bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+
+def unregister():
+ bpy.utils.unregister_class(ImportChan)
+ bpy.utils.unregister_class(ExportChan)
+ bpy.types.INFO_MT_file_import.remove(menu_func_import)
+ bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
+
+if __name__ == "__main__":
+ register()
Modified: contrib/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py
===================================================================
--- contrib/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py 2011-12-05 18:06:49 UTC (rev 2726)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py 2011-12-05 18:31:02 UTC (rev 2727)
@@ -15,33 +15,14 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
-bl_info = {
- "name": "Export animation to nuke (.chan)",
- "author": "Michael Krupa",
- "version": (1, 0),
- "blender": (2, 6, 0),
- "api": 36079,
- "location": "File > Export > Nuke (.chan)",
- "description": "Export object's animation to nuke",
- "warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Import-Export/Nuke",
- "tracker_url": "http://projects.blender.org/tracker/?"\
- "func=detail&atid=467&aid=28368&group_id=153",
- "category": "Import-Export"}
""" This script is an exporter to the nuke's .chan files.
It takes the currently active object and writes it's transformation data
into a text file with .chan extension."""
import bpy
-from mathutils import Matrix
-from mathutils import Euler
-from math import radians
-from math import degrees
-from math import atan
-from math import atan2
-from math import tan
+from mathutils import Matrix, Euler
+from math import radians, degrees, atan, atan2, tan
def save_chan(context, filepath, y_up, rot_ord):
@@ -120,55 +101,3 @@
f.close()
return {'FINISHED'}
-
-
-from bpy_extras.io_utils import ExportHelper
-from bpy.props import StringProperty, BoolProperty, EnumProperty
-
-
-class ExportChan(bpy.types.Operator, ExportHelper):
- '''Export the animation to .chan file, readable by nuke and houdini.
- The exporter uses frames from the frames range'''
- bl_idname = "export.export_chan"
- bl_label = "Export chan file"
- filename_ext = ".chan"
- filter_glob = StringProperty(default="*.chan", options={'HIDDEN'})
- y_up = BoolProperty(name="Make Y up",
- description="Switch the Y and Z axis",
- default=True)
- rot_ord = EnumProperty(items=(('XYZ', "XYZ", "XYZ"),
- ('XZY', "XZY", "XZY"),
- ('YXZ', "YXZ", "YXZ"),
- ('YZX', "YZX", "YZX"),
- ('ZXY', "ZXY", "ZXY"),
- ('ZYX', "ZYX", "ZYX"),
- ),
- name="Rotation order",
- description="Choose the export rotation order",
- default='XYZ')
- settings = {"y_up": y_up, "rot_ord": rot_ord}
-
- @classmethod
- def poll(cls, context):
- return context.active_object != None
-
- def execute(self, context):
- return save_chan(context, self.filepath, self.y_up, self.rot_ord)
-
-
-def menu_func_export(self, context):
- self.layout.operator(ExportChan.bl_idname, text="Nuke (.chan)")
-
-
-def register():
- bpy.utils.register_class(ExportChan)
- bpy.types.INFO_MT_file_export.append(menu_func_export)
-
-
-def unregister():
- bpy.utils.unregister_class(ExportChan)
- bpy.types.INFO_MT_file_export.remove(menu_func_export)
-
-
-if __name__ == "__main__":
- register()
Modified: contrib/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py
===================================================================
--- contrib/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py 2011-12-05 18:06:49 UTC (rev 2726)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py 2011-12-05 18:31:02 UTC (rev 2727)
@@ -15,31 +15,12 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
-bl_info = {
- "name": "Import animation from chan file (.chan)",
- "author": "Michael Krupa",
- "version": (1, 0),
- "blender": (2, 6, 0),
- "api": 36079,
- "location": "File > Import > Nuke (.chan)",
- "description": "Import object's animation from nuke",
- "warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Import-Export/Nuke",
- "tracker_url": "http://projects.blender.org/tracker/index.php?"\
- "func=detail&atid=467&aid=28368&group_id=153",
- "category": "Import-Export"}
""" This script is an importer for the nuke's .chan files"""
import bpy
-from mathutils import Matrix
-from mathutils import Euler
-from mathutils import Vector
-from math import radians
-from math import degrees
-from math import atan
-from math import tan
+from mathutils import Vector, Matrix, Euler
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list