Currently, the lifecycle described in Scene-Actor-Component model is not actually properly implemented. Specifically, (resume) and (activate) are not called as described during initialization.
To implement this lifecycle, actors should not be properly added to their scenes (via [scene (add-actor)]) immediately after they are created. Instead, a new function should be called to properly initialize them, after all their components and children have been attached.
Currently, the lifecycle described in [Scene-Actor-Component model](https://bytes.keithhacks.cyou/keith/wh-engine/wiki/Scene-Actor-Component-model#lifecycle) is not actually properly implemented. Specifically, `(resume)` and `(activate)` are not called as described during initialization.
To implement this lifecycle, actors should *not* be properly added to their scenes (via `[scene (add-actor)]`) immediately after they are created. Instead, a new function should be called to properly initialize them, after all their components and children have been attached.
The (attach-actor-to-world) functionality can probably be done in [scene (add-actor)] instead?
Also, (parent-activated) and (parent-deactivated) should be rolled into the standard (activate)/(deactivate) methods, with some parameter to specify whether it's being called manually or due to a parent changing activation state.
The `(attach-actor-to-world)` functionality can probably be done in `[scene (add-actor)]` instead?
Also, `(parent-activated)` and `(parent-deactivated)` should be rolled into the standard `(activate)`/`(deactivate)` methods, with some parameter to specify whether it's being called manually or due to a parent changing activation state.
Actually, (attach-actor-to-world) can't really be moved into [scene (add-actor)] because that would also be called when moving an already-initialized actor between scenes.
Actually, `(attach-actor-to-world)` can't really be moved into `[scene (add-actor)]` because that would also be called when moving an already-initialized actor between scenes.
Okay so there's an unpredictable bug where (weak-pointer-value child-ptr) will return nil in #[actor (apply-to-tree)]. This happens when garbage collection occurs after the actors have been created in memory, but before (initialize-actors-in) has completed. During this time, the child actors are only referenced by a weak-pointer in their parent, so they are garbage collected. Not entirely sure how to fix this.
Okay so there's an unpredictable bug where `(weak-pointer-value child-ptr)` will return `nil` in `#[actor (apply-to-tree)]`. This happens when garbage collection occurs after the actors have been created in memory, but before `(initialize-actors-in)` has completed. During this time, the child actors are only referenced by a weak-pointer in their parent, so they are garbage collected. Not entirely sure how to fix this.
Currently, the lifecycle described in Scene-Actor-Component model is not actually properly implemented. Specifically,
(resume)
and(activate)
are not called as described during initialization.To implement this lifecycle, actors should not be properly added to their scenes (via
[scene (add-actor)]
) immediately after they are created. Instead, a new function should be called to properly initialize them, after all their components and children have been attached.The
(attach-actor-to-world)
functionality can probably be done in[scene (add-actor)]
instead?Also,
(parent-activated)
and(parent-deactivated)
should be rolled into the standard(activate)
/(deactivate)
methods, with some parameter to specify whether it's being called manually or due to a parent changing activation state.Actually,
(attach-actor-to-world)
can't really be moved into[scene (add-actor)]
because that would also be called when moving an already-initialized actor between scenes.Okay so there's an unpredictable bug where
(weak-pointer-value child-ptr)
will returnnil
in#[actor (apply-to-tree)]
. This happens when garbage collection occurs after the actors have been created in memory, but before(initialize-actors-in)
has completed. During this time, the child actors are only referenced by a weak-pointer in their parent, so they are garbage collected. Not entirely sure how to fix this.