[OoT] Add basic title cards support (#525)

* add basic title card support

* review

* add z64path.h

* remove added includes in favor of another PR
This commit is contained in:
Yanis
2025-05-23 07:39:46 +02:00
committed by GitHub
parent 66d38da91a
commit 552bdb797c
4 changed files with 14 additions and 5 deletions
@@ -48,6 +48,7 @@ class Files: # TODO: find a better name
exportInfo.exportPath,
exportInfo.name,
scene.mainHeader.infos.drawConfig,
scene.mainHeader.infos.title_card_name,
)
@staticmethod
@@ -54,11 +54,10 @@ class SceneTableEntry:
raise PluginError("ERROR: This line is not a scene table entry!")
@staticmethod
def from_scene(scene_name: str, draw_config: str):
# TODO: Implement title cards
def from_scene(scene_name: str, draw_config: str, title_card_name: str):
return SceneTableEntry(
scene_name if scene_name.endswith("_scene") else f"{scene_name}_scene",
"none",
title_card_name if title_card_name.strip() else "none",
get_scene_enum_from_name(scene_name),
draw_config,
"0",
@@ -264,13 +263,13 @@ class SceneTableUtility:
raise PluginError(f"ERROR: Scene name {scene_name} not found in scene table.")
@staticmethod
def edit_scene_table(export_path: str, export_name: str, draw_config: str):
def edit_scene_table(export_path: str, export_name: str, draw_config: str, title_card_name: str):
"""Update the scene table entry of the selected scene"""
path = os.path.join(export_path, "include/tables/scene_table.h")
scene_table = SceneTable.new(path)
export_enum = get_scene_enum_from_name(export_name)
scene_table.update(SceneTableEntry.from_scene(export_name, draw_config), export_enum)
scene_table.update(SceneTableEntry.from_scene(export_name, draw_config, title_card_name), export_enum)
# write the file with the final data
writeFile(path, scene_table.to_c())
@@ -157,6 +157,7 @@ class SceneInfos:
drawConfig: str
appendNullEntrance: bool
useDummyRoomList: bool
title_card_name: str
### Skybox And Sound ###
@@ -185,6 +186,7 @@ class SceneInfos:
Utility.getPropValue(props.sceneTableEntry, "drawConfig"),
props.appendNullEntrance,
sceneObj.fast64.oot.scene.write_dummy_room_list,
Utility.getPropValue(props, "title_card_name"),
Utility.getPropValue(props, "skyboxID"),
Utility.getPropValue(props, "skyboxCloudiness"),
Utility.getPropValue(props, "musicSeq"),
+7
View File
@@ -309,6 +309,10 @@ class OOTSceneHeaderProperty(PropertyGroup):
default=False,
)
title_card_name: StringProperty(
name="Title Card", default="none", description="Segment name of the title card to use"
)
def draw_props(self, layout: UILayout, dropdownLabel: str, headerIndex: int, objName: str):
from .operators import OOT_SearchMusicSeqEnumOperator # temp circular import fix
@@ -338,6 +342,9 @@ class OOTSceneHeaderProperty(PropertyGroup):
drawEnumWithCustom(general, self, "naviCup", "Navi Hints", "")
if headerIndex is None or headerIndex == 0:
self.sceneTableEntry.draw_props(general)
prop_split(general, self, "title_card_name", "Title Card")
if bpy.context.scene.ootSceneExportSettings.customExport:
general.label(text="Custom Export Path enabled, title card will be ignored.", icon="INFO")
general.prop(self, "appendNullEntrance")
skyboxAndSound = layout.column()