Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from .fast64_internal.z64 import OOT_Properties, oot_register, oot_unregister
from .fast64_internal.z64.constants import oot_world_defaults
from .fast64_internal.z64.props_panel_main import OOT_ObjectProperties
from .fast64_internal.z64.actor.properties import initOOTActorProperties
from .fast64_internal.utility_anim import utility_anim_register, utility_anim_unregister, ArmatureApplyWithMeshOperator

from .fast64_internal.mk64 import MK64_Properties, mk64_register, mk64_unregister
Expand Down Expand Up @@ -435,7 +434,6 @@ def register():
addon_updater_ops.register(bl_info)

register_class(Matrix4x4Property)
initOOTActorProperties()
utility_anim_register()
mat_register()
bsdf_conv_register()
Expand Down
114 changes: 24 additions & 90 deletions fast64_internal/data/z64/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,76 +185,6 @@
("ROOM_TYPE_BOSS", "Boss", "0x05"),
]

oot_enum_floor_property = [
("Custom", "Custom", "Custom"),
("0x00", "Default", "Default"),
("0x05", "Trigger Respawn", "Trigger Respawn"),
("0x06", "Grab Wall", "Grab Wall"),
("0x08", "Stop Air Momentum", "Stop Air Momentum"),
("0x09", "Fall Instead Of Jumping", "Fall Instead Of Jumping"),
("0x0B", "Dive Animation", "Dive Animation"),
("0x0C", "Trigger Void", "Trigger Void"),
]

mm_enum_floor_property = [
("Custom", "Custom", "Custom"),
("0x00", "Default", "FLOOR_PROPERTY_0"),
("0x01", "Frontflip Jump Animation", "FLOOR_PROPERTY_1"),
("0x02", "Sideflip Jump Animation", "FLOOR_PROPERTY_2"),
("0x05", "Trigger Respawn (sets human no mask)", "FLOOR_PROPERTY_5"),
("0x06", "Grab Wall", "FLOOR_PROPERTY_6"),
("0x07", "Unknown (sets speed to 0)", "FLOOR_PROPERTY_7"),
("0x08", "Stop Air Momentum", "FLOOR_PROPERTY_8"),
("0x09", "Fall Instead Of Jumping", "FLOOR_PROPERTY_9"),
("0x0B", "Dive Animation", "FLOOR_PROPERTY_11"),
("0x0C", "Trigger Void", "FLOOR_PROPERTY_12"),
("0x0D", "Trigger Void (runs `Player_Action_1`)", "FLOOR_PROPERTY_13"),
]

oot_enum_floor_type = [
("Custom", "Custom", "Custom"),
("0x00", "Default", "Default"),
("0x01", "Haunted Wasteland Camera", "Haunted Wasteland Camera"),
("0x02", "Fire (damages every 6s)", "Fire (damages every 6s)"),
("0x03", "Fire (damages every 3s)", "Fire (damages every 3s)"),
("0x04", "Shallow Sand", "Shallow Sand"),
("0x05", "Slippery", "Slippery"),
("0x06", "Ignore Fall Damage", "Ignore Fall Damage"),
("0x07", "Quicksand Crossing (Blocks Epona)", "Quicksand Crossing (Epona Uncrossable)"),
("0x08", "Jabu Jabu's Belly Floor", "Jabu Jabu's Belly Floor"),
("0x09", "Trigger Void", "Trigger Void"),
("0x0A", "Stops Air Momentum", "Stops Air Momentum"),
("0x0B", "Grotto Exit Animation", "Link Looks Up"),
("0x0C", "Quicksand Crossing (Epona Crossable)", "Quicksand Crossing (Epona Crossable)"),
]

mm_enum_floor_type = [
("Custom", "Custom", "Custom"),
("0x00", "Default", "FLOOR_TYPE_0"),
("0x01", "Unused (?)", "FLOOR_TYPE_1"),
("0x02", "Fire Damages (burns Player every second)", "FLOOR_TYPE_2"),
("0x03", "Fire Damages 2 (burns Player every second)", "FLOOR_TYPE_3"),
("0x04", "Shallow Sand", "FLOOR_TYPE_4"),
("0x05", "Ice (Slippery)", "FLOOR_TYPE_5"),
("0x06", "Ignore Fall Damages", "FLOOR_TYPE_6"),
("0x07", "Quicksand (blocks Epona)", "FLOOR_TYPE_7"),
("0x08", "Jabu Jabu's Belly Floor (Unused)", "FLOOR_TYPE_8"),
("0x09", "Triggers Void", "FLOOR_TYPE_9"),
("0x0A", "Stops Air Momentum", "FLOOR_TYPE_10"),
("0x0B", "Grotto Exit Animation", "FLOOR_TYPE_11"),
("0x0C", "Quicksand (doesn't block Epona)", "FLOOR_TYPE_12"),
("0x0D", "Deeper Shallow Sand", "FLOOR_TYPE_13"),
("0x0E", "Shallow Snow", "FLOOR_TYPE_14"),
("0x0F", "Deeper Shallow Snow", "FLOOR_TYPE_15"),
]

enum_floor_effect = [
("Custom", "Custom", "Custom"),
("0x00", "Default", "FLOOR_EFFECT_0"),
("0x01", "Steep/Slippery Slope", "FLOOR_EFFECT_1"),
("0x02", "Walkable (Preserves Exit Flags)", "FLOOR_EFFECT_2"),
]

oot_enum_camera_setting_type = [
("Custom", "Custom", "Custom"),
("CAM_SET_NONE", "None", "None"),
Expand Down Expand Up @@ -820,8 +750,6 @@ def __init__(self, game: str):
self.is_registering = True
self.update(None, game, True) # forcing the update as we're in the init function

self.enum_floor_effect = enum_floor_effect

def is_oot(self):
self.update(bpy.context, None)
return self.game == "OOT"
Expand Down Expand Up @@ -877,8 +805,6 @@ def update(self, context: Optional[Context], game: Optional[str], force: bool =
self.enum_skybox_config = oot_enum_skybox_config
self.enum_environment_type = oot_enum_environment_type
self.enum_room_type = oot_enum_room_type
self.enum_floor_property = oot_enum_floor_property
self.enum_floor_type = oot_enum_floor_type
self.enum_camera_setting_type = oot_enum_camera_setting_type
self.enum_cs_list_type = oot_enum_cs_list_type
self.skeleton_dict = oot_skeleton_dict
Expand All @@ -892,8 +818,6 @@ def update(self, context: Optional[Context], game: Optional[str], force: bool =
self.enum_skybox_config = mm_enum_skybox_config
self.enum_environment_type = mm_enum_environment_type
self.enum_room_type = mm_enum_room_type
self.enum_floor_property = mm_enum_floor_property
self.enum_floor_type = mm_enum_floor_type
self.enum_camera_setting_type = mm_enum_camera_setting_type
self.enum_cs_list_type = mm_enum_cs_list_type
self.skeleton_dict = mm_skeleton_dict
Expand All @@ -903,25 +827,29 @@ def update(self, context: Optional[Context], game: Optional[str], force: bool =

self.enum_map: dict[str, list[tuple[str, str, str]]] = {
"globalObject": self.enums.enum_global_object,
"musicSeq": self.enums.enum_seq_id,
"seq_id": self.enums.enum_seq_id,
"drawConfig": self.enums.enum_draw_config,
"sound": self.enums.enum_surface_material,
"csDestination": self.enums.enum_cs_destination,
"seqId": self.enums.enum_seq_id,
"playerCueID": self.enums.enum_cs_player_cue_id,
"ocarinaAction": self.enums.enum_ocarina_song_action_id,
"csTextType": self.enums.enum_cs_text_type,
"csSeqPlayer": self.enums.enum_cs_fade_out_seq_player,
"csMiscType": self.enums.enum_cs_misc_type,
"transitionType": self.enums.enum_cs_transition_type,
"actor_cue_list_cmd_type": self.enums.enum_cs_actor_cue_list_cmd_type,
"surface_material": self.enums.enum_surface_material,
"cs_destination": self.enums.enum_cs_destination,
"cs_player_cue_id": self.enums.enum_cs_player_cue_id,
"cs_song_action_id": self.enums.enum_ocarina_song_action_id,
"cs_text_type": self.enums.enum_cs_text_type,
"cs_seq_player": self.enums.enum_cs_fade_out_seq_player,
"cs_misc_type": self.enums.enum_cs_misc_type,
"cs_transition_type": self.enums.enum_cs_transition_type,
"cs_actor_cue_list": self.enums.enum_cs_actor_cue_list_cmd_type,
"spline_interp_type": self.enums.enum_cs_spline_interp_type,
"spline_rel_to": self.enums.enum_cs_spline_rel,
"trans_general": self.enums.enum_cs_transition_general,
"blur_type": self.enums.enum_cs_motion_blur_type,
"credits_scene_type": self.enums.enum_cs_credits_scene_type,
"mod_seq_type": self.enums.enum_cs_modify_seq_type,
"objectKey": self.objects.ootEnumObjectKey,
"wall_type": self.enums.enum_wall_type,
"floor_effect": self.enums.enum_floor_effect,
"floor_property": self.enums.enum_floor_property,
"floor_type": self.enums.enum_floor_type,
"conveyor_speed": self.enums.enum_conveyor_speed,
"object_key": self.objects.ootEnumObjectKey,
"actor_id": self.actors.ootEnumActorID,
"chest_content": self.actors.ootEnumChestContent,
"navi_msg_id": self.actors.ootEnumNaviMessageData,
Expand All @@ -931,8 +859,6 @@ def update(self, context: Optional[Context], game: Optional[str], force: bool =
"nature_id": self.enum_nature_id,
"room_type": self.enum_room_type,
"environment_type": self.enum_environment_type,
"floor_property": self.enum_floor_property,
"floor_type": self.enum_floor_type,
"camera_setting_type": self.enum_camera_setting_type,
"cs_list_type": self.enum_cs_list_type,
"skeleton_mode": self.enum_skeleton_mode,
Expand All @@ -941,3 +867,11 @@ def update(self, context: Optional[Context], game: Optional[str], force: bool =
def get_enum(self, prop_name: str):
self.update(bpy.context, None)
return self.enum_map[prop_name]

def get_enum_value(self, enum_key: str, item_key: str):
enum = self.enums.enumByKey[enum_key]

if bpy.context.scene.fast64.oot.useDecompFeatures:
return enum.item_by_key[item_key].id
else:
return str(enum.item_by_key[item_key].index)
36 changes: 13 additions & 23 deletions fast64_internal/data/z64/enum_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Z64_ItemElement(Z64_BaseElement):
parentKey: str
game: str
desc: str
enum_index: int

def __post_init__(self):
# generate the name from the id
Expand All @@ -35,14 +36,8 @@ def __post_init__(self):
"ocarina_song_action_id": "OCARINA_ACTION",
"seq_id": "NA_BGM",
"draw_config": ("SCENE_DRAW_CFG" if self.game == "MM" else "SDC"),
"surface_material": "SURFACE_MATERIAL",
"global_object": "OBJECT",
"floor_type": "",
"wall_type": "",
"floor_property": "",
"surface_sfx_offset": "",
"floor_effect": "",
"conveyor_speed": "",
"surface_sfx_offset": "SURFACE_SFX_OFFSET",
}

self.name = self.id.removeprefix(f"{keyToPrefix[self.parentKey]}_")
Expand All @@ -65,6 +60,7 @@ class Z64_EnumElement(Z64_BaseElement):
item_by_id: dict[int, Z64_ItemElement] = field(default_factory=dict)

def __post_init__(self):
self.items.sort(key=lambda item: item.enum_index)
self.item_by_key = {item.key: item for item in self.items}
self.item_by_index = {item.index: item for item in self.items}
self.item_by_id = {item.id: item for item in self.items}
Expand Down Expand Up @@ -98,15 +94,14 @@ def __init__(self, game: str):
enum.attrib["Key"],
game,
item.attrib.get("Description", "Unset"),
int(item.attrib.get("EnumIndex", str(i))),
)
for item in enum
for i, item in enumerate(enum)
],
)
)

# create list of tuples used by Blender's enum properties
self.deletedEntry = ("None", "(Deleted from the XML)", "None")

self.enum_cs_cmd: list[tuple[str, str, str]] = []
self.enum_cs_misc_type: list[tuple[str, str, str]] = []
self.enum_cs_text_type: list[tuple[str, str, str]] = []
Expand All @@ -127,7 +122,6 @@ def __init__(self, game: str):
self.enum_ocarina_song_action_id: list[tuple[str, str, str]] = []
self.enum_seq_id: list[tuple[str, str, str]] = []
self.enum_draw_config: list[tuple[str, str, str]] = []
self.enum_surface_material: list[tuple[str, str, str]] = []
self.enum_global_object: list[tuple[str, str, str]] = []
self.enum_floor_type: list[tuple[str, str, str]] = []
self.enum_wall_type: list[tuple[str, str, str]] = []
Expand All @@ -143,27 +137,23 @@ def __init__(self, game: str):
for key in self.enumByKey.keys():
setattr(self, f"enum_{key}", self.get_enum_data(key))

# Note: `CS_CMD_UNIMPLEMENTED_16` is an unused actor cue
self.enum_cs_actor_cue_list_cmd_type = [
item for item in self.enum_cs_cmd if "actor_cue" in item[0] or "player_cue" in item[0]
(item[0], item[1], item[2])
for item in self.enum_cs_cmd
if "actor_cue" in item[0] or "player_cue" in item[0] or item[0] == "unimplemented_16"
]
self.enum_cs_actor_cue_list_cmd_type.sort()
self.enum_cs_actor_cue_list_cmd_type.insert(0, ("Custom", "Custom", "Custom"))

def get_enum_data(self, enumKey: str):
enum = self.enumByKey[enumKey]
firstIndex = min(1, *(item.index for item in enum.items))
lastIndex = max(1, *(item.index for item in enum.items)) + 1
enumData = [self.deletedEntry] * lastIndex
custom = ("Custom", "Custom", "Custom")
enumData = [("None", "(Deleted from the XML)", "None", i + 1) for i in range(len(enum.items))]

for item in enum.items:
if item.index < lastIndex:
if item.enum_index < len(enum.items):
identifier = item.key
enumData[item.index] = (identifier, item.name, item.id)

if firstIndex > 0:
enumData[0] = custom
else:
enumData.insert(0, custom)
enumData[item.enum_index] = (identifier, item.name, item.id, item.enum_index + 1)

enumData.insert(0, ("Custom", "Custom", "Custom", 0))
return enumData
2 changes: 1 addition & 1 deletion fast64_internal/data/z64/xml/mm_actor_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ for each sub element (of <Actor>) mentioned below:
<Item Key="item_3E" Value="0x3E" Name="Map" />
<Item Key="item_3F" Value="0x3F" Name="Compass" />
<Item Key="item_40" Value="0x40" Name="GI_40" />
<Item Key="item_41" Value="0x41" Name="Hookshor" />
<Item Key="item_41" Value="0x41" Name="Hookshot" />
<Item Key="item_42" Value="0x42" Name="Lens of Truth" />
<Item Key="item_43" Value="0x43" Name="Pictograph Box" />
<Item Key="item_44" Value="0x44" Name="GI_44" />
Expand Down
36 changes: 36 additions & 0 deletions fast64_internal/data/z64/xml/mm_enum_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,42 @@
<Item Key="surface_material_carpet" ID="SURFACE_MATERIAL_CARPET" Name="Carpet" Index="13"/>
<Item Key="surface_material_snow" ID="SURFACE_MATERIAL_SNOW" Name="Snow" Index="14"/>
</Enum>
<Enum Key="floor_type" ID="FloorType">
<Item Key="floor_type_0" ID="FLOOR_TYPE_0" Name="Default" Index="0"/>
<Item Key="floor_type_1" ID="FLOOR_TYPE_1" Name="Unused (?)" Index="1"/>
<Item Key="floor_type_2" ID="FLOOR_TYPE_2" Name="Fire Damages (burns Player every second)" Index="2"/>
<Item Key="floor_type_3" ID="FLOOR_TYPE_3" Name="Fire Damages 2 (burns Player every second)" Index="3"/>
<Item Key="floor_type_4" ID="FLOOR_TYPE_4" Name="Shallow Sand" Index="4"/>
<Item Key="floor_type_5" ID="FLOOR_TYPE_5" Name="Ice (Slippery)" Index="5"/>
<Item Key="floor_type_6" ID="FLOOR_TYPE_6" Name="Ignore Fall Damages" Index="6"/>
<Item Key="floor_type_7" ID="FLOOR_TYPE_7" Name="Quicksand (blocks Epona)" Index="7"/>
<Item Key="floor_type_8" ID="FLOOR_TYPE_8" Name="Jabu Jabu's Belly Floor (Unused)" Index="8"/>
<Item Key="floor_type_9" ID="FLOOR_TYPE_9" Name="Triggers Void" Index="9"/>
<Item Key="floor_type_10" ID="FLOOR_TYPE_10" Name="Stops Air Momentum" Index="10"/>
<Item Key="floor_type_11" ID="FLOOR_TYPE_11" Name="Grotto Exit Animation" Index="11"/>
<Item Key="floor_type_12" ID="FLOOR_TYPE_12" Name="Quicksand (doesn't block Epona)" Index="12"/>
<Item Key="floor_type_13" ID="FLOOR_TYPE_13" Name="Deeper Shallow Sand" Index="13"/>
<Item Key="floor_type_14" ID="FLOOR_TYPE_14" Name="Shallow Snow" Index="14"/>
<Item Key="floor_type_15" ID="FLOOR_TYPE_15" Name="Deeper Shallow Snow" Index="15"/>
</Enum>
<Enum Key="floor_property" ID="FloorProperty">
<Item Key="floor_property_0" ID="FLOOR_PROPERTY_0" Name="Default" Index="0"/>
<Item Key="floor_property_1" ID="FLOOR_PROPERTY_1" Name="Frontflip Jump Animation" Index="1"/>
<Item Key="floor_property_2" ID="FLOOR_PROPERTY_2" Name="Sideflip Jump Animation" Index="2"/>
<Item Key="floor_property_5" ID="FLOOR_PROPERTY_5" Name="Trigger Respawn (sets human no mask)" Index="5"/>
<Item Key="floor_property_6" ID="FLOOR_PROPERTY_6" Name="Grab Wall" Index="6"/>
<Item Key="floor_property_7" ID="FLOOR_PROPERTY_7" Name="Unknown (sets speed to 0)" Index="7"/>
<Item Key="floor_property_8" ID="FLOOR_PROPERTY_8" Name="Stop Air Momentum" Index="8"/>
<Item Key="floor_property_9" ID="FLOOR_PROPERTY_9" Name="Fall Instead Of Jumping" Index="9"/>
<Item Key="floor_property_11" ID="FLOOR_PROPERTY_11" Name="Dive Animation" Index="11"/>
<Item Key="floor_property_12" ID="FLOOR_PROPERTY_12" Name="Trigger Void" Index="12"/>
<Item Key="floor_property_13" ID="FLOOR_PROPERTY_13" Name="Trigger Void (runs `Player_Action_1`)" Index="13"/>
</Enum>
<Enum Key="floor_effect" ID="FloorEffect">
<Item Key="floor_effect_0" ID="FLOOR_EFFECT_0" Name="Default" Index="0"/>
<Item Key="floor_effect_1" ID="FLOOR_EFFECT_1" Name="Steep/Slippery Slope" Index="1"/>
<Item Key="floor_effect_2" ID="FLOOR_EFFECT_2" Name="Walkable (Preserves Exit Flags)" Index="2"/>
</Enum>
<Enum Key="global_object" ID="GlobalObjects">
<Item Key="gameplay_field_keep" ID="GAMEPLAY_FIELD_KEEP" Name="Overworld" Index="1"/>
<Item Key="gameplay_dangeon_keep" ID="GAMEPLAY_DANGEON_KEEP" Name="Dungeon" Index="2"/>
Expand Down
Loading