[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31748] trunk/blender/release/scripts/op/ io_scene_obj/import_obj.py: Bugfix for [#23676] Obj Import fails again.

Thomas Dinges dingto at gmx.de
Sat Sep 4 13:11:37 CEST 2010


Revision: 31748
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31748
Author:   dingto
Date:     2010-09-04 13:11:37 +0200 (Sat, 04 Sep 2010)

Log Message:
-----------
Bugfix for [#23676] Obj Import fails again.

Modified Paths:
--------------
    trunk/blender/release/scripts/op/io_scene_obj/import_obj.py

Modified: trunk/blender/release/scripts/op/io_scene_obj/import_obj.py
===================================================================
--- trunk/blender/release/scripts/op/io_scene_obj/import_obj.py	2010-09-04 09:27:21 UTC (rev 31747)
+++ trunk/blender/release/scripts/op/io_scene_obj/import_obj.py	2010-09-04 11:11:37 UTC (rev 31748)
@@ -298,32 +298,52 @@
                 # Image has alpha
 
                 # XXX bitmask won't work?
-                blender_material.add_texture(texture, 'UV', {'COLOR', 'ALPHA'})
+                mtex = blender_material.texture_slots.add()
+                mtex.texture = texture
+                mtex.texture_coords = 'UV'
+                mtex.use_map_color_diffuse = True
+                mtex.use_map_alpha = True
+
                 texture.mipmap = True
                 texture.interpolation = True
                 texture.use_alpha = True
                 blender_material.use_transparency = True
                 blender_material.alpha = 0.0
             else:
-                blender_material.add_texture(texture, 'UV', 'COLOR')
+                mtex = blender_material.texture_slots.add()
+                mtex.texture = texture
+                mtex.texture_coords = 'UV'
+                mtex.use_map_color_diffuse = True
 
             # adds textures to faces (Textured/Alt-Z mode)
             # Only apply the diffuse texture to the face if the image has not been set with the inline usemat func.
             unique_material_images[context_material_name]= image, has_data # set the texface image
 
         elif type == 'Ka':
-            blender_material.add_texture(texture, 'UV', 'AMBIENT')
+            mtex = blender_material.texture_slots.add()
+            mtex.texture = texture
+            mtex.texture_coords = 'UV'
+            mtex.use_map_ambient = True
 #             blender_material.setTexture(1, texture, Texture.TexCo.UV, Texture.MapTo.CMIR) # TODO- Add AMB to BPY API
 
         elif type == 'Ks':
-            blender_material.add_texture(texture, 'UV', 'SPECULARITY')
-#             blender_material.setTexture(2, texture, Texture.TexCo.UV, Texture.MapTo.SPEC)
+            mtex = blender_material.texture_slots.add()
+            mtex.texture = texture
+            mtex.texture_coords = 'UV'
+            mtex.use_map_specular = True
+#           blender_material.setTexture(2, texture, Texture.TexCo.UV, Texture.MapTo.SPEC)
 
         elif type == 'Bump':
-            blender_material.add_texture(texture, 'UV', 'NORMAL')
+            mtex = blender_material.texture_slots.add()
+            mtex.texture = texture
+            mtex.texture_coords = 'UV'
+            mtex.use_map_normal = True
 #             blender_material.setTexture(3, texture, Texture.TexCo.UV, Texture.MapTo.NOR)
         elif type == 'D':
-            blender_material.add_texture(texture, 'UV', 'ALPHA')
+            mtex = blender_material.texture_slots.add()
+            mtex.texture = texture
+            mtex.texture_coords = 'UV'
+            mtex.use_map_alpha = True
             blender_material.z_transparency = True
             blender_material.alpha = 0.0
 #             blender_material.setTexture(4, texture, Texture.TexCo.UV, Texture.MapTo.ALPHA)
@@ -332,7 +352,10 @@
             # Todo, unset deffuse material alpha if it has an alpha channel
 
         elif type == 'refl':
-            blender_material.add_texture(texture, 'UV', 'REFLECTION')
+            mtex = blender_material.texture_slots.add()
+            mtex.texture = texture
+            mtex.texture_coords = 'UV'
+            mtex.use_map_reflect = True
 #             blender_material.setTexture(5, texture, Texture.TexCo.UV, Texture.MapTo.REF)
 
 





More information about the Bf-blender-cvs mailing list