From b3fc252a6e3224ca5b647a21bea590c96e6d9b5e Mon Sep 17 00:00:00 2001 From: Kostantinos Roditakis Date: Fri, 8 Nov 2024 16:14:56 +0200 Subject: [PATCH 1/2] fix: components can use callback --- moai/engine/callbacks/model.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/moai/engine/callbacks/model.py b/moai/engine/callbacks/model.py index 7e2c008..5f07d38 100644 --- a/moai/engine/callbacks/model.py +++ b/moai/engine/callbacks/model.py @@ -17,6 +17,11 @@ def __init__( super().__init__(list) if model: self.data.extend((c for c in model.children() if isinstance(c, Callback))) + for c in model.children(): + for k, v in c.items(): + if isinstance(v, Callback): + self.data.append(v) + if hasattr(model, "named_monitors"): # search within named monitors # for callbacks From 6604134307c3276363841490c53a8193479942ca Mon Sep 17 00:00:00 2001 From: Kostantinos Roditakis Date: Thu, 14 Nov 2024 23:25:55 +0200 Subject: [PATCH 2/2] fix: focusing on named_components --- moai/engine/callbacks/model.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/moai/engine/callbacks/model.py b/moai/engine/callbacks/model.py index 5f07d38..235bdb4 100644 --- a/moai/engine/callbacks/model.py +++ b/moai/engine/callbacks/model.py @@ -16,12 +16,12 @@ def __init__( ): super().__init__(list) if model: - self.data.extend((c for c in model.children() if isinstance(c, Callback))) - for c in model.children(): - for k, v in c.items(): - if isinstance(v, Callback): - self.data.append(v) + # deprecated self.data.extend((c for c in model.children() if isinstance(c, Callback))) + if hasattr(model, "named_components"): + for component in model.named_components.values(): + if isinstance(component, Callback): + self.data.append(component) if hasattr(model, "named_monitors"): # search within named monitors # for callbacks