Skip to content

Commit

Permalink
pylance hates me
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Sep 22, 2024
1 parent 9d3ee86 commit 583404a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions fast64_internal/sm64/animation/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,13 +972,13 @@ def add_data(values_table: IntArray, size: int, anim_data: SM64_AnimData, values
if size_before_add == 0: # If the table was empty, it is simply invalid
raise PluginError(f"Index table cannot fit into value table of {MAX_U16} size")
else: # try again with a fresh value table
value_table.data.resize(size_before_add, refcheck=False) # resize to remove unused data
value_table.data.resize(size_before_add, refcheck=False)
if start_address != -1:
values_address += size_before_add * 2
value_table = IntArray(f"{values_name}_{len(value_tables)}", 9, data=np.empty(MAX_U16, np.int16))
value_tables.append(value_table)
size = 0 # reset size
# don't increment i, redo
value_table.data.resize(size, refcheck=False) # resize to remove unused data
value_table.data.resize(size, refcheck=False)

return indice_tables, value_tables
9 changes: 5 additions & 4 deletions fast64_internal/sm64/animation/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def draw_list_op(layout: UILayout, op_cls: OperatorBase, op_name: str, index=-1,
return op_cls.draw_props(col, icon, text, index=index, op_name=op_name, **op_args)


def draw_list_ops(layout: UILayout, op_cls: type, index: int, **op_args):
def draw_list_ops(layout: UILayout, op_cls: OperatorBase, index: int, **op_args):
layout.label(text=str(index))
ops = ("MOVE_UP", "MOVE_DOWN", "ADD", "REMOVE")
for op_name in ops:
Expand Down Expand Up @@ -1109,15 +1109,16 @@ def draw_table(self, layout: UILayout, export_type: str, actor_name: str, bhv_ex
draw_list_op(op_row, SM64_AnimTableOps, "ADD")
draw_list_op(op_row, SM64_AnimTableOps, "CLEAR")

if self.elements:
box = col.box().column()
if not self.elements:
return

box = col.box().column()
actions_dups: dict[Action, list[int]] = {}
if self.is_dma:
actions_repeats: dict[Action, list[int]] = {} # possible dups
last_action = None
for i, element_props in enumerate(self.elements):
action = element_props.get_action(can_reference=not self.is_dma)
action: Action = element_props.get_action(can_reference=False)
if action != last_action:
if action in actions_repeats:
actions_repeats[action].append(i)
Expand Down

0 comments on commit 583404a

Please sign in to comment.