[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2650] trunk/py/scripts/addons/ io_scene_obj/import_obj.py: fix [#29375] Obj Import fails
Campbell Barton
ideasman42 at gmail.com
Wed Nov 23 22:23:04 CET 2011
Revision: 2650
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2650
Author: campbellbarton
Date: 2011-11-23 21:23:04 +0000 (Wed, 23 Nov 2011)
Log Message:
-----------
fix [#29375] Obj Import fails
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_obj/import_obj.py
Modified: trunk/py/scripts/addons/io_scene_obj/import_obj.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/import_obj.py 2011-11-23 17:31:53 UTC (rev 2649)
+++ trunk/py/scripts/addons/io_scene_obj/import_obj.py 2011-11-23 21:23:04 UTC (rev 2650)
@@ -55,37 +55,19 @@
return b' '.join(line_split[1:])
-def obj_image_load(imagepath, DIR, use_image_search):
+def obj_image_load(imagepath, DIR, recursive):
+ '''
+ Mainly uses comprehensiveImageLoad
+ but tries to replace '_' with ' ' for Max's exporter replaces spaces with underscores.
+ '''
if b'_' in imagepath:
- image = load_image(imagepath.replace(b'_', b' '), DIR)
+ image = load_image(imagepath.replace(b'_', b' '), DIR, recursive=recursive)
if image:
return image
- image = load_image(imagepath, DIR)
- if image:
- return image
+ return load_image(imagepath, DIR, recursive=recursive, place_holder=True)
- print("failed to load %r doesn't exist" % imagepath)
- return None
-# def obj_image_load(imagepath, DIR, use_image_search):
-# '''
-# Mainly uses comprehensiveImageLoad
-# but tries to replace '_' with ' ' for Max's exporter replaces spaces with underscores.
-# '''
-
-# if '_' in imagepath:
-# image= BPyImage.comprehensiveImageLoad(imagepath, DIR, PLACE_HOLDER= False, RECURSIVE= use_image_search)
-# if image: return image
-# # Did the exporter rename the image?
-# image= BPyImage.comprehensiveImageLoad(imagepath.replace('_', ' '), DIR, PLACE_HOLDER= False, RECURSIVE= use_image_search)
-# if image: return image
-
-# # Return an image, placeholder if it dosnt exist
-# image= BPyImage.comprehensiveImageLoad(imagepath, DIR, PLACE_HOLDER= True, RECURSIVE= use_image_search)
-# return image
-
-
def create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search):
'''
Create all the used materials in this obj,
@@ -124,6 +106,8 @@
texture.use_alpha = True
blender_material.use_transparency = True
blender_material.alpha = 0.0
+
+ blender_material.game_settings.alpha_blend = 'ALPHA'
else:
mtex = blender_material.texture_slots.add()
mtex.texture = texture
@@ -619,8 +603,6 @@
image, has_data = unique_material_images[context_material]
if image: # Can be none if the material dosnt have an image.
blender_tface.image = image
- if has_data and image.depth == 32:
- blender_tface.alpha_blend = 'ALPHA'
# BUG - Evil eekadoodle problem where faces that have vert index 0 location at 3 or 4 are shuffled.
if len(face_vert_loc_indices) == 4:
More information about the Bf-extensions-cvs
mailing list