[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2730] contrib/py/scripts/addons/ io_anim_nuke_chan: de-duplicate property, remove unused imports

Campbell Barton ideasman42 at gmail.com
Mon Dec 5 20:18:54 CET 2011


Revision: 2730
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2730
Author:   campbellbarton
Date:     2011-12-05 19:18:53 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
de-duplicate property, remove unused imports

Modified Paths:
--------------
    contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py
    contrib/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py
    contrib/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py

Modified: contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py	2011-12-05 19:14:02 UTC (rev 2729)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/__init__.py	2011-12-05 19:18:53 UTC (rev 2730)
@@ -43,13 +43,27 @@
 
 
 import bpy
+from bpy.types import Operator
 from bpy_extras.io_utils import ImportHelper, ExportHelper
 from bpy.props import (StringProperty,
                        BoolProperty,
                        EnumProperty)
 
+# property shared by both operators
+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')
 
-class ImportChan(bpy.types.Operator, ImportHelper):
+
+class ImportChan(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"
@@ -59,22 +73,11 @@
 
     filter_glob = StringProperty(default="*.chan", options={'HIDDEN'})
 
+    rot_ord = rot_ord
     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):
@@ -88,7 +91,7 @@
                                           self.rot_ord)
 
 
-class ExportChan(bpy.types.Operator, ExportHelper):
+class ExportChan(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"
@@ -100,20 +103,8 @@
             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')
+    rot_ord = rot_ord
 
-    settings = {"y_up": y_up, "rot_ord": rot_ord}
-
     @classmethod
     def poll(cls, context):
         return context.active_object is not None

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 19:14:02 UTC (rev 2729)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py	2011-12-05 19:18:53 UTC (rev 2730)
@@ -20,9 +20,8 @@
 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, Euler
-from math import radians, degrees, atan, atan2, tan
+from mathutils import Matrix
+from math import radians, degrees, atan2
 
 
 def save_chan(context, filepath, y_up, rot_ord):

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 19:14:02 UTC (rev 2729)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py	2011-12-05 19:18:53 UTC (rev 2730)
@@ -18,9 +18,8 @@
 
 """ This script is an importer for the nuke's .chan files"""
 
-import bpy
 from mathutils import Vector, Matrix, Euler
-from math import radians, degrees, atan, tan
+from math import radians, tan
 
 
 def read_chan(context, filepath, z_up, rot_ord):



More information about the Bf-extensions-cvs mailing list