Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-13 00:16:53 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-13 00:16:53 +0300
commitbdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch)
treed00eb50b749cb001e2b08272c91791e66740b05d /release/scripts/bpymodules/blend2renderinfo.py
parent78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff)
parent7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff)
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416 Issues: * GHOST/X11 had conflicting changes. Some code was added in 2.5, which was later added in trunk also, but reverted partially, specifically revision 16683. I have left out this reversion in the 2.5 branch since I think it is needed there. http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683 * Scons had various conflicting changes, I decided to go with trunk version for everything except priorities and some library renaming. * In creator.c, there were various fixes and fixes for fixes related to the -w -W and -p options. In 2.5 -w and -W is not coded yet, and -p is done differently. Since this is changed so much, and I don't think those fixes would be needed in 2.5, I've left them out. * Also in creator.c: there was code for a python bugfix where the screen was not initialized when running with -P. The code that initializes the screen there I had to disable, that can't work in 2.5 anymore but left it commented as a reminder. Further I had to disable some new function calls. using src/ and python/, as was done already in this branch, disabled function calls: * bpath.c: error reporting * BME_conversions.c: editmesh conversion functions. * SHD_dynamic: disabled almost completely, there is no python/. * KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled. * text.c: clipboard copy call. * object.c: OB_SUPPORT_MATERIAL. * DerivedMesh.c and subsurf_ccg, stipple_quarttone. Still to be done: * Go over files and functions that were moved to a different location but could still use changes that were done in trunk.
Diffstat (limited to 'release/scripts/bpymodules/blend2renderinfo.py')
-rw-r--r--release/scripts/bpymodules/blend2renderinfo.py95
1 files changed, 95 insertions, 0 deletions
diff --git a/release/scripts/bpymodules/blend2renderinfo.py b/release/scripts/bpymodules/blend2renderinfo.py
new file mode 100644
index 00000000000..1b9dec58d55
--- /dev/null
+++ b/release/scripts/bpymodules/blend2renderinfo.py
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+
+# --------------------------------------------------------------------------
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+# --------------------------------------------------------------------------
+
+import struct
+
+# In Blender, selecting scenes in the databrowser (shift+f4) will tag for rendering.
+
+# This struct wont change according to ton.
+# Note that the size differs on 32/64bit
+'''
+typedef struct BHead {
+ int code, len;
+ void *old;
+ int SDNAnr, nr;
+} BHead;
+'''
+
+
+def read_blend_rend_chunk(path):
+ file = open(path, 'rb')
+
+ if file.read(len('BLENDER')) != 'BLENDER':
+ return []
+
+ #
+ if file.read(1) == '-':
+ is64bit = True
+ else: # '_'
+ is64bit = False
+
+ if file.read(1) == 'V':
+ isBigEndian = True # ppc
+ else: # 'V'
+ isBigEndian = False # x86
+
+
+ # 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
+ else: sizeof_bhead = sizeof_bhead_left = 20 # 32bit
+
+ sizeof_bhead_left -= 4
+
+ if isBigEndian: rend_length = struct.unpack('>i', file.read(4))[0]
+ else: rend_length = struct.unpack('<i', file.read(4))[0]
+
+ sizeof_bhead_left -= 4
+
+ # We dont care about the rest of the bhead struct
+ file.read(sizeof_bhead_left)
+
+ # Now we want the scene name, start and end frame. this is 32bites long
+
+ if isBigEndian: start_frame, end_frame = struct.unpack('>2i', file.read(8))
+ else: start_frame, end_frame = struct.unpack('<2i', file.read(8))
+
+ scene_name = file.read(24)
+ scene_name = scene_name[ : scene_name.index('\0') ]
+
+ 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)
+
+if __name__ == '__main__':
+ main()
+