Skip to content

Commit

Permalink
Update converter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Oct 26, 2024
1 parent b9313c4 commit 684e425
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fast64_internal/f3d/bsdf_converter/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,9 @@ def obj_to_f3d(
return True
print(f"Converting BSDF materials in {obj.name}")
uvs = np.empty((len(obj.data.loops), 2), dtype=np.float32) if len(obj.data.uv_layers) != 1 else None
colors = np.ones((len(obj.data.loops), 4), dtype=np.float32)
colors = np.ones((len(obj.data.loops), 4), dtype=np.float32) # TODO: should col and alpha be seperate?

# populate a dict of material -> list of loop indices
loop_indexes: dict[Material, list] = {}
for poly in obj.data.polygons:
material = obj.data.materials[poly.material_index] if poly.material_index < len(obj.data.materials) else None
Expand All @@ -910,7 +911,7 @@ def obj_to_f3d(
for loop_idx in poly.loop_indices:
loop_indexes[material].append(loop_idx)

def get_layer_and_convert(layer_name: str | None):
def get_layer_and_convert(layer_name: str | None): # get color layer, convert it if needed
layer = obj.data.vertex_colors.get(layer_name or "", obj.data.vertex_colors.active)
if layer is None:
return None
Expand Down

0 comments on commit 684e425

Please sign in to comment.