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:
authorCampbell Barton <ideasman42@gmail.com>2011-01-21 00:02:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-21 00:02:42 +0300
commit039bb7812f7c99eda99661fd26182fdb1b7cd900 (patch)
treec8b8c5a52a556fc13445a35935b66f88efa68040 /release/bin
parentdc2431c4919e23ba071f2c4582e533759a580d49 (diff)
bugfix [#25742] blender-thumbnailer.py doesn't work with python 3.1
Diffstat (limited to 'release/bin')
-rwxr-xr-xrelease/bin/blender-thumbnailer.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/release/bin/blender-thumbnailer.py b/release/bin/blender-thumbnailer.py
index be870560110..16a89d29724 100755
--- a/release/bin/blender-thumbnailer.py
+++ b/release/bin/blender-thumbnailer.py
@@ -27,18 +27,19 @@ To run automatically with nautilus:
import struct
+
def blend_extract_thumb(path):
import os
# def MAKE_ID(tag): ord(tag[0])<<24 | ord(tag[1])<<16 | ord(tag[2])<<8 | ord(tag[3])
- REND = 1145980242 # MAKE_ID(b'REND')
- TEST = 1414743380 # MAKE_ID(b'TEST')
+ REND = 1145980242 # MAKE_ID(b'REND')
+ TEST = 1414743380 # MAKE_ID(b'TEST')
blendfile = open(path, 'rb')
head = blendfile.read(12)
- if head[0:2] == b'\x1f\x8b': # gzip magic
+ if head[0:2] == b'\x1f\x8b': # gzip magic
import gzip
blendfile.close()
blendfile = gzip.open(path, 'rb')
@@ -48,10 +49,10 @@ def blend_extract_thumb(path):
blendfile.close()
return None, 0, 0
- is_64_bit = (head[7] == b'-')
+ is_64_bit = (head[7] == b'-'[0])
# true for PPC, false for X86
- is_big_endian = (head[8] == b'V')
+ is_big_endian = (head[8] == b'V'[0])
# blender pre 2.5 had no thumbs
if head[9:11] <= b'24':
@@ -66,23 +67,22 @@ def blend_extract_thumb(path):
if len(bhead) < sizeof_bhead:
return None, 0, 0
- code, length = struct.unpack(int_endian_pair, bhead[0:8]) # 8 == sizeof(int) * 2
+ code, length = struct.unpack(int_endian_pair, bhead[0:8]) # 8 == sizeof(int) * 2
if code == REND:
blendfile.seek(length, os.SEEK_CUR)
else:
break
-
-
+
if code != TEST:
return None, 0, 0
try:
- x, y = struct.unpack(int_endian_pair, blendfile.read(8)) # 8 == sizeof(int) * 2
+ x, y = struct.unpack(int_endian_pair, blendfile.read(8)) # 8 == sizeof(int) * 2
except struct.error:
return None, 0, 0
- length -= 8 # sizeof(int) * 2
+ length -= 8 # sizeof(int) * 2
if length != x * y * 4:
return None, 0, 0
@@ -122,7 +122,7 @@ if __name__ == '__main__':
file_in = sys.argv[-2]
buf, width, height = blend_extract_thumb(file_in)
-
+
if buf:
file_out = sys.argv[-1]