[Bf-extensions-cvs] [3c2a3f8a] blender2.8: Update for node_shader_utils changes.

Brecht Van Lommel noreply at git.blender.org
Fri Oct 12 15:56:34 CEST 2018


Commit: 3c2a3f8a60d68b131d0ec606e28f8795327651df
Author: Brecht Van Lommel
Date:   Fri Oct 12 15:45:40 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBA3c2a3f8a60d68b131d0ec606e28f8795327651df

Update for node_shader_utils changes.

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

M	io_scene_obj/export_obj.py
M	io_scene_obj/import_obj.py

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

diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index 86f84da7..f3b92afd 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -82,7 +82,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
                     fw('Ka %.6f %.6f %.6f\n' % (mat_wrap.metallic, mat_wrap.metallic, mat_wrap.metallic))
                 else:
                     fw('Ka %.6f %.6f %.6f\n' % (1.0, 1.0, 1.0))
-                fw('Kd %.6f %.6f %.6f\n' % mat_wrap.diffuse_color[:3])  # Diffuse
+                fw('Kd %.6f %.6f %.6f\n' % mat_wrap.base_color[:3])  # Diffuse
                 # XXX TODO Find a way to handle tint and diffuse color, in a consistent way with import...
                 fw('Ks %.6f %.6f %.6f\n' % (mat_wrap.specular, mat_wrap.specular, mat_wrap.specular))  # Specular
                 # Emission, not in original MTL standard but seems pretty common, see T45766.
@@ -108,7 +108,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
 
                 #### And now, the image textures...
                 image_map = {
-                        "map_Kd": "diffuse_texture",
+                        "map_Kd": "base_color_texture",
                         "map_Ka": None,  # ambient...
                         "map_Ks": "specular_texture",
                         "map_Ns": "roughness_texture",
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 55e7648c..2bf4ac94 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -133,7 +133,7 @@ def create_materials(filepath, relpath,
 
         # Adds textures for materials (rendering)
         if type == 'Kd':
-            _generic_tex_set(mat_wrap.diffuse_texture, image, 'UV', map_offset, map_scale)
+            _generic_tex_set(mat_wrap.base_color_texture, image, 'UV', map_offset, map_scale)
 
         elif type == 'Ka':
             # XXX Not supported?
@@ -168,8 +168,8 @@ def create_materials(filepath, relpath,
                 print("WARNING, unsupported reflection type '%s', defaulting to 'sphere'"
                       "" % ' '.join(i.decode() for i in map_type))
 
-            _generic_tex_set(mat_wrap.diffuse_texture, image, 'Reflection', map_offset, map_scale)
-            mat_wrap.diffuse_texture.projection = 'SPHERE'
+            _generic_tex_set(mat_wrap.base_color_texture, image, 'Reflection', map_offset, map_scale)
+            mat_wrap.base_color_texture.projection = 'SPHERE'
 
         else:
             raise Exception("invalid type %r" % type)
@@ -227,8 +227,8 @@ def create_materials(filepath, relpath,
                             #       from some grey), and apply the the proportion between those two as tint factor?
                             # ~ spec = sum(spec_color) / 3.0
                             # ~ spec_var = math.sqrt(sum((c - spec) ** 2 for c in spec_color) / 3.0)
-                            # ~ diff = sum(context_mat_wrap.diffuse_color[:3]) / 3.0
-                            # ~ diff_var = math.sqrt(sum((c - diff) ** 2 for c in context_mat_wrap.diffuse_color[:3]) / 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)
                             # ~ tint = min(1.0, spec_var / diff_var)
                             context_mat_wrap.specular = spec
                             context_mat_wrap.specular_tint = 0.0
@@ -293,7 +293,7 @@ def create_materials(filepath, relpath,
                         context_material_vars.add("metallic")
                     elif line_id == b'kd':
                         col = (float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3]))
-                        context_mat_wrap.diffuse_color[:3] = col
+                        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]))
                         context_material_vars.add("specular")



More information about the Bf-extensions-cvs mailing list