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 52b28788f1 - Show all commits

View File

@ -803,14 +803,17 @@ def extract_triangles(mesh):
uv1, uv2, uv3 = f_uv uv1, uv2, uv3 = f_uv
"""Flag 0x1 sets CA edge visible, Flag 0x2 sets BC edge visible, Flag 0x4 sets AB edge visible """Flag 0x1 sets CA edge visible, Flag 0x2 sets BC edge visible, Flag 0x4 sets AB edge visible
Flag 0x8 indicates a U axis texture wrap and Flag 0x10 indicates a V axis texture wrap Flag 0x8 indicates a U axis texture wrap seam and Flag 0x10 indicates a V axis texture wrap seam
In Blender we use the edge CA, BC, and AB flags for sharp edges flags""" In Blender we use the edge CA, BC, and AB flags for sharp edges flags"""
a_b = mesh.edges[mesh.loops[face.loops[0]].edge_index] a_b = mesh.edges[mesh.loops[face.loops[0]].edge_index]
b_c = mesh.edges[mesh.loops[face.loops[1]].edge_index] b_c = mesh.edges[mesh.loops[face.loops[1]].edge_index]
c_a = mesh.edges[mesh.loops[face.loops[2]].edge_index] c_a = mesh.edges[mesh.loops[face.loops[2]].edge_index]
if v3 == 0: if v3 == 0:
v1, v2, v3 = v3, v1, v2
a_b, b_c, c_a = c_a, a_b, b_c a_b, b_c, c_a = c_a, a_b, b_c
if do_uv:
uv1, uv2, uv3 = uv3, uv1, uv2
faceflag = 0 faceflag = 0
if c_a.use_edge_sharp: if c_a.use_edge_sharp:
@ -822,11 +825,7 @@ def extract_triangles(mesh):
smoothgroup = polygroup[face.polygon_index] smoothgroup = polygroup[face.polygon_index]
if len(f_v)==3: if len(f_v)==3:
if v3 == 0:
v1, v2, v3 = v3, v1, v2
if do_uv:
uv1, uv2, uv3 = uv3, uv1, uv2
new_tri = tri_wrapper((v1, v2, v3), face.material_index, img) new_tri = tri_wrapper((v1, v2, v3), face.material_index, img)
if (do_uv): if (do_uv):
new_tri.faceuvs = uv_key(uv1), uv_key(uv2), uv_key(uv3) new_tri.faceuvs = uv_key(uv1), uv_key(uv2), uv_key(uv3)