Skip to content

Commit

Permalink
GIMP image to scene: in XJT mode GIMP sometimes decide not to export an
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ZanQdo committed Feb 16, 2011
1 parent 42b9469 commit 7d429d1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions io_import_gimp_image_to_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
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

Expand All @@ -101,6 +104,12 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
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()

Expand Down

0 comments on commit 7d429d1

Please sign in to comment.