From 3df66df2269cf36cdcaf04b7679dbc83d7d7c1ce Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 13 Mar 2026 14:42:25 +0100 Subject: [PATCH 1/3] Workaround decomp extracting params macroified The workaround is to try set the params value, and if it fails then fallback to using the actor as "custom", setting the custom actor id and custom params. --- fast64_internal/z64/exporter/scene/actors.py | 22 ++++++++++++-- fast64_internal/z64/importer/actor.py | 31 ++++++++++++-------- fast64_internal/z64/utility.py | 4 ++- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/fast64_internal/z64/exporter/scene/actors.py b/fast64_internal/z64/exporter/scene/actors.py index ba4f2f6d8..62efd3c16 100644 --- a/fast64_internal/z64/exporter/scene/actors.py +++ b/fast64_internal/z64/exporter/scene/actors.py @@ -40,6 +40,24 @@ def getEntryC(self): + ("\n" + indent + "},\n") ) +def split_c_on_commas(s: str): + parts: list[str] = [] + part = "" + parens_depth = 0 + for c in s: + if c == "(": + parens_depth += 1 + if c == ")": + parens_depth -= 1 + if parens_depth < 0: + parens_depth = 0 + if c == "," and parens_depth == 0: + parts.append(part) + part = "" + else: + part += c + parts.append(part) + return parts @dataclass class SceneTransitionActors: @@ -116,14 +134,14 @@ def from_data(raw_data: str, not_zapd_assets: bool): if entry == "": continue - params = entry.replace("{", "").replace("}", "").split(",") + params = split_c_on_commas(entry.replace("{", "").replace("}", "")) # trailing commas for p in params: if p == "": params.remove(p) - assert len(params) == 10 + assert len(params) == 10, entry trans_actor = TransitionActor() trans_actor.name = "(unset)" trans_actor.id = params[4] diff --git a/fast64_internal/z64/importer/actor.py b/fast64_internal/z64/importer/actor.py index 505510b72..bd2e948a0 100644 --- a/fast64_internal/z64/importer/actor.py +++ b/fast64_internal/z64/importer/actor.py @@ -1,4 +1,5 @@ import re +import traceback import bpy from ...utility import parentObject, hexOrDecInt @@ -19,6 +20,21 @@ ) +def set_actor_params(actorProp, actor_id, actor_params): + if actorProp.actor_id != "Custom": + try: + actorProp.set_param_value(actor_params, "Params") + except: + print("Failed to parse params " + actor.params + " for actor " + actor_id + ":") + traceback.print_exc() + print("Defaulting to custom") + actorProp.actor_id = "Custom" + actorProp.actor_id_custom = actor_id + actorProp.params_custom = actor_params + else: + actorProp.params_custom = actor_params + + def parseTransActorList( roomObjs: list[bpy.types.Object], sceneData: str, @@ -66,10 +82,7 @@ def parseTransActorList( actorProp = transActorProp.actor setCustomProperty(actorProp, "actor_id", actor.id, game_data.z64.actors.ootEnumActorID) - if actorProp.actor_id != "Custom": - actorProp.params = actor.params - else: - actorProp.params_custom = actor.params + set_actor_params(actorProp, actor.id, actor.params) handleActorWithRotAsParam(actorProp, actor.id, rotation) unsetAllHeadersExceptSpecified(actorProp.headerSettings, headerIndex) @@ -147,10 +160,7 @@ def parseSpawnList( spawnProp.customActor = actorID != "ACTOR_PLAYER" actorProp = spawnProp.actor setCustomProperty(actorProp, "actor_id", actorID, game_data.z64.actors.ootEnumActorID) - if actorProp.actor_id != "Custom": - actorProp.params = actorParam - else: - actorProp.params_custom = actorParam + set_actor_params(actorProp, actorID, actorParam) handleActorWithRotAsParam(actorProp, actorID, rotation) unsetAllHeadersExceptSpecified(actorProp.headerSettings, headerIndex) @@ -188,10 +198,7 @@ def parseActorList( actorProp = actorObj.ootActorProperty setCustomProperty(actorProp, "actor_id", actorID, game_data.z64.actors.ootEnumActorID) - if actorProp.actor_id != "Custom": - actorProp.params = actorParam - else: - actorProp.params_custom = actorParam + set_actor_params(actorProp, actorID, actorParam) handleActorWithRotAsParam(actorProp, actorID, rotation) unsetAllHeadersExceptSpecified(actorProp.headerSettings, headerIndex) diff --git a/fast64_internal/z64/utility.py b/fast64_internal/z64/utility.py index da7bd8719..76159807b 100644 --- a/fast64_internal/z64/utility.py +++ b/fast64_internal/z64/utility.py @@ -845,7 +845,9 @@ def _eval(node) -> int: try: return _eval(node.body) except: - print("WARNING: something wrong happened:", traceback.print_exc()) + print("WARNING: something wrong happened:") + print("input:", input) + traceback.print_exc() return None From 696dedaec00f749057d49db733eb4f0a7b093c7d Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 13 Mar 2026 14:51:27 +0100 Subject: [PATCH 2/3] fix my code --- fast64_internal/z64/importer/actor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast64_internal/z64/importer/actor.py b/fast64_internal/z64/importer/actor.py index bd2e948a0..af1f09751 100644 --- a/fast64_internal/z64/importer/actor.py +++ b/fast64_internal/z64/importer/actor.py @@ -25,7 +25,7 @@ def set_actor_params(actorProp, actor_id, actor_params): try: actorProp.set_param_value(actor_params, "Params") except: - print("Failed to parse params " + actor.params + " for actor " + actor_id + ":") + print("Failed to parse params " + actor_params + " for actor " + actor_id + ":") traceback.print_exc() print("Defaulting to custom") actorProp.actor_id = "Custom" From 3680ec9a8262eb001bd9784c31a99e6319b2a31e Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 13 Mar 2026 14:53:15 +0100 Subject: [PATCH 3/3] black --- fast64_internal/z64/exporter/scene/actors.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fast64_internal/z64/exporter/scene/actors.py b/fast64_internal/z64/exporter/scene/actors.py index 62efd3c16..7dd3cd0a7 100644 --- a/fast64_internal/z64/exporter/scene/actors.py +++ b/fast64_internal/z64/exporter/scene/actors.py @@ -40,6 +40,7 @@ def getEntryC(self): + ("\n" + indent + "},\n") ) + def split_c_on_commas(s: str): parts: list[str] = [] part = "" @@ -59,6 +60,7 @@ def split_c_on_commas(s: str): parts.append(part) return parts + @dataclass class SceneTransitionActors: name: str