diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-04 11:57:26 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-04 11:57:26 +0400 |
commit | ce5fb029ba4f7950c6b8b46a2f5624d262795d31 (patch) | |
tree | 2ad6f8187894a0d0c3137aa43c46b79d2a5c1570 /io_import_gimp_image_to_scene.py | |
parent | 360f7301a0f58cb9ab281b2d18616b35ed5f6e22 (diff) |
Changes for recent image alpha rework.
Addons maintainers please double check the changes.
Diffstat (limited to 'io_import_gimp_image_to_scene.py')
-rw-r--r-- | io_import_gimp_image_to_scene.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/io_import_gimp_image_to_scene.py b/io_import_gimp_image_to_scene.py index 1cf405b0..e9aaf862 100644 --- a/io_import_gimp_image_to_scene.py +++ b/io_import_gimp_image_to_scene.py @@ -35,7 +35,7 @@ This script imports GIMP layered image files into 3D Scenes (.xcf, .xjt) """ def main(File, Path, LayerViewers, MixerViewers, LayerOffset, - LayerScale, OpacityMode, PremulAlpha, ShadelessMats, + LayerScale, OpacityMode, AlphaMode, ShadelessMats, SetCamera, SetupCompo, GroupUntagged, Ext): #------------------------------------------------- @@ -238,7 +238,7 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset, Render.resolution_x = ResX Render.resolution_y = ResY Render.resolution_percentage = 100 - if PremulAlpha: Render.alpha_mode = 'PREMUL' + Render.alpha_mode = 'TRANSPARENT' #------------------------------------------------- # 3D VIEW SETTINGS @@ -347,7 +347,7 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset, Img = bpy.data.images.new(NameShort, 128, 128) Img.source = 'FILE' - if PremulAlpha: Img.use_premultiply = True + Img.alpha_mode = AlphaMode Img.filepath = '%s%s%s' % (PathSaveRaw, Name, ExtSave) UVFace = Active.data.uv_textures[0].data[0] @@ -391,7 +391,7 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset, Img = bpy.data.images.new(NameShort+'_A', 128, 128) Img.source = 'FILE' - if PremulAlpha: Img.use_premultiply = True + Img.alpha_mode = AlphaMode Img.filepath = '%s%s_A%s' % (PathSaveRaw, Name, ExtSave) Tex.image = Img @@ -560,9 +560,12 @@ class GIMPImageToScene(bpy.types.Operator): description="Add Viewer nodes to each Mix node", default=True) - PremulAlpha = BoolProperty(name="Premuliply Alpha", - description="Set Image and Render settings to premultiplied alpha", - default=True) + AlphaMode = EnumProperty(name="Alpha Mode", + description="Representation of alpha information in the RGBA pixels", + items=( + ('STRAIGHT', 'Texture Alpha Factor', 'Transparent RGB and alpha pixels are unmodified'), + ('PREMUL', 'Material Alpha Value', 'Transparent RGB pixels are multiplied by the alpha channel')), + default='STRAIGHT') ShadelessMats = BoolProperty(name="Shadeless Material", description="Set Materials as Shadeless", @@ -608,7 +611,7 @@ class GIMPImageToScene(bpy.types.Operator): box.prop(self, 'OpacityMode', icon='GHOST') if self.OpacityMode == 'COMPO' and self.SetupCompo == False: box.label('Tip: Enable Node Compositing', icon='INFO') - box.prop(self, 'PremulAlpha', icon='IMAGE_RGB_ALPHA') + box.prop(self, 'AlphaMode', icon='IMAGE_RGB_ALPHA') box.prop(self, 'ShadelessMats', icon='SOLID') box.prop(self, 'LayerOffset') box.prop(self, 'LayerScale') @@ -630,7 +633,7 @@ class GIMPImageToScene(bpy.types.Operator): LayerViewers = self.LayerViewers MixerViewers = self.MixerViewers OpacityMode = self.OpacityMode - PremulAlpha = self.PremulAlpha + AlphaMode = self.AlphaMode ShadelessMats = self.ShadelessMats SetCamera = self.SetCamera SetupCompo = self.SetupCompo @@ -645,7 +648,7 @@ class GIMPImageToScene(bpy.types.Operator): # Call Main Function if Ext: main(filename, directory, LayerViewers, MixerViewers, LayerOffset, - LayerScale, OpacityMode, PremulAlpha, ShadelessMats, + LayerScale, OpacityMode, AlphaMode, ShadelessMats, SetCamera, SetupCompo, GroupUntagged, Ext) else: self.report({'ERROR'},"Selected file wasn't valid, try .xcf or .xjt") |