From ac822b8f1688242a37b58cf8274f46ae3434fe5d Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 5 Jan 2024 19:44:26 +0100 Subject: [PATCH 1/3] fix wrong segments on import (thanks to cdi-fails) --- fast64_internal/oot/oot_model_classes.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fast64_internal/oot/oot_model_classes.py b/fast64_internal/oot/oot_model_classes.py index 5d0b77869..f50756b7b 100644 --- a/fast64_internal/oot/oot_model_classes.py +++ b/fast64_internal/oot/oot_model_classes.py @@ -389,7 +389,14 @@ def processDLName(self, name): except: if name == "gEmptyDL": return None - return name + else: + for attr_name in dir(self.materialContext.ootMaterial.opaque): + if re.match("segment[89ABCD]", attr_name): + setattr(self.materialContext.ootMaterial.opaque, attr_name, False) + for attr_name in dir(self.materialContext.ootMaterial.transparent): + if re.match("segment[89ABCD]", attr_name): + setattr(self.materialContext.ootMaterial.transparent, attr_name, False) + return name else: segment = pointer >> 24 if segment >= 0x08 and segment <= 0x0D: @@ -397,7 +404,6 @@ def processDLName(self, name): setattr(self.materialContext.ootMaterial.transparent, "segment" + format(segment, "1X"), True) self.materialChanged = True return None - return name def processTextureName(self, textureName): try: From 9c818641ca62a9b72e66156564fe14060b9717fc Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:26:54 +0100 Subject: [PATCH 2/3] improvements --- fast64_internal/oot/oot_model_classes.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fast64_internal/oot/oot_model_classes.py b/fast64_internal/oot/oot_model_classes.py index f50756b7b..4c322baaa 100644 --- a/fast64_internal/oot/oot_model_classes.py +++ b/fast64_internal/oot/oot_model_classes.py @@ -390,12 +390,12 @@ def processDLName(self, name): if name == "gEmptyDL": return None else: - for attr_name in dir(self.materialContext.ootMaterial.opaque): - if re.match("segment[89ABCD]", attr_name): - setattr(self.materialContext.ootMaterial.opaque, attr_name, False) - for attr_name in dir(self.materialContext.ootMaterial.transparent): - if re.match("segment[89ABCD]", attr_name): - setattr(self.materialContext.ootMaterial.transparent, attr_name, False) + def clear_segment_attrs(obj): + for attr_name in dir(obj): + setattr(obj, attr_name, False) + + clear_segment_attrs(self.materialContext.ootMaterial.opaque) + clear_segment_attrs(self.materialContext.ootMaterial.transparent) return name else: segment = pointer >> 24 From 6fc81f5c86e69ee39acc311212747befe48bd27e Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Mon, 20 May 2024 15:35:43 +0200 Subject: [PATCH 3/3] format --- fast64_internal/oot/oot_model_classes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fast64_internal/oot/oot_model_classes.py b/fast64_internal/oot/oot_model_classes.py index 95db1ca29..5fc3fe771 100644 --- a/fast64_internal/oot/oot_model_classes.py +++ b/fast64_internal/oot/oot_model_classes.py @@ -384,6 +384,7 @@ def processDLName(self, name): if name == "gEmptyDL": return None else: + def clear_segment_attrs(obj): for attr_name in dir(obj): setattr(obj, attr_name, False)