[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13483] trunk/blender/release/scripts/ bpymodules/blend2renderinfo.py: some mistakes, also forgot to mention, this script can run from the command line and will print out the star, end, scene

Campbell Barton ideasman42 at gmail.com
Wed Jan 30 17:25:50 CET 2008


Revision: 13483
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13483
Author:   campbellbarton
Date:     2008-01-30 17:25:50 +0100 (Wed, 30 Jan 2008)

Log Message:
-----------
some mistakes, also forgot to mention, this script can run from the command line and will print out the star,end,scene
otherwise if its imported it will just have the function read_blend_rend_chunk(path) which returns a list of [(start,end,scene),...]

Modified Paths:
--------------
    trunk/blender/release/scripts/bpymodules/blend2renderinfo.py

Modified: trunk/blender/release/scripts/bpymodules/blend2renderinfo.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/blend2renderinfo.py	2008-01-30 16:16:38 UTC (rev 13482)
+++ trunk/blender/release/scripts/bpymodules/blend2renderinfo.py	2008-01-30 16:25:50 UTC (rev 13483)
@@ -20,7 +20,7 @@
 # ***** END GPL LICENCE BLOCK *****
 # --------------------------------------------------------------------------
 
-import sys, struct
+import struct
 
 # In Blender, selecting scenes in the databrowser (shift+f4) will tag for rendering.
 
@@ -39,7 +39,7 @@
 	file = open(path, 'rb')
 	
 	if file.read(len('BLENDER')) != 'BLENDER':
-		return
+		return []
 	
 	# 
 	if file.read(1) == '-':
@@ -56,6 +56,8 @@
 	# Now read the bhead chunk!!!
 	file.read(3) # skip the version
 	
+	scenes = []
+	
 	while file.read(4) == 'REND':
 	
 		if is64bit:		sizeof_bhead = sizeof_bhead_left = 24 # 64bit
@@ -69,10 +71,9 @@
 		sizeof_bhead_left -= 4
 		
 		# We dont care about the rest of the bhead struct
-		sizeof_bhead_left, file.read(sizeof_bhead_left)
+		file.read(sizeof_bhead_left)
 		
 		# Now we want the scene name, start and end frame. this is 32bites long
-		#file.read(sizeof_bhead_left)
 		
 		if isBigEndian:	start_frame, end_frame = struct.unpack('>2i', file.read(8))
 		else:			start_frame, end_frame = struct.unpack('<2i', file.read(8))
@@ -80,9 +81,11 @@
 		scene_name = file.read(24)
 		scene_name = scene_name[ : scene_name.index('\0') ]
 		
-		return start_frame, end_frame, scene_name
+		scenes.append( (start_frame, end_frame, scene_name) )
+	return scenes
 
 def main():
+	import sys
 	for arg in sys.argv[1:]:
 		if arg.lower().endswith('.blend'):
 			print read_blend_rend_chunk(arg)





More information about the Bf-blender-cvs mailing list