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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Salazar <zanqdo@gmail.com>2011-02-17 01:46:08 +0300
committerDaniel Salazar <zanqdo@gmail.com>2011-02-17 01:46:08 +0300
commit7d429d1ac503990c8e8977370e82bdd3b7824682 (patch)
tree93ba20340e03a4c3adb4ad0fd82d05c27c9d55cb
parent42b9469d29455f856deea328ea9034135a6e4bbc (diff)
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
-rw-r--r--io_import_gimp_image_to_scene.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/io_import_gimp_image_to_scene.py b/io_import_gimp_image_to_scene.py
index bf1ed44b..d6172d98 100644
--- a/io_import_gimp_image_to_scene.py
+++ b/io_import_gimp_image_to_scene.py
@@ -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
@@ -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()