Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2010-09-04 15:11:37 +0400
committerThomas Dinges <blender@dingto.org>2010-09-04 15:11:37 +0400
commit916a466e151d30dce66bb6d6ad2872d21bfeb4ac (patch)
tree6f792df5b7e26bff26e965668b6b7d144491b7bd /release/scripts
parent25af4f12fa1edc3b8634521e2438837d81005689 (diff)
Bugfix for [#23676] Obj Import fails again.
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/op/io_scene_obj/import_obj.py39
1 files changed, 31 insertions, 8 deletions
diff --git a/release/scripts/op/io_scene_obj/import_obj.py b/release/scripts/op/io_scene_obj/import_obj.py
index 73b5484ff3a..a5605d23cb3 100644
--- a/release/scripts/op/io_scene_obj/import_obj.py
+++ b/release/scripts/op/io_scene_obj/import_obj.py
@@ -298,32 +298,52 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# 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 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# 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)