Implement proper actor/component lifecycle #9
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.