An animation reaches the scene's own background and objects inside placed containers (#109)
game-maker / gate (push) Successful in 1m33s
game-maker / suite (push) Successful in 5m37s

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-17 06:48:21 +02:00
1 parent 353b348c3c
commit f68941fa3a
7 files changed
+334 -128

No files matched your search

+9 -3
View File
@@ -1,6 +1,7 @@
import { ENTITY_HANDLE, isHandleEnabled, type PointerState, worldMatrixOf } from '../core/graph';
import { newId } from '../core/ids';
import type { Asset } from '../core/model/Asset';
import type { PropertyBag } from '../core/model/Properties';
import { isPlaceableType } from '../core/model/AssetTypes';
import { bakeInstances, materializeInstance, objectRef, resolveObjects } from '../core/model/instance';
import { treeOrder } from '../core/model/hierarchy';
@@ -34,7 +35,8 @@ export interface ModelWrite {
*/
export class World {
readonly entities: Entity[] = [];
backgroundColor = 0x000000;
/** The running scene's own properties – read from the model, and written by an animation over the scene. */
readonly sceneProps: PropertyBag = {};
/** Set by a behavior (Stop game node); the editor leaves play mode on the next tick. */
stopRequested = false;
/** Set by a behavior (Restart game node); the editor restarts the scene on the next tick. */
@@ -83,6 +85,11 @@ export class World {
return this.elapsed;
}
get backgroundColor(): number {
const background = this.sceneProps.backgroundColor;
return typeof background === 'number' ? background : 0x000000;
}
/** Makes the entities match the scene; props are updated in place so systems holding a bag stay current. */
syncFromModel(): void {
const scene = findScene(this.project, this.sceneId);
@@ -91,8 +98,7 @@ export class World {
// behavior destroy one of them for good. Play does it (on its throwaway copy); the editor run
// must not, so there the content stays resolved and `objectRef` writes into the instance edits.
if (this.bakeContainers && bakeInstances(this.project, scene)) this.structureChanged = true;
const background = scene.props.backgroundColor;
this.backgroundColor = typeof background === 'number' ? background : 0x000000;
Object.assign(this.sceneProps, scene.props);
const objects = new Map(resolveObjects(this.project, scene).map((o) => [o.id, o]));
const keep = new Set<Entity>();
for (const object of objects.values()) {