[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2729] contrib/py/scripts/addons/ io_anim_nuke_chan: comment formatting

Campbell Barton ideasman42 at gmail.com
Mon Dec 5 20:14:02 CET 2011


Revision: 2729
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2729
Author:   campbellbarton
Date:     2011-12-05 19:14:02 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
comment formatting

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

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:09:05 UTC (rev 2728)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py	2011-12-05 19:14:02 UTC (rev 2729)
@@ -27,71 +27,71 @@
 
 def save_chan(context, filepath, y_up, rot_ord):
 
-    #get the active scene and object
+    # get the active scene and object
     scene = context.scene
     obj = context.active_object
 
-    #get the range of an animation
+    # get the range of an animation
     f_start = scene.frame_start
     f_end = scene.frame_end
 
-    #get the resolution (needed by nuke)
+    # get the resolution (needed by nuke)
     res_x = scene.render.resolution_x
     res_y = scene.render.resolution_y
     res_ratio = res_y / res_x
 
-    #prepare the correcting matrix
+    # prepare the correcting matrix
     rot_mat = Matrix.Rotation(radians(-90.0), 4, 'X').to_4x4()
 
     filehandle = open(filepath, 'w')
     fw = filehandle.write
 
-    #iterate the frames
+    # iterate the frames
     for frame in range(f_start, f_end, 1):
 
-        #set the current frame
+        # set the current frame
         scene.frame_set(frame)
 
-        #get the objects world matrix
+        # get the objects world matrix
         mat = obj.matrix_world.copy()
 
-        #if the setting is proper use the rotation matrix
-        #to flip the Z and Y axis
+        # if the setting is proper use the rotation matrix
+        # to flip the Z and Y axis
         if y_up:
             mat = rot_mat * mat
 
-        #create the first component of a new line, the frame number
+        # create the first component of a new line, the frame number
         fw("%i\t" % frame)
 
-        #create transform component
+        # create transform component
         t = mat.to_translation()
         fw("%f\t%f\t%f\t" % t[:])
 
-        #create rotation component
+        # create rotation component
         r = mat.to_euler(rot_ord)
 
         fw("%f\t%f\t%f\t" % (degrees(r[0]), degrees(r[1]), degrees(r[2])))
 
-        #if we have a camera, add the focal length
+        # if we have a camera, add the focal length
         if obj.type == 'CAMERA':
-            #I've found via the experiments that this is a blenders 
-            #default sensor size (in mm)
+            # I've found via the experiments that this is a blenders 
+            # default sensor size (in mm)
             sensor_x = 32.0
-            #the vertical sensor size we get by multiplying the sensor_x by
-            #resolution ratio
+            # the vertical sensor size we get by multiplying the sensor_x by
+            # resolution ratio
             sensor_y = sensor_x * res_ratio
             cam_lens = obj.data.lens
-            #calculate the vertical field of view
-            #we know the vertical size of (virtual) sensor, the focal length
-            #of the camera so all we need to do is to feed this data to
-            #atan2 function whitch returns the degree (in radians) of 
-            #an angle formed by a triangle with two legs of a given lengths
+            # calculate the vertical field of view
+            # we know the vertical size of (virtual) sensor, the focal length
+            # of the camera so all we need to do is to feed this data to
+            # atan2 function whitch returns the degree (in radians) of 
+            # an angle formed by a triangle with two legs of a given lengths
             vfov = degrees(atan2(sensor_y / 2, cam_lens))*2
             fw("%f" % vfov)
 
         fw("\n")
 
-    #after the whole loop close the file
+    # after the whole loop close the file
     filehandle.close()
 
     return {'FINISHED'}

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:09:05 UTC (rev 2728)
+++ contrib/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py	2011-12-05 19:14:02 UTC (rev 2729)
@@ -25,48 +25,48 @@
 
 def read_chan(context, filepath, z_up, rot_ord):
 
-    #get the active object
+    # get the active object
     scene = context.scene
     obj = context.active_object
 
-    #get the resolution (needed to calculate the camera lens)
+    # get the resolution (needed to calculate the camera lens)
     res_x = scene.render.resolution_x
     res_y = scene.render.resolution_y
     res_ratio = res_y / res_x
 
-    #prepare the correcting matrix
+    # prepare the correcting matrix
     rot_mat = Matrix.Rotation(radians(90.0), 4, 'X').to_4x4()
 
-    #read the file
+    # read the file
     filehandle = open(filepath, 'r')
 
-    #iterate throug the files lines
+    # iterate throug the files lines
     for line in filehandle:
-        #reset the target objects matrix
-        #(the one from whitch one we'll extract the final transforms)
+        # reset the target objects matrix
+        # (the one from whitch one we'll extract the final transforms)
         m_trans_mat = Matrix()
 
-        #strip the line
+        # strip the line
         data = line.split()
 
-        #test if the line is not commented out
+        # test if the line is not commented out
         if data and not data[0].startswith("#"):
 
-            #set the frame number basing on the chan file
+            # set the frame number basing on the chan file
             scene.frame_set(int(data[0]))
 
-            #read the translation values from the first three columns of line
+            # read the translation values from the first three columns of line
             v_transl = Vector((float(data[1]),
                                float(data[2]),
                                float(data[3])))
             translation_mat = Matrix.Translation(v_transl)
             translation_mat.to_4x4()
 
-            #read the rotations, and set the rotation order basing on the order
-            #set during the export (it's not being saved in the chan file
-            #you have to keep it noted somewhere
-            #the actual objects rotation order doesn't matter since the
-            #rotations are being extracted from the matrix afterwards
+            # read the rotations, and set the rotation order basing on the order
+            # set during the export (it's not being saved in the chan file
+            # you have to keep it noted somewhere
+            # the actual objects rotation order doesn't matter since the
+            # rotations are being extracted from the matrix afterwards
             e_rot = Euler((radians(float(data[4])),
                            radians(float(data[5])),
                            radians(float(data[6]))))
@@ -74,23 +74,23 @@
             mrot_mat = e_rot.to_matrix()
             mrot_mat.resize_4x4()
 
-            #merge the rotation and translation
+            # merge the rotation and translation
             m_trans_mat = translation_mat * mrot_mat
 
-            #correct the world space
-            #(nuke's and blenders scene spaces are different)
+            # correct the world space
+            # (nuke's and blenders scene spaces are different)
             if z_up:
                 m_trans_mat = rot_mat * m_trans_mat
 
-            #break the matrix into a set of the coordinates
+            # break the matrix into a set of the coordinates
             trns = m_trans_mat.decompose()
 
-            #set the location and the location's keyframe
+            # set the location and the location's keyframe
             obj.location = trns[0]
             obj.keyframe_insert("location")
 
-            #convert the rotation to euler angles (or not)
-            #basing on the objects rotation mode
+            # convert the rotation to euler angles (or not)
+            # basing on the objects rotation mode
             if obj.rotation_mode == 'QUATERNION':
                 obj.rotation_quaternion = trns[1]
                 obj.keyframe_insert("rotation_quaternion")
@@ -104,7 +104,7 @@
                 obj.keyframe_insert("rotation_euler")
 
 
-            #check if the object is camera and fov data is present
+            # check if the object is camera and fov data is present
             if obj.type == 'CAMERA' and len(data) > 7:
                 v_fov = float(data[7])
                 sensor_v = 32.0



More information about the Bf-extensions-cvs mailing list