@onerjs/core 8.49.4 → 8.49.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAI/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAM9E,OAAO,EAA+B,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAE/G,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAmC,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEvG,MAAM,CAAN,IAAkB,cAajB;AAbD,WAAkB,cAAc;IAC5B;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,uDAAM,CAAA;AACV,CAAC,EAbiB,cAAc,KAAd,cAAc,QAa/B;AAqCD;;;;;;;GAOG;AACH,MAAM,OAAO,SAAS;IA8BlB;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAWD;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK,CAAC,KAAqB;QAClC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,YAAmB,MAAwB;QAhE3C;;WAEG;QACI,6BAAwB,GAA+B,IAAI,UAAU,EAAE,CAAC;QAC/E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ACnE,kEAAkE;QAClE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,cAAc,GAAG,CAAC,KAAqB,EAAE,EAAE;YAC7C,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC3B,OAAO;YACX,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACzB,MAAM,eAAe,GAAQ,EAAE,CAAC;YAChC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YACjC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,mBAAmB,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC3C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5C,MAAM,iBAAiB,GAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,SAAS,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;YAC7D,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Observer, Observable } from \"../Misc/observable\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\nimport { type IFlowGraphEventTrigger, FlowGraphSceneEventCoordinator } from \"./flowGraphSceneEventCoordinator\";\r\nimport { type FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _IsDescendantOf } from \"./utils\";\r\nimport { type IFlowGraphValidationResult, ValidateFlowGraphWithBlockList } from \"./flowGraphValidator\";\r\n\r\nexport const enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n /**\r\n * The graph is paused (contexts kept, pending tasks cancelled)\r\n */\r\n Paused,\r\n}\r\n\r\n/**\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface IFlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n}\r\n\r\n/**\r\n * Options for parsing a flow graph.\r\n */\r\nexport interface IFlowGraphParseOptions {\r\n /**\r\n * A function that parses complex values in a scene.\r\n * @param key the key of the value\r\n * @param serializationObject the object to read the value from\r\n * @param assetsContainer the assets container to read assets from\r\n * @param scene the scene to read the value from\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The flow graph coordinator.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * A function that converts a path to an object accessor.\r\n */\r\n pathConverter?: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n/**\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n *\r\n * @experimental FlowGraph is still in development and is subject to change.\r\n */\r\nexport class FlowGraph {\r\n /**\r\n * An observable that is triggered when the state of the graph changes.\r\n */\r\n public onStateChangedObservable: Observable<FlowGraphState> = new Observable();\r\n /** @internal */\r\n public _eventBlocks: { [keyof in FlowGraphEventType]: FlowGraphEventBlock[] } = {\r\n [FlowGraphEventType.SceneReady]: [],\r\n [FlowGraphEventType.SceneDispose]: [],\r\n [FlowGraphEventType.SceneBeforeRender]: [],\r\n [FlowGraphEventType.MeshPick]: [],\r\n [FlowGraphEventType.PointerDown]: [],\r\n [FlowGraphEventType.PointerUp]: [],\r\n [FlowGraphEventType.PointerMove]: [],\r\n [FlowGraphEventType.PointerOver]: [],\r\n [FlowGraphEventType.PointerOut]: [],\r\n [FlowGraphEventType.SceneAfterRender]: [],\r\n [FlowGraphEventType.NoTrigger]: [],\r\n };\r\n\r\n /**\r\n * All blocks that belong to this graph, including unreachable ones.\r\n * @internal\r\n */\r\n public _allBlocks: FlowGraphBlock[] = [];\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n\r\n /**\r\n * The scene associated with this flow graph.\r\n */\r\n public get scene(): Scene {\r\n return this._scene;\r\n }\r\n private _coordinator: FlowGraphCoordinator;\r\n private _executionContexts: FlowGraphContext[] = [];\r\n private _sceneEventCoordinator: FlowGraphSceneEventCoordinator;\r\n private _eventObserver: Nullable<Observer<IFlowGraphEventTrigger>>;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n private _state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public get state() {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public set state(value: FlowGraphState) {\r\n this._state = value;\r\n this.onStateChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: IFlowGraphParams) {\r\n this._scene = params.scene;\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n this._coordinator = params.coordinator;\r\n }\r\n\r\n private _attachEventObserver() {\r\n if (this._eventObserver) {\r\n return;\r\n }\r\n this._eventObserver = this._sceneEventCoordinator.onEventTriggeredObservable.add((event) => {\r\n if (event.type === FlowGraphEventType.SceneDispose) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n\r\n for (const context of this._executionContexts) {\r\n const order = this._getContextualOrder(event.type, context);\r\n for (const block of order) {\r\n // iterate contexts\r\n if (!block._executeEvent(context, event.payload)) {\r\n break;\r\n }\r\n }\r\n }\r\n // custom behavior(s) of specific events\r\n switch (event.type) {\r\n case FlowGraphEventType.SceneReady:\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n break;\r\n case FlowGraphEventType.SceneBeforeRender:\r\n for (const context of this._executionContexts) {\r\n context._notifyOnTick(event.payload);\r\n }\r\n break;\r\n }\r\n });\r\n }\r\n\r\n private _detachEventObserver() {\r\n this._eventObserver?.remove();\r\n this._eventObserver = null;\r\n }\r\n\r\n /**\r\n * Sets a new scene for this flow graph, re-wiring all event listeners.\r\n * This is useful when the scene the flow graph should listen to changes\r\n * (e.g. when a new scene is loaded in an editor preview).\r\n * If the graph is currently running, it will be stopped first and must be\r\n * restarted manually after calling this method.\r\n * @param scene the new scene to attach to\r\n */\r\n public setScene(scene: Scene): void {\r\n if (scene === this._scene) {\r\n return;\r\n }\r\n if (this.state === FlowGraphState.Started) {\r\n this.stop();\r\n }\r\n // Tear down old event coordinator\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n // Rebuild with the new scene\r\n (this as { _scene: Scene })._scene = scene;\r\n this._scene.constantlyUpdateMeshUnderPointer = true; // ensure pointer info is always up to date for event blocks that need it\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n // Pre-attach the event observer so that events from the new\r\n // coordinator are routed to the graph immediately. The handler\r\n // guards against processing events while the graph is stopped,\r\n // but having the observer in place ensures no events are lost\r\n // when start() is called shortly after.\r\n this._attachEventObserver();\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n /**\r\n * Returns the execution context at a given index\r\n * @param index the index of the context\r\n * @returns the execution context at that index\r\n */\r\n public getContext(index: number) {\r\n return this._executionContexts[index];\r\n }\r\n\r\n /**\r\n * Returns all blocks registered in this graph, including disconnected ones.\r\n * @returns a read-only array of all blocks\r\n */\r\n public getAllBlocks(): readonly FlowGraphBlock[] {\r\n return this._allBlocks;\r\n }\r\n\r\n /**\r\n * Register a block with the graph. This does not wire any connections;\r\n * it simply ensures the block is tracked so that serialization, editor\r\n * display, and validation see it even when it is not reachable from an\r\n * event block.\r\n * @param block the block to register\r\n */\r\n public addBlock(block: FlowGraphBlock): void {\r\n if (this._allBlocks.indexOf(block) === -1) {\r\n this._allBlocks.push(block);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a block from the graph. Disconnects all of its ports and, if it\r\n * is an event block, unregisters it from the event-block lists.\r\n * @param block the block to remove\r\n */\r\n public removeBlock(block: FlowGraphBlock): void {\r\n const idx = this._allBlocks.indexOf(block);\r\n if (idx !== -1) {\r\n this._allBlocks.splice(idx, 1);\r\n }\r\n // If it is an event block, remove from the event-block registry\r\n if (block instanceof FlowGraphExecutionBlock && \"type\" in block) {\r\n const eventBlock = block as unknown as FlowGraphEventBlock;\r\n const list = this._eventBlocks[eventBlock.type];\r\n if (list) {\r\n const eIdx = list.indexOf(eventBlock);\r\n if (eIdx !== -1) {\r\n list.splice(eIdx, 1);\r\n }\r\n }\r\n }\r\n // If the block has pending async tasks (e.g. event subscriptions),\r\n // cancel them in all active execution contexts so deletion takes\r\n // effect immediately even while the graph is running.\r\n if (block instanceof FlowGraphAsyncExecutionBlock) {\r\n for (const context of this._executionContexts) {\r\n block._cancelPendingTasks(context);\r\n block._resetAfterCanceled(context);\r\n }\r\n }\r\n // Disconnect all ports\r\n for (const input of block.dataInputs) {\r\n input.disconnectFromAll();\r\n }\r\n for (const output of block.dataOutputs) {\r\n output.disconnectFromAll();\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n signalIn.disconnectFromAll();\r\n }\r\n for (const signalOut of block.signalOutputs) {\r\n signalOut.disconnectFromAll();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block the event block to be added\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n this.addBlock(block);\r\n if (block.type === FlowGraphEventType.PointerOver || block.type === FlowGraphEventType.PointerOut) {\r\n this._scene.constantlyUpdateMeshUnderPointer = true;\r\n }\r\n\r\n this._eventBlocks[block.type].push(block);\r\n\r\n // if already started, sort and add to the pending\r\n if (this.state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n } else {\r\n this.onStateChangedObservable.addOnce((state) => {\r\n if (state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stops the flow graph. Cancels all pending tasks and clears execution contexts,\r\n * but keeps event blocks so the graph can be restarted.\r\n */\r\n public stop() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n }\r\n\r\n /**\r\n * Pauses the flow graph. Cancels pending tasks but keeps execution contexts and event blocks.\r\n * Call start() to resume.\r\n */\r\n public pause() {\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Paused;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n * Can also be called to resume from a paused state.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n const resumingFromPause = this.state === FlowGraphState.Paused;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n this._attachEventObserver();\r\n this.state = FlowGraphState.Started;\r\n this._startPendingEvents();\r\n // On a fresh start (not resume), fire the SceneReady event.\r\n // The coordinator's own scene-ready observer may have already\r\n // fired (and been lost) while the graph was stopped, so reset\r\n // the flag and handle the ready state ourselves.\r\n if (!resumingFromPause) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = false;\r\n if (this._scene.isReady(true)) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n } else {\r\n // Scene isn't ready yet (e.g. pending shader compilations after\r\n // a scene swap). Use executeWhenReady(true) which restarts the\r\n // readiness check loop — a plain addOnce on onReadyObservable\r\n // may never fire if the check loop already completed.\r\n this._scene.executeWhenReady(() => {\r\n if (this.state === FlowGraphState.Started && !this._sceneEventCoordinator.sceneReadyTriggered) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n }\r\n }, true);\r\n }\r\n }\r\n }\r\n\r\n private _startPendingEvents() {\r\n for (const context of this._executionContexts) {\r\n for (const type in this._eventBlocks) {\r\n const order = this._getContextualOrder(type as FlowGraphEventType, context);\r\n for (const block of order) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(type: FlowGraphEventType, context: FlowGraphContext): FlowGraphEventBlock[] {\r\n const order = this._eventBlocks[type].sort((a, b) => b.initPriority - a.initPriority);\r\n\r\n if (type === FlowGraphEventType.MeshPick) {\r\n const meshPickOrder = [] as FlowGraphEventBlock[];\r\n for (const block1 of order) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n if (mesh1 && mesh2 && _IsDescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n meshPickOrder.splice(i, 0, block1);\r\n }\r\n return meshPickOrder;\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n for (const type in this._eventBlocks) {\r\n this._eventBlocks[type as FlowGraphEventType].length = 0;\r\n }\r\n this._allBlocks.length = 0;\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const type in this._eventBlocks) {\r\n for (const block of this._eventBlocks[type as FlowGraphEventType]) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Validates the flow graph and returns all issues found.\r\n * Uses the tracked block list for complete validation including unreachable block detection.\r\n * @returns The validation result containing errors and warnings.\r\n */\r\n public validate(): IFlowGraphValidationResult {\r\n return ValidateFlowGraphWithBlockList(this, this._allBlocks);\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.allBlocks = [];\r\n // Collect all blocks: traversal-reachable ones plus any registered\r\n // orphans in _allBlocks (e.g. disconnected blocks in the editor).\r\n const seen = new Set<string>();\r\n const serializeBlock = (block: FlowGraphBlock) => {\r\n if (seen.has(block.uniqueId)) {\r\n return;\r\n }\r\n seen.add(block.uniqueId);\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n };\r\n this.visitAllBlocks(serializeBlock);\r\n for (const block of this._allBlocks) {\r\n serializeBlock(block);\r\n }\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"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QACnE,kEAAkE;QAClE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,cAAc,GAAG,CAAC,KAAqB,EAAE,EAAE;YAC7C,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC3B,OAAO;YACX,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACzB,MAAM,eAAe,GAAQ,EAAE,CAAC;YAChC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YACjC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,mBAAmB,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC3C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5C,MAAM,iBAAiB,GAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,SAAS,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;YAC7D,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Observer, Observable } from \"../Misc/observable\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\nimport { type IFlowGraphEventTrigger, FlowGraphSceneEventCoordinator } from \"./flowGraphSceneEventCoordinator\";\r\nimport { type FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _IsDescendantOf } from \"./utils\";\r\nimport { type IFlowGraphValidationResult, ValidateFlowGraphWithBlockList } from \"./flowGraphValidator\";\r\n\r\nexport const enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n /**\r\n * The graph is paused (contexts kept, pending tasks cancelled)\r\n */\r\n Paused,\r\n}\r\n\r\n/**\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface IFlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n}\r\n\r\n/**\r\n * Options for parsing a flow graph.\r\n */\r\nexport interface IFlowGraphParseOptions {\r\n /**\r\n * A function that parses complex values in a scene.\r\n * @param key the key of the value\r\n * @param serializationObject the object to read the value from\r\n * @param assetsContainer the assets container to read assets from\r\n * @param scene the scene to read the value from\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The flow graph coordinator.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * A function that converts a path to an object accessor.\r\n */\r\n pathConverter?: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n/**\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n *\r\n * @experimental FlowGraph is still in development and is subject to change.\r\n */\r\nexport class FlowGraph {\r\n /**\r\n * An observable that is triggered when the state of the graph changes.\r\n */\r\n public onStateChangedObservable: Observable<FlowGraphState> = new Observable();\r\n /** @internal */\r\n public _eventBlocks: { [keyof in FlowGraphEventType]: FlowGraphEventBlock[] } = {\r\n [FlowGraphEventType.SceneReady]: [],\r\n [FlowGraphEventType.SceneDispose]: [],\r\n [FlowGraphEventType.SceneBeforeRender]: [],\r\n [FlowGraphEventType.MeshPick]: [],\r\n [FlowGraphEventType.PointerDown]: [],\r\n [FlowGraphEventType.PointerUp]: [],\r\n [FlowGraphEventType.PointerMove]: [],\r\n [FlowGraphEventType.PointerOver]: [],\r\n [FlowGraphEventType.PointerOut]: [],\r\n [FlowGraphEventType.SceneAfterRender]: [],\r\n [FlowGraphEventType.NoTrigger]: [],\r\n };\r\n\r\n /**\r\n * All blocks that belong to this graph, including unreachable ones.\r\n * @internal\r\n */\r\n public _allBlocks: FlowGraphBlock[] = [];\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n\r\n /**\r\n * The scene associated with this flow graph.\r\n */\r\n public get scene(): Scene {\r\n return this._scene;\r\n }\r\n private _coordinator: FlowGraphCoordinator;\r\n private _executionContexts: FlowGraphContext[] = [];\r\n private _sceneEventCoordinator: FlowGraphSceneEventCoordinator;\r\n private _eventObserver: Nullable<Observer<IFlowGraphEventTrigger>>;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n private _state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public get state() {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public set state(value: FlowGraphState) {\r\n this._state = value;\r\n this.onStateChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: IFlowGraphParams) {\r\n this._scene = params.scene;\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n this._coordinator = params.coordinator;\r\n }\r\n\r\n private _attachEventObserver() {\r\n if (this._eventObserver) {\r\n return;\r\n }\r\n this._eventObserver = this._sceneEventCoordinator.onEventTriggeredObservable.add((event) => {\r\n if (event.type === FlowGraphEventType.SceneDispose) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n\r\n for (const context of this._executionContexts) {\r\n const order = this._getContextualOrder(event.type, context);\r\n for (const block of order) {\r\n // iterate contexts\r\n if (!block._executeEvent(context, event.payload)) {\r\n break;\r\n }\r\n }\r\n }\r\n // custom behavior(s) of specific events\r\n switch (event.type) {\r\n case FlowGraphEventType.SceneReady:\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n break;\r\n case FlowGraphEventType.SceneBeforeRender:\r\n for (const context of this._executionContexts) {\r\n context._notifyOnTick(event.payload);\r\n }\r\n break;\r\n }\r\n });\r\n }\r\n\r\n private _detachEventObserver() {\r\n this._eventObserver?.remove();\r\n this._eventObserver = null;\r\n }\r\n\r\n /**\r\n * Sets a new scene for this flow graph, re-wiring all event listeners.\r\n * This is useful when the scene the flow graph should listen to changes\r\n * (e.g. when a new scene is loaded in an editor preview).\r\n * If the graph is currently running, it will be stopped first and must be\r\n * restarted manually after calling this method.\r\n * @param scene the new scene to attach to\r\n */\r\n public setScene(scene: Scene): void {\r\n if (scene === this._scene) {\r\n return;\r\n }\r\n if (this.state === FlowGraphState.Started) {\r\n this.stop();\r\n }\r\n // Tear down old event coordinator\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n // Clear execution contexts so start() creates fresh ones with the new scene.\r\n // NOTE: This intentionally discards user variables and connection values.\r\n // Callers that need to preserve them (e.g. the Flow Graph Editor) should\r\n // snapshot context state BEFORE calling setScene() and restore it in a\r\n // wrapped createContext() callback after start() re-creates contexts.\r\n this._executionContexts.length = 0;\r\n // Rebuild with the new scene\r\n (this as { _scene: Scene })._scene = scene;\r\n this._scene.constantlyUpdateMeshUnderPointer = true; // ensure pointer info is always up to date for event blocks that need it\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n // Pre-attach the event observer so that events from the new\r\n // coordinator are routed to the graph immediately. The handler\r\n // guards against processing events while the graph is stopped,\r\n // but having the observer in place ensures no events are lost\r\n // when start() is called shortly after.\r\n this._attachEventObserver();\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n /**\r\n * Returns the execution context at a given index\r\n * @param index the index of the context\r\n * @returns the execution context at that index\r\n */\r\n public getContext(index: number) {\r\n return this._executionContexts[index];\r\n }\r\n\r\n /**\r\n * Returns all blocks registered in this graph, including disconnected ones.\r\n * @returns a read-only array of all blocks\r\n */\r\n public getAllBlocks(): readonly FlowGraphBlock[] {\r\n return this._allBlocks;\r\n }\r\n\r\n /**\r\n * Register a block with the graph. This does not wire any connections;\r\n * it simply ensures the block is tracked so that serialization, editor\r\n * display, and validation see it even when it is not reachable from an\r\n * event block.\r\n * @param block the block to register\r\n */\r\n public addBlock(block: FlowGraphBlock): void {\r\n if (this._allBlocks.indexOf(block) === -1) {\r\n this._allBlocks.push(block);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a block from the graph. Disconnects all of its ports and, if it\r\n * is an event block, unregisters it from the event-block lists.\r\n * @param block the block to remove\r\n */\r\n public removeBlock(block: FlowGraphBlock): void {\r\n const idx = this._allBlocks.indexOf(block);\r\n if (idx !== -1) {\r\n this._allBlocks.splice(idx, 1);\r\n }\r\n // If it is an event block, remove from the event-block registry\r\n if (block instanceof FlowGraphExecutionBlock && \"type\" in block) {\r\n const eventBlock = block as unknown as FlowGraphEventBlock;\r\n const list = this._eventBlocks[eventBlock.type];\r\n if (list) {\r\n const eIdx = list.indexOf(eventBlock);\r\n if (eIdx !== -1) {\r\n list.splice(eIdx, 1);\r\n }\r\n }\r\n }\r\n // If the block has pending async tasks (e.g. event subscriptions),\r\n // cancel them in all active execution contexts so deletion takes\r\n // effect immediately even while the graph is running.\r\n if (block instanceof FlowGraphAsyncExecutionBlock) {\r\n for (const context of this._executionContexts) {\r\n block._cancelPendingTasks(context);\r\n block._resetAfterCanceled(context);\r\n }\r\n }\r\n // Disconnect all ports\r\n for (const input of block.dataInputs) {\r\n input.disconnectFromAll();\r\n }\r\n for (const output of block.dataOutputs) {\r\n output.disconnectFromAll();\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n signalIn.disconnectFromAll();\r\n }\r\n for (const signalOut of block.signalOutputs) {\r\n signalOut.disconnectFromAll();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block the event block to be added\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n this.addBlock(block);\r\n if (block.type === FlowGraphEventType.PointerOver || block.type === FlowGraphEventType.PointerOut) {\r\n this._scene.constantlyUpdateMeshUnderPointer = true;\r\n }\r\n\r\n this._eventBlocks[block.type].push(block);\r\n\r\n // if already started, sort and add to the pending\r\n if (this.state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n } else {\r\n this.onStateChangedObservable.addOnce((state) => {\r\n if (state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stops the flow graph. Cancels all pending tasks and clears execution contexts,\r\n * but keeps event blocks so the graph can be restarted.\r\n */\r\n public stop() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n }\r\n\r\n /**\r\n * Pauses the flow graph. Cancels pending tasks but keeps execution contexts and event blocks.\r\n * Call start() to resume.\r\n */\r\n public pause() {\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Paused;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n * Can also be called to resume from a paused state.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n const resumingFromPause = this.state === FlowGraphState.Paused;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n this._attachEventObserver();\r\n this.state = FlowGraphState.Started;\r\n this._startPendingEvents();\r\n // On a fresh start (not resume), fire the SceneReady event.\r\n // The coordinator's own scene-ready observer may have already\r\n // fired (and been lost) while the graph was stopped, so reset\r\n // the flag and handle the ready state ourselves.\r\n if (!resumingFromPause) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = false;\r\n if (this._scene.isReady(true)) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n } else {\r\n // Scene isn't ready yet (e.g. pending shader compilations after\r\n // a scene swap). Use executeWhenReady(true) which restarts the\r\n // readiness check loop — a plain addOnce on onReadyObservable\r\n // may never fire if the check loop already completed.\r\n this._scene.executeWhenReady(() => {\r\n if (this.state === FlowGraphState.Started && !this._sceneEventCoordinator.sceneReadyTriggered) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n }\r\n }, true);\r\n }\r\n }\r\n }\r\n\r\n private _startPendingEvents() {\r\n for (const context of this._executionContexts) {\r\n for (const type in this._eventBlocks) {\r\n const order = this._getContextualOrder(type as FlowGraphEventType, context);\r\n for (const block of order) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(type: FlowGraphEventType, context: FlowGraphContext): FlowGraphEventBlock[] {\r\n const order = this._eventBlocks[type].sort((a, b) => b.initPriority - a.initPriority);\r\n\r\n if (type === FlowGraphEventType.MeshPick) {\r\n const meshPickOrder = [] as FlowGraphEventBlock[];\r\n for (const block1 of order) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n if (mesh1 && mesh2 && _IsDescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n meshPickOrder.splice(i, 0, block1);\r\n }\r\n return meshPickOrder;\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n for (const type in this._eventBlocks) {\r\n this._eventBlocks[type as FlowGraphEventType].length = 0;\r\n }\r\n this._allBlocks.length = 0;\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const type in this._eventBlocks) {\r\n for (const block of this._eventBlocks[type as FlowGraphEventType]) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Validates the flow graph and returns all issues found.\r\n * Uses the tracked block list for complete validation including unreachable block detection.\r\n * @returns The validation result containing errors and warnings.\r\n */\r\n public validate(): IFlowGraphValidationResult {\r\n return ValidateFlowGraphWithBlockList(this, this._allBlocks);\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.allBlocks = [];\r\n // Collect all blocks: traversal-reachable ones plus any registered\r\n // orphans in _allBlocks (e.g. disconnected blocks in the editor).\r\n const seen = new Set<string>();\r\n const serializeBlock = (block: FlowGraphBlock) => {\r\n if (seen.has(block.uniqueId)) {\r\n return;\r\n }\r\n seen.add(block.uniqueId);\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n };\r\n this.visitAllBlocks(serializeBlock);\r\n for (const block of this._allBlocks) {\r\n serializeBlock(block);\r\n }\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n}\r\n"]}
@@ -19,6 +19,16 @@ export declare abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutio
19
19
  * @internal
20
20
  */
21
21
  _execute(context: FlowGraphContext): void;
22
+ /**
23
+ * @internal
24
+ * Override _startPendingTasks so that event blocks do NOT fire the
25
+ * `out` signal at graph-start time. The base FlowGraphAsyncExecutionBlock
26
+ * fires `out` immediately in _startPendingTasks (useful for async blocks
27
+ * like PlayAnimation that start a task and let sync flow continue).
28
+ * Event blocks should only fire their output signals when the actual
29
+ * event occurs, which is handled by _execute.
30
+ */
31
+ _startPendingTasks(context: FlowGraphContext): void;
22
32
  /**
23
33
  * Execute the event. This function should be called by the flow graph when the event is triggered.
24
34
  * @param context the context in which the event is executed
@@ -21,7 +21,31 @@ export class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {
21
21
  */
22
22
  _execute(context) {
23
23
  context._notifyExecuteNode(this);
24
+ // Fire both signals: KHR_interactivity graphs connect to `done`,
25
+ // while editor-authored graphs typically connect to `out`.
26
+ // Both must fire so that either wiring style works correctly.
24
27
  this.done._activateSignal(context);
28
+ this.out._activateSignal(context);
29
+ }
30
+ /**
31
+ * @internal
32
+ * Override _startPendingTasks so that event blocks do NOT fire the
33
+ * `out` signal at graph-start time. The base FlowGraphAsyncExecutionBlock
34
+ * fires `out` immediately in _startPendingTasks (useful for async blocks
35
+ * like PlayAnimation that start a task and let sync flow continue).
36
+ * Event blocks should only fire their output signals when the actual
37
+ * event occurs, which is handled by _execute.
38
+ */
39
+ _startPendingTasks(context) {
40
+ if (context._getExecutionVariable(this, "_initialized", false)) {
41
+ this._cancelPendingTasks(context);
42
+ this._resetAfterCanceled(context);
43
+ }
44
+ this._preparePendingTasks(context);
45
+ context._addPendingBlock(this);
46
+ // Do NOT fire out._activateSignal — event blocks fire both out and
47
+ // done in _execute when the actual event triggers.
48
+ context._setExecutionVariable(this, "_initialized", true);
25
49
  }
26
50
  }
27
51
  //# sourceMappingURL=flowGraphEventBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphEventBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAI9E;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAA9E;;QACI;;;WAGG;QACI,iBAAY,GAAW,CAAC,CAAC;QAEhC;;WAEG;QACa,SAAI,kDAAoD;IAgB5E,CAAC;IAfG;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CASJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\n\r\n/**\r\n * A type of block that listens to an event observable and activates\r\n * its output signal when the event is triggered.\r\n */\r\nexport abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * the priority of initialization of this block.\r\n * For example, scene start should have a negative priority because it should be initialized last.\r\n */\r\n public initPriority: number = 0;\r\n\r\n /**\r\n * The type of the event\r\n */\r\n public readonly type: FlowGraphEventType = FlowGraphEventType.NoTrigger;\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n context._notifyExecuteNode(this);\r\n this.done._activateSignal(context);\r\n }\r\n\r\n /**\r\n * Execute the event. This function should be called by the flow graph when the event is triggered.\r\n * @param context the context in which the event is executed\r\n * @param payload the payload of the event\r\n * @returns a boolean indicating if the event should stop propagation. if false, the event will stop propagating.\r\n */\r\n public abstract _executeEvent(context: FlowGraphContext, payload: any): boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphEventBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAI9E;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAA9E;;QACI;;;WAGG;QACI,iBAAY,GAAW,CAAC,CAAC;QAEhC;;WAEG;QACa,SAAI,kDAAoD;IAyC5E,CAAC;IAxCG;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACjC,iEAAiE;QACjE,2DAA2D;QAC3D,8DAA8D;QAC9D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;OAQG;IACa,kBAAkB,CAAC,OAAyB;QACxD,IAAI,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC/B,mEAAmE;QACnE,mDAAmD;QACnD,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;CASJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\n\r\n/**\r\n * A type of block that listens to an event observable and activates\r\n * its output signal when the event is triggered.\r\n */\r\nexport abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * the priority of initialization of this block.\r\n * For example, scene start should have a negative priority because it should be initialized last.\r\n */\r\n public initPriority: number = 0;\r\n\r\n /**\r\n * The type of the event\r\n */\r\n public readonly type: FlowGraphEventType = FlowGraphEventType.NoTrigger;\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n context._notifyExecuteNode(this);\r\n // Fire both signals: KHR_interactivity graphs connect to `done`,\r\n // while editor-authored graphs typically connect to `out`.\r\n // Both must fire so that either wiring style works correctly.\r\n this.done._activateSignal(context);\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @internal\r\n * Override _startPendingTasks so that event blocks do NOT fire the\r\n * `out` signal at graph-start time. The base FlowGraphAsyncExecutionBlock\r\n * fires `out` immediately in _startPendingTasks (useful for async blocks\r\n * like PlayAnimation that start a task and let sync flow continue).\r\n * Event blocks should only fire their output signals when the actual\r\n * event occurs, which is handled by _execute.\r\n */\r\n public override _startPendingTasks(context: FlowGraphContext): void {\r\n if (context._getExecutionVariable(this, \"_initialized\", false)) {\r\n this._cancelPendingTasks(context);\r\n this._resetAfterCanceled(context);\r\n }\r\n this._preparePendingTasks(context);\r\n context._addPendingBlock(this);\r\n // Do NOT fire out._activateSignal — event blocks fire both out and\r\n // done in _execute when the actual event triggers.\r\n context._setExecutionVariable(this, \"_initialized\", true);\r\n }\r\n\r\n /**\r\n * Execute the event. This function should be called by the flow graph when the event is triggered.\r\n * @param context the context in which the event is executed\r\n * @param payload the payload of the event\r\n * @returns a boolean indicating if the event should stop propagation. if false, the event will stop propagating.\r\n */\r\n public abstract _executeEvent(context: FlowGraphContext, payload: any): boolean;\r\n}\r\n"]}
@@ -100,18 +100,37 @@ export function ParseFlowGraph(serializationObject, options, resolvedClasses) {
100
100
  graph.addEventBlock(block);
101
101
  }
102
102
  }
103
- // After parsing all blocks, connect them
103
+ // After parsing all blocks, connect them.
104
+ // Build lookup maps for O(1) connection resolution instead of O(B*P) linear scans.
105
+ const dataOutMap = new Map();
106
+ const signalInMap = new Map();
107
+ for (const block of blocks) {
108
+ for (const dataOut of block.dataOutputs) {
109
+ dataOutMap.set(dataOut.uniqueId, dataOut);
110
+ }
111
+ if (block instanceof FlowGraphExecutionBlock) {
112
+ for (const signalIn of block.signalInputs) {
113
+ signalInMap.set(signalIn.uniqueId, signalIn);
114
+ }
115
+ }
116
+ }
104
117
  for (const block of blocks) {
105
118
  for (const dataIn of block.dataInputs) {
106
119
  for (const serializedConnection of dataIn.connectedPointIds) {
107
- const connection = GetDataOutConnectionByUniqueId(blocks, serializedConnection);
120
+ const connection = dataOutMap.get(serializedConnection);
121
+ if (!connection) {
122
+ throw new Error("Could not find data out connection with unique id " + serializedConnection);
123
+ }
108
124
  dataIn.connectTo(connection);
109
125
  }
110
126
  }
111
127
  if (block instanceof FlowGraphExecutionBlock) {
112
128
  for (const signalOut of block.signalOutputs) {
113
129
  for (const serializedConnection of signalOut.connectedPointIds) {
114
- const connection = GetSignalInConnectionByUniqueId(blocks, serializedConnection);
130
+ const connection = signalInMap.get(serializedConnection);
131
+ if (!connection) {
132
+ throw new Error("Could not find signal in connection with unique id " + serializedConnection);
133
+ }
115
134
  signalOut.connectTo(connection);
116
135
  }
117
136
  }
@@ -210,7 +229,7 @@ export function ParseFlowGraphBlockWithClassType(serializationObject, parseOptio
210
229
  }
211
230
  if (needsPathConverter(serializationObject.className)) {
212
231
  if (!parseOptions.pathConverter) {
213
- throw new Error("Path converter is required for this block");
232
+ throw new Error("Block " + serializationObject.className + " requires a path converter to be provided in parse options.");
214
233
  }
215
234
  parsedConfig.pathConverter = parseOptions.pathConverter;
216
235
  }
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphParser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AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAAgC,sBAA2B,EAAE,EAAE,UAAkB,EAAE,SAAqC;IACrK,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC5G,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,mBAAwB,EAAE,UAA0B,EAAE,SAAyC;IACpI,MAAM,QAAQ,GAAG,aAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC;IACtD,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACrK,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,mBAAwB;IAC3C,OAAO,IAAI,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\nimport { blockFactory } from \"./Blocks/flowGraphBlockFactory\";\nimport { type FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\nimport { type FlowGraph, type IFlowGraphParseOptions } from \"./flowGraph\";\nimport { type FlowGraphBlock, type IFlowGraphBlockParseOptions } from \"./flowGraphBlock\";\nimport { type FlowGraphContext, type IFlowGraphContextParseOptions } from \"./flowGraphContext\";\nimport { type IFlowGraphCoordinatorParseOptions, FlowGraphCoordinator } from \"./flowGraphCoordinator\";\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\nimport { defaultValueParseFunction, needsPathConverter } from \"./serialization\";\nimport { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport { type Node } from \"core/node\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes\";\nimport { type FlowGraphConnection } from \"./flowGraphConnection\";\n\n/**\n * Given a list of blocks, find an output data connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n if (dataOut.uniqueId === uniqueId) {\n return dataOut;\n }\n }\n }\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\n}\n\n/**\n * Given a list of blocks, find an input signal connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\n for (const block of blocks) {\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n if (signalIn.uniqueId === uniqueId) {\n return signalIn;\n }\n }\n }\n }\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\n}\n\n/**\n * Parses a serialized coordinator.\n * @param serializedObject the object to parse\n * @param options the options to use when parsing\n * @returns the parsed coordinator\n */\nexport async function ParseCoordinatorAsync(serializedObject: any, options: IFlowGraphCoordinatorParseOptions) {\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\n\n if (serializedObject.dispatchEventsSynchronously) {\n coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;\n }\n\n await options.scene.whenReadyAsync();\n // if custom default values are defined, set them in the global context\n if (serializedObject._defaultValues) {\n for (const key in serializedObject._defaultValues) {\n // key is the FlowGraphType, value is the default value\n const value = serializedObject._defaultValues[key];\n getRichTypeByFlowGraphType(key).defaultValue = value;\n }\n }\n // async-parse the flow graphs. This can be done in parallel\n await Promise.all(\n serializedObject._flowGraphs?.map(\n async (serializedGraph: any) => await ParseFlowGraphAsync(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter })\n )\n );\n return coordinator;\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @returns the parsed graph\n */\nexport async function ParseFlowGraphAsync(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): Promise<FlowGraph> {\n // get all classes types needed for the blocks using the block factory\n const resolvedClasses = await Promise.all(\n serializationObject.allBlocks.map(async (serializedBlock) => {\n const classFactory = blockFactory(serializedBlock.className as FlowGraphBlockNames);\n return await classFactory();\n })\n );\n // async will be used when we start using the block async factory\n return ParseFlowGraph(serializationObject, options, resolvedClasses);\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @param resolvedClasses the resolved classes for the blocks\n * @returns the parsed graph\n */\nexport function ParseFlowGraph(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions, resolvedClasses: (typeof FlowGraphBlock)[]) {\n const graph = options.coordinator.createGraph();\n const blocks: FlowGraphBlock[] = [];\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n // Parse all blocks\n // for (const serializedBlock of serializationObject.allBlocks) {\n for (let i = 0; i < serializationObject.allBlocks.length; i++) {\n const serializedBlock = serializationObject.allBlocks[i];\n const block = ParseFlowGraphBlockWithClassType(\n serializedBlock,\n { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, assetsContainer: options.coordinator.config.scene, valueParseFunction },\n resolvedClasses[i]\n );\n blocks.push(block);\n graph.addBlock(block);\n if (block instanceof FlowGraphEventBlock) {\n graph.addEventBlock(block);\n }\n }\n // After parsing all blocks, connect them\n for (const block of blocks) {\n for (const dataIn of block.dataInputs) {\n for (const serializedConnection of dataIn.connectedPointIds) {\n const connection = GetDataOutConnectionByUniqueId(blocks, serializedConnection);\n dataIn.connectTo(connection);\n }\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalOut of block.signalOutputs) {\n for (const serializedConnection of signalOut.connectedPointIds) {\n const connection = GetSignalInConnectionByUniqueId(blocks, serializedConnection);\n signalOut.connectTo(connection);\n }\n }\n }\n }\n for (const serializedContext of serializationObject.executionContexts) {\n ParseFlowGraphContext(serializedContext, { graph, valueParseFunction }, serializationObject.rightHanded);\n }\n return graph;\n}\n\n/**\n * Parses a context\n * @param serializationObject the object containing the context serialization values\n * @param options the options for parsing the context\n * @param rightHanded whether the serialized data is right handed\n * @returns\n */\nexport function ParseFlowGraphContext(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions, rightHanded?: boolean): FlowGraphContext {\n const result = options.graph.createContext();\n if (serializationObject.enableLogging) {\n result.enableLogging = true;\n }\n result.treatDataAsRightHanded = rightHanded || false;\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n result.uniqueId = serializationObject.uniqueId;\n const scene = result.getScene();\n // check if assets context is available\n if (serializationObject._assetsContext) {\n const ac = serializationObject._assetsContext;\n const assetsContext: IAssetContainer = {\n meshes: ac.meshes?.map((m: string) => scene.getMeshById(m)),\n lights: ac.lights?.map((l: string) => scene.getLightByName(l)),\n cameras: ac.cameras?.map((c: string) => scene.getCameraByName(c)),\n materials: ac.materials?.map((m: string) => scene.getMaterialById(m)),\n textures: ac.textures?.map((t: string) => scene.getTextureByName(t)),\n animations: ac.animations?.map((a: string) => scene.animations.find((anim) => anim.name === a)),\n skeletons: ac.skeletons?.map((s: string) => scene.getSkeletonByName(s)),\n particleSystems: ac.particleSystems?.map((ps: string) => scene.getParticleSystemById(ps)),\n animationGroups: ac.animationGroups?.map((ag: string) => scene.getAnimationGroupByName(ag)),\n transformNodes: ac.transformNodes?.map((tn: string) => scene.getTransformNodeById(tn)),\n rootNodes: [],\n multiMaterials: [],\n morphTargetManagers: [],\n geometries: [],\n actionManagers: [],\n environmentTexture: null,\n postProcesses: [],\n sounds: null,\n effectLayers: [],\n layers: [],\n reflectionProbes: [],\n lensFlareSystems: [],\n proceduralTextures: [],\n getNodes: function (): Array<Node> {\n throw new Error(\"Function not implemented.\");\n },\n };\n result.assetsContext = assetsContext;\n }\n for (const key in serializationObject._userVariables) {\n const value = valueParseFunction(key, serializationObject._userVariables, result.assetsContext, scene);\n result.userVariables[key] = value;\n }\n for (const key in serializationObject._connectionValues) {\n const value = valueParseFunction(key, serializationObject._connectionValues, result.assetsContext, scene);\n result._setConnectionValueByKey(key, value);\n }\n\n return result;\n}\n\n/**\n * Parses a block from a serialization object\n * This function is async due to the factory method that is used to create the block's class. If you load the class externally use ParseBlockWithClassType\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @returns the parsed block\n */\nexport async function ParseBlockAsync(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): Promise<FlowGraphBlock> {\n const classFactory = blockFactory(serializationObject.className as FlowGraphBlockNames);\n const classType = await classFactory();\n return ParseFlowGraphBlockWithClassType(serializationObject, parseOptions, classType);\n}\n\n/**\n * Parses a block from a serialization object\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @param classType the class type of the block. This is used when the class is not loaded asynchronously\n * @returns the parsed block\n */\nexport function ParseFlowGraphBlockWithClassType(\n serializationObject: ISerializedFlowGraphBlock,\n parseOptions: IFlowGraphBlockParseOptions,\n classType: typeof FlowGraphBlock\n): FlowGraphBlock {\n const parsedConfig: any = {};\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\n if (serializationObject.config) {\n for (const key in serializationObject.config) {\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.assetsContainer || parseOptions.scene, parseOptions.scene);\n }\n }\n if (needsPathConverter(serializationObject.className)) {\n if (!parseOptions.pathConverter) {\n throw new Error(\"Path converter is required for this block\");\n }\n parsedConfig.pathConverter = parseOptions.pathConverter;\n }\n const obj = new classType(parsedConfig);\n obj.uniqueId = serializationObject.uniqueId;\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\n if (dataInput) {\n dataInput.deserialize(serializationObject.dataInputs[i]);\n } else {\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\n if (dataOutput) {\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\n } else {\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n obj.metadata = serializationObject.metadata;\n obj.deserialize && obj.deserialize(serializationObject);\n return obj;\n}\n\n/**\n * Parses a connection from an object\n * @param serializationObject the object to parse from.\n * @param ownerBlock the block that owns the connection.\n * @param classType the class type of the connection.\n * @returns the parsed connection.\n */\nexport function ParseGraphConnectionWithClassType<BlockT extends FlowGraphBlock>(serializationObject: any = {}, ownerBlock: BlockT, classType: typeof FlowGraphConnection) {\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @param classType the class type of the data connection\n * @returns the parsed connection\n */\nexport function ParseGraphDataConnection(serializationObject: any, ownerBlock: FlowGraphBlock, classType: typeof FlowGraphDataConnection): FlowGraphDataConnection<any> {\n const richType = ParseRichType(serializationObject.richType);\n const defaultValue = serializationObject.defaultValue;\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock, richType, defaultValue, !!serializationObject._optional);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\nfunction ParseRichType(serializationObject: any): RichType<any> {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n}\n"]}
1
+ {"version":3,"file":"flowGraphParser.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAK9D,OAAO,EAA0C,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGhF,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG5E;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAwB,EAAE,QAAgB;IACrF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,OAAO,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,GAAG,QAAQ,CAAC,CAAC;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAwB,EAAE,QAAgB;IACtF,KAAK,MAAM,KA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kB,EAAE,SAAqC;IACrK,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC5G,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,mBAAwB,EAAE,UAA0B,EAAE,SAAyC;IACpI,MAAM,QAAQ,GAAG,aAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC;IACtD,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACrK,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,mBAAwB;IAC3C,OAAO,IAAI,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\nimport { blockFactory } from \"./Blocks/flowGraphBlockFactory\";\nimport { type FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\nimport { type FlowGraph, type IFlowGraphParseOptions } from \"./flowGraph\";\nimport { type FlowGraphBlock, type IFlowGraphBlockParseOptions } from \"./flowGraphBlock\";\nimport { type FlowGraphContext, type IFlowGraphContextParseOptions } from \"./flowGraphContext\";\nimport { type IFlowGraphCoordinatorParseOptions, FlowGraphCoordinator } from \"./flowGraphCoordinator\";\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\nimport { defaultValueParseFunction, needsPathConverter } from \"./serialization\";\nimport { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport { type Node } from \"core/node\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes\";\nimport { type FlowGraphConnection } from \"./flowGraphConnection\";\n\n/**\n * Given a list of blocks, find an output data connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n if (dataOut.uniqueId === uniqueId) {\n return dataOut;\n }\n }\n }\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\n}\n\n/**\n * Given a list of blocks, find an input signal connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\n for (const block of blocks) {\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n if (signalIn.uniqueId === uniqueId) {\n return signalIn;\n }\n }\n }\n }\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\n}\n\n/**\n * Parses a serialized coordinator.\n * @param serializedObject the object to parse\n * @param options the options to use when parsing\n * @returns the parsed coordinator\n */\nexport async function ParseCoordinatorAsync(serializedObject: any, options: IFlowGraphCoordinatorParseOptions) {\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\n\n if (serializedObject.dispatchEventsSynchronously) {\n coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;\n }\n\n await options.scene.whenReadyAsync();\n // if custom default values are defined, set them in the global context\n if (serializedObject._defaultValues) {\n for (const key in serializedObject._defaultValues) {\n // key is the FlowGraphType, value is the default value\n const value = serializedObject._defaultValues[key];\n getRichTypeByFlowGraphType(key).defaultValue = value;\n }\n }\n // async-parse the flow graphs. This can be done in parallel\n await Promise.all(\n serializedObject._flowGraphs?.map(\n async (serializedGraph: any) => await ParseFlowGraphAsync(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter })\n )\n );\n return coordinator;\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @returns the parsed graph\n */\nexport async function ParseFlowGraphAsync(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): Promise<FlowGraph> {\n // get all classes types needed for the blocks using the block factory\n const resolvedClasses = await Promise.all(\n serializationObject.allBlocks.map(async (serializedBlock) => {\n const classFactory = blockFactory(serializedBlock.className as FlowGraphBlockNames);\n return await classFactory();\n })\n );\n // async will be used when we start using the block async factory\n return ParseFlowGraph(serializationObject, options, resolvedClasses);\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @param resolvedClasses the resolved classes for the blocks\n * @returns the parsed graph\n */\nexport function ParseFlowGraph(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions, resolvedClasses: (typeof FlowGraphBlock)[]) {\n const graph = options.coordinator.createGraph();\n const blocks: FlowGraphBlock[] = [];\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n // Parse all blocks\n // for (const serializedBlock of serializationObject.allBlocks) {\n for (let i = 0; i < serializationObject.allBlocks.length; i++) {\n const serializedBlock = serializationObject.allBlocks[i];\n const block = ParseFlowGraphBlockWithClassType(\n serializedBlock,\n { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, assetsContainer: options.coordinator.config.scene, valueParseFunction },\n resolvedClasses[i]\n );\n blocks.push(block);\n graph.addBlock(block);\n if (block instanceof FlowGraphEventBlock) {\n graph.addEventBlock(block);\n }\n }\n // After parsing all blocks, connect them.\n // Build lookup maps for O(1) connection resolution instead of O(B*P) linear scans.\n const dataOutMap = new Map<string, FlowGraphDataConnection<any>>();\n const signalInMap = new Map<string, FlowGraphSignalConnection>();\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n dataOutMap.set(dataOut.uniqueId, dataOut);\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n signalInMap.set(signalIn.uniqueId, signalIn);\n }\n }\n }\n for (const block of blocks) {\n for (const dataIn of block.dataInputs) {\n for (const serializedConnection of dataIn.connectedPointIds) {\n const connection = dataOutMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find data out connection with unique id \" + serializedConnection);\n }\n dataIn.connectTo(connection);\n }\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalOut of block.signalOutputs) {\n for (const serializedConnection of signalOut.connectedPointIds) {\n const connection = signalInMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find signal in connection with unique id \" + serializedConnection);\n }\n signalOut.connectTo(connection);\n }\n }\n }\n }\n for (const serializedContext of serializationObject.executionContexts) {\n ParseFlowGraphContext(serializedContext, { graph, valueParseFunction }, serializationObject.rightHanded);\n }\n return graph;\n}\n\n/**\n * Parses a context\n * @param serializationObject the object containing the context serialization values\n * @param options the options for parsing the context\n * @param rightHanded whether the serialized data is right handed\n * @returns\n */\nexport function ParseFlowGraphContext(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions, rightHanded?: boolean): FlowGraphContext {\n const result = options.graph.createContext();\n if (serializationObject.enableLogging) {\n result.enableLogging = true;\n }\n result.treatDataAsRightHanded = rightHanded || false;\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n result.uniqueId = serializationObject.uniqueId;\n const scene = result.getScene();\n // check if assets context is available\n if (serializationObject._assetsContext) {\n const ac = serializationObject._assetsContext;\n const assetsContext: IAssetContainer = {\n meshes: ac.meshes?.map((m: string) => scene.getMeshById(m)),\n lights: ac.lights?.map((l: string) => scene.getLightByName(l)),\n cameras: ac.cameras?.map((c: string) => scene.getCameraByName(c)),\n materials: ac.materials?.map((m: string) => scene.getMaterialById(m)),\n textures: ac.textures?.map((t: string) => scene.getTextureByName(t)),\n animations: ac.animations?.map((a: string) => scene.animations.find((anim) => anim.name === a)),\n skeletons: ac.skeletons?.map((s: string) => scene.getSkeletonByName(s)),\n particleSystems: ac.particleSystems?.map((ps: string) => scene.getParticleSystemById(ps)),\n animationGroups: ac.animationGroups?.map((ag: string) => scene.getAnimationGroupByName(ag)),\n transformNodes: ac.transformNodes?.map((tn: string) => scene.getTransformNodeById(tn)),\n rootNodes: [],\n multiMaterials: [],\n morphTargetManagers: [],\n geometries: [],\n actionManagers: [],\n environmentTexture: null,\n postProcesses: [],\n sounds: null,\n effectLayers: [],\n layers: [],\n reflectionProbes: [],\n lensFlareSystems: [],\n proceduralTextures: [],\n getNodes: function (): Array<Node> {\n throw new Error(\"Function not implemented.\");\n },\n };\n result.assetsContext = assetsContext;\n }\n for (const key in serializationObject._userVariables) {\n const value = valueParseFunction(key, serializationObject._userVariables, result.assetsContext, scene);\n result.userVariables[key] = value;\n }\n for (const key in serializationObject._connectionValues) {\n const value = valueParseFunction(key, serializationObject._connectionValues, result.assetsContext, scene);\n result._setConnectionValueByKey(key, value);\n }\n\n return result;\n}\n\n/**\n * Parses a block from a serialization object\n * This function is async due to the factory method that is used to create the block's class. If you load the class externally use ParseBlockWithClassType\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @returns the parsed block\n */\nexport async function ParseBlockAsync(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): Promise<FlowGraphBlock> {\n const classFactory = blockFactory(serializationObject.className as FlowGraphBlockNames);\n const classType = await classFactory();\n return ParseFlowGraphBlockWithClassType(serializationObject, parseOptions, classType);\n}\n\n/**\n * Parses a block from a serialization object\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @param classType the class type of the block. This is used when the class is not loaded asynchronously\n * @returns the parsed block\n */\nexport function ParseFlowGraphBlockWithClassType(\n serializationObject: ISerializedFlowGraphBlock,\n parseOptions: IFlowGraphBlockParseOptions,\n classType: typeof FlowGraphBlock\n): FlowGraphBlock {\n const parsedConfig: any = {};\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\n if (serializationObject.config) {\n for (const key in serializationObject.config) {\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.assetsContainer || parseOptions.scene, parseOptions.scene);\n }\n }\n if (needsPathConverter(serializationObject.className)) {\n if (!parseOptions.pathConverter) {\n throw new Error(\"Block \" + serializationObject.className + \" requires a path converter to be provided in parse options.\");\n }\n parsedConfig.pathConverter = parseOptions.pathConverter;\n }\n const obj = new classType(parsedConfig);\n obj.uniqueId = serializationObject.uniqueId;\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\n if (dataInput) {\n dataInput.deserialize(serializationObject.dataInputs[i]);\n } else {\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\n if (dataOutput) {\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\n } else {\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n obj.metadata = serializationObject.metadata;\n obj.deserialize && obj.deserialize(serializationObject);\n return obj;\n}\n\n/**\n * Parses a connection from an object\n * @param serializationObject the object to parse from.\n * @param ownerBlock the block that owns the connection.\n * @param classType the class type of the connection.\n * @returns the parsed connection.\n */\nexport function ParseGraphConnectionWithClassType<BlockT extends FlowGraphBlock>(serializationObject: any = {}, ownerBlock: BlockT, classType: typeof FlowGraphConnection) {\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @param classType the class type of the data connection\n * @returns the parsed connection\n */\nexport function ParseGraphDataConnection(serializationObject: any, ownerBlock: FlowGraphBlock, classType: typeof FlowGraphDataConnection): FlowGraphDataConnection<any> {\n const richType = ParseRichType(serializationObject.richType);\n const defaultValue = serializationObject.defaultValue;\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock, richType, defaultValue, !!serializationObject._optional);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\nfunction ParseRichType(serializationObject: any): RichType<any> {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n}\n"]}
@@ -7,7 +7,9 @@ import { FlowGraphMatrix2D, FlowGraphMatrix3D } from "./CustomTypes/flowGraphMat
7
7
  function IsMeshClassName(className) {
8
8
  return (className === "Mesh" ||
9
9
  className === "AbstractMesh" ||
10
+ className === "TransformNode" ||
10
11
  className === "GroundMesh" ||
12
+ className === "InstancedMesh" ||
11
13
  className === "InstanceMesh" ||
12
14
  className === "LinesMesh" ||
13
15
  className === "GoldbergMesh" ||
@@ -85,6 +87,7 @@ export function defaultValueSerializationFunction(key, value, serializationObjec
85
87
  id: value.id,
86
88
  name: value.name,
87
89
  className,
90
+ uniqueId: value.uniqueId,
88
91
  };
89
92
  }
90
93
  else {
@@ -92,8 +95,19 @@ export function defaultValueSerializationFunction(key, value, serializationObjec
92
95
  serializationObject[key] = value;
93
96
  }
94
97
  else {
95
- // Plain object (e.g. parsed event config) — store it if JSON-safe,
96
- // otherwise skip (e.g. objects containing functions like pathConverter).
98
+ // Skip known non-serializable keys immediately to avoid
99
+ // expensive JSON.stringify attempts on large object trees
100
+ // (e.g. pathConverter holds the entire glTF parse tree).
101
+ if (key === "pathConverter") {
102
+ return;
103
+ }
104
+ // Quick check: if any own property is a function, the object
105
+ // is not JSON-safe and stringify would be wasteful.
106
+ const hasFunction = Object.values(value).some((v) => typeof v === "function");
107
+ if (hasFunction) {
108
+ return;
109
+ }
110
+ // Plain object (e.g. parsed event config) — store it if JSON-safe.
97
111
  try {
98
112
  serializationObject[key] = JSON.parse(JSON.stringify(value));
99
113
  }
@@ -153,19 +167,27 @@ export function defaultValueParseFunction(key, serializationObject, assetsContai
153
167
  }
154
168
  else {
155
169
  if (Array.isArray(intermediateValue)) {
156
- // configuration data of an event
157
- finalValue = intermediateValue.reduce((acc, val) => {
158
- if (!val.eventData) {
170
+ // Check if this is an event configuration array (objects with id/eventData)
171
+ // versus a plain array of primitives (e.g. variable name lists)
172
+ if (intermediateValue.length > 0 && typeof intermediateValue[0] === "object" && intermediateValue[0] !== null && "eventData" in intermediateValue[0]) {
173
+ // configuration data of an event
174
+ finalValue = intermediateValue.reduce((acc, val) => {
175
+ if (!val.eventData) {
176
+ return acc;
177
+ }
178
+ acc[val.id] = {
179
+ type: getRichTypeByFlowGraphType(val.type),
180
+ };
181
+ if (typeof val.value !== "undefined") {
182
+ acc[val.id].value = defaultValueParseFunction("value", val, assetsContainer, scene);
183
+ }
159
184
  return acc;
160
- }
161
- acc[val.id] = {
162
- type: getRichTypeByFlowGraphType(val.type),
163
- };
164
- if (typeof val.value !== "undefined") {
165
- acc[val.id].value = defaultValueParseFunction("value", val, assetsContainer, scene);
166
- }
167
- return acc;
168
- }, {});
185
+ }, {});
186
+ }
187
+ else {
188
+ // Plain array of primitives — return as-is
189
+ finalValue = intermediateValue;
190
+ }
169
191
  }
170
192
  else {
171
193
  finalValue = intermediateValue;
@@ -1 +1 @@
1
- {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/serialization.ts"],"names":[],"mappings":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AC,GAAG,EAAE,GAAG,EAAE,EAAE;gBAC/C,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;oBACjB,OAAO,GAAG,CAAC;gBACf,CAAC;gBACD,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG;oBACV,IAAI,EAAE,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC;iBAC7C,CAAC;gBACF,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;oBACnC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;gBACxF,CAAC;gBACD,OAAO,GAAG,CAAC;YACf,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,CAAC;aAAM,CAAC;YACJ,UAAU,GAAG,iBAAiB,CAAC;QACnC,CAAC;IACL,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,gEAAgE;AAChE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAChD,0FAA0F;IAC1F,OAAO,SAAS,kFAA0C,CAAC;AAC/D,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { Matrix, Quaternion, Vector2, Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport { type Scene } from \"../scene\";\r\nimport { FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger\";\r\nimport { FlowGraphTypes, getRichTypeByFlowGraphType } from \"./flowGraphRichTypes\";\r\nimport { type TransformNode } from \"core/Meshes/transformNode\";\r\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\n\r\nfunction IsMeshClassName(className: string) {\r\n return (\r\n className === \"Mesh\" ||\r\n className === \"AbstractMesh\" ||\r\n className === \"GroundMesh\" ||\r\n className === \"InstanceMesh\" ||\r\n className === \"LinesMesh\" ||\r\n className === \"GoldbergMesh\" ||\r\n className === \"GreasedLineMesh\" ||\r\n className === \"TrailMesh\"\r\n );\r\n}\r\n\r\nfunction IsVectorClassName(className: string) {\r\n return (\r\n className === FlowGraphTypes.Vector2 ||\r\n className === FlowGraphTypes.Vector3 ||\r\n className === FlowGraphTypes.Vector4 ||\r\n className === FlowGraphTypes.Quaternion ||\r\n className === FlowGraphTypes.Color3 ||\r\n className === FlowGraphTypes.Color4\r\n );\r\n}\r\n\r\nfunction IsMatrixClassName(className: string) {\r\n return className === FlowGraphTypes.Matrix || className === FlowGraphTypes.Matrix2D || className === FlowGraphTypes.Matrix3D;\r\n}\r\n\r\nfunction IsAnimationGroupClassName(className: string) {\r\n return className === \"AnimationGroup\";\r\n}\r\n\r\nfunction ParseVector(className: string, value: Array<number>, flipHandedness = false) {\r\n if (className === FlowGraphTypes.Vector2) {\r\n return Vector2.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector3) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n }\r\n return Vector3.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector4) {\r\n return Vector4.FromArray(value);\r\n } else if (className === FlowGraphTypes.Quaternion) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n value[3] *= -1;\r\n }\r\n return Quaternion.FromArray(value);\r\n } else if (className === FlowGraphTypes.Color3) {\r\n return new Color3(value[0], value[1], value[2]);\r\n } else if (className === FlowGraphTypes.Color4) {\r\n return new Color4(value[0], value[1], value[2], value[3]);\r\n } else {\r\n throw new Error(`Unknown vector class name ${className}`);\r\n }\r\n}\r\n\r\n/**\r\n * The default function that serializes values in a context object to a serialization object\r\n * @param key the key where the value should be stored in the serialization object\r\n * @param value the value to store\r\n * @param serializationObject the object where the value will be stored\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n const className = value?.getClassName?.() ?? \"\";\r\n if (IsVectorClassName(className) || IsMatrixClassName(className)) {\r\n serializationObject[key] = {\r\n value: value.asArray(),\r\n className,\r\n };\r\n } else if (className === FlowGraphTypes.Integer) {\r\n serializationObject[key] = {\r\n value: value.value,\r\n className,\r\n };\r\n } else {\r\n if (className && (value.id || value.name)) {\r\n serializationObject[key] = {\r\n id: value.id,\r\n name: value.name,\r\n className,\r\n };\r\n } else {\r\n if (typeof value !== \"object\" || value === null) {\r\n serializationObject[key] = value;\r\n } else {\r\n // Plain object (e.g. parsed event config) — store it if JSON-safe,\r\n // otherwise skip (e.g. objects containing functions like pathConverter).\r\n try {\r\n serializationObject[key] = JSON.parse(JSON.stringify(value));\r\n } catch {\r\n Logger.Warn(`FlowGraph serialization: value for key \"${key}\" is not JSON-serializable and was skipped.`);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The default function that parses values stored in a serialization object\r\n * @param key the key to the value that will be parsed\r\n * @param serializationObject the object that will be parsed\r\n * @param assetsContainer the assets container that will be used to find the objects\r\n * @param scene\r\n * @returns\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueParseFunction(key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) {\r\n const intermediateValue = serializationObject[key];\r\n let finalValue;\r\n const className = intermediateValue?.type ?? intermediateValue?.className;\r\n if (IsMeshClassName(className)) {\r\n let nodes: TransformNode[] = scene.meshes.filter((m) => (intermediateValue.id ? m.id === intermediateValue.id : m.name === intermediateValue.name));\r\n if (nodes.length === 0) {\r\n nodes = scene.transformNodes.filter((m) => (intermediateValue.id ? m.id === intermediateValue.id : m.name === intermediateValue.name));\r\n }\r\n finalValue = intermediateValue.uniqueId ? nodes.find((m) => m.uniqueId === intermediateValue.uniqueId) : nodes[0];\r\n } else if (IsVectorClassName(className)) {\r\n finalValue = ParseVector(className, intermediateValue.value);\r\n } else if (IsAnimationGroupClassName(className)) {\r\n // do not use the scene.getAnimationGroupByName because it is possible that two AGs will have the same name\r\n const ags = scene.animationGroups.filter((ag) => ag.name === intermediateValue.name);\r\n // uniqueId changes on each load. this is used for the glTF loader, that uses serialization after the scene was loaded.\r\n finalValue = ags.length === 1 ? ags[0] : ags.find((ag) => ag.uniqueId === intermediateValue.uniqueId);\r\n } else if (className === FlowGraphTypes.Matrix) {\r\n finalValue = Matrix.FromArray(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix2D) {\r\n finalValue = new FlowGraphMatrix2D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix3D) {\r\n finalValue = new FlowGraphMatrix3D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Integer) {\r\n finalValue = FlowGraphInteger.FromValue(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Number || className === FlowGraphTypes.String || className === FlowGraphTypes.Boolean) {\r\n finalValue = intermediateValue.value[0];\r\n } else if (intermediateValue && intermediateValue.value !== undefined) {\r\n finalValue = intermediateValue.value;\r\n } else {\r\n if (Array.isArray(intermediateValue)) {\r\n // configuration data of an event\r\n finalValue = intermediateValue.reduce((acc, val) => {\r\n if (!val.eventData) {\r\n return acc;\r\n }\r\n acc[val.id] = {\r\n type: getRichTypeByFlowGraphType(val.type),\r\n };\r\n if (typeof val.value !== \"undefined\") {\r\n acc[val.id].value = defaultValueParseFunction(\"value\", val, assetsContainer, scene);\r\n }\r\n return acc;\r\n }, {});\r\n } else {\r\n finalValue = intermediateValue;\r\n }\r\n }\r\n return finalValue;\r\n}\r\n\r\n/**\r\n * Given a name of a flow graph block class, return if this\r\n * class needs to be created with a path converter. Used in\r\n * parsing.\r\n * @param className the name of the flow graph block class\r\n * @returns a boolean indicating if the class needs a path converter\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function needsPathConverter(className: string) {\r\n // I am not using the ClassName property here because it was causing a circular dependency\r\n return className === FlowGraphBlockNames.JsonPointerParser;\r\n}\r\n"]}
1
+ {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/serialization.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAkB,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAErF,SAAS,eAAe,CAAC,SAAiB;IACtC,OAAO,CACH,SAAS,KAAK,MAAM;QACpB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,eAAe;QAC7B,SAAS,KAAK,YAAY;QAC1B,SAAS,KAAK,eAAe;QAC7B,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,WAAW;QACzB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,iBAAiB;QAC/B,SAAS,KAAK,WAAW,CAC5B,CAAC;AACN,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAiB;IACxC,OAAO,CACH,SAAS,2CAA2B;QACpC,SAAS,2CAA2B;QACpC,SAAS,2CAA2B;QACpC,SAAS,iDAA8B;QACvC,SAAS,yCAA0B;QACnC,SAAS,yCAA0B,CACtC,CAAC;AACN,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAiB;IACxC,OAAO,SAAS,yCAA0B,IAAI,SAAS,6CAA4B,IAAI,SAAS,6CAA4B,CAAC;AACjI,CAAC;AAED,SAAS,yBAAyB,CAAC,SAAiB;IAChD,OAAO,SAAS,KAAK,gBAAgB,CAAC;AAC1C,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB,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ACf,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,CAAC;iBAAM,CAAC;gBACJ,2CAA2C;gBAC3C,UAAU,GAAG,iBAAiB,CAAC;YACnC,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,UAAU,GAAG,iBAAiB,CAAC;QACnC,CAAC;IACL,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,gEAAgE;AAChE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAChD,0FAA0F;IAC1F,OAAO,SAAS,kFAA0C,CAAC;AAC/D,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { Matrix, Quaternion, Vector2, Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport { type Scene } from \"../scene\";\r\nimport { FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger\";\r\nimport { FlowGraphTypes, getRichTypeByFlowGraphType } from \"./flowGraphRichTypes\";\r\nimport { type TransformNode } from \"core/Meshes/transformNode\";\r\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\n\r\nfunction IsMeshClassName(className: string) {\r\n return (\r\n className === \"Mesh\" ||\r\n className === \"AbstractMesh\" ||\r\n className === \"TransformNode\" ||\r\n className === \"GroundMesh\" ||\r\n className === \"InstancedMesh\" ||\r\n className === \"InstanceMesh\" ||\r\n className === \"LinesMesh\" ||\r\n className === \"GoldbergMesh\" ||\r\n className === \"GreasedLineMesh\" ||\r\n className === \"TrailMesh\"\r\n );\r\n}\r\n\r\nfunction IsVectorClassName(className: string) {\r\n return (\r\n className === FlowGraphTypes.Vector2 ||\r\n className === FlowGraphTypes.Vector3 ||\r\n className === FlowGraphTypes.Vector4 ||\r\n className === FlowGraphTypes.Quaternion ||\r\n className === FlowGraphTypes.Color3 ||\r\n className === FlowGraphTypes.Color4\r\n );\r\n}\r\n\r\nfunction IsMatrixClassName(className: string) {\r\n return className === FlowGraphTypes.Matrix || className === FlowGraphTypes.Matrix2D || className === FlowGraphTypes.Matrix3D;\r\n}\r\n\r\nfunction IsAnimationGroupClassName(className: string) {\r\n return className === \"AnimationGroup\";\r\n}\r\n\r\nfunction ParseVector(className: string, value: Array<number>, flipHandedness = false) {\r\n if (className === FlowGraphTypes.Vector2) {\r\n return Vector2.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector3) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n }\r\n return Vector3.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector4) {\r\n return Vector4.FromArray(value);\r\n } else if (className === FlowGraphTypes.Quaternion) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n value[3] *= -1;\r\n }\r\n return Quaternion.FromArray(value);\r\n } else if (className === FlowGraphTypes.Color3) {\r\n return new Color3(value[0], value[1], value[2]);\r\n } else if (className === FlowGraphTypes.Color4) {\r\n return new Color4(value[0], value[1], value[2], value[3]);\r\n } else {\r\n throw new Error(`Unknown vector class name ${className}`);\r\n }\r\n}\r\n\r\n/**\r\n * The default function that serializes values in a context object to a serialization object\r\n * @param key the key where the value should be stored in the serialization object\r\n * @param value the value to store\r\n * @param serializationObject the object where the value will be stored\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n const className = value?.getClassName?.() ?? \"\";\r\n if (IsVectorClassName(className) || IsMatrixClassName(className)) {\r\n serializationObject[key] = {\r\n value: value.asArray(),\r\n className,\r\n };\r\n } else if (className === FlowGraphTypes.Integer) {\r\n serializationObject[key] = {\r\n value: value.value,\r\n className,\r\n };\r\n } else {\r\n if (className && (value.id || value.name)) {\r\n serializationObject[key] = {\r\n id: value.id,\r\n name: value.name,\r\n className,\r\n uniqueId: value.uniqueId,\r\n };\r\n } else {\r\n if (typeof value !== \"object\" || value === null) {\r\n serializationObject[key] = value;\r\n } else {\r\n // Skip known non-serializable keys immediately to avoid\r\n // expensive JSON.stringify attempts on large object trees\r\n // (e.g. pathConverter holds the entire glTF parse tree).\r\n if (key === \"pathConverter\") {\r\n return;\r\n }\r\n // Quick check: if any own property is a function, the object\r\n // is not JSON-safe and stringify would be wasteful.\r\n const hasFunction = Object.values(value).some((v) => typeof v === \"function\");\r\n if (hasFunction) {\r\n return;\r\n }\r\n // Plain object (e.g. parsed event config) — store it if JSON-safe.\r\n try {\r\n serializationObject[key] = JSON.parse(JSON.stringify(value));\r\n } catch {\r\n Logger.Warn(`FlowGraph serialization: value for key \"${key}\" is not JSON-serializable and was skipped.`);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The default function that parses values stored in a serialization object\r\n * @param key the key to the value that will be parsed\r\n * @param serializationObject the object that will be parsed\r\n * @param assetsContainer the assets container that will be used to find the objects\r\n * @param scene\r\n * @returns\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueParseFunction(key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) {\r\n const intermediateValue = serializationObject[key];\r\n let finalValue;\r\n const className = intermediateValue?.type ?? intermediateValue?.className;\r\n if (IsMeshClassName(className)) {\r\n let nodes: TransformNode[] = scene.meshes.filter((m) => (intermediateValue.id ? m.id === intermediateValue.id : m.name === intermediateValue.name));\r\n if (nodes.length === 0) {\r\n nodes = scene.transformNodes.filter((m) => (intermediateValue.id ? m.id === intermediateValue.id : m.name === intermediateValue.name));\r\n }\r\n finalValue = intermediateValue.uniqueId ? nodes.find((m) => m.uniqueId === intermediateValue.uniqueId) : nodes[0];\r\n } else if (IsVectorClassName(className)) {\r\n finalValue = ParseVector(className, intermediateValue.value);\r\n } else if (IsAnimationGroupClassName(className)) {\r\n // do not use the scene.getAnimationGroupByName because it is possible that two AGs will have the same name\r\n const ags = scene.animationGroups.filter((ag) => ag.name === intermediateValue.name);\r\n // uniqueId changes on each load. this is used for the glTF loader, that uses serialization after the scene was loaded.\r\n finalValue = ags.length === 1 ? ags[0] : ags.find((ag) => ag.uniqueId === intermediateValue.uniqueId);\r\n } else if (className === FlowGraphTypes.Matrix) {\r\n finalValue = Matrix.FromArray(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix2D) {\r\n finalValue = new FlowGraphMatrix2D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix3D) {\r\n finalValue = new FlowGraphMatrix3D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Integer) {\r\n finalValue = FlowGraphInteger.FromValue(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Number || className === FlowGraphTypes.String || className === FlowGraphTypes.Boolean) {\r\n finalValue = intermediateValue.value[0];\r\n } else if (intermediateValue && intermediateValue.value !== undefined) {\r\n finalValue = intermediateValue.value;\r\n } else {\r\n if (Array.isArray(intermediateValue)) {\r\n // Check if this is an event configuration array (objects with id/eventData)\r\n // versus a plain array of primitives (e.g. variable name lists)\r\n if (intermediateValue.length > 0 && typeof intermediateValue[0] === \"object\" && intermediateValue[0] !== null && \"eventData\" in intermediateValue[0]) {\r\n // configuration data of an event\r\n finalValue = intermediateValue.reduce((acc, val) => {\r\n if (!val.eventData) {\r\n return acc;\r\n }\r\n acc[val.id] = {\r\n type: getRichTypeByFlowGraphType(val.type),\r\n };\r\n if (typeof val.value !== \"undefined\") {\r\n acc[val.id].value = defaultValueParseFunction(\"value\", val, assetsContainer, scene);\r\n }\r\n return acc;\r\n }, {});\r\n } else {\r\n // Plain array of primitives — return as-is\r\n finalValue = intermediateValue;\r\n }\r\n } else {\r\n finalValue = intermediateValue;\r\n }\r\n }\r\n return finalValue;\r\n}\r\n\r\n/**\r\n * Given a name of a flow graph block class, return if this\r\n * class needs to be created with a path converter. Used in\r\n * parsing.\r\n * @param className the name of the flow graph block class\r\n * @returns a boolean indicating if the class needs a path converter\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function needsPathConverter(className: string) {\r\n // I am not using the ClassName property here because it was causing a circular dependency\r\n return className === FlowGraphBlockNames.JsonPointerParser;\r\n}\r\n"]}
@@ -99,6 +99,7 @@ export declare class TransformNode extends Node {
99
99
  private _pivotMatrix;
100
100
  private _pivotMatrixInverse;
101
101
  /** @internal */
102
+ private _eulerCacheRotation;
102
103
  /** @internal */
103
104
  _postMultiplyPivotMatrix: boolean;
104
105
  protected _isWorldMatrixFrozen: boolean;