[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31899] trunk/blender/release/scripts/op/ io_scene_obj/import_obj.py: bugfix [#23778] obj importing forgets to enable transparent into material
Campbell Barton
ideasman42 at gmail.com
Mon Sep 13 04:36:07 CEST 2010
Revision: 31899
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31899
Author: campbellbarton
Date: 2010-09-13 04:35:59 +0200 (Mon, 13 Sep 2010)
Log Message:
-----------
bugfix [#23778] obj importing forgets to enable transparent into material
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-13 00:53:47 UTC (rev 31898)
+++ trunk/blender/release/scripts/op/io_scene_obj/import_obj.py 2010-09-13 02:35:59 UTC (rev 31899)
@@ -297,7 +297,6 @@
if has_data and image.depth == 32:
# Image has alpha
- # XXX bitmask won't work?
mtex = blender_material.texture_slots.add()
mtex.texture = texture
mtex.texture_coords = 'UV'
@@ -324,21 +323,19 @@
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':
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':
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':
mtex = blender_material.texture_slots.add()
mtex.texture = texture
@@ -354,7 +351,6 @@
mtex.texture = texture
mtex.texture_coords = 'UV'
mtex.use_map_reflect = True
-# blender_material.setTexture(5, texture, Texture.TexCo.UV, Texture.MapTo.REF)
# Add an MTL with the same name as the obj if no MTLs are spesified.
@@ -394,17 +390,18 @@
line_split= line.split()
line_lower= line.lower().lstrip()
if line_lower.startswith('ka'):
- context_material.mirror_color = (float(line_split[1]), float(line_split[2]), float(line_split[3]))
+ context_material.mirror_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
elif line_lower.startswith('kd'):
- context_material.diffuse_color = (float(line_split[1]), float(line_split[2]), float(line_split[3]))
+ context_material.diffuse_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
elif line_lower.startswith('ks'):
- context_material.specular_color = (float(line_split[1]), float(line_split[2]), float(line_split[3]))
+ context_material.specular_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
elif line_lower.startswith('ns'):
- context_material.specular_hardness = int((float(line_split[1])*0.51))
+ context_material.specular_hardness = int((float(line_split[1]) * 0.51))
elif line_lower.startswith('ni'): # Refraction index
- context_material.raytrace_transparency.ior = max(1, min(float(line_split[1]), 3)) # Between 1 and 3
+ context_material.raytrace_transparency.ior = max(1, min(float(line_split[1]), 3)) # between 1 and 3
elif line_lower.startswith('d') or line_lower.startswith('tr'):
context_material.alpha = float(line_split[1])
+ context_material.z_transparency = True
elif line_lower.startswith('map_ka'):
img_filepath= line_value(line.split())
if img_filepath:
@@ -421,12 +418,12 @@
img_filepath= line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'Bump')
- elif line_lower.startswith('map_d') or line_lower.startswith('map_tr'): # Alpha map - Dissolve
+ elif line_lower.startswith('map_d') or line_lower.startswith('map_tr'): # Alpha map - Dissolve
img_filepath= line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'D')
- elif line_lower.startswith('refl'): # Reflectionmap
+ elif line_lower.startswith('refl'): # reflectionmap
img_filepath= line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'refl')
More information about the Bf-blender-cvs
mailing list