Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Apr 23, 2024
1 parent ba805d8 commit b722315
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
14 changes: 1 addition & 13 deletions fast64_internal/sm64/animation/panels.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from bpy.utils import register_class, unregister_class
from bpy.path import abspath
from bpy.types import Context

from ...panels import SM64_Panel
from ...utility import multilineLabel
from ..sm64_utility import import_rom_checks


class SM64_ExportAnimPanel(SM64_Panel):
bl_idname = "SM64_PT_export_anim"
Expand All @@ -27,15 +23,7 @@ def draw(self, context: Context):

sm64_props = context.scene.fast64.sm64

binary_col_enabled = True
try:
if sm64_props.anim_import.import_type == "Binary":
import_rom_checks(abspath(sm64_props.import_rom))
except Exception as exc:
multilineLabel(self.layout.box(), str(exc), "ERROR")
binary_col_enabled = False

sm64_props.anim_import.draw_props(col, binary_col_enabled)
sm64_props.anim_import.draw_props(col, sm64_props.import_rom)


sm64_anim_panels = (
Expand Down
46 changes: 29 additions & 17 deletions fast64_internal/sm64/animation/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
toAlnum,
writeBoxExportType,
)
from ..sm64_utility import import_rom_checks
from ..sm64_constants import (
MAX_U16,
MIN_S16,
Expand Down Expand Up @@ -1279,8 +1280,14 @@ def draw_c(self, layout: UILayout):
col.prop(self, "remove_name_footer")
col.prop(self, "use_custom_name")

def draw_binary(self, layout: UILayout):
def draw_binary(self, layout: UILayout, import_rom_path: str):
col = layout.column()
try:
import_rom_checks(abspath(import_rom_path))
except Exception as exc:
multilineLabel(col.box(), str(exc), "ERROR")
col = col.column()
col.enabled = False

prop_split(col, self, "binary_import_type", "Binary Type")

Expand All @@ -1306,18 +1313,24 @@ def draw_binary(self, layout: UILayout):
prop_split(col, self, "table_index", "List Index")
col.prop(self, "ignore_null")

def draw_insertable_binary(self, layout: UILayout):
def draw_insertable_binary(self, layout: UILayout, import_rom_path: str):
col = layout.column()

col.label(text="Type will be read from the data type of the files")
col.separator()

read_from_rom_box = col.box().column()
read_from_rom_box.prop(self, "insertable_read_from_rom")
from_rom_box = col.box().column()
from_rom_box.prop(self, "insertable_read_from_rom")
if self.insertable_read_from_rom:
prop_split(read_from_rom_box, self, "level", "Level")
read_from_rom_box.prop(self, "is_segmented_address")
prop_split(read_from_rom_box, self, "address", "Address")
try:
import_rom_checks(abspath(import_rom_path))
except Exception as exc:
multilineLabel(from_rom_box.box(), str(exc), "ERROR")
from_rom_box = from_rom_box.column()
from_rom_box.enabled = False
prop_split(from_rom_box, self, "level", "Level")
from_rom_box.prop(self, "is_segmented_address")
prop_split(from_rom_box, self, "address", "Address")

table_box = col.box().column()
table_box.label(text="Table Imports")
Expand All @@ -1326,8 +1339,9 @@ def draw_insertable_binary(self, layout: UILayout):
prop_split(table_box, self, "table_index", "List Index")
table_box.prop(self, "ignore_null")

def draw_props(self, layout: UILayout, binary_col_enabled: bool = True):
def draw_props(self, layout: UILayout, import_rom_path: str):
col = layout.column()

prop_split(col, self, "import_type", "Type")
col.separator()

Expand All @@ -1338,15 +1352,13 @@ def draw_props(self, layout: UILayout, binary_col_enabled: bool = True):

if self.import_type == "C":
self.draw_c(col)
elif self.import_type == "Binary":
binary_col = col.column()
binary_col.enabled = binary_col_enabled
self.draw_binary(binary_col)
elif self.import_type == "Insertable Binary":
self.draw_insertable_binary(col)

if self.import_type in {"Binary", "Insertable Binary"}:
col.prop(self, "assume_bone_count")
else:
if self.import_type == "Binary":
self.draw_binary(col, import_rom_path)
elif self.import_type == "Insertable Binary":
self.draw_insertable_binary(col, import_rom_path)

binary_col.prop(self, "assume_bone_count")

col.separator()
col.operator(SM64_ImportAnim.bl_idname, icon="IMPORT")
Expand Down

0 comments on commit b722315

Please sign in to comment.