3
11

io_scene_3ds: Added face and point flags #11

Merged
Sebastian Sille merged 3 commits from :main into main 2023-03-26 19:29:34 +02:00
Showing only changes of commit cce6fce4bc - Show all commits

View File

@ -400,15 +400,6 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
for fidx in faces: for fidx in faces:
bmesh.polygons[fidx].material_index = mat_idx bmesh.polygons[fidx].material_index = mat_idx
# if uv_faces and img:
# for fidx in faces:
# bmesh.polygons[fidx].material_index = mat_idx
# # TODO: How to restore this?
# # uv_faces[fidx].image = img
# else:
# for fidx in faces:
# bmesh.polygons[fidx].material_index = mat_idx
if uv_faces: if uv_faces:
uvl = bmesh.uv_layers.active.data[:] uvl = bmesh.uv_layers.active.data[:]
for fidx, pl in enumerate(bmesh.polygons): for fidx, pl in enumerate(bmesh.polygons):
@ -433,13 +424,16 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
imported_objects.append(ob) imported_objects.append(ob)
if myContextMesh_flag: if myContextMesh_flag:
# Bit 0 (0x1) sets edge CA visible, Bit 1 (0x2) sets edge BC visible and Bit 2 (0x4) sets the edge AB visible # Bit 0 (0x1) sets edge CA visible, Bit 1 (0x2) sets edge BC visible and Bit 2 (0x4) sets edge AB visible
# In Blender we use sharp edges for those flags # In Blender we use sharp edges for those flags
for lt, tri in enumerate(bmesh.loop_triangles): for f, pl in enumerate(bmesh.polygons):
faceflag = myContextMesh_flag[lt] face = myContextMesh_facels[f]
edge_ca = bmesh.edges[bmesh.loops[tri.loops[2]].edge_index] faceflag = myContextMesh_flag[f]
edge_bc = bmesh.edges[bmesh.loops[tri.loops[1]].edge_index] edge_ab = bmesh.edges[bmesh.loops[pl.loop_start].edge_index]
edge_ab = bmesh.edges[bmesh.loops[tri.loops[0]].edge_index] edge_bc = bmesh.edges[bmesh.loops[pl.loop_start + 1].edge_index]
edge_ca = bmesh.edges[bmesh.loops[pl.loop_start + 2].edge_index]
if face[2] == 0:
edge_ab, edge_bc, edge_ca = edge_ca, edge_ab, edge_bc
if faceflag == 1: if faceflag == 1:
edge_ca.use_edge_sharp = True edge_ca.use_edge_sharp = True
elif faceflag == 2: elif faceflag == 2:
@ -455,8 +449,10 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
elif faceflag == 6: elif faceflag == 6:
edge_bc.use_edge_sharp = True edge_bc.use_edge_sharp = True
edge_ab.use_edge_sharp = True edge_ab.use_edge_sharp = True
elif faceflag >= 7: elif faceflag == 7:
pass edge_bc.use_edge_sharp = True
edge_ab.use_edge_sharp = True
edge_ca.use_edge_sharp = True
if myContextMesh_smooth: if myContextMesh_smooth:
for f, pl in enumerate(bmesh.polygons): for f, pl in enumerate(bmesh.polygons):