Skip to content

Commit

Permalink
break for e, commit because in 2 hours im gonna be sleepy
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Apr 7, 2024
1 parent cc92ce6 commit b7401b8
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 75 deletions.
12 changes: 6 additions & 6 deletions fast64_internal/sm64/animation/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class SM64_Anim:
reference: bool = False
headers: list[SM64_AnimHeader] = dataclasses.field(default_factory=list)
pairs: list[SM64_AnimPair] = dataclasses.field(default_factory=list)
actionName: str = None
action_name: str = None
fileName: str = None

def create_tables(self):
Expand Down Expand Up @@ -354,15 +354,15 @@ def to_c(self, is_dma_structure: bool, refresh_version: str):
def to_action(self, action, remove_name_footer: bool = True):
action_props = action.fast64.sm64

if not self.actionName:
if not self.action_name:
if self.headers[0].name:
if remove_name_footer and self.headers[0].name.startswith("anim_"):
self.actionName = self.headers[0].name.replace("anim_", "", 1)
self.action_name = self.headers[0].name.replace("anim_", "", 1)
else:
self.actionName = self.headers[0].name
self.action_name = self.headers[0].name
else:
self.actionName = hex(self.headers[0].address)
action.name = self.actionName
self.action_name = hex(self.headers[0].address)
action.name = self.action_name

if self.fileName:
action_props.custom_file_name = self.fileName
Expand Down
17 changes: 11 additions & 6 deletions fast64_internal/sm64/animation/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class SM64_TableOperations(Operator):

array_index: IntProperty()
type: StringProperty()
actionName: StringProperty(name="Action")
action_name: StringProperty(name="Action")
header_variant: IntProperty()

def execute_operator(self, context: Context):
Expand All @@ -158,9 +158,14 @@ def execute_operator(self, context: Context):
table_elements.move(self.array_index, self.array_index + 1)
elif self.type == "ADD":
table_elements.add()
table_elements.move(len(table_elements) - 1, self.array_index)
table_elements[-1].action = bpy.data.actions[self.actionName]
table_elements[-1].action = bpy.data.actions[self.action_name]
table_elements[-1].header_variant = self.header_variant
elif self.type == "ADD_ALL":
action = bpy.data.actions[self.action_name]
for header_variant in range(len(action.fast64.sm64.headers)):
table_elements.add()
table_elements[-1].action = action
table_elements[-1].header_variant = header_variant
elif self.type == "REMOVE":
table_elements.remove(self.array_index)
if self.type == "CLEAR":
Expand All @@ -184,10 +189,10 @@ class SM64_AnimVariantOperations(Operator):

array_index: IntProperty()
type: StringProperty()
actionName: StringProperty(name="Action")
action_name: StringProperty(name="Action")

def execute_operator(self, context):
action = bpy.data.actions[self.actionName]
action = bpy.data.actions[self.action_name]
action_props = action.fast64.sm64

variants = action_props.header_variants
Expand Down Expand Up @@ -391,7 +396,7 @@ def execute_operator(self, context):
tableList,
)
header.name = toAlnum(name)
header.data.actionName = name
header.data.action_name = name
else:
raise PluginError("Unimplemented import type.")

Expand Down
1 change: 0 additions & 1 deletion fast64_internal/sm64/animation/panels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import bpy
from bpy.utils import register_class, unregister_class
from bpy.path import abspath
from bpy.types import Context
Expand Down
Loading

0 comments on commit b7401b8

Please sign in to comment.