|
1 | 1 | # <pep8 compliant> |
2 | 2 | # Written by Stephan Vedder and Michael Schnabel |
3 | 3 |
|
| 4 | +import bpy |
4 | 5 | from mathutils import Vector |
5 | 6 | from io_mesh_w3d.w3d.structs.mesh_structs.shader import * |
6 | 7 | from io_mesh_w3d.w3d.structs.mesh_structs.vertex_material import * |
@@ -118,20 +119,24 @@ def retrieve_shader_material(context, material, principled, w3x=False): |
118 | 119 | header=ShaderMaterialHeader( |
119 | 120 | type_name=name), |
120 | 121 | properties=[]) |
| 122 | + |
| 123 | + color_emissive_default = Vector((0.0, 0.0, 0.0, 1.0)) |
| 124 | + if bpy.app.version >= (4, 0, 0): |
| 125 | + color_emissive_default = Vector((1.0, 1.0, 1.0, 1.0)) |
121 | 126 |
|
122 | 127 | if w3x: |
123 | 128 | append_property(shader_mat, 2, 'Shininess', material.specular_intensity * 200.0, 100.0) |
124 | 129 | append_property(shader_mat, 5, 'ColorDiffuse', to_vec(material.diffuse_color), Vector((0.8, 0.8, 0.8, 1.0))) |
125 | 130 | append_property(shader_mat, 5, 'ColorSpecular', to_vec(material.specular_color), Vector((0.0, 0.0, 0.0, 1.0))) |
126 | 131 | append_property(shader_mat, 5, 'ColorAmbient', to_vec(material.ambient), Vector((1.0, 1.0, 1.0, 0.0))) |
127 | | - append_property(shader_mat, 5, 'ColorEmissive', to_vec(principled.emission_color), Vector((0.0, 0.0, 0.0, 1.0))) |
| 132 | + append_property(shader_mat, 5, 'ColorEmissive', to_vec(principled.emission_color), color_emissive_default) |
128 | 133 |
|
129 | 134 | else: |
130 | 135 | append_property(shader_mat, 2, 'SpecularExponent', material.specular_intensity * 200.0, 100.0) |
131 | 136 | append_property(shader_mat, 5, 'DiffuseColor', to_vec(material.diffuse_color), Vector((0.8, 0.8, 0.8, 1.0))) |
132 | 137 | append_property(shader_mat, 5, 'SpecularColor', to_vec(material.specular_color), Vector((0.0, 0.0, 0.0, 1.0))) |
133 | 138 | append_property(shader_mat, 5, 'AmbientColor', to_vec(material.ambient), Vector((1.0, 1.0, 1.0, 0.0))) |
134 | | - append_property(shader_mat, 5, 'EmissiveColor', to_vec(principled.emission_color), Vector((0.0, 0.0, 0.0, 1.0))) |
| 139 | + append_property(shader_mat, 5, 'EmissiveColor', to_vec(principled.emission_color), color_emissive_default) |
135 | 140 |
|
136 | 141 | if material.texture_1: |
137 | 142 | append_property(shader_mat, 1, 'Texture_0', principled.base_color_texture) |
|
0 commit comments