[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4118] trunk/py/scripts/addons/ io_import_images_as_planes.py: Another fix to import image as plane, due to recent alpha refactor in blender code ( thanks to meta-androcto for the report on IRC).

Bastien Montagne montagne29 at wanadoo.fr
Tue Jan 1 21:22:52 CET 2013


Revision: 4118
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4118
Author:   mont29
Date:     2013-01-01 20:22:49 +0000 (Tue, 01 Jan 2013)
Log Message:
-----------
Another fix to import image as plane, due to recent alpha refactor in blender code (thanks to meta-androcto for the report on IRC).

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

Modified: trunk/py/scripts/addons/io_import_images_as_planes.py
===================================================================
--- trunk/py/scripts/addons/io_import_images_as_planes.py	2013-01-01 15:56:21 UTC (rev 4117)
+++ trunk/py/scripts/addons/io_import_images_as_planes.py	2013-01-01 20:22:49 UTC (rev 4118)
@@ -247,8 +247,9 @@
 
     # --------------
     # Image Options.
-    t = bpy.types.Image.bl_rna.properties["use_premultiply"]
-    use_premultiply = BoolProperty(name=t.name, default=False, description=t.description)
+    t = bpy.types.Image.bl_rna.properties["alpha_mode"]
+    alpha_mode_items = tuple((e.identifier, e.name, e.description) for e in t.enum_items)
+    alpha_mode = EnumProperty(name=t.name, items=alpha_mode_items, default=t.default, description=t.description)
 
     t = bpy.types.IMAGE_OT_match_movie_length.bl_rna
     match_len = BoolProperty(name=t.name, default=True, description=t.description)
@@ -285,7 +286,7 @@
             box.label("Material Settings: (Blender)", icon='MATERIAL')
             box.prop(self, "use_shadeless")
             box.prop(self, "use_transparency")
-            box.prop(self, "use_premultiply")
+            box.prop(self, "alpha_mode")
             row = box.row()
             row.prop(self, "transparency_method", expand=True)
             box.prop(self, "use_transparent_shadows")
@@ -453,14 +454,14 @@
         return material
 
     def set_image_options(self, image):
-        image.use_premultiply = self.use_premultiply
+        image.alpha_mode = self.alpha_mode
         image.use_fields = self.use_fields
 
         if self.relative:
             image.filepath = bpy.path.relpath(image.filepath)
 
     def set_texture_options(self, context, texture):
-        texture.use_alpha = self.use_transparency
+        texture.image.use_alpha = self.use_transparency
         texture.image_user.use_auto_refresh = self.use_auto_refresh
         if self.match_len:
             ctx = context.copy()



More information about the Bf-extensions-cvs mailing list