[Bf-extensions-cvs] [a0e769ee] blender2.8: OBJ import: Fix spec

Philipp Oeser noreply at git.blender.org
Thu Nov 15 18:04:14 CET 2018


Commit: a0e769eeb3603a30caf663c97f833f569e757b5f
Author: Philipp Oeser
Date:   Thu Nov 15 17:51:35 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBAa0e769eeb3603a30caf663c97f833f569e757b5f

OBJ import: Fix spec

===================================================================

M	io_scene_obj/import_obj.py

===================================================================

diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 5980a0b2..176a5a99 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -227,7 +227,7 @@ def create_materials(filepath, relpath,
                             # TODO: Find a way to guesstimate best value from diffuse color...
                             # IDEA: Use standard deviation of both spec and diff colors (i.e. how far away they are
                             #       from some grey), and apply the the proportion between those two as tint factor?
-                            spec = sum(spec_color) / 3.0
+                            spec = sum(spec_colors) / 3.0
                             # ~ spec_var = math.sqrt(sum((c - spec) ** 2 for c in spec_color) / 3.0)
                             # ~ diff = sum(context_mat_wrap.base_color) / 3.0
                             # ~ diff_var = math.sqrt(sum((c - diff) ** 2 for c in context_mat_wrap.base_color) / 3.0)
@@ -297,7 +297,8 @@ def create_materials(filepath, relpath,
                         col = (float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3]))
                         context_mat_wrap.base_color = col
                     elif line_id == b'ks':
-                        spec_color = (float_func(line_split[1]) + float_func(line_split[2]) + float_func(line_split[3]))
+                        spec_colors[:] = [
+                            float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])]
                         context_material_vars.add("specular")
                     elif line_id == b'ke':
                         # We cannot set context_material.emit right now, we need final diffuse color as well for this.



More information about the Bf-extensions-cvs mailing list