[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1249] branches/ io_import_gimp_to_3d_layers.py: GIMPto3DLayers: XJT support working! only alpha channel left

Daniel Salazar zanqdo at gmail.com
Tue Dec 7 21:54:02 CET 2010


Revision: 1249
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1249
Author:   zanqdo
Date:     2010-12-07 21:54:02 +0100 (Tue, 07 Dec 2010)

Log Message:
-----------
GIMPto3DLayers: XJT support working! only alpha channel left

Modified Paths:
--------------
    branches/io_import_gimp_to_3d_layers.py

Modified: branches/io_import_gimp_to_3d_layers.py
===================================================================
--- branches/io_import_gimp_to_3d_layers.py	2010-12-07 19:20:12 UTC (rev 1248)
+++ branches/io_import_gimp_to_3d_layers.py	2010-12-07 20:54:02 UTC (rev 1249)
@@ -81,16 +81,17 @@
 		IMGs = []
 		for Line in PRP.readlines():
 			Line = str(Line)
+			
 			if Line.startswith("b'GIMP_XJ_IMAGE"):
 				for Segment in Line.split():
 					if Segment.startswith('w/h:'):
 						ResX, ResY = map (int, Segment[4:].split(','))
-						print (ResX, ResY)
 			if Line.startswith("b'L") or Line.startswith("b'l"):
 				md = None
 				op = 1
 				
 				for Segment in Line.split():
+					
 					if Segment.startswith("b'"):
 						imageFile = 'l' + Segment[3:] + '.jpg'
 						
@@ -106,17 +107,19 @@
 							if hexList[k] == 'FF' and (hexList[k+1] == 'C0' or hexList[k+1] == 'C2'):
 								ow = int(hexList[k+7],16)*256 + int(hexList[k+8],16)
 								oh = int(hexList[k+5],16)*256 + int(hexList[k+6],16)
-						
-					if Segment.startswith('md:'): # mode
+					
+					elif Segment.startswith('md:'): # mode
 						md = Segment[3:]
 						
 					elif Segment.startswith('op:'): # opacity
 						op = float(Segment[3:])*.01
 						
 					elif Segment.startswith('o:'): # origin
-						o = Segment[2:].split(',')
-						ox, oy = int(o[0]), int(o[1])
+						ox, oy = map(int, Segment[2:].split(','))
 						
+					elif Segment == 'acl': # blank origin layer
+						ox, oy = 0, 0
+					
 					elif Segment.startswith('n:'): # name
 						n = Segment[3:-4]
 						OpenBracket = n.find ('[')
@@ -129,12 +132,12 @@
 						else:
 							RenderLayer = n
 							NameShort = n
-				
+						
+						os.rename(PathSaveRaw+imageFile, PathSaveRaw+NameShort+'.jpg')
+						
 				IMGs.append({'LayerMode':md, 'LayerOpacity':op,\
 							'LayerName':n, 'LayerNameShort':NameShort,\
 							'RenderLayer':RenderLayer, 'LayerCoords':[ow, oh, ox, oy]})
-				
-		print (IMGs)
 	
 	else: # Ext == '.xcf':
 		ExtSave = '.png'




More information about the Bf-extensions-cvs mailing list