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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-16 00:21:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-16 00:21:41 +0400
commitf915b3487de14e6c34a3fafc417d5c07c1a9f363 (patch)
tree4cf5a18ef5bf3ff4f4b0ecdf712778aac1f6f75e
parentab73e1f5827423c32a2417adf949ca68121224aa (diff)
OBJ now reads MTL using the float_func(), so materials can use commas in floating point values too.
-rw-r--r--io_scene_obj/import_obj.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 11fa543f..a03fea28 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -68,7 +68,7 @@ def obj_image_load(imagepath, DIR, recursive):
return load_image(imagepath, DIR, recursive=recursive, place_holder=True)
-def create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search):
+def create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search, float_func):
"""
Create all the used materials in this obj,
assign colors and images to the materials from all referenced material libs
@@ -203,17 +203,17 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
line_split = line.split()
line_lower = line.lower().lstrip()
if line_lower.startswith(b'ka'):
- context_material.mirror_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
+ context_material.mirror_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
elif line_lower.startswith(b'kd'):
- context_material.diffuse_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
+ context_material.diffuse_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
elif line_lower.startswith(b'ks'):
- context_material.specular_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
+ context_material.specular_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
elif line_lower.startswith(b'ns'):
- context_material.specular_hardness = int((float(line_split[1]) * 0.51))
+ context_material.specular_hardness = int((float_func(line_split[1]) * 0.51))
elif line_lower.startswith(b'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_func(line_split[1]), 3)) # between 1 and 3
elif line_lower.startswith((b'd', b'tr')):
- context_material.alpha = float(line_split[1])
+ context_material.alpha = float_func(line_split[1])
context_material.use_transparency = True
context_material.transparency_method = 'Z_TRANSPARENCY'
elif line_lower.startswith(b'tf'):
@@ -1080,7 +1080,7 @@ def load(operator, context, filepath,
time_sub = time_new
print('\tloading materials and images...')
- create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search)
+ create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search, float_func)
time_new = time.time()
print("%.4f sec" % (time_new - time_sub))