[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31305] trunk/blender/release/scripts/io/ import_scene_obj.py: bugfix [#22974] OBJ import arrives without texture

Campbell Barton ideasman42 at gmail.com
Fri Aug 13 05:17:38 CEST 2010


Revision: 31305
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31305
Author:   campbellbarton
Date:     2010-08-13 05:17:10 +0200 (Fri, 13 Aug 2010)

Log Message:
-----------
bugfix [#22974] OBJ import arrives without texture

Modified Paths:
--------------
    trunk/blender/release/scripts/io/import_scene_obj.py

Modified: trunk/blender/release/scripts/io/import_scene_obj.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_obj.py	2010-08-13 01:59:42 UTC (rev 31304)
+++ trunk/blender/release/scripts/io/import_scene_obj.py	2010-08-13 03:17:10 UTC (rev 31305)
@@ -310,19 +310,22 @@
             if os.path.exists(nfilepath):
                 return bpy.data.images.load(nfilepath)
 
-    print(filepath, "doesn't exist")
-
     # TODO comprehensiveImageLoad also searched in bpy.config.textureDir
     return None
 
 def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
-
     if '_' in imagepath:
         image= load_image(imagepath.replace('_', ' '), DIR)
-        if image: return image
+        if image:
+            return image
 
-    return load_image(imagepath, DIR)
+    image = load_image(imagepath, DIR)
+    if image:
+        return image
 
+    print("failed to load '%s' doesn't exist", imagepath)
+    return None
+
 # def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
 # 	'''
 # 	Mainly uses comprehensiveImageLoad
@@ -764,14 +767,12 @@
                     blender_tface= me.uv_textures[0].data[i]
 
                     if context_material:
-                        image, has_data= unique_material_images[context_material]
+                        image, has_data = unique_material_images[context_material]
                         if image: # Can be none if the material dosnt have an image.
-                            blender_tface.image= image
-# 							blender_face.image= image
-                            if has_data:
-# 							if has_data and image.depth == 32:
+                            blender_tface.image = image
+                            blender_tface.tex = True
+                            if has_data and image.depth == 32:
                                 blender_tface.transp = 'ALPHA'
-# 								blender_face.transp |= ALPHA
 
                     # BUG - Evil eekadoodle problem where faces that have vert index 0 location at 3 or 4 are shuffled.
                     if len(face_vert_loc_indicies)==4:





More information about the Bf-blender-cvs mailing list