[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4576] trunk/py/scripts/addons/ io_import_images_as_planes.py: Fix import image as plane to work in Blender Game engine mode too.
Bastien Montagne
montagne29 at wanadoo.fr
Fri Jun 14 10:06:54 CEST 2013
Revision: 4576
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4576
Author: mont29
Date: 2013-06-14 08:06:53 +0000 (Fri, 14 Jun 2013)
Log Message:
-----------
Fix import image as plane to work in Blender Game engine mode too.
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-06-14 05:15:39 UTC (rev 4575)
+++ trunk/py/scripts/addons/io_import_images_as_planes.py 2013-06-14 08:06:53 UTC (rev 4576)
@@ -317,8 +317,7 @@
# the add utils don't work in this case because many objects are added disable relevant things beforehand
editmode = context.user_preferences.edit.use_enter_edit_mode
context.user_preferences.edit.use_enter_edit_mode = False
- if (context.active_object and
- context.active_object.mode == 'EDIT'):
+ if context.active_object and context.active_object.mode == 'EDIT':
bpy.ops.object.mode_set(mode='OBJECT')
self.import_images(context)
@@ -333,16 +332,17 @@
images = (load_image(path, directory) for path in import_list)
- if engine == 'BLENDER_RENDER':
+ if engine in {'BLENDER_RENDER', 'BLENDER_GAME'}:
textures = []
for img in images:
self.set_image_options(img)
textures.append(self.create_image_textures(context, img))
materials = (self.create_material_for_texture(tex) for tex in textures)
-
elif engine == 'CYCLES':
materials = (self.create_cycles_material(img) for img in images)
+ else:
+ return
planes = tuple(self.create_image_plane(context, mat) for mat in materials)
@@ -357,7 +357,7 @@
def create_image_plane(self, context, material):
engine = context.scene.render.engine
- if engine == 'BLENDER_RENDER':
+ if engine in {'BLENDER_RENDER', 'BLENDER_GAME'}:
img = material.texture_slots[0].texture.image
elif engine == 'CYCLES':
nodes = material.node_tree.nodes
More information about the Bf-extensions-cvs
mailing list