diff options
Diffstat (limited to 'io_scene_fbx')
-rw-r--r-- | io_scene_fbx/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_fbx/export_fbx_bin.py | 58 |
2 files changed, 31 insertions, 29 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 5aa337fd..97228a74 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "FBX format", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier", - "version": (3, 8, 0), + "version": (3, 8, 1), "blender": (2, 79, 1), "location": "File > Import-Export", "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions", diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index a630f86b..f9d6ceee 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -1203,7 +1203,7 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes): def check_skip_material(mat): """Simple helper to check whether we actually support exporting that material or not""" - return mat.type not in {'SURFACE'} or mat.use_nodes + return mat.type not in {'SURFACE'} def fbx_data_material_elements(root, mat, scene_data): @@ -1216,9 +1216,10 @@ def fbx_data_material_elements(root, mat, scene_data): mat_key, _objs = scene_data.data_materials[mat] skip_mat = check_skip_material(mat) + node_mat = mat.use_nodes mat_type = b"Phong" # Approximation... - if not skip_mat and mat.specular_shader not in {'COOKTORR', 'PHONG', 'BLINN'}: + if not skip_mat and not node_mat and mat.specular_shader not in {'COOKTORR', 'PHONG', 'BLINN'}: mat_type = b"Lambert" fbx_mat = elem_data_single_int64(root, b"Material", get_fbx_uuid_from_key(mat_key)) @@ -1235,34 +1236,35 @@ def fbx_data_material_elements(root, mat, scene_data): if not skip_mat: elem_props_template_set(tmpl, props, "p_string", b"ShadingModel", mat_type.decode()) - elem_props_template_set(tmpl, props, "p_color", b"EmissiveColor", mat.diffuse_color) - elem_props_template_set(tmpl, props, "p_number", b"EmissiveFactor", mat.emit) - elem_props_template_set(tmpl, props, "p_color", b"AmbientColor", ambient_color) - elem_props_template_set(tmpl, props, "p_number", b"AmbientFactor", mat.ambient) elem_props_template_set(tmpl, props, "p_color", b"DiffuseColor", mat.diffuse_color) elem_props_template_set(tmpl, props, "p_number", b"DiffuseFactor", mat.diffuse_intensity) - elem_props_template_set(tmpl, props, "p_color", b"TransparentColor", - mat.diffuse_color if mat.use_transparency else (1.0, 1.0, 1.0)) - elem_props_template_set(tmpl, props, "p_number", b"TransparencyFactor", - 1.0 - mat.alpha if mat.use_transparency else 0.0) - elem_props_template_set(tmpl, props, "p_number", b"Opacity", mat.alpha if mat.use_transparency else 1.0) - elem_props_template_set(tmpl, props, "p_vector_3d", b"NormalMap", (0.0, 0.0, 0.0)) - # Not sure about those... - """ - b"Bump": ((0.0, 0.0, 0.0), "p_vector_3d"), - b"BumpFactor": (1.0, "p_double"), - b"DisplacementColor": ((0.0, 0.0, 0.0), "p_color_rgb"), - b"DisplacementFactor": (0.0, "p_double"), - """ - if mat_type == b"Phong": - elem_props_template_set(tmpl, props, "p_color", b"SpecularColor", mat.specular_color) - elem_props_template_set(tmpl, props, "p_number", b"SpecularFactor", mat.specular_intensity / 2.0) - # See Material template about those two! - elem_props_template_set(tmpl, props, "p_number", b"Shininess", (mat.specular_hardness - 1.0) / 5.10) - elem_props_template_set(tmpl, props, "p_number", b"ShininessExponent", (mat.specular_hardness - 1.0) / 5.10) - elem_props_template_set(tmpl, props, "p_color", b"ReflectionColor", mat.mirror_color) - elem_props_template_set(tmpl, props, "p_number", b"ReflectionFactor", - mat.raytrace_mirror.reflect_factor if mat.raytrace_mirror.use else 0.0) + if not node_mat: + elem_props_template_set(tmpl, props, "p_color", b"EmissiveColor", mat.diffuse_color) + elem_props_template_set(tmpl, props, "p_number", b"EmissiveFactor", mat.emit) + elem_props_template_set(tmpl, props, "p_color", b"AmbientColor", ambient_color) + elem_props_template_set(tmpl, props, "p_number", b"AmbientFactor", mat.ambient) + elem_props_template_set(tmpl, props, "p_color", b"TransparentColor", + mat.diffuse_color if mat.use_transparency else (1.0, 1.0, 1.0)) + elem_props_template_set(tmpl, props, "p_number", b"TransparencyFactor", + 1.0 - mat.alpha if mat.use_transparency else 0.0) + elem_props_template_set(tmpl, props, "p_number", b"Opacity", mat.alpha if mat.use_transparency else 1.0) + elem_props_template_set(tmpl, props, "p_vector_3d", b"NormalMap", (0.0, 0.0, 0.0)) + # Not sure about those... + """ + b"Bump": ((0.0, 0.0, 0.0), "p_vector_3d"), + b"BumpFactor": (1.0, "p_double"), + b"DisplacementColor": ((0.0, 0.0, 0.0), "p_color_rgb"), + b"DisplacementFactor": (0.0, "p_double"), + """ + if mat_type == b"Phong": + elem_props_template_set(tmpl, props, "p_color", b"SpecularColor", mat.specular_color) + elem_props_template_set(tmpl, props, "p_number", b"SpecularFactor", mat.specular_intensity / 2.0) + # See Material template about those two! + elem_props_template_set(tmpl, props, "p_number", b"Shininess", (mat.specular_hardness - 1.0) / 5.10) + elem_props_template_set(tmpl, props, "p_number", b"ShininessExponent", (mat.specular_hardness - 1.0) / 5.10) + elem_props_template_set(tmpl, props, "p_color", b"ReflectionColor", mat.mirror_color) + elem_props_template_set(tmpl, props, "p_number", b"ReflectionFactor", + mat.raytrace_mirror.reflect_factor if mat.raytrace_mirror.use else 0.0) elem_props_template_finalize(tmpl, props) |