Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Jan 21, 2024
1 parent 5a9f64d commit 553ee1c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions fast64_internal/sm64/animation/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ class SM64_Anim:
fileName: str = None

def create_tables(self):
def find_offset(unconnected_value_table: list[SM64_AnimPair], pair: SM64_AnimPair):
def find_offset(added_pairs: list[SM64_AnimPair], pair: SM64_AnimPair):
offset = None
for values in unconnected_value_table:
for i, j in zip(pair.values[0 : len(values)], values[0 : len(pair.values)]):
for added_pair in added_pairs:
for i, j in zip(pair.values[0 : len(added_pair.values)], added_pair.values[0 : len(pair.values)]):
offset = pair.offset
if abs(i - j) > 1:
offset = None
Expand All @@ -249,7 +249,7 @@ def find_offset(unconnected_value_table: list[SM64_AnimPair], pair: SM64_AnimPai

print("Merging values and creating tables.")

value_table, indices_table, added_indices = (
value_table, indices_table, added_pairs = (
SM64_ShortArray(self.valuesReference, True),
SM64_ShortArray(self.indicesReference, False),
[],
Expand All @@ -261,13 +261,12 @@ def find_offset(unconnected_value_table: list[SM64_AnimPair], pair: SM64_AnimPai
raise PluginError("Index pair has too many frames.")

pair.clean_frames()
pairValues: list[int] = pair.values[0:max_frame]
existing_offset = find_offset(added_indices, pairValues)
existing_offset = find_offset(added_pairs, pair)
if existing_offset is None:
offset: int = len(value_table.data)
pair.offset = offset
value_table.data.extend(pairValues)
added_indices.append(pair)
value_table.data.extend(pair.values)
added_pairs.append(pair)
else:
offset: int = existing_offset

Expand Down

0 comments on commit 553ee1c

Please sign in to comment.