Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[F3D] Material Ordered By Slot #285

Merged
merged 6 commits into from
Jan 26, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions fast64_internal/f3d/f3d_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,17 @@ def saveStaticModel(

# checkForF3DMaterial(obj)

facesByMat = {}
faces_by_mat = {}
for face in obj.data.loop_triangles:
if face.material_index not in facesByMat:
facesByMat[face.material_index] = []
facesByMat[face.material_index].append(face)
if face.material_index not in faces_by_mat:
faces_by_mat[face.material_index] = []
faces_by_mat[face.material_index].append(face)

# sort by material slot
faces_by_mat = {mat_index: faces_by_mat[mat_index] for mat_index, _ in enumerate(obj.material_slots)}
jesusyoshi54 marked this conversation as resolved.
Show resolved Hide resolved

fMeshes = {}
for material_index, faces in facesByMat.items():
for material_index, faces in faces_by_mat.items():
material = obj.material_slots[material_index].material

if drawLayerField is not None and material.mat_ver > 3:
Expand Down