[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2939] trunk/py/scripts/addons/ io_export_after_effects.py: 1. Fixed get_active_cam_for_each_frame(scene, start, end): Corrected checking markers.

Bartek Skorupa bartekskorupa at bartekskorupa.com
Mon Jan 23 16:57:57 CET 2012


Revision: 2939
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2939
Author:   bartekskorupa
Date:     2012-01-23 15:57:46 +0000 (Mon, 23 Jan 2012)
Log Message:
-----------
1. Fixed get_active_cam_for_each_frame(scene, start, end): Corrected checking markers.    2. Added displayStartTime on AE side to reflect exported range. It is just the way of displaying current tome in AE composition.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_export_after_effects.py

Modified: trunk/py/scripts/addons/io_export_after_effects.py
===================================================================
--- trunk/py/scripts/addons/io_export_after_effects.py	2012-01-23 14:45:13 UTC (rev 2938)
+++ trunk/py/scripts/addons/io_export_after_effects.py	2012-01-23 15:57:46 UTC (rev 2939)
@@ -76,18 +76,17 @@
                 sorted_markers.append([marker.frame, marker])
         sorted_markers = sorted(sorted_markers)
 
-        for i, marker in enumerate(sorted_markers):
-            cam = marker[1].camera
-            if i is 0 and marker[0] > start:
-                start_range = start
-            else:
-                start_range = sorted_markers[i][0]
-            if len(sorted_markers) > i + 1:
-                end_range = sorted_markers[i + 1][0] - 1
-            else:
-                end_range = end
-            for i in range(start_range, end_range + 1):
-                active_cam_frames.append(cam)
+        if sorted_markers:
+            for frame in range(start, end + 1):
+                for m, marker in enumerate(sorted_markers):
+                    if marker[0] > frame:
+                        if m != 0:
+                            active_cam_frames.append(sorted_markers[m - 1][1].camera)
+                        else:
+                            active_cam_frames.append(marker[1].camera)
+                        break
+                    elif m == len(sorted_markers) - 1:
+                        active_cam_frames.append(marker[1].camera)
     if not active_cam_frames:
         if scene.camera:
             # in this case active_cam_frames array will have legth of 1. This will indicate that there is only one active cam in all frames
@@ -459,10 +458,11 @@
     # wrap in function
     jsx_file.write("function compFromBlender(){\n")
     # create new comp
-    jsx_file.write('\nvar compName = prompt("Blender Comp\'s Name \\nEnter Name of newly created Composition","BlendComp","Composition\'s Name");')
+    jsx_file.write('\nvar compName = prompt("Blender Comp\'s Name \\nEnter Name of newly created Composition","BlendComp","Composition\'s Name");\n')
     jsx_file.write('if (compName){')
-    jsx_file.write('\nvar newComp = app.project.items.addComp(compName, %i, %i, %f, %f, %i);\n\n\n' %
+    jsx_file.write('\nvar newComp = app.project.items.addComp(compName, %i, %i, %f, %f, %i);' %
                    (data['width'], data['height'], data['aspect'], data['duration'], data['fps']))
+    jsx_file.write('\nnewComp.displayStartTime = %f;\n\n\n' % ((data['start'] + 1.0) / data['fps']))
 
     # create camera bundles (nulls)
     jsx_file.write('// **************  CAMERA 3D MARKERS  **************\n\n\n')
@@ -621,4 +621,4 @@
     bpy.types.INFO_MT_file_export.remove(menu_func)
 
 if __name__ == "__main__":
-    register()
+    register()
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list