diff --git a/fast64_internal/sm64/animation/constants.py b/fast64_internal/sm64/animation/constants.py index 9ac4db0e4..ab2074cd0 100644 --- a/fast64_internal/sm64/animation/constants.py +++ b/fast64_internal/sm64/animation/constants.py @@ -4,7 +4,7 @@ ( "DMA", "DMA (Mario)", - "No headers or includes are genarated and correct order is applied (needed for decomp converter)", + "No headers or includes are genarated. Mario animation converter order is used (headers, indicies, values)", ), ("Custom", "Custom Path", "Exports to a specific path"), ] diff --git a/fast64_internal/sm64/animation/operators.py b/fast64_internal/sm64/animation/operators.py index 0d1c8fc77..b59fec138 100644 --- a/fast64_internal/sm64/animation/operators.py +++ b/fast64_internal/sm64/animation/operators.py @@ -2,7 +2,7 @@ import os import bpy from bpy.utils import register_class, unregister_class -from bpy.types import Context, Object, Scene +from bpy.types import Context, Object, Scene, Operator from bpy.path import abspath from bpy.props import ( EnumProperty, @@ -80,7 +80,7 @@ def emulate_no_loop(scene: Scene): scene.frame_set(loop_start) -class SM64_PreviewAnimOperator(bpy.types.Operator): +class SM64_PreviewAnimOperator(Operator): bl_idname = "scene.sm64_preview_animation" bl_label = "Preview Animation" bl_options = {"REGISTER", "UNDO", "PRESET"} @@ -137,7 +137,7 @@ def execute(self, context: Context): bpy.ops.object.mode_set(mode=get_mode_set_from_context_mode(starting_context_mode)) -class SM64_TableOperations(bpy.types.Operator): +class SM64_TableOperations(Operator): bl_idname = "scene.sm64_table_operations" bl_label = "" bl_options = {"UNDO"} @@ -176,7 +176,7 @@ def execute(self, context: Context): return {"CANCELLED"} -class SM64_AnimVariantOperations(bpy.types.Operator): +class SM64_AnimVariantOperations(Operator): bl_idname = "scene.sm64_header_variant_operations" bl_label = "" bl_options = {"UNDO"} @@ -225,7 +225,7 @@ def execute(self, context): return {"CANCELLED"} -class SM64_ExportAnimTable(bpy.types.Operator): +class SM64_ExportAnimTable(Operator): bl_idname = "scene.sm64_export_anim_table" bl_label = "Export" bl_description = "Select an armature with animation data to use" @@ -260,13 +260,15 @@ def execute(self, context: Context): return result -class SM64_ExportAnim(bpy.types.Operator): +class SM64_ExportAnim(Operator): bl_idname = "scene.sm64_export_anim" bl_label = "Export" bl_description = "Exports the selected action, select an armature with animation data to use" bl_options = {"REGISTER", "UNDO", "PRESET"} - def execute_operator(self, context: Context): + def execute_operator( + self, context: Context + ): # TODO: Put this stuff into an exporting.py function again? still nice to have stuff be more independetly callable tho scene = context.scene sm64_props = scene.fast64.sm64 anim_export_props = sm64_props.anim_export @@ -282,8 +284,6 @@ def execute_operator(self, context: Context): action, armature_obj, sm64_props.blender_to_sm64_scale, actor_name ) - is_dma_structure = anim_export_props.is_dma_structure(sm64_props) - if sm64_props.export_type == "C": header_type = anim_export_props.header_type @@ -297,7 +297,7 @@ def execute_operator(self, context: Context): applyBasicTweaks(abspath(sm64_props.decomp_path)) with open(anim_path, "w", newline="\n") as file: - file.write(animation.to_c(is_dma_structure, sm64_props.refresh_version)) + file.write(animation.to_c(anim_export_props.is_c_dma_structure, sm64_props.refresh_version)) if header_type != "DMA": table_name = table_props.get_anim_table_name(actor_name) @@ -326,7 +326,7 @@ def execute_operator(self, context: Context): header_type, ) elif sm64_props.export_type == "Insertable Binary": - data, ptrs = animation.to_binary(is_dma_structure, 0) + data, ptrs = animation.to_binary(anim_export_props.binary_is_dma, 0) path = abspath(anim_export_props.insertable_path) writeInsertableFile(path, 2, ptrs, 0, data) else: @@ -360,7 +360,7 @@ def execute(self, context: Context): # Importing -class SM64_ImportAllMarioAnims(bpy.types.Operator): +class SM64_ImportAllMarioAnims(Operator): bl_idname = "scene.sm64_import_mario_anims" bl_label = "Import All Mario Animations" bl_options = {"REGISTER", "UNDO", "PRESET"} @@ -407,7 +407,7 @@ def execute(self, context): return {"CANCELLED"} -class SM64_ImportAnim(bpy.types.Operator): +class SM64_ImportAnim(Operator): bl_idname = "scene.sm64_import_anim" bl_label = "Import Animation" bl_options = {"REGISTER", "UNDO", "PRESET"} @@ -473,7 +473,7 @@ def execute(self, context): return {"CANCELLED"} -class SM64_SearchMarioAnimEnum(bpy.types.Operator): +class SM64_SearchMarioAnimEnum(Operator): bl_idname = "scene.search_mario_anim_enum_operator" bl_label = "Search Mario Animations" bl_description = "Search Mario Animations" diff --git a/fast64_internal/sm64/animation/properties.py b/fast64_internal/sm64/animation/properties.py index 777a19d10..205835dc7 100644 --- a/fast64_internal/sm64/animation/properties.py +++ b/fast64_internal/sm64/animation/properties.py @@ -680,9 +680,9 @@ class SM64_AnimExportProps(PropertyGroup): dma_folder: StringProperty(name="DMA Folder", default="assets/anims/") use_dma_structure: BoolProperty( - name="Use Vanilla DMA Structure", - description="Headers before values and index tables and designated initialisers are not available", - default=True, + name="Use DMA Structure", + description="When enabled, the Mario animation converter order is used (headers, indicies, values)", + default=False, ) custom_path: StringProperty(name="Directory", subtype="FILE_PATH") @@ -699,10 +699,11 @@ class SM64_AnimExportProps(PropertyGroup): insertable_path: StringProperty(name="Insertable Path", subtype="FILE_PATH") - def is_dma_structure(self, sm64_props): - if sm64_props.is_binary_export(): - return self.binary_is_dma - elif self.header_type in {"DMA", "Custom"}: + @property + def is_c_dma_structure(self): + if self.header_type == "DMA": + return True + if self.header_type == "Custom": return self.use_dma_structure return False @@ -764,9 +765,6 @@ def draw_action_properties(self, layout, export_type: str): export_type, ) - def can_use_dma_structure(self): - return self.header_type == "Custom" or self.header_type == "DMA" - def draw_binary_settings(self, layout: UILayout, export_type: str): col = layout.column() col.prop(self, "binary_is_dma") @@ -788,10 +786,8 @@ def draw_c_settings(self, layout: UILayout): if self.header_type != "DMA": prop_split(col, self, "actor_name", "Name") - if self.can_use_dma_structure(): - col.prop(self, "use_dma_structure") - if self.header_type == "Custom": + col.prop(self, "use_dma_structure") col.prop(self, "custom_path") customExportWarning(col) elif self.header_type == "DMA": diff --git a/fast64_internal/sm64/settings/panels.py b/fast64_internal/sm64/settings/panels.py index a44083685..7eb5de9d4 100644 --- a/fast64_internal/sm64/settings/panels.py +++ b/fast64_internal/sm64/settings/panels.py @@ -21,7 +21,6 @@ def draw_repo_settings(scene: Scene, layout: UILayout): prop_split(col, sm64_props, "compression_format", "Compression Format") prop_split(col, sm64_props, "refresh_version", "Refresh (Function Map)") - col.prop(sm64_props.anim_export, "use_dma_structure") class SM64_GeneralSettingsPanel(SM64_Panel): diff --git a/fast64_internal/sm64/settings/repo_settings.py b/fast64_internal/sm64/settings/repo_settings.py index 78c0e2f8d..7397d54eb 100644 --- a/fast64_internal/sm64/settings/repo_settings.py +++ b/fast64_internal/sm64/settings/repo_settings.py @@ -19,7 +19,6 @@ def save_sm64_repo_settings(scene: Scene): sm64_props = scene.fast64.sm64 data["refresh_version"] = sm64_props.refresh_version data["compression_format"] = sm64_props.compression_format - data["use_dma_structure"] = sm64_props.anim_export.use_dma_structure return data @@ -38,4 +37,3 @@ def load_sm64_repo_settings(scene: Scene, data: dict[str, Any]): sm64_props = scene.fast64.sm64 sm64_props.refresh_version = data.get("refresh_version", sm64_props.refresh_version) sm64_props.compression_format = data.get("compression_format", sm64_props.compression_format) - sm64_props.anim_export.use_dma_structure = data.get("use_dma_structure", sm64_props.anim_export.use_dma_structure)