@onerjs/core 8.56.3 → 9.0.0
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.
- package/Animations/animatable.core.js +36 -0
- package/Animations/animatable.core.js.map +1 -1
- package/Animations/animationGroup.pure.d.ts +61 -1
- package/Animations/animationGroup.pure.js +191 -2
- package/Animations/animationGroup.pure.js.map +1 -1
- package/Animations/index.d.ts +1 -0
- package/Animations/index.js +1 -0
- package/Animations/index.js.map +1 -1
- package/Animations/pure.d.ts +1 -0
- package/Animations/pure.js +1 -0
- package/Animations/pure.js.map +1 -1
- package/Animations/rootMotion.d.ts +560 -0
- package/Animations/rootMotion.js +1709 -0
- package/Animations/rootMotion.js.map +1 -0
- package/Animations/runtimeAnimation.d.ts +57 -0
- package/Animations/runtimeAnimation.js +127 -3
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.d.ts +2 -0
- package/Cameras/arcRotateCamera.pure.js +2 -0
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/camera.pure.js +4 -0
- package/Cameras/camera.pure.js.map +1 -1
- package/Cameras/targetCamera.pure.d.ts +2 -0
- package/Cameras/targetCamera.pure.js +7 -1
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.js +5 -5
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.query.pure.js +4 -2
- package/Engines/AbstractEngine/abstractEngine.query.pure.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.query.types.d.ts +11 -2
- package/Engines/AbstractEngine/abstractEngine.query.types.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js +1 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.pure.js +63 -0
- package/Engines/Extensions/engine.multiRender.pure.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.types.d.ts +13 -0
- package/Engines/Extensions/engine.multiRender.types.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +2 -2
- package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.types.d.ts +2 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.types.js.map +1 -1
- package/Engines/Extensions/index.d.ts +1 -0
- package/Engines/Extensions/index.js +1 -0
- package/Engines/Extensions/index.js.map +1 -1
- package/Engines/Extensions/pure.d.ts +1 -1
- package/Engines/Extensions/pure.js +1 -1
- package/Engines/Extensions/pure.js.map +1 -1
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +88 -39
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.d.ts +20 -2
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +4 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.types.d.ts +13 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.types.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.pure.js +11 -3
- package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/index.d.ts +1 -0
- package/Engines/WebGPU/Extensions/index.js +1 -0
- package/Engines/WebGPU/Extensions/index.js.map +1 -1
- package/Engines/WebGPU/Extensions/pure.d.ts +1 -1
- package/Engines/WebGPU/Extensions/pure.js +1 -1
- package/Engines/WebGPU/Extensions/pure.js.map +1 -1
- package/Engines/WebGPU/webgpuBundleList.d.ts +2 -0
- package/Engines/WebGPU/webgpuBundleList.js +4 -0
- package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +5 -2
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +3 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +4 -0
- package/Engines/WebGPU/webgpuSnapshotRendering.js +40 -7
- package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +2 -2
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +2 -0
- package/Engines/WebGPU/webgpuTextureManager.js +286 -13
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +2 -0
- package/Engines/abstractEngine.pure.js +7 -3
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/constants.d.ts +4 -0
- package/Engines/constants.js +4 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/thinEngine.pure.d.ts +14 -0
- package/Engines/thinEngine.pure.js +48 -12
- package/Engines/thinEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +1 -0
- package/Engines/thinNativeEngine.pure.js +7 -1
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +4 -0
- package/Engines/thinWebGPUEngine.js +10 -1
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +5 -2
- package/Engines/webgpuEngine.pure.js +48 -13
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +2 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.d.ts +11 -2
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +1 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.d.ts +9 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js +6 -8
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +9 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +34 -9
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +4 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +4 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js +19 -7
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +20 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +53 -10
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.d.ts +16 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +64 -14
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js +64 -16
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +4 -0
- package/FlowGraph/flowGraph.js +38 -7
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.js +3 -0
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +7 -0
- package/FlowGraph/flowGraphConnection.js +7 -0
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +2 -1
- package/FlowGraph/flowGraphContext.js +4 -3
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +15 -1
- package/FlowGraph/flowGraphCoordinator.js +47 -16
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphEventBlock.d.ts +5 -0
- package/FlowGraph/flowGraphEventBlock.js +7 -0
- package/FlowGraph/flowGraphEventBlock.js.map +1 -1
- package/FlowGraph/flowGraphHostResolver.d.ts +2 -1
- package/FlowGraph/flowGraphHostResolver.js.map +1 -1
- package/FlowGraph/flowGraphParser.js +60 -2
- package/FlowGraph/flowGraphParser.js.map +1 -1
- package/FlowGraph/serialization.d.ts +2 -0
- package/FlowGraph/serialization.js +10 -22
- package/FlowGraph/serialization.js.map +1 -1
- package/FlowGraph/typeDefinitions.d.ts +8 -0
- package/FlowGraph/typeDefinitions.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.d.ts +5 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js +8 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.d.ts +87 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js +295 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/pure.d.ts +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/pure.js +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +4 -4
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.d.ts +5 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +13 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/allBlocks.pure.js +2 -0
- package/FrameGraph/Node/Blocks/allBlocks.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js +20 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/pure.d.ts +1 -0
- package/FrameGraph/Node/Blocks/pure.js +1 -0
- package/FrameGraph/Node/Blocks/pure.js.map +1 -1
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +4 -2
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +1 -0
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +5 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +1 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.d.ts +69 -0
- package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js +223 -0
- package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +25 -3
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +69 -33
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/frameGraphObjectList.d.ts +6 -1
- package/FrameGraph/frameGraphObjectList.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +3 -1
- package/FrameGraph/frameGraphRenderContext.js +5 -5
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/FrameGraph/pure.d.ts +1 -0
- package/FrameGraph/pure.js +1 -0
- package/FrameGraph/pure.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +4 -0
- package/Inputs/scene.inputManager.js +50 -8
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js +5 -5
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +5 -5
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +26 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +151 -47
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +5 -5
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +11 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js +17 -2
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +2 -2
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.d.ts +4 -0
- package/Materials/Node/nodeMaterial.pure.js +4 -0
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +25 -3
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -0
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -0
- package/Materials/Textures/Procedurals/proceduralTexture.pure.d.ts +13 -14
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js +6 -6
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
- package/Materials/Textures/baseTexture.pure.js +3 -0
- package/Materials/Textures/baseTexture.pure.js.map +1 -1
- package/Materials/Textures/cubeTexture.pure.js +1 -1
- package/Materials/Textures/cubeTexture.pure.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +8 -1
- package/Materials/Textures/internalTexture.js +9 -2
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.functions.d.ts +3 -3
- package/Materials/Textures/rawTexture2DArray.functions.js.map +1 -1
- package/Materials/Textures/rawTexture3D.d.ts +1 -1
- package/Materials/Textures/rawTexture3D.js +1 -1
- package/Materials/Textures/rawTexture3D.js.map +1 -1
- package/Materials/Textures/textureHelper.functions.d.ts +14 -0
- package/Materials/Textures/textureHelper.functions.js +24 -0
- package/Materials/Textures/textureHelper.functions.js.map +1 -1
- package/Materials/ditheredTileFadeMaterialPlugin.d.ts +210 -0
- package/Materials/ditheredTileFadeMaterialPlugin.js +509 -0
- package/Materials/ditheredTileFadeMaterialPlugin.js.map +1 -0
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +46 -1
- package/Materials/materialHelper.geometryrendering.js +105 -8
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/prepass.defines.d.ts +2 -0
- package/Materials/prepass.defines.js +2 -0
- package/Materials/prepass.defines.js.map +1 -1
- package/Materials/pure.d.ts +1 -0
- package/Materials/pure.js +1 -0
- package/Materials/pure.js.map +1 -1
- package/Materials/standardMaterial.pure.d.ts +2 -0
- package/Materials/standardMaterial.pure.js +6 -3
- package/Materials/standardMaterial.pure.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.pure.d.ts +4 -0
- package/Meshes/Builders/polygonBuilder.pure.js +4 -1
- package/Meshes/Builders/polygonBuilder.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplatting.functions.d.ts +19 -0
- package/Meshes/GaussianSplatting/gaussianSplatting.functions.js +23 -0
- package/Meshes/GaussianSplatting/gaussianSplatting.functions.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -14
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +20 -24
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +11 -4
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.d.ts +18 -0
- package/Meshes/abstractMesh.pure.js +22 -0
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/instancedMesh.pure.d.ts +5 -0
- package/Meshes/instancedMesh.pure.js +12 -0
- package/Meshes/instancedMesh.pure.js.map +1 -1
- package/Meshes/mesh.pure.js +23 -8
- package/Meshes/mesh.pure.js.map +1 -1
- package/Meshes/meshBlendingTag.d.ts +47 -0
- package/Meshes/meshBlendingTag.js +64 -0
- package/Meshes/meshBlendingTag.js.map +1 -0
- package/Meshes/polygonMesh.js +2 -2
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/pure.d.ts +1 -0
- package/Meshes/pure.js +1 -0
- package/Meshes/pure.js.map +1 -1
- package/Misc/fileTools.pure.js +21 -0
- package/Misc/fileTools.pure.js.map +1 -1
- package/Misc/snapshotRenderingHelper.js +2 -2
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +2 -0
- package/Particles/gpuParticleSystem.pure.js +89 -28
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Particles/thinParticleSystem.pure.d.ts +2 -0
- package/Particles/thinParticleSystem.pure.js +84 -19
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/Particles/webgl2ParticleSystem.pure.d.ts +1 -0
- package/Particles/webgl2ParticleSystem.pure.js +12 -4
- package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js +7 -0
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/index.d.ts +2 -0
- package/PostProcesses/index.js +2 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/meshBlendingBlueNoise.d.ts +15 -0
- package/PostProcesses/meshBlendingBlueNoise.js +77 -0
- package/PostProcesses/meshBlendingBlueNoise.js.map +1 -0
- package/PostProcesses/meshBlendingPostProcess.d.ts +131 -0
- package/PostProcesses/meshBlendingPostProcess.js +315 -0
- package/PostProcesses/meshBlendingPostProcess.js.map +1 -0
- package/PostProcesses/pure.d.ts +2 -0
- package/PostProcesses/pure.js +2 -0
- package/PostProcesses/pure.js.map +1 -1
- package/PostProcesses/thinMeshBlendingPostProcess.d.ts +339 -0
- package/PostProcesses/thinMeshBlendingPostProcess.js +771 -0
- package/PostProcesses/thinMeshBlendingPostProcess.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +6 -6
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +8 -8
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/Rendering/boundingBoxRenderer.pure.js +2 -1
- package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
- package/Rendering/depthRenderer.pure.js +3 -4
- package/Rendering/depthRenderer.pure.js.map +1 -1
- package/Rendering/edgesRenderer.pure.d.ts +4 -2
- package/Rendering/edgesRenderer.pure.js +11 -2
- package/Rendering/edgesRenderer.pure.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +10 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js +20 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +9 -3
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +14 -9
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.d.ts +38 -4
- package/Rendering/geometryBufferRenderer.pure.js +126 -17
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +7 -1
- package/Rendering/objectRenderer.js +45 -7
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.pure.js +6 -2
- package/Rendering/outlineRenderer.pure.js.map +1 -1
- package/Rendering/renderingManager.d.ts +1 -1
- package/Rendering/renderingManager.js +5 -4
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
- package/Shaders/ShadersInclude/defaultFragmentAlpha.js +34 -0
- package/Shaders/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +5 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/geometryRenderingFragment.d.ts +5 -0
- package/Shaders/ShadersInclude/geometryRenderingFragment.js +74 -0
- package/Shaders/ShadersInclude/geometryRenderingFragment.js.map +1 -0
- package/Shaders/ShadersInclude/mrtFragmentDeclaration.js +89 -0
- package/Shaders/ShadersInclude/mrtFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js +24 -17
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +27 -20
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js +6 -2
- package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
- package/Shaders/ShadersInclude/prePassDeclaration.js +95 -2
- package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/Shaders/default.fragment.js +31 -40
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/depthOfField.fragment.js +13 -9
- package/Shaders/depthOfField.fragment.js.map +1 -1
- package/Shaders/fluidRenderingParticleDepth.vertex.js +16 -1
- package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
- package/Shaders/fluidRenderingParticleThickness.vertex.js +16 -1
- package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.js +63 -3
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +80 -0
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/geometry.fragment.js +17 -11
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/gpuRenderParticles.fragment.js +43 -1
- package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.js +96 -16
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/meshBlending.fragment.d.ts +5 -0
- package/Shaders/meshBlending.fragment.js +519 -0
- package/Shaders/meshBlending.fragment.js.map +1 -0
- package/Shaders/particles.fragment.js +43 -1
- package/Shaders/particles.fragment.js.map +1 -1
- package/Shaders/particles.vertex.js +84 -3
- package/Shaders/particles.vertex.js.map +1 -1
- package/Shaders/sprites.fragment.js +52 -2
- package/Shaders/sprites.fragment.js.map +1 -1
- package/Shaders/sprites.vertex.js +62 -1
- package/Shaders/sprites.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js +33 -0
- package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.d.ts +6 -0
- package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js +76 -0
- package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js +18 -0
- package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js +11 -25
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +11 -25
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js +5 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +6 -1
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +17 -48
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +15 -2
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -2
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js +63 -2
- package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +80 -0
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +37 -2
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/gpuRenderParticles.fragment.js +47 -2
- package/ShadersWGSL/gpuRenderParticles.fragment.js.map +1 -1
- package/ShadersWGSL/gpuRenderParticles.vertex.js +110 -7
- package/ShadersWGSL/gpuRenderParticles.vertex.js.map +1 -1
- package/ShadersWGSL/meshBlending.fragment.d.ts +5 -0
- package/ShadersWGSL/meshBlending.fragment.js +576 -0
- package/ShadersWGSL/meshBlending.fragment.js.map +1 -0
- package/ShadersWGSL/openpbr.fragment.js +2 -1
- package/ShadersWGSL/openpbr.fragment.js.map +1 -1
- package/ShadersWGSL/particles.fragment.js +45 -1
- package/ShadersWGSL/particles.fragment.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +86 -4
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +2 -1
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/sprites.fragment.js +56 -2
- package/ShadersWGSL/sprites.fragment.js.map +1 -1
- package/ShadersWGSL/sprites.vertex.js +62 -1
- package/ShadersWGSL/sprites.vertex.js.map +1 -1
- package/Sprites/spriteManager.d.ts +13 -0
- package/Sprites/spriteManager.js +15 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.d.ts +24 -1
- package/Sprites/spriteRenderer.js +368 -50
- package/Sprites/spriteRenderer.js.map +1 -1
- package/Sprites/thinSprite.d.ts +4 -0
- package/Sprites/thinSprite.js +4 -0
- package/Sprites/thinSprite.js.map +1 -1
- package/States/alphaCullingState.d.ts +3 -1
- package/States/alphaCullingState.js +18 -3
- package/States/alphaCullingState.js.map +1 -1
- package/XR/webXRDefaultExperience.d.ts +5 -1
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXREnterExitUI.d.ts +2 -1
- package/XR/webXREnterExitUI.js.map +1 -1
- package/package.json +1 -1
- package/scene.pure.d.ts +23 -0
- package/scene.pure.js +35 -0
- package/scene.pure.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AA4CpE;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAuBvB;;;OAGG;IACH;IACI;;OAEG;IACI,MAAqC;QAArC,WAAM,GAAN,MAAM,CAA+B;QA9BhD;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QA6B3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,QAA0B;QAC5C,8CAA8C;IAClD,CAAC;IAED;;;;;;OAMG;IACI,iBAAiB,CAAI,IAAY,EAAE,QAAqB,EAAE,YAAgB;QAC7E,MAAM,KAAK,GAAG,IAAI,uBAAuB,CAAC,IAAI,yCAAiC,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC7G,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACI,kBAAkB,CAAI,IAAY,EAAE,QAAqB,EAAE,YAAgB;QAC9E,MAAM,MAAM,GAAG,IAAI,uBAAuB,CAAC,IAAI,0CAAkC,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC/G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C,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACpC,MAAM,gBAAgB,GAAQ,EAAE,CAAC;YACjC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;YACnC,mBAAmB,CAAC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,oBAA+C;QAC9D,mBAAmB;IACvB,CAAC;IAES,IAAI,CAAC,OAAyB,EAAE,MAAuB,EAAE,OAAa;QAC5E,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC;YACvB,MAAM;YACN,OAAO;YACP,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE;YAC9B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SAC1B,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphDataConnection } from \"./flowGraphDataConnection.pure\";\r\nimport { type RichType } from \"./flowGraphRichTypes\";\r\nimport { type ISerializedFlowGraphBlock, type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { type FlowGraphAction } from \"./flowGraphLogger\";\r\n\r\n/**\r\n * Options for parsing a block.\r\n */\r\nexport interface IFlowGraphBlockParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the property\r\n * @param serializationObject the serialization object where the property is located\r\n * @param assetsContainer the assets container\r\n * @param scene the scene that the block is being parsed in\r\n * @returns the parsed value\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The assets container to use when loading assets.\r\n */\r\n assetsContainer?: IAssetContainer;\r\n /**\r\n * The scene that the block is being parsed in.\r\n */\r\n scene: Scene;\r\n /**\r\n * The path converter to use to convert the path to an object accessor.\r\n */\r\n pathConverter?: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n\r\n/**\r\n * Configuration for a block.\r\n */\r\nexport interface IFlowGraphBlockConfiguration {\r\n /**\r\n * The name of the block.\r\n */\r\n name?: string;\r\n [extraPropertyKey: string]: any;\r\n}\r\n\r\n/**\r\n * A block in a flow graph. The most basic form\r\n * of a block has inputs and outputs that contain\r\n * data.\r\n */\r\nexport class FlowGraphBlock {\r\n /**\r\n * A randomly generated GUID for each block.\r\n */\r\n public uniqueId = RandomGUID();\r\n /**\r\n * The name of the block.\r\n */\r\n public name: string;\r\n /**\r\n * The data inputs of the block.\r\n */\r\n public dataInputs: FlowGraphDataConnection<any>[];\r\n /**\r\n * The data outputs of the block.\r\n */\r\n public dataOutputs: FlowGraphDataConnection<any>[];\r\n\r\n /**\r\n * Metadata that can be used by the block.\r\n */\r\n public metadata: any;\r\n\r\n /** Constructor is protected so only subclasses can be instantiated\r\n * @param config optional configuration for this block\r\n * @internal - do not use directly. Extend this class instead.\r\n */\r\n constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public config?: IFlowGraphBlockConfiguration\r\n ) {\r\n this.name = this.config?.name ?? this.getClassName();\r\n this.dataInputs = [];\r\n this.dataOutputs = [];\r\n }\r\n\r\n /**\r\n * @internal\r\n * This function is called when the block needs to update its output flows.\r\n * @param _context the context in which it is running\r\n */\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n // empty by default, overridden in data blocks\r\n }\r\n\r\n /**\r\n * Registers a data input on the block.\r\n * @param name the name of the input\r\n * @param richType the type of the input\r\n * @param defaultValue optional default value of the input. If not set, the rich type's default value will be used.\r\n * @returns the created connection\r\n */\r\n public registerDataInput<T>(name: string, richType: RichType<T>, defaultValue?: T): FlowGraphDataConnection<T> {\r\n const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input, this, richType, defaultValue);\r\n this.dataInputs.push(input);\r\n return input;\r\n }\r\n\r\n /**\r\n * Registers a data output on the block.\r\n * @param name the name of the input\r\n * @param richType the type of the input\r\n * @param defaultValue optional default value of the input. If not set, the rich type's default value will be used.\r\n * @returns the created connection\r\n */\r\n public registerDataOutput<T>(name: string, richType: RichType<T>, defaultValue?: T): FlowGraphDataConnection<T> {\r\n const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output, this, richType, defaultValue);\r\n this.dataOutputs.push(output);\r\n return output;\r\n }\r\n\r\n /**\r\n * Given the name of a data input, returns the connection if it exists\r\n * @param name the name of the input\r\n * @returns the connection if it exists, undefined otherwise\r\n */\r\n public getDataInput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataInputs.find((i) => i.name === name);\r\n }\r\n\r\n /**\r\n * Given the name of a data output, returns the connection if it exists\r\n * @param name the name of the output\r\n * @returns the connection if it exists, undefined otherwise\r\n */\r\n public getDataOutput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataOutputs.find((i) => i.name === name);\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @param serializationObject the object to serialize to\r\n * @param _valueSerializeFunction a function that serializes a specific value\r\n */\r\n public serialize(serializationObject: any = {}, _valueSerializeFunction: (key: string, value: any, serializationObject: any) => any = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.config = {};\r\n if (this.config) {\r\n const config = this.config;\r\n const keys = Object.keys(config);\r\n for (const key of keys) {\r\n _valueSerializeFunction(key, config[key], serializationObject.config);\r\n }\r\n }\r\n serializationObject.dataInputs = [];\r\n serializationObject.dataOutputs = [];\r\n serializationObject.className = this.getClassName();\r\n for (const input of this.dataInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.dataInputs.push(serializedInput);\r\n }\r\n for (const output of this.dataOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.dataOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n /**\r\n * Deserializes this block\r\n * @param _serializationObject the object to deserialize from\r\n */\r\n public deserialize(_serializationObject: ISerializedFlowGraphBlock) {\r\n // no-op by default\r\n }\r\n\r\n protected _log(context: FlowGraphContext, action: FlowGraphAction, payload?: any) {\r\n context.logger?.addLogItem({\r\n action,\r\n payload,\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n });\r\n }\r\n\r\n /**\r\n * Gets the class name of this block\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FlowGraphBlock\";\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AA4CpE;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAuBvB;;;OAGG;IACH;IACI;;OAEG;IACI,MAAqC;QAArC,WAAM,GAAN,MAAM,CAA+B;QA9BhD;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QA6B3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,QAA0B;QAC5C,8CAA8C;I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AAC;IAC5B,CAAC;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphDataConnection } from \"./flowGraphDataConnection.pure\";\r\nimport { type RichType } from \"./flowGraphRichTypes\";\r\nimport { type ISerializedFlowGraphBlock, type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { type FlowGraphAction } from \"./flowGraphLogger\";\r\n\r\n/**\r\n * Options for parsing a block.\r\n */\r\nexport interface IFlowGraphBlockParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the property\r\n * @param serializationObject the serialization object where the property is located\r\n * @param assetsContainer the assets container\r\n * @param scene the scene that the block is being parsed in\r\n * @returns the parsed value\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The assets container to use when loading assets.\r\n */\r\n assetsContainer?: IAssetContainer;\r\n /**\r\n * The scene that the block is being parsed in.\r\n */\r\n scene: Scene;\r\n /**\r\n * The path converter to use to convert the path to an object accessor.\r\n */\r\n pathConverter?: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n\r\n/**\r\n * Configuration for a block.\r\n */\r\nexport interface IFlowGraphBlockConfiguration {\r\n /**\r\n * The name of the block.\r\n */\r\n name?: string;\r\n [extraPropertyKey: string]: any;\r\n}\r\n\r\n/**\r\n * A block in a flow graph. The most basic form\r\n * of a block has inputs and outputs that contain\r\n * data.\r\n */\r\nexport class FlowGraphBlock {\r\n /**\r\n * A randomly generated GUID for each block.\r\n */\r\n public uniqueId = RandomGUID();\r\n /**\r\n * The name of the block.\r\n */\r\n public name: string;\r\n /**\r\n * The data inputs of the block.\r\n */\r\n public dataInputs: FlowGraphDataConnection<any>[];\r\n /**\r\n * The data outputs of the block.\r\n */\r\n public dataOutputs: FlowGraphDataConnection<any>[];\r\n\r\n /**\r\n * Metadata that can be used by the block.\r\n */\r\n public metadata: any;\r\n\r\n /** Constructor is protected so only subclasses can be instantiated\r\n * @param config optional configuration for this block\r\n * @internal - do not use directly. Extend this class instead.\r\n */\r\n constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public config?: IFlowGraphBlockConfiguration\r\n ) {\r\n this.name = this.config?.name ?? this.getClassName();\r\n this.dataInputs = [];\r\n this.dataOutputs = [];\r\n }\r\n\r\n /**\r\n * @internal\r\n * This function is called when the block needs to update its output flows.\r\n * @param _context the context in which it is running\r\n */\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n // empty by default, overridden in data blocks\r\n }\r\n\r\n /**\r\n * Registers a data input on the block.\r\n * @param name the name of the input\r\n * @param richType the type of the input\r\n * @param defaultValue optional default value of the input. If not set, the rich type's default value will be used.\r\n * @returns the created connection\r\n */\r\n public registerDataInput<T>(name: string, richType: RichType<T>, defaultValue?: T): FlowGraphDataConnection<T> {\r\n const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input, this, richType, defaultValue);\r\n this.dataInputs.push(input);\r\n return input;\r\n }\r\n\r\n /**\r\n * Registers a data output on the block.\r\n * @param name the name of the input\r\n * @param richType the type of the input\r\n * @param defaultValue optional default value of the input. If not set, the rich type's default value will be used.\r\n * @returns the created connection\r\n */\r\n public registerDataOutput<T>(name: string, richType: RichType<T>, defaultValue?: T): FlowGraphDataConnection<T> {\r\n const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output, this, richType, defaultValue);\r\n this.dataOutputs.push(output);\r\n return output;\r\n }\r\n\r\n /**\r\n * Given the name of a data input, returns the connection if it exists\r\n * @param name the name of the input\r\n * @returns the connection if it exists, undefined otherwise\r\n */\r\n public getDataInput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataInputs.find((i) => i.name === name);\r\n }\r\n\r\n /**\r\n * Given the name of a data output, returns the connection if it exists\r\n * @param name the name of the output\r\n * @returns the connection if it exists, undefined otherwise\r\n */\r\n public getDataOutput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataOutputs.find((i) => i.name === name);\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @param serializationObject the object to serialize to\r\n * @param _valueSerializeFunction a function that serializes a specific value\r\n */\r\n public serialize(serializationObject: any = {}, _valueSerializeFunction: (key: string, value: any, serializationObject: any) => any = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n if (this.metadata !== undefined) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n serializationObject.config = {};\r\n if (this.config) {\r\n const config = this.config;\r\n const keys = Object.keys(config);\r\n for (const key of keys) {\r\n _valueSerializeFunction(key, config[key], serializationObject.config);\r\n }\r\n }\r\n serializationObject.dataInputs = [];\r\n serializationObject.dataOutputs = [];\r\n serializationObject.className = this.getClassName();\r\n for (const input of this.dataInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.dataInputs.push(serializedInput);\r\n }\r\n for (const output of this.dataOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.dataOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n /**\r\n * Deserializes this block\r\n * @param _serializationObject the object to deserialize from\r\n */\r\n public deserialize(_serializationObject: ISerializedFlowGraphBlock) {\r\n // no-op by default\r\n }\r\n\r\n protected _log(context: FlowGraphContext, action: FlowGraphAction, payload?: any) {\r\n context.logger?.addLogItem({\r\n action,\r\n payload,\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n });\r\n }\r\n\r\n /**\r\n * Gets the class name of this block\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FlowGraphBlock\";\r\n }\r\n}\r\n"]}
|
|
@@ -42,6 +42,10 @@ export declare class FlowGraphConnection<BlockT, ConnectedToT extends IConnectab
|
|
|
42
42
|
* A uniquely identifying string for the connection.
|
|
43
43
|
*/
|
|
44
44
|
uniqueId: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional host-format metadata associated with this connection.
|
|
47
|
+
*/
|
|
48
|
+
metadata?: any;
|
|
45
49
|
/**
|
|
46
50
|
* The name of the connection.
|
|
47
51
|
*/
|
|
@@ -85,6 +89,9 @@ export declare class FlowGraphConnection<BlockT, ConnectedToT extends IConnectab
|
|
|
85
89
|
* Disconnects all connected points.
|
|
86
90
|
*/
|
|
87
91
|
disconnectFromAll(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Disconnects this point from every connected point.
|
|
94
|
+
*/
|
|
88
95
|
dispose(): void;
|
|
89
96
|
/**
|
|
90
97
|
* Saves the connection to a JSON object.
|
|
@@ -89,6 +89,9 @@ export class FlowGraphConnection {
|
|
|
89
89
|
}
|
|
90
90
|
this._connectedPoint.length = 0;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Disconnects this point from every connected point.
|
|
94
|
+
*/
|
|
92
95
|
dispose() {
|
|
93
96
|
for (const point of this._connectedPoint) {
|
|
94
97
|
this.disconnectFrom(point);
|
|
@@ -104,6 +107,9 @@ export class FlowGraphConnection {
|
|
|
104
107
|
serializationObject._connectionType = this._connectionType;
|
|
105
108
|
serializationObject.connectedPointIds = [];
|
|
106
109
|
serializationObject.className = this.getClassName();
|
|
110
|
+
if (this.metadata !== undefined) {
|
|
111
|
+
serializationObject.metadata = this.metadata;
|
|
112
|
+
}
|
|
107
113
|
for (const point of this._connectedPoint) {
|
|
108
114
|
serializationObject.connectedPointIds.push(point.uniqueId);
|
|
109
115
|
}
|
|
@@ -123,6 +129,7 @@ export class FlowGraphConnection {
|
|
|
123
129
|
this.name = serializationObject.name;
|
|
124
130
|
this._connectionType = serializationObject._connectionType;
|
|
125
131
|
this.connectedPointIds = serializationObject.connectedPointIds;
|
|
132
|
+
this.metadata = serializationObject.metadata;
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
135
|
//# sourceMappingURL=flowGraphConnection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAN,IAAkB,uBAGjB;AAHD,WAAkB,uBAAuB;IACrC,uEAAK,CAAA;IACL,yEAAM,CAAA;AACV,CAAC,EAHiB,uBAAuB,KAAvB,uBAAuB,QAGxC;AA6BD;;GAEG;AACH,MAAM,OAAO,mBAAmB;
|
|
1
|
+
{"version":3,"file":"flowGraphConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAN,IAAkB,uBAGjB;AAHD,WAAkB,uBAAuB;IACrC,uEAAK,CAAA;IACL,yEAAM,CAAA;AACV,CAAC,EAHiB,uBAAuB,KAAvB,uBAAuB,QAGxC;AA6BD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IA+B5B,YACI,IAAY,EACZ,eAAwC;IACxC,eAAe,CAAQ,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;QAjC9C,gBAAgB;QACT,oBAAe,GAAwB,EAAE,CAAC;QACjD;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAiB/B;;;WAGG;QACH,8CAA8C;QAC9C,6DAA6D;QACtD,sBAAiB,GAAU,EAAE,CAAC;QAOjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;O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AAC;QACrC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,iBAAiB,GAAG,mBAAmB,CAAC,iBAAiB,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\n\r\n/**\r\n * The type of a connection point - input or output.\r\n */\r\nexport const enum FlowGraphConnectionType {\r\n Input,\r\n Output,\r\n}\r\n\r\n/**\r\n * An interface for a connectable point in the flow graph.\r\n */\r\nexport interface IConnectable {\r\n /**\r\n * A uniquely identifying string for the connection.\r\n */\r\n uniqueId: string;\r\n /**\r\n * An array of the points that this point is connected to.\r\n */\r\n _connectedPoint: Array<IConnectable>;\r\n /**\r\n * Returns if the connection can only be connected to one other point.\r\n */\r\n _isSingularConnection(): boolean;\r\n /**\r\n * The type of the connection\r\n */\r\n _connectionType: FlowGraphConnectionType;\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n connectTo(point: IConnectable): void;\r\n}\r\n\r\n/**\r\n * The base connection class.\r\n */\r\nexport class FlowGraphConnection<BlockT, ConnectedToT extends IConnectable> implements IConnectable {\r\n /** @internal */\r\n public _connectedPoint: Array<ConnectedToT> = [];\r\n /**\r\n * A uniquely identifying string for the connection.\r\n */\r\n public uniqueId = RandomGUID();\r\n\r\n /**\r\n * Optional host-format metadata associated with this connection.\r\n */\r\n public metadata?: any;\r\n\r\n /**\r\n * The name of the connection.\r\n */\r\n public name: string;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _connectionType: FlowGraphConnectionType;\r\n\r\n /**\r\n * Used for parsing connections.\r\n * @internal\r\n */\r\n // disable warning as this is used for parsing\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public connectedPointIds: any[] = [];\r\n\r\n public constructor(\r\n name: string,\r\n _connectionType: FlowGraphConnectionType,\r\n /* @internal */ public _ownerBlock: BlockT\r\n ) {\r\n this.name = name;\r\n this._connectionType = _connectionType;\r\n }\r\n\r\n /**\r\n * The type of the connection\r\n */\r\n public get connectionType() {\r\n return this._connectionType;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Override this to indicate if a point can connect to more than one point.\r\n */\r\n public _isSingularConnection(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns if a point is connected to any other point.\r\n * @returns boolean indicating if the point is connected.\r\n */\r\n public isConnected(): boolean {\r\n return this._connectedPoint.length > 0;\r\n }\r\n\r\n /**\r\n * Connects two connections together.\r\n * @param point the connection to connect to.\r\n */\r\n public connectTo(point: ConnectedToT): void {\r\n if (this._connectionType === point._connectionType) {\r\n throw new Error(`Cannot connect two points of type ${this.connectionType}`);\r\n }\r\n if ((this._isSingularConnection() && this._connectedPoint.length > 0) || (point._isSingularConnection() && point._connectedPoint.length > 0)) {\r\n throw new Error(\"Max number of connections for point reached\");\r\n }\r\n this._connectedPoint.push(point);\r\n point._connectedPoint.push(this);\r\n }\r\n\r\n /**\r\n * Disconnects two connections.\r\n * @param point the connection to disconnect from.\r\n * @param removeFromLocal if true, the connection will be removed from the local connection list.\r\n */\r\n public disconnectFrom(point: ConnectedToT, removeFromLocal = true): void {\r\n const indexLocal = this._connectedPoint.indexOf(point);\r\n const indexConnected = point._connectedPoint.indexOf(this);\r\n if (indexLocal === -1 || indexConnected === -1) {\r\n return;\r\n }\r\n if (removeFromLocal) {\r\n this._connectedPoint.splice(indexLocal, 1);\r\n }\r\n point._connectedPoint.splice(indexConnected, 1);\r\n }\r\n\r\n /**\r\n * Disconnects all connected points.\r\n */\r\n public disconnectFromAll() {\r\n for (const point of this._connectedPoint) {\r\n this.disconnectFrom(point, false);\r\n }\r\n this._connectedPoint.length = 0;\r\n }\r\n\r\n /**\r\n * Disconnects this point from every connected point.\r\n */\r\n public dispose() {\r\n for (const point of this._connectedPoint) {\r\n this.disconnectFrom(point);\r\n }\r\n }\r\n\r\n /**\r\n * Saves the connection to a JSON object.\r\n * @param serializationObject the object to serialize to.\r\n */\r\n public serialize(serializationObject: any = {}) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject._connectionType = this._connectionType;\r\n serializationObject.connectedPointIds = [];\r\n serializationObject.className = this.getClassName();\r\n if (this.metadata !== undefined) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n for (const point of this._connectedPoint) {\r\n serializationObject.connectedPointIds.push(point.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the connection.\r\n */\r\n public getClassName(): string {\r\n return \"FGConnection\";\r\n }\r\n\r\n /**\r\n * Deserialize from a object into this\r\n * @param serializationObject the object to deserialize from.\r\n */\r\n deserialize(serializationObject: any) {\r\n this.uniqueId = serializationObject.uniqueId;\r\n this.name = serializationObject.name;\r\n this._connectionType = serializationObject._connectionType;\r\n this.connectedPointIds = serializationObject.connectedPointIds;\r\n this.metadata = serializationObject.metadata;\r\n }\r\n}\r\n"]}
|
|
@@ -241,9 +241,10 @@ export declare class FlowGraphContext {
|
|
|
241
241
|
* Decodes the array index denoted by a reference. Returns `undefined` when no host resolver is
|
|
242
242
|
* configured or the host does not recognise the value as an indexed reference.
|
|
243
243
|
* @param reference the reference to decode
|
|
244
|
+
* @param collection optional host collection the reference must address
|
|
244
245
|
* @returns the index the reference denotes, or `undefined` when it does not denote one
|
|
245
246
|
*/
|
|
246
|
-
decodeIndexReference(reference: string): number | undefined;
|
|
247
|
+
decodeIndexReference(reference: string, collection?: string): number | undefined;
|
|
247
248
|
/**
|
|
248
249
|
* Maps a runtime object to the reference the host addresses it by. Returns `undefined` when no
|
|
249
250
|
* host resolver is configured or the host cannot address the object.
|
|
@@ -227,10 +227,11 @@ let FlowGraphContext = (() => {
|
|
|
227
227
|
* Decodes the array index denoted by a reference. Returns `undefined` when no host resolver is
|
|
228
228
|
* configured or the host does not recognise the value as an indexed reference.
|
|
229
229
|
* @param reference the reference to decode
|
|
230
|
+
* @param collection optional host collection the reference must address
|
|
230
231
|
* @returns the index the reference denotes, or `undefined` when it does not denote one
|
|
231
232
|
*/
|
|
232
|
-
decodeIndexReference(reference) {
|
|
233
|
-
return this._configuration.coordinator.config.hostResolver?.decodeIndexReference?.(reference);
|
|
233
|
+
decodeIndexReference(reference, collection) {
|
|
234
|
+
return this._configuration.coordinator.config.hostResolver?.decodeIndexReference?.(reference, collection);
|
|
234
235
|
}
|
|
235
236
|
/**
|
|
236
237
|
* Maps a runtime object to the reference the host addresses it by. Returns `undefined` when no
|
|
@@ -454,7 +455,7 @@ let FlowGraphContext = (() => {
|
|
|
454
455
|
* @internal
|
|
455
456
|
*/
|
|
456
457
|
_clearPendingBlocks() {
|
|
457
|
-
for (const block of this._pendingBlocks) {
|
|
458
|
+
for (const block of this._pendingBlocks.slice()) {
|
|
458
459
|
block._cancelPendingTasks(this);
|
|
459
460
|
}
|
|
460
461
|
this._pendingBlocks.length = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAA2C,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAG9G,OAAO,EAAmB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA8DrE;;;;;GAKG;IACU,gBAAgB;;;;;;;;sBAAhB,gBAAgB;YA6GzB;;eAEG;YACH,IAAW,aAAa;gBACpB,OAAO,IAAI,CAAC,cAAc,CAAC;YAC/B,CAAC;YAED,IAAW,aAAa,CAAC,KAAc;gBACnC,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK,EAAE,CAA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,EAAE;gCAMX,SAAS,EAAE;YALZ,0KAAO,QAAQ,6BAAR,QAAQ,2FAAgB;YAM/B,8JAAO,IAAI,6BAAJ,IAAI,mFAAc;;;;;SAXhB,gBAAgB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { type FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { type FlowGraphSceneEventCoordinator } from \"./flowGraphSceneEventCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { type AssetType, type FlowGraphAssetType, GetFlowGraphAssetWithType } from \"./flowGraphAssetsContext\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { FlowGraphAction, FlowGraphLogger } from \"./flowGraphLogger\";\r\nimport { type IFlowGraphOnTickEventPayload } from \"./Blocks/Event/flowGraphSceneTickEventBlock\";\r\nimport { type FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * Represents a pending signal activation that was paused by a breakpoint.\r\n */\r\nexport interface IFlowGraphPendingActivation {\r\n /** The block that was about to execute */\r\n readonly block: FlowGraphExecutionBlock;\r\n /** The context in which execution was paused */\r\n readonly context: FlowGraphContext;\r\n /** The signal connection that triggered the execution */\r\n readonly signal: FlowGraphSignalConnection;\r\n}\r\n/**\r\n * Construction parameters for the context.\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n\r\n /**\r\n * The scene event coordinator that tracks runtime event state\r\n * (e.g. currently pressed keyboard keys).\r\n * When not provided, keyboard polling blocks (e.g. IsKeyPressed) will\r\n * report no keys pressed.\r\n */\r\n readonly sceneEventCoordinator?: FlowGraphSceneEventCoordinator;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * If none is provided, a default one will be created.\r\n */\r\n readonly assetsContext?: IAssetContainer;\r\n}\r\n\r\n/**\r\n * Options for parsing a context.\r\n */\r\nexport interface IFlowGraphContextParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the value\r\n * @param serializationObject the object containing the value\r\n * @param assetsContainer the assets container\r\n * @param scene the current scene\r\n * @returns\r\n */\r\n readonly valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The graph that the context is being parsed in.\r\n */\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * An optional user-facing name for the context.\r\n * Defaults to an empty string; the editor may assign a label like \"Context 0\".\r\n */\r\n @serialize()\r\n public name: string = \"\";\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * Optional type annotations for user variables.\r\n * Keys are variable names; values are type name strings (e.g. \"number\", \"Vector3\", \"Mesh\").\r\n * This map is maintained by the editor and persisted through serialization so\r\n * that a variable's declared type survives even when its value is undefined.\r\n */\r\n private _variableTypes: { [key: string]: string } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n\r\n /**\r\n * A context-specific global variables, available to all blocks in the context.\r\n */\r\n private _globalContextVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n /**\r\n * Observable triggered when a breakpoint is hit.\r\n * Observers receive the pending activation (block, context, signal) that was paused.\r\n */\r\n public onBreakpointHitObservable: Observable<IFlowGraphPendingActivation> = new Observable<IFlowGraphPendingActivation>();\r\n\r\n /**\r\n * A predicate called before each execution block runs.\r\n * If it returns true, execution is paused before the block and a\r\n * pending activation is stored, which can be resumed via\r\n * {@link continueExecution} or {@link stepExecution}.\r\n *\r\n * Set to `null` to disable breakpoint checking.\r\n */\r\n public breakpointPredicate: Nullable<(block: FlowGraphExecutionBlock) => boolean> = null;\r\n\r\n /**\r\n * The activation that is currently paused due to a breakpoint hit.\r\n * `null` when execution is not paused on a breakpoint.\r\n */\r\n private _pendingActivation: Nullable<IFlowGraphPendingActivation> = null;\r\n\r\n /**\r\n * When true, the next activation will pause regardless of the breakpoint predicate.\r\n * Set by {@link stepExecution}.\r\n */\r\n private _stepMode: boolean = false;\r\n\r\n /**\r\n * When set, the breakpoint check is skipped for this specific block uniqueId\r\n * on the very next call to {@link _shouldBreak}. Used by continue/step to avoid\r\n * immediately re-hitting the breakpoint on the block being resumed.\r\n */\r\n private _skipBreakpointForBlockId: Nullable<string> = null;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * Note that it can be shared between flow graph contexts.\r\n */\r\n public assetsContext: IAssetContainer;\r\n\r\n /**\r\n * Whether to treat data as right-handed.\r\n * This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing.\r\n * Default is false.\r\n */\r\n public treatDataAsRightHanded = false;\r\n\r\n private _enableLogging = false;\r\n\r\n /**\r\n * The logger used by the context to log actions.\r\n */\r\n public logger: Nullable<FlowGraphLogger>;\r\n\r\n /**\r\n * Enable logging on this context\r\n */\r\n public get enableLogging() {\r\n return this._enableLogging;\r\n }\r\n\r\n public set enableLogging(value: boolean) {\r\n if (this._enableLogging === value) {\r\n return;\r\n }\r\n this._enableLogging = value;\r\n if (this._enableLogging) {\r\n this.logger = new FlowGraphLogger();\r\n this.logger.logToConsole = true;\r\n } else {\r\n this.logger = null;\r\n }\r\n }\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n this.assetsContext = params.assetsContext ?? params.scene;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableSet,\r\n payload: {\r\n name,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Get an assets from the assets context based on its type and index in the array\r\n * @param type The type of the asset\r\n * @param index The index of the asset\r\n * @returns The asset or null if not found\r\n */\r\n public getAsset<T extends FlowGraphAssetType>(type: T, index: number): Nullable<AssetType<T>> {\r\n return GetFlowGraphAssetWithType(this.assetsContext, type, index);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name the name of the variable\r\n * @returns the value of the variable\r\n */\r\n public getVariable(name: string): any {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableGet,\r\n payload: {\r\n name,\r\n value: this._userVariables[name],\r\n },\r\n });\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n /**\r\n * Set the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @param typeName - the type name string (e.g. \"number\", \"Vector3\", \"Mesh\")\r\n */\r\n public setVariableType(name: string, typeName: string): void {\r\n this._variableTypes[name] = typeName;\r\n }\r\n\r\n /**\r\n * Get the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @returns the type name string, or undefined if no type was declared\r\n */\r\n public getVariableType(name: string): string | undefined {\r\n return this._variableTypes[name];\r\n }\r\n\r\n /**\r\n * Gets all variable type annotations.\r\n */\r\n public get variableTypes(): { [key: string]: string } {\r\n return this._variableTypes;\r\n }\r\n\r\n /**\r\n * Get the scene that the context belongs to.\r\n * @returns the scene\r\n */\r\n public getScene() {\r\n return this._configuration.scene;\r\n }\r\n\r\n /**\r\n * Encodes an event source key as the opaque reference exposed by event blocks on their `event`\r\n * output. Delegates to the {@link IFlowGraphHostResolver} configured on the coordinator, so the\r\n * reference format is owned by the environment hosting the graph.\r\n * @param key the event source key (e.g. `\"sceneReady\"`, `\"sceneTick\"`, or a custom event id)\r\n * @returns the event reference\r\n */\r\n public getEventReference(key: string): string {\r\n return this._configuration.coordinator._getEventReference(key);\r\n }\r\n\r\n /**\r\n * Decodes the array index denoted by a reference. Returns `undefined` when no host resolver is\r\n * configured or the host does not recognise the value as an indexed reference.\r\n * @param reference the reference to decode\r\n * @returns the index the reference denotes, or `undefined` when it does not denote one\r\n */\r\n public decodeIndexReference(reference: string): number | undefined {\r\n return this._configuration.coordinator.config.hostResolver?.decodeIndexReference?.(reference);\r\n }\r\n\r\n /**\r\n * Maps a runtime object to the reference the host addresses it by. Returns `undefined` when no\r\n * host resolver is configured or the host cannot address the object.\r\n * @param object the runtime object to address\r\n * @param hint optional disambiguation hint telling the host which kind of reference is wanted\r\n * @returns the reference for the object, or `undefined` when it cannot be addressed\r\n */\r\n public getObjectReference(object: object, hint?: string): string | undefined {\r\n return this._configuration.coordinator.config.hostResolver?.getObjectReference?.(object, hint);\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param name name of the variable\r\n * @param defaultValue default value to return if the variable is not defined\r\n * @returns the variable value or the default value if the variable is not defined\r\n */\r\n public _getGlobalContextVariable<T>(name: string, defaultValue: T): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableGet,\r\n payload: {\r\n name,\r\n defaultValue,\r\n possibleValue: this._globalContextVariables[name],\r\n },\r\n });\r\n if (this._hasGlobalContextVariable(name)) {\r\n return this._globalContextVariables[name];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Set a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public _setGlobalContextVariable<T>(name: string, value: T) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableSet,\r\n payload: { name, value },\r\n });\r\n this._globalContextVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Delete a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n */\r\n public _deleteGlobalContextVariable(name: string) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableDelete,\r\n payload: { name },\r\n });\r\n delete this._globalContextVariables[name];\r\n }\r\n\r\n /**\r\n * Check if a global context variable is defined\r\n * @internal\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public _hasGlobalContextVariable(name: string) {\r\n return name in this._globalContextVariables;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable<T>(block: FlowGraphBlock, name: string, defaultValue: T): T {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.SetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Set a connection value by key\r\n * @internal\r\n * @param key the key of the connection value\r\n * @param value the value of the connection\r\n */\r\n public _setConnectionValueByKey<T>(key: string, value: T) {\r\n this._connectionValues[key] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value: this._connectionValues[connectionPoint.uniqueId],\r\n },\r\n });\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Check if there are any pending blocks in this context\r\n * @returns true if there are pending blocks\r\n */\r\n public get hasPendingBlocks() {\r\n return this._pendingBlocks.length > 0;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n // check if block is already in the array\r\n if (this._pendingBlocks.includes(block)) {\r\n return;\r\n }\r\n this._pendingBlocks.push(block);\r\n // sort pending blocks by priority\r\n this._pendingBlocks.sort((a, b) => a.priority - b.priority);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: node.getClassName(),\r\n uniqueId: node.uniqueId,\r\n action: FlowGraphAction.ExecuteBlock,\r\n });\r\n }\r\n\r\n public _notifyOnTick(framePayload: IFlowGraphOnTickEventPayload) {\r\n // set the values as global variables\r\n this._setGlobalContextVariable(\"timeSinceStart\", framePayload.timeSinceStart);\r\n this._setGlobalContextVariable(\"deltaTime\", framePayload.deltaTime);\r\n // iterate the pending blocks and run each one's onFrame function\r\n for (const block of this._pendingBlocks) {\r\n block._executeOnTick?.(this);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n // ── Breakpoint API ─────────────────────────────────────────────────\r\n\r\n /**\r\n * Check whether the given block should break before executing.\r\n * Called by the signal connection infrastructure.\r\n * @internal\r\n * @param block the block about to execute\r\n * @param signal the signal that is triggering the execution\r\n * @returns true if execution should be paused (breakpoint hit)\r\n */\r\n public _shouldBreak(block: FlowGraphExecutionBlock, signal: FlowGraphSignalConnection): boolean {\r\n // If continue/step just resumed this specific block, let it through\r\n if (this._skipBreakpointForBlockId === block.uniqueId) {\r\n this._skipBreakpointForBlockId = null;\r\n return false;\r\n }\r\n\r\n // If already paused on a breakpoint, silently block further execution\r\n // without overwriting the pending activation or re-notifying observers.\r\n if (this._pendingActivation) {\r\n return true;\r\n }\r\n\r\n if (this._stepMode) {\r\n this._stepMode = false;\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n if (this.breakpointPredicate && this.breakpointPredicate(block)) {\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns the currently paused activation, or null if not paused.\r\n */\r\n public get pendingActivation(): Nullable<IFlowGraphPendingActivation> {\r\n return this._pendingActivation;\r\n }\r\n\r\n /**\r\n * Resume execution from a breakpoint hit.\r\n * The paused block and all downstream blocks will execute normally until\r\n * the next breakpoint (if any) is hit.\r\n */\r\n public continueExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // Clear in case no re-entry happened (shouldn't linger)\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Execute exactly the paused block and then pause again before the next\r\n * execution block fires. If no activation is pending, this is a no-op.\r\n */\r\n public stepExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Enable step mode so the very next input-signal activation will pause\r\n this._stepMode = true;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // If nothing further executed (end of chain), clear step mode\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Discard any pending breakpoint activation without resuming.\r\n * Used when stopping or resetting the graph.\r\n * @internal\r\n */\r\n public _clearPendingActivation(): void {\r\n this._pendingActivation = null;\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n // Persist variable type annotations (editor metadata)\r\n if (Object.keys(this._variableTypes).length > 0) {\r\n serializationObject._variableTypes = { ...this._variableTypes };\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n // serialize assets context, if not scene\r\n if (this.assetsContext !== this.getScene()) {\r\n serializationObject._assetsContext = {\r\n meshes: this.assetsContext.meshes.map((m) => m.id),\r\n materials: this.assetsContext.materials.map((m) => m.id),\r\n textures: this.assetsContext.textures.map((m) => m.name),\r\n animations: this.assetsContext.animations.map((m) => m.name),\r\n lights: this.assetsContext.lights.map((m) => m.id),\r\n cameras: this.assetsContext.cameras.map((m) => m.id),\r\n sounds: this.assetsContext.sounds?.map((m) => m.name),\r\n skeletons: this.assetsContext.skeletons.map((m) => m.id),\r\n particleSystems: this.assetsContext.particleSystems.map((m) => m.name),\r\n geometries: this.assetsContext.geometries.map((m) => m.id),\r\n multiMaterials: this.assetsContext.multiMaterials.map((m) => m.id),\r\n transformNodes: this.assetsContext.transformNodes.map((m) => m.id),\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name of the object.\r\n */\r\n public getClassName() {\r\n return \"FlowGraphContext\";\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,M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CAAC,IAAI,CAAC;wBACtE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC1D,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBAClE,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBACrE,CAAC;gBACN,CAAC;YACL,CAAC;YAED;;eAEG;YACI,YAAY;gBACf,OAAO,kBAAkB,CAAC;YAC9B,CAAC;;;;oCA7pBA,SAAS,EAAE;gCAMX,SAAS,EAAE;YALZ,0KAAO,QAAQ,6BAAR,QAAQ,2FAAgB;YAM/B,8JAAO,IAAI,6BAAJ,IAAI,mFAAc;;;;;SAXhB,gBAAgB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { type FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { type FlowGraphSceneEventCoordinator } from \"./flowGraphSceneEventCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { type AssetType, type FlowGraphAssetType, GetFlowGraphAssetWithType } from \"./flowGraphAssetsContext\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { FlowGraphAction, FlowGraphLogger } from \"./flowGraphLogger\";\r\nimport { type IFlowGraphOnTickEventPayload } from \"./Blocks/Event/flowGraphSceneTickEventBlock\";\r\nimport { type FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * Represents a pending signal activation that was paused by a breakpoint.\r\n */\r\nexport interface IFlowGraphPendingActivation {\r\n /** The block that was about to execute */\r\n readonly block: FlowGraphExecutionBlock;\r\n /** The context in which execution was paused */\r\n readonly context: FlowGraphContext;\r\n /** The signal connection that triggered the execution */\r\n readonly signal: FlowGraphSignalConnection;\r\n}\r\n/**\r\n * Construction parameters for the context.\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n\r\n /**\r\n * The scene event coordinator that tracks runtime event state\r\n * (e.g. currently pressed keyboard keys).\r\n * When not provided, keyboard polling blocks (e.g. IsKeyPressed) will\r\n * report no keys pressed.\r\n */\r\n readonly sceneEventCoordinator?: FlowGraphSceneEventCoordinator;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * If none is provided, a default one will be created.\r\n */\r\n readonly assetsContext?: IAssetContainer;\r\n}\r\n\r\n/**\r\n * Options for parsing a context.\r\n */\r\nexport interface IFlowGraphContextParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the value\r\n * @param serializationObject the object containing the value\r\n * @param assetsContainer the assets container\r\n * @param scene the current scene\r\n * @returns\r\n */\r\n readonly valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The graph that the context is being parsed in.\r\n */\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * An optional user-facing name for the context.\r\n * Defaults to an empty string; the editor may assign a label like \"Context 0\".\r\n */\r\n @serialize()\r\n public name: string = \"\";\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * Optional type annotations for user variables.\r\n * Keys are variable names; values are type name strings (e.g. \"number\", \"Vector3\", \"Mesh\").\r\n * This map is maintained by the editor and persisted through serialization so\r\n * that a variable's declared type survives even when its value is undefined.\r\n */\r\n private _variableTypes: { [key: string]: string } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n\r\n /**\r\n * A context-specific global variables, available to all blocks in the context.\r\n */\r\n private _globalContextVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n /**\r\n * Observable triggered when a breakpoint is hit.\r\n * Observers receive the pending activation (block, context, signal) that was paused.\r\n */\r\n public onBreakpointHitObservable: Observable<IFlowGraphPendingActivation> = new Observable<IFlowGraphPendingActivation>();\r\n\r\n /**\r\n * A predicate called before each execution block runs.\r\n * If it returns true, execution is paused before the block and a\r\n * pending activation is stored, which can be resumed via\r\n * {@link continueExecution} or {@link stepExecution}.\r\n *\r\n * Set to `null` to disable breakpoint checking.\r\n */\r\n public breakpointPredicate: Nullable<(block: FlowGraphExecutionBlock) => boolean> = null;\r\n\r\n /**\r\n * The activation that is currently paused due to a breakpoint hit.\r\n * `null` when execution is not paused on a breakpoint.\r\n */\r\n private _pendingActivation: Nullable<IFlowGraphPendingActivation> = null;\r\n\r\n /**\r\n * When true, the next activation will pause regardless of the breakpoint predicate.\r\n * Set by {@link stepExecution}.\r\n */\r\n private _stepMode: boolean = false;\r\n\r\n /**\r\n * When set, the breakpoint check is skipped for this specific block uniqueId\r\n * on the very next call to {@link _shouldBreak}. Used by continue/step to avoid\r\n * immediately re-hitting the breakpoint on the block being resumed.\r\n */\r\n private _skipBreakpointForBlockId: Nullable<string> = null;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * Note that it can be shared between flow graph contexts.\r\n */\r\n public assetsContext: IAssetContainer;\r\n\r\n /**\r\n * Whether to treat data as right-handed.\r\n * This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing.\r\n * Default is false.\r\n */\r\n public treatDataAsRightHanded = false;\r\n\r\n private _enableLogging = false;\r\n\r\n /**\r\n * The logger used by the context to log actions.\r\n */\r\n public logger: Nullable<FlowGraphLogger>;\r\n\r\n /**\r\n * Enable logging on this context\r\n */\r\n public get enableLogging() {\r\n return this._enableLogging;\r\n }\r\n\r\n public set enableLogging(value: boolean) {\r\n if (this._enableLogging === value) {\r\n return;\r\n }\r\n this._enableLogging = value;\r\n if (this._enableLogging) {\r\n this.logger = new FlowGraphLogger();\r\n this.logger.logToConsole = true;\r\n } else {\r\n this.logger = null;\r\n }\r\n }\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n this.assetsContext = params.assetsContext ?? params.scene;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableSet,\r\n payload: {\r\n name,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Get an assets from the assets context based on its type and index in the array\r\n * @param type The type of the asset\r\n * @param index The index of the asset\r\n * @returns The asset or null if not found\r\n */\r\n public getAsset<T extends FlowGraphAssetType>(type: T, index: number): Nullable<AssetType<T>> {\r\n return GetFlowGraphAssetWithType(this.assetsContext, type, index);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name the name of the variable\r\n * @returns the value of the variable\r\n */\r\n public getVariable(name: string): any {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableGet,\r\n payload: {\r\n name,\r\n value: this._userVariables[name],\r\n },\r\n });\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n /**\r\n * Set the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @param typeName - the type name string (e.g. \"number\", \"Vector3\", \"Mesh\")\r\n */\r\n public setVariableType(name: string, typeName: string): void {\r\n this._variableTypes[name] = typeName;\r\n }\r\n\r\n /**\r\n * Get the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @returns the type name string, or undefined if no type was declared\r\n */\r\n public getVariableType(name: string): string | undefined {\r\n return this._variableTypes[name];\r\n }\r\n\r\n /**\r\n * Gets all variable type annotations.\r\n */\r\n public get variableTypes(): { [key: string]: string } {\r\n return this._variableTypes;\r\n }\r\n\r\n /**\r\n * Get the scene that the context belongs to.\r\n * @returns the scene\r\n */\r\n public getScene() {\r\n return this._configuration.scene;\r\n }\r\n\r\n /**\r\n * Encodes an event source key as the opaque reference exposed by event blocks on their `event`\r\n * output. Delegates to the {@link IFlowGraphHostResolver} configured on the coordinator, so the\r\n * reference format is owned by the environment hosting the graph.\r\n * @param key the event source key (e.g. `\"sceneReady\"`, `\"sceneTick\"`, or a custom event id)\r\n * @returns the event reference\r\n */\r\n public getEventReference(key: string): string {\r\n return this._configuration.coordinator._getEventReference(key);\r\n }\r\n\r\n /**\r\n * Decodes the array index denoted by a reference. Returns `undefined` when no host resolver is\r\n * configured or the host does not recognise the value as an indexed reference.\r\n * @param reference the reference to decode\r\n * @param collection optional host collection the reference must address\r\n * @returns the index the reference denotes, or `undefined` when it does not denote one\r\n */\r\n public decodeIndexReference(reference: string, collection?: string): number | undefined {\r\n return this._configuration.coordinator.config.hostResolver?.decodeIndexReference?.(reference, collection);\r\n }\r\n\r\n /**\r\n * Maps a runtime object to the reference the host addresses it by. Returns `undefined` when no\r\n * host resolver is configured or the host cannot address the object.\r\n * @param object the runtime object to address\r\n * @param hint optional disambiguation hint telling the host which kind of reference is wanted\r\n * @returns the reference for the object, or `undefined` when it cannot be addressed\r\n */\r\n public getObjectReference(object: object, hint?: string): string | undefined {\r\n return this._configuration.coordinator.config.hostResolver?.getObjectReference?.(object, hint);\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param name name of the variable\r\n * @param defaultValue default value to return if the variable is not defined\r\n * @returns the variable value or the default value if the variable is not defined\r\n */\r\n public _getGlobalContextVariable<T>(name: string, defaultValue: T): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableGet,\r\n payload: {\r\n name,\r\n defaultValue,\r\n possibleValue: this._globalContextVariables[name],\r\n },\r\n });\r\n if (this._hasGlobalContextVariable(name)) {\r\n return this._globalContextVariables[name];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Set a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public _setGlobalContextVariable<T>(name: string, value: T) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableSet,\r\n payload: { name, value },\r\n });\r\n this._globalContextVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Delete a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n */\r\n public _deleteGlobalContextVariable(name: string) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableDelete,\r\n payload: { name },\r\n });\r\n delete this._globalContextVariables[name];\r\n }\r\n\r\n /**\r\n * Check if a global context variable is defined\r\n * @internal\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public _hasGlobalContextVariable(name: string) {\r\n return name in this._globalContextVariables;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable<T>(block: FlowGraphBlock, name: string, defaultValue: T): T {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.SetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Set a connection value by key\r\n * @internal\r\n * @param key the key of the connection value\r\n * @param value the value of the connection\r\n */\r\n public _setConnectionValueByKey<T>(key: string, value: T) {\r\n this._connectionValues[key] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value: this._connectionValues[connectionPoint.uniqueId],\r\n },\r\n });\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Check if there are any pending blocks in this context\r\n * @returns true if there are pending blocks\r\n */\r\n public get hasPendingBlocks() {\r\n return this._pendingBlocks.length > 0;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n // check if block is already in the array\r\n if (this._pendingBlocks.includes(block)) {\r\n return;\r\n }\r\n this._pendingBlocks.push(block);\r\n // sort pending blocks by priority\r\n this._pendingBlocks.sort((a, b) => a.priority - b.priority);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks.slice()) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: node.getClassName(),\r\n uniqueId: node.uniqueId,\r\n action: FlowGraphAction.ExecuteBlock,\r\n });\r\n }\r\n\r\n public _notifyOnTick(framePayload: IFlowGraphOnTickEventPayload) {\r\n // set the values as global variables\r\n this._setGlobalContextVariable(\"timeSinceStart\", framePayload.timeSinceStart);\r\n this._setGlobalContextVariable(\"deltaTime\", framePayload.deltaTime);\r\n // iterate the pending blocks and run each one's onFrame function\r\n for (const block of this._pendingBlocks) {\r\n block._executeOnTick?.(this);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n // ── Breakpoint API ─────────────────────────────────────────────────\r\n\r\n /**\r\n * Check whether the given block should break before executing.\r\n * Called by the signal connection infrastructure.\r\n * @internal\r\n * @param block the block about to execute\r\n * @param signal the signal that is triggering the execution\r\n * @returns true if execution should be paused (breakpoint hit)\r\n */\r\n public _shouldBreak(block: FlowGraphExecutionBlock, signal: FlowGraphSignalConnection): boolean {\r\n // If continue/step just resumed this specific block, let it through\r\n if (this._skipBreakpointForBlockId === block.uniqueId) {\r\n this._skipBreakpointForBlockId = null;\r\n return false;\r\n }\r\n\r\n // If already paused on a breakpoint, silently block further execution\r\n // without overwriting the pending activation or re-notifying observers.\r\n if (this._pendingActivation) {\r\n return true;\r\n }\r\n\r\n if (this._stepMode) {\r\n this._stepMode = false;\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n if (this.breakpointPredicate && this.breakpointPredicate(block)) {\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns the currently paused activation, or null if not paused.\r\n */\r\n public get pendingActivation(): Nullable<IFlowGraphPendingActivation> {\r\n return this._pendingActivation;\r\n }\r\n\r\n /**\r\n * Resume execution from a breakpoint hit.\r\n * The paused block and all downstream blocks will execute normally until\r\n * the next breakpoint (if any) is hit.\r\n */\r\n public continueExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // Clear in case no re-entry happened (shouldn't linger)\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Execute exactly the paused block and then pause again before the next\r\n * execution block fires. If no activation is pending, this is a no-op.\r\n */\r\n public stepExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Enable step mode so the very next input-signal activation will pause\r\n this._stepMode = true;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // If nothing further executed (end of chain), clear step mode\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Discard any pending breakpoint activation without resuming.\r\n * Used when stopping or resetting the graph.\r\n * @internal\r\n */\r\n public _clearPendingActivation(): void {\r\n this._pendingActivation = null;\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n // Persist variable type annotations (editor metadata)\r\n if (Object.keys(this._variableTypes).length > 0) {\r\n serializationObject._variableTypes = { ...this._variableTypes };\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n // serialize assets context, if not scene\r\n if (this.assetsContext !== this.getScene()) {\r\n serializationObject._assetsContext = {\r\n meshes: this.assetsContext.meshes.map((m) => m.id),\r\n materials: this.assetsContext.materials.map((m) => m.id),\r\n textures: this.assetsContext.textures.map((m) => m.name),\r\n animations: this.assetsContext.animations.map((m) => m.name),\r\n lights: this.assetsContext.lights.map((m) => m.id),\r\n cameras: this.assetsContext.cameras.map((m) => m.id),\r\n sounds: this.assetsContext.sounds?.map((m) => m.name),\r\n skeletons: this.assetsContext.skeletons.map((m) => m.id),\r\n particleSystems: this.assetsContext.particleSystems.map((m) => m.name),\r\n geometries: this.assetsContext.geometries.map((m) => m.id),\r\n multiMaterials: this.assetsContext.multiMaterials.map((m) => m.id),\r\n transformNodes: this.assetsContext.transformNodes.map((m) => m.id),\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name of the object.\r\n */\r\n public getClassName() {\r\n return \"FlowGraphContext\";\r\n }\r\n}\r\n"]}
|
|
@@ -101,12 +101,22 @@ export declare class FlowGraphCoordinator {
|
|
|
101
101
|
_eventDispatchStack: {
|
|
102
102
|
eventId: string;
|
|
103
103
|
state: EventState;
|
|
104
|
+
propagationStopped: boolean;
|
|
104
105
|
}[];
|
|
105
106
|
constructor(
|
|
106
107
|
/**
|
|
107
108
|
* the configuration of the block
|
|
108
109
|
*/
|
|
109
110
|
config: IFlowGraphCoordinatorConfiguration);
|
|
111
|
+
private _attachToScene;
|
|
112
|
+
private _detachFromScene;
|
|
113
|
+
/**
|
|
114
|
+
* Reattaches this coordinator's lifecycle observers to another scene.
|
|
115
|
+
* @param scene new scene owned by the coordinator
|
|
116
|
+
* @param updateGraphs whether existing graphs should also be reattached
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
_setScene(scene: Scene, updateGraphs?: boolean): void;
|
|
110
120
|
/**
|
|
111
121
|
* Creates a new flow graph and adds it to the list of existing flow graphs
|
|
112
122
|
* @param name - optional name for the new graph. If not provided, an auto-generated name is used.
|
|
@@ -164,7 +174,11 @@ export declare class FlowGraphCoordinator {
|
|
|
164
174
|
* Marks the end of the most recent custom-event dispatch started with
|
|
165
175
|
* {@link _beginEventDispatch}.
|
|
166
176
|
*/
|
|
167
|
-
_endEventDispatch():
|
|
177
|
+
_endEventDispatch(): {
|
|
178
|
+
eventId: string;
|
|
179
|
+
state: EventState;
|
|
180
|
+
propagationStopped: boolean;
|
|
181
|
+
} | undefined;
|
|
168
182
|
/**
|
|
169
183
|
* Stops the propagation of an in-flight custom event, preventing any event
|
|
170
184
|
* handler nodes that have not been activated yet from running for the current
|
|
@@ -48,11 +48,14 @@ export class FlowGraphCoordinator {
|
|
|
48
48
|
* @internal
|
|
49
49
|
*/
|
|
50
50
|
this._eventDispatchStack = [];
|
|
51
|
+
this._attachToScene(this.config.scene);
|
|
52
|
+
}
|
|
53
|
+
_attachToScene(scene) {
|
|
51
54
|
// When the scene is disposed, dispose all graphs currently running on it.
|
|
52
|
-
this._disposeObserver =
|
|
55
|
+
this._disposeObserver = scene.onDisposeObservable.add(() => {
|
|
53
56
|
this.dispose();
|
|
54
57
|
});
|
|
55
|
-
this._onBeforeRenderObserver =
|
|
58
|
+
this._onBeforeRenderObserver = scene.onBeforeRenderObservable.add(() => {
|
|
56
59
|
// Reset the event execution counter at the beginning of each frame.
|
|
57
60
|
this._eventExecutionCounter.clear();
|
|
58
61
|
// duplicate the _executeOnNextFrame array to avoid modifying it while iterating over it
|
|
@@ -70,13 +73,45 @@ export class FlowGraphCoordinator {
|
|
|
70
73
|
}
|
|
71
74
|
});
|
|
72
75
|
// Add itself to the SceneCoordinators list for the Inspector.
|
|
73
|
-
let coordinators = FlowGraphCoordinator.SceneCoordinators.get(
|
|
76
|
+
let coordinators = FlowGraphCoordinator.SceneCoordinators.get(scene);
|
|
74
77
|
if (!coordinators) {
|
|
75
78
|
coordinators = [];
|
|
76
|
-
FlowGraphCoordinator.SceneCoordinators.set(
|
|
79
|
+
FlowGraphCoordinator.SceneCoordinators.set(scene, coordinators);
|
|
77
80
|
}
|
|
78
81
|
coordinators.push(this);
|
|
79
82
|
}
|
|
83
|
+
_detachFromScene(scene) {
|
|
84
|
+
this._disposeObserver.remove();
|
|
85
|
+
this._onBeforeRenderObserver.remove();
|
|
86
|
+
const coordinators = FlowGraphCoordinator.SceneCoordinators.get(scene);
|
|
87
|
+
if (!coordinators) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const index = coordinators.indexOf(this);
|
|
91
|
+
if (index !== -1) {
|
|
92
|
+
coordinators.splice(index, 1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Reattaches this coordinator's lifecycle observers to another scene.
|
|
97
|
+
* @param scene new scene owned by the coordinator
|
|
98
|
+
* @param updateGraphs whether existing graphs should also be reattached
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
_setScene(scene, updateGraphs = true) {
|
|
102
|
+
const previousScene = this.config.scene;
|
|
103
|
+
if (scene === previousScene) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this._detachFromScene(previousScene);
|
|
107
|
+
this.config.scene = scene;
|
|
108
|
+
if (updateGraphs) {
|
|
109
|
+
for (const graph of this._flowGraphs) {
|
|
110
|
+
graph.setScene(scene);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
this._attachToScene(scene);
|
|
114
|
+
}
|
|
80
115
|
/**
|
|
81
116
|
* Creates a new flow graph and adds it to the list of existing flow graphs
|
|
82
117
|
* @param name - optional name for the new graph. If not provided, an auto-generated name is used.
|
|
@@ -118,14 +153,7 @@ export class FlowGraphCoordinator {
|
|
|
118
153
|
FlowGraphCoordinator._OnFlowGraphRemovedObservable.notifyObservers(graph);
|
|
119
154
|
}
|
|
120
155
|
this._flowGraphs.length = 0;
|
|
121
|
-
this.
|
|
122
|
-
this._onBeforeRenderObserver?.remove();
|
|
123
|
-
// Remove itself from the SceneCoordinators list for the Inspector.
|
|
124
|
-
const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];
|
|
125
|
-
const index = coordinators.indexOf(this);
|
|
126
|
-
if (index !== -1) {
|
|
127
|
-
coordinators.splice(index, 1);
|
|
128
|
-
}
|
|
156
|
+
this._detachFromScene(this.config.scene);
|
|
129
157
|
}
|
|
130
158
|
/**
|
|
131
159
|
* Serializes this coordinator to a JSON object.
|
|
@@ -201,7 +229,7 @@ export class FlowGraphCoordinator {
|
|
|
201
229
|
* @param state the Observable EventState for this dispatch
|
|
202
230
|
*/
|
|
203
231
|
_beginEventDispatch(eventId, state) {
|
|
204
|
-
this._eventDispatchStack.push({ eventId, state });
|
|
232
|
+
this._eventDispatchStack.push({ eventId, state, propagationStopped: false });
|
|
205
233
|
}
|
|
206
234
|
/**
|
|
207
235
|
* @internal
|
|
@@ -209,7 +237,7 @@ export class FlowGraphCoordinator {
|
|
|
209
237
|
* {@link _beginEventDispatch}.
|
|
210
238
|
*/
|
|
211
239
|
_endEventDispatch() {
|
|
212
|
-
this._eventDispatchStack.pop();
|
|
240
|
+
return this._eventDispatchStack.pop();
|
|
213
241
|
}
|
|
214
242
|
/**
|
|
215
243
|
* Stops the propagation of an in-flight custom event, preventing any event
|
|
@@ -226,7 +254,7 @@ export class FlowGraphCoordinator {
|
|
|
226
254
|
* @param stopImmediate whether to also stop remaining immediate handlers
|
|
227
255
|
*/
|
|
228
256
|
stopEventPropagation(event, stopImmediate) {
|
|
229
|
-
if (typeof event !== "string"
|
|
257
|
+
if (typeof event !== "string") {
|
|
230
258
|
return;
|
|
231
259
|
}
|
|
232
260
|
const decode = this.config.hostResolver?.decodeEventReference ?? GetDefaultEventReferenceKey;
|
|
@@ -237,7 +265,10 @@ export class FlowGraphCoordinator {
|
|
|
237
265
|
// Find the most recent matching in-flight dispatch and skip its remaining observers.
|
|
238
266
|
for (let i = this._eventDispatchStack.length - 1; i >= 0; i--) {
|
|
239
267
|
if (this._eventDispatchStack[i].eventId === eventId) {
|
|
240
|
-
this._eventDispatchStack[i].
|
|
268
|
+
this._eventDispatchStack[i].propagationStopped = true;
|
|
269
|
+
if (stopImmediate) {
|
|
270
|
+
this._eventDispatchStack[i].state.skipNextObservers = true;
|
|
271
|
+
}
|
|
241
272
|
return;
|
|
242
273
|
}
|
|
243
274
|
}
|