io_scene_3ds: Update for Blender 3.x #104507

Closed
Sebastian Sille wants to merge 12 commits from nrgsille-patch-2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 31d1a49b2e - Show all commits

View File

@ -668,7 +668,7 @@ def make_material_chunk(material, image):
material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, wrap.emission_color[:3])) material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, wrap.emission_color[:3]))
material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, wrap.base_color[:3])) material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, wrap.base_color[:3]))
material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, material.specular_color[:])) material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, material.specular_color[:]))
material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, wrap.roughness)) material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, 1 - wrap.roughness))
material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, wrap.specular)) material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, wrap.specular))
material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, wrap.metallic)) material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, wrap.metallic))
material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - wrap.alpha)) material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - wrap.alpha))
@ -716,7 +716,7 @@ def make_material_chunk(material, image):
if wrap.roughness_texture: if wrap.roughness_texture:
roughness = [wrap.roughness_texture] roughness = [wrap.roughness_texture]
r_pct = material.roughness r_pct = 1 - material.roughness
matmap = make_material_texture_chunk(MAT_SHINMAP, roughness, r_pct) matmap = make_material_texture_chunk(MAT_SHINMAP, roughness, r_pct)
if matmap: if matmap:
material_chunk.add_subchunk(matmap) material_chunk.add_subchunk(matmap)
@ -749,7 +749,7 @@ def make_material_chunk(material, image):
material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, material.line_color[:3])) material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, material.line_color[:3]))
material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, material.diffuse_color[:3])) material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, material.diffuse_color[:3]))
material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, material.specular_color[:])) material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, material.specular_color[:]))
material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, material.roughness)) material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, 1 - material.roughness))
material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, material.specular_intensity)) material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, material.specular_intensity))
material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, material.metallic)) material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, material.metallic))
material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - material.diffuse_color[3])) material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - material.diffuse_color[3]))