[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1614] trunk/py/scripts/addons/ io_import_gimp_image_to_scene.py: GIMP image to scene: in XJT mode GIMP sometimes decide not to export an

Daniel Salazar zanqdo at gmail.com
Wed Feb 16 23:46:08 CET 2011


Revision: 1614
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1614
Author:   zanqdo
Date:     2011-02-16 22:46:08 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
GIMP image to scene: in XJT mode GIMP sometimes decide not to export an
alpha layer if this layer is unmodified (pure white) even if the layer
is marked as alpha. This makes it impossible to know without phisically
checking if the alpha file exists or not

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

Modified: trunk/py/scripts/addons/io_import_gimp_image_to_scene.py
===================================================================
--- trunk/py/scripts/addons/io_import_gimp_image_to_scene.py	2011-02-16 20:22:40 UTC (rev 1613)
+++ trunk/py/scripts/addons/io_import_gimp_image_to_scene.py	2011-02-16 22:46:08 UTC (rev 1614)
@@ -88,6 +88,9 @@
                         ResX, ResY = map (int, Segment[4:].split(','))
             if Line.startswith("b'L") or Line.startswith("b'l"):
                 
+                '''The "nice" method to check if layer has alpha channel
+                sadly GIMP sometimes decides not to export an alpha channel
+                if it's pure white so we are not completly sure here yet'''
                 if Line.startswith("b'L"): HasAlpha = True
                 else: HasAlpha = False
                 
@@ -101,6 +104,12 @@
                         imageFile = 'l' + Segment[3:] + '.jpg'
                         imageFileAlpha ='la'+Segment[3:]+'.jpg'
                         
+                        '''Phisically double checking if alpha image exists
+                        now we can be sure! (damn GIMP)'''
+                        if HasAlpha:
+                            if not os.path.isfile(PathSaveRaw+imageFileAlpha): HasAlpha = False
+                            print ("This image has alpha: ", HasAlpha)
+                        
                         # Get Widht and Height from images
                         data = open(PathSaveRaw+imageFile, "rb").read()
                         



More information about the Bf-extensions-cvs mailing list