@onerjs/core 8.54.4 → 8.54.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/Native/nativeHelpers.js +5 -0
- package/Engines/Native/nativeHelpers.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
- package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
- package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
- package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +4 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +5 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +5 -0
- package/Engines/thinNativeEngine.pure.js +52 -10
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +1 -0
- package/Engines/webgpuEngine.pure.js +22 -8
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Event/index.d.ts +1 -0
- package/FlowGraph/Blocks/Event/index.js +1 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
- package/FlowGraph/Blocks/Event/pure.js +1 -0
- package/FlowGraph/Blocks/Event/pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +23 -0
- package/FlowGraph/flowGraphContext.js +29 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
- package/FlowGraph/flowGraphCoordinator.js +72 -0
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
- package/FlowGraph/flowGraphDelayRegistry.js +50 -0
- package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
- package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
- package/FlowGraph/flowGraphHostResolver.js +25 -0
- package/FlowGraph/flowGraphHostResolver.js.map +1 -0
- package/FlowGraph/flowGraphMath.d.ts +48 -1
- package/FlowGraph/flowGraphMath.js +169 -4
- package/FlowGraph/flowGraphMath.js.map +1 -1
- package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
- package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
- package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
- package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
- package/FlowGraph/index.d.ts +2 -0
- package/FlowGraph/index.js +2 -0
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/pure.d.ts +2 -0
- package/FlowGraph/pure.js +2 -0
- package/FlowGraph/pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.d.ts +3 -1
- package/Materials/Node/nodeMaterial.pure.js +18 -1
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Textures/envCubeTexture.pure.js +7 -2
- package/Materials/Textures/envCubeTexture.pure.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +14 -0
- package/Materials/materialHelper.functions.js +67 -0
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Maths/math.vector.pure.d.ts +11 -1
- package/Maths/math.vector.pure.js +13 -0
- package/Maths/math.vector.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.js +1 -0
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/mesh.pure.js +5 -0
- package/Meshes/mesh.pure.js.map +1 -1
- package/Meshes/transformNode.pure.js +1 -0
- package/Meshes/transformNode.pure.js.map +1 -1
- package/Misc/areaLightsTextureTools.js +1 -1
- package/Misc/areaLightsTextureTools.js.map +1 -1
- package/Misc/greasedLineTools.js +1 -1
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/tools.pure.js +14 -2
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +66 -1
- package/Particles/gpuParticleSystem.pure.js +189 -49
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Physics/v2/characterController.js +69 -17
- package/Physics/v2/characterController.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.d.ts +79 -0
- package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js +171 -0
- package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js.map +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +5 -0
- package/PostProcesses/RenderPipeline/Pipelines/index.js +6 -0
- package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/pure.d.ts +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/pure.js +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/pure.js.map +1 -1
- package/PostProcesses/thinFSR1SharpenPostProcess.d.ts +32 -0
- package/PostProcesses/thinFSR1SharpenPostProcess.js +58 -0
- package/PostProcesses/thinFSR1SharpenPostProcess.js.map +1 -0
- package/PostProcesses/thinFSR1UpscalePostProcess.d.ts +37 -0
- package/PostProcesses/thinFSR1UpscalePostProcess.js +68 -0
- package/PostProcesses/thinFSR1UpscalePostProcess.js.map +1 -0
- package/Shaders/ShadersInclude/ffxFunctions.d.ts +5 -0
- package/Shaders/ShadersInclude/ffxFunctions.js +18 -0
- package/Shaders/ShadersInclude/ffxFunctions.js.map +1 -0
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -2
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrIblFunctions.js +1 -6
- package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/Shaders/fsr1Sharpen.fragment.d.ts +5 -0
- package/Shaders/fsr1Sharpen.fragment.js +26 -0
- package/Shaders/fsr1Sharpen.fragment.js.map +1 -0
- package/Shaders/fsr1Upscale.fragment.d.ts +5 -0
- package/Shaders/fsr1Upscale.fragment.js +77 -0
- package/Shaders/fsr1Upscale.fragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/ffxFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/ffxFunctions.js +18 -0
- package/ShadersWGSL/ShadersInclude/ffxFunctions.js.map +1 -0
- package/ShadersWGSL/fsr1Sharpen.fragment.d.ts +5 -0
- package/ShadersWGSL/fsr1Sharpen.fragment.js +34 -0
- package/ShadersWGSL/fsr1Sharpen.fragment.js.map +1 -0
- package/ShadersWGSL/fsr1Upscale.fragment.d.ts +5 -0
- package/ShadersWGSL/fsr1Upscale.fragment.js +68 -0
- package/ShadersWGSL/fsr1Upscale.fragment.js.map +1 -0
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
- package/XR/features/WebXRAbstractFeature.d.ts +9 -0
- package/XR/features/WebXRAbstractFeature.js +16 -0
- package/XR/features/WebXRAbstractFeature.js.map +1 -1
- package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
- package/XR/features/WebXRDepthSensing.pure.js +350 -39
- package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
- package/XR/features/WebXRImageTracking.pure.js.map +1 -1
- package/XR/features/WebXRLayers.pure.d.ts +6 -5
- package/XR/features/WebXRLayers.pure.js +65 -8
- package/XR/features/WebXRLayers.pure.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
- package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
- package/XR/features/WebXRSpaceWarp.pure.js +13 -4
- package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
- package/XR/webXRCamera.js +27 -0
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
- package/XR/webXRFeatureWarningRegistry.js +19 -0
- package/XR/webXRFeatureWarningRegistry.js.map +1 -0
- package/XR/webXRFeaturesManager.d.ts +5 -0
- package/XR/webXRFeaturesManager.js +23 -4
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRGraphicsBinding.d.ts +17 -10
- package/XR/webXRGraphicsBinding.js +8 -5
- package/XR/webXRGraphicsBinding.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +3 -5
- package/XR/webXRSessionManager.js +1 -3
- package/XR/webXRSessionManager.js.map +1 -1
- package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
- package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
- package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphArrayIndexBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAqC,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGlG,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,EAAwB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,wBAAkC,SAAQ,cAAc;IAgBjE;;;OAGG;IACH,YAA4B,MAAoC;QAC5D,KAAK,CAAC,MAAM,CAAC,CAAC;QADU,WAAM,GAAN,MAAM,CAA8B;QAG5D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpF,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACa,cAAc,CAAC,OAAyB;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"flowGraphArrayIndexBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6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AAC;YAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YACvD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBACxB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBACnC,OAAO;YACX,CAAC;YACD,KAAK,GAAG,OAAO,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IAED;;;OAGG;IACa,SAAS,CAAC,mBAAyB;QAC/C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IAEe,YAAY;QACxB,uEAAsC;IAC1C,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,gCAAgC;IAC5C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,kEAAiC,wBAAwB,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { type IFlowGraphBlockConfiguration, FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphInteger } from \"core/FlowGraph/CustomTypes/flowGraphInteger.pure\";\nimport { type FlowGraphNumber, getNumericValue } from \"core/FlowGraph/utils\";\nimport { type Nullable } from \"core/types\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\n/**\n * This simple Util block takes an array as input and selects a single element from it.\n */\nexport class FlowGraphArrayIndexBlock<T = any> extends FlowGraphBlock {\n /**\n * Input connection: The array to select from.\n */\n public readonly array: FlowGraphDataConnection<T[]>;\n\n /**\n * Input connection: The index to select.\n */\n public readonly index: FlowGraphDataConnection<FlowGraphNumber>;\n\n /**\n * Output connection: The selected element.\n */\n public readonly value: FlowGraphDataConnection<Nullable<T>>;\n\n /**\n * Construct a FlowGraphArrayIndexBlock.\n * @param config construction parameters\n */\n constructor(public override config: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.array = this.registerDataInput(\"array\", RichTypeAny);\n this.index = this.registerDataInput(\"index\", RichTypeAny, new FlowGraphInteger(-1));\n this.value = this.registerDataOutput(\"value\", RichTypeAny);\n }\n\n /**\n * @internal\n */\n public override _updateOutputs(context: FlowGraphContext): void {\n const array = this.array.getValue(context);\n const rawIndex = this.index.getValue(context);\n // An undefined or unconnected input short-circuits to a null output rather than crashing\n // `getNumericValue` on a missing `.value` property.\n if (rawIndex === undefined || rawIndex === null) {\n this.value.setValue(null, context);\n return;\n }\n // A string index is an opaque reference whose format the host environment owns, so ask it\n // which element the reference denotes.\n let index: number;\n if (typeof rawIndex === \"string\") {\n const decoded = context.decodeIndexReference(rawIndex);\n if (decoded === undefined) {\n this.value.setValue(null, context);\n return;\n }\n index = decoded;\n } else {\n index = getNumericValue(rawIndex);\n }\n if (array && index >= 0 && index < array.length) {\n this.value.setValue(array[index], context);\n } else {\n this.value.setValue(null, context);\n }\n }\n\n /**\n * Serializes this block\n * @param serializationObject the object to serialize to\n */\n public override serialize(serializationObject?: any): void {\n super.serialize(serializationObject);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ArrayIndex;\n }\n}\n\nlet _Registered = false;\n/**\n * Register side effects for flowGraphArrayIndexBlock.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphArrayIndexBlock(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.ArrayIndex, FlowGraphArrayIndexBlock);\n}\n"]}
|
|
@@ -14,6 +14,7 @@ export declare abstract class FlowGraphCachedOperationBlock<OutputT> extends Flo
|
|
|
14
14
|
* Output connection: Whether the value is valid.
|
|
15
15
|
*/
|
|
16
16
|
readonly isValid: FlowGraphDataConnection<boolean>;
|
|
17
|
+
private readonly _outputRichType;
|
|
17
18
|
constructor(outputRichType: RichType<OutputT>, config?: IFlowGraphBlockConfiguration);
|
|
18
19
|
/**
|
|
19
20
|
* @internal
|
|
@@ -21,5 +22,22 @@ export declare abstract class FlowGraphCachedOperationBlock<OutputT> extends Flo
|
|
|
21
22
|
* @param context the graph context
|
|
22
23
|
*/
|
|
23
24
|
abstract _doOperation(context: FlowGraphContext): OutputT | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The value delivered on the `value` output when the operation cannot produce a result.
|
|
27
|
+
*
|
|
28
|
+
* Defaults to the output type's default value. Override this when a block defines a different
|
|
29
|
+
* value for that case, for example a polymorphic block whose output type is only known from its
|
|
30
|
+
* inputs. Implementations must return a fresh value rather than a shared instance, because
|
|
31
|
+
* consumers may mutate the value they receive.
|
|
32
|
+
* @param _context the graph context
|
|
33
|
+
* @returns the value to deliver alongside `isValid = false`
|
|
34
|
+
*/
|
|
35
|
+
protected _getInvalidOutputValue(_context: FlowGraphContext): OutputT;
|
|
24
36
|
_updateOutputs(context: FlowGraphContext): void;
|
|
37
|
+
/**
|
|
38
|
+
* Reports the operation as invalid. `value` is still assigned, so it never reports a stale
|
|
39
|
+
* result from an earlier execution nor an undefined value on the first one.
|
|
40
|
+
* @param context the graph context
|
|
41
|
+
*/
|
|
42
|
+
private _setInvalid;
|
|
25
43
|
}
|
|
@@ -8,9 +8,27 @@ const CacheExecIdName = "cachedExecutionId";
|
|
|
8
8
|
export class FlowGraphCachedOperationBlock extends FlowGraphBlock {
|
|
9
9
|
constructor(outputRichType, config) {
|
|
10
10
|
super(config);
|
|
11
|
+
this._outputRichType = outputRichType;
|
|
11
12
|
this.value = this.registerDataOutput("value", outputRichType);
|
|
12
13
|
this.isValid = this.registerDataOutput("isValid", RichTypeBoolean);
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The value delivered on the `value` output when the operation cannot produce a result.
|
|
17
|
+
*
|
|
18
|
+
* Defaults to the output type's default value. Override this when a block defines a different
|
|
19
|
+
* value for that case, for example a polymorphic block whose output type is only known from its
|
|
20
|
+
* inputs. Implementations must return a fresh value rather than a shared instance, because
|
|
21
|
+
* consumers may mutate the value they receive.
|
|
22
|
+
* @param _context the graph context
|
|
23
|
+
* @returns the value to deliver alongside `isValid = false`
|
|
24
|
+
*/
|
|
25
|
+
_getInvalidOutputValue(_context) {
|
|
26
|
+
const defaultValue = this._outputRichType.defaultValue;
|
|
27
|
+
// The rich type defaults for object types (vectors, matrices, ...) are shared instances, so
|
|
28
|
+
// hand out a copy to keep a consumer from mutating the default for every other block.
|
|
29
|
+
const clone = defaultValue?.clone;
|
|
30
|
+
return typeof clone === "function" ? clone.call(defaultValue) : defaultValue;
|
|
31
|
+
}
|
|
14
32
|
_updateOutputs(context) {
|
|
15
33
|
const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);
|
|
16
34
|
const cachedValue = context._getExecutionVariable(this, CacheName, null);
|
|
@@ -22,7 +40,7 @@ export class FlowGraphCachedOperationBlock extends FlowGraphBlock {
|
|
|
22
40
|
try {
|
|
23
41
|
const calculatedValue = this._doOperation(context);
|
|
24
42
|
if (calculatedValue === undefined || calculatedValue === null) {
|
|
25
|
-
this.
|
|
43
|
+
this._setInvalid(context);
|
|
26
44
|
return;
|
|
27
45
|
}
|
|
28
46
|
context._setExecutionVariable(this, CacheName, calculatedValue);
|
|
@@ -31,9 +49,18 @@ export class FlowGraphCachedOperationBlock extends FlowGraphBlock {
|
|
|
31
49
|
this.isValid.setValue(true, context);
|
|
32
50
|
}
|
|
33
51
|
catch (e) {
|
|
34
|
-
this.
|
|
52
|
+
this._setInvalid(context);
|
|
35
53
|
}
|
|
36
54
|
}
|
|
37
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Reports the operation as invalid. `value` is still assigned, so it never reports a stale
|
|
58
|
+
* result from an earlier execution nor an undefined value on the first one.
|
|
59
|
+
* @param context the graph context
|
|
60
|
+
*/
|
|
61
|
+
_setInvalid(context) {
|
|
62
|
+
this.isValid.setValue(false, context);
|
|
63
|
+
this.value.setValue(this._getInvalidOutputValue(context), context);
|
|
64
|
+
}
|
|
38
65
|
}
|
|
39
66
|
//# sourceMappingURL=flowGraphCachedOperationBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphCachedOperationBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGzF,OAAO,EAAiB,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE/E,MAAM,SAAS,GAAG,sBAAsB,CAAC;AACzC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAgB,6BAAuC,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"flowGraphCachedOperationBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGzF,OAAO,EAAiB,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE/E,MAAM,SAAS,GAAG,sBAAsB,CAA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D,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;gBACnD,IAAI,eAAe,KAAK,SAAS,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;oBAC5D,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;oBAC1B,OAAO;gBACX,CAAC;gBACD,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;gBAChE,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;gBAC1E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;gBAC9C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;OAIG;IACK,WAAW,CAAC,OAAyB;QACzC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../../../types\";\r\nimport { type IFlowGraphBlockConfiguration, FlowGraphBlock } from \"../../flowGraphBlock\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { type RichType, RichTypeBoolean } from \"../../flowGraphRichTypes.pure\";\r\n\r\nconst CacheName = \"cachedOperationValue\";\r\nconst CacheExecIdName = \"cachedExecutionId\";\r\n\r\n/**\r\n * A block that will cache the result of an operation and deliver it as an output.\r\n */\r\nexport abstract class FlowGraphCachedOperationBlock<OutputT> extends FlowGraphBlock {\r\n /**\r\n * The output of the operation\r\n */\r\n public readonly value: FlowGraphDataConnection<OutputT>;\r\n\r\n /**\r\n * Output connection: Whether the value is valid.\r\n */\r\n public readonly isValid: FlowGraphDataConnection<boolean>;\r\n\r\n private readonly _outputRichType: RichType<OutputT>;\r\n\r\n constructor(outputRichType: RichType<OutputT>, config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this._outputRichType = outputRichType;\r\n this.value = this.registerDataOutput(\"value\", outputRichType);\r\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean);\r\n }\r\n\r\n /**\r\n * @internal\r\n * Operation to realize\r\n * @param context the graph context\r\n */\r\n public abstract _doOperation(context: FlowGraphContext): OutputT | undefined;\r\n\r\n /**\r\n * The value delivered on the `value` output when the operation cannot produce a result.\r\n *\r\n * Defaults to the output type's default value. Override this when a block defines a different\r\n * value for that case, for example a polymorphic block whose output type is only known from its\r\n * inputs. Implementations must return a fresh value rather than a shared instance, because\r\n * consumers may mutate the value they receive.\r\n * @param _context the graph context\r\n * @returns the value to deliver alongside `isValid = false`\r\n */\r\n protected _getInvalidOutputValue(_context: FlowGraphContext): OutputT {\r\n const defaultValue = this._outputRichType.defaultValue;\r\n // The rich type defaults for object types (vectors, matrices, ...) are shared instances, so\r\n // hand out a copy to keep a consumer from mutating the default for every other block.\r\n const clone = (defaultValue as unknown as { clone?: () => OutputT })?.clone;\r\n return typeof clone === \"function\" ? clone.call(defaultValue) : defaultValue;\r\n }\r\n\r\n public override _updateOutputs(context: FlowGraphContext) {\r\n const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);\r\n const cachedValue = context._getExecutionVariable<Nullable<OutputT>>(this, CacheName, null);\r\n if (cachedValue !== undefined && cachedValue !== null && cachedExecutionId === context.executionId) {\r\n this.isValid.setValue(true, context);\r\n this.value.setValue(cachedValue, context);\r\n } else {\r\n try {\r\n const calculatedValue = this._doOperation(context);\r\n if (calculatedValue === undefined || calculatedValue === null) {\r\n this._setInvalid(context);\r\n return;\r\n }\r\n context._setExecutionVariable(this, CacheName, calculatedValue);\r\n context._setExecutionVariable(this, CacheExecIdName, context.executionId);\r\n this.value.setValue(calculatedValue, context);\r\n this.isValid.setValue(true, context);\r\n } catch (e) {\r\n this._setInvalid(context);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Reports the operation as invalid. `value` is still assigned, so it never reports a stale\r\n * result from an earlier execution nor an undefined value on the first one.\r\n * @param context the graph context\r\n */\r\n private _setInvalid(context: FlowGraphContext): void {\r\n this.isValid.setValue(false, context);\r\n this.value.setValue(this._getInvalidOutputValue(context), context);\r\n }\r\n}\r\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { type FlowGraphContext } from "../../flowGraphContext.js";
|
|
3
3
|
import { FlowGraphEventBlock } from "../../flowGraphEventBlock.js";
|
|
4
4
|
import { type RichType } from "../../flowGraphRichTypes.pure.js";
|
|
5
|
+
import { type FlowGraphDataConnection } from "../../flowGraphDataConnection.pure.js";
|
|
5
6
|
import { type IFlowGraphBlockConfiguration } from "../../flowGraphBlock.js";
|
|
6
7
|
/**
|
|
7
8
|
* Parameters used to create a FlowGraphReceiveCustomEventBlock.
|
|
@@ -33,12 +34,26 @@ export declare class FlowGraphReceiveCustomEventBlock extends FlowGraphEventBloc
|
|
|
33
34
|
*/
|
|
34
35
|
config: IFlowGraphReceiveCustomEventBlockConfiguration;
|
|
35
36
|
initPriority: number;
|
|
37
|
+
/**
|
|
38
|
+
* Output: the opaque reference identifying the received event source.
|
|
39
|
+
* Receivers configured with the same event id share the same reference, so comparing their
|
|
40
|
+
* `event` outputs for equality succeeds. The reference format is owned by the host environment.
|
|
41
|
+
*/
|
|
42
|
+
readonly eventRef: FlowGraphDataConnection<string>;
|
|
36
43
|
constructor(
|
|
37
44
|
/**
|
|
38
45
|
* the configuration of the block
|
|
39
46
|
*/
|
|
40
47
|
config: IFlowGraphReceiveCustomEventBlockConfiguration);
|
|
48
|
+
_updateOutputs(context: FlowGraphContext): void;
|
|
41
49
|
_preparePendingTasks(context: FlowGraphContext): void;
|
|
50
|
+
/**
|
|
51
|
+
* The value an output falls back to when the sender provides no value for it: the default
|
|
52
|
+
* declared by the payload schema, or the socket type's default when the schema declares none.
|
|
53
|
+
* @param key the payload key
|
|
54
|
+
* @returns the default value for that key
|
|
55
|
+
*/
|
|
56
|
+
private _getEventDataDefault;
|
|
42
57
|
_cancelPendingTasks(context: FlowGraphContext): void;
|
|
43
58
|
_executeEvent(_context: FlowGraphContext, _payload: any): boolean;
|
|
44
59
|
serialize(serializationObject?: any): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
2
|
import { FlowGraphEventBlock } from "../../flowGraphEventBlock.js";
|
|
3
3
|
import { Logger } from "../../../Misc/logger.js";
|
|
4
|
-
import { getRichTypeByFlowGraphType } from "../../flowGraphRichTypes.pure.js";
|
|
4
|
+
import { getRichTypeByFlowGraphType, RichTypeString } from "../../flowGraphRichTypes.pure.js";
|
|
5
5
|
import { FlowGraphCoordinator } from "../../flowGraphCoordinator.js";
|
|
6
6
|
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
7
7
|
/**
|
|
@@ -26,8 +26,18 @@ export class FlowGraphReceiveCustomEventBlock extends FlowGraphEventBlock {
|
|
|
26
26
|
const typeKey = typeof entry.type === "string" ? entry.type : entry.type?.typeName;
|
|
27
27
|
const richType = typeof entry.type?.serialize === "function" ? entry.type : getRichTypeByFlowGraphType(typeKey);
|
|
28
28
|
entry.type = richType;
|
|
29
|
-
|
|
29
|
+
// Pass default value from event data schema so outputs have the correct initial value
|
|
30
|
+
this.registerDataOutput(key, richType, entry.value);
|
|
30
31
|
}
|
|
32
|
+
// Reserved `event` output exposing the event reference. Guard against a
|
|
33
|
+
// (pathological) custom event value socket literally named "event".
|
|
34
|
+
this.eventRef =
|
|
35
|
+
this.config.eventData && Object.prototype.hasOwnProperty.call(this.config.eventData, "event")
|
|
36
|
+
? this.getDataOutput("event")
|
|
37
|
+
: this.registerDataOutput("event", RichTypeString);
|
|
38
|
+
}
|
|
39
|
+
_updateOutputs(context) {
|
|
40
|
+
this.eventRef.setValue(context.getEventReference(this.config.eventId), context);
|
|
31
41
|
}
|
|
32
42
|
_preparePendingTasks(context) {
|
|
33
43
|
const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);
|
|
@@ -36,15 +46,42 @@ export class FlowGraphReceiveCustomEventBlock extends FlowGraphEventBlock {
|
|
|
36
46
|
this._reportError(context, `FlowGraphReceiveCustomEventBlock: Too many observers for event ${this.config.eventId}. Max is ${FlowGraphCoordinator.MaxEventsPerType}.`);
|
|
37
47
|
return;
|
|
38
48
|
}
|
|
39
|
-
const eventObserver = observable.add((eventData) => {
|
|
40
|
-
|
|
41
|
-
for
|
|
42
|
-
|
|
49
|
+
const eventObserver = observable.add((eventData, eventState) => {
|
|
50
|
+
// Make this dispatch's EventState reachable by event/stopPropagation
|
|
51
|
+
// for the duration of the synchronous receiver flow.
|
|
52
|
+
context.configuration.coordinator._beginEventDispatch(this.config.eventId, eventState);
|
|
53
|
+
try {
|
|
54
|
+
// Drive the outputs from the configured payload schema rather than from the incoming
|
|
55
|
+
// keys, so a key the sender omitted (or sent as undefined) resets to its configured
|
|
56
|
+
// default instead of retaining the value from a previous dispatch.
|
|
57
|
+
for (const key in this.config.eventData) {
|
|
58
|
+
const output = this.getDataOutput(key);
|
|
59
|
+
if (!output) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const incoming = eventData?.[key];
|
|
63
|
+
output.setValue(incoming === undefined ? this._getEventDataDefault(key) : incoming, context);
|
|
64
|
+
}
|
|
65
|
+
// Expose the event reference before activating downstream flow.
|
|
66
|
+
this.eventRef.setValue(context.getEventReference(this.config.eventId), context);
|
|
67
|
+
this._execute(context);
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
context.configuration.coordinator._endEventDispatch();
|
|
43
71
|
}
|
|
44
|
-
this._execute(context);
|
|
45
72
|
});
|
|
46
73
|
context._setExecutionVariable(this, "_eventObserver", eventObserver);
|
|
47
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* The value an output falls back to when the sender provides no value for it: the default
|
|
77
|
+
* declared by the payload schema, or the socket type's default when the schema declares none.
|
|
78
|
+
* @param key the payload key
|
|
79
|
+
* @returns the default value for that key
|
|
80
|
+
*/
|
|
81
|
+
_getEventDataDefault(key) {
|
|
82
|
+
const entry = this.config.eventData?.[key];
|
|
83
|
+
return entry?.value !== undefined ? entry.value : entry?.type?.defaultValue;
|
|
84
|
+
}
|
|
48
85
|
_cancelPendingTasks(context) {
|
|
49
86
|
const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);
|
|
50
87
|
if (observable) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphReceiveCustomEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAiB,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAG1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAiBxD;;;;GAIG;AACH,MAAM,OAAO,gCAAiC,SAAQ,mBAAmB;IAGrE;IACI;;OAEG;IACa,MAAsD;QAEtE,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAAgD;QAN1D,iBAAY,GAAW,CAAC,CAAC;QASrC,0CAA0C;QAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;Y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C;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,wCAAwC;IACpD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,kFAAyC,gCAAgC,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Observer } from \"../../../Misc/observable.pure\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type Nullable } from \"../../../types\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport { type RichType, getRichTypeByFlowGraphType } from \"../../flowGraphRichTypes.pure\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { FlowGraphCoordinator } from \"core/FlowGraph/flowGraphCoordinator\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n/**\r\n * Parameters used to create a FlowGraphReceiveCustomEventBlock.\r\n */\r\nexport interface IFlowGraphReceiveCustomEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The id of the event to receive.\r\n * This event id is unique to the environment (not the context).\r\n */\r\n eventId: string;\r\n /**\r\n * The names of the data outputs for that event. Should be in the same order as the event data in\r\n * SendCustomEvent\r\n */\r\n eventData: { [key: string]: { type: RichType<any> } };\r\n}\r\n\r\n/**\r\n * A block that receives a custom event.\r\n * It saves the event data in the data outputs, based on the provided eventData in the configuration. For example, if the event data is\r\n * `{ x: { type: RichTypeNumber }, y: { type: RichTypeNumber } }`, the block will have two data outputs: x and y.\r\n */\r\nexport class FlowGraphReceiveCustomEventBlock extends FlowGraphEventBlock {\r\n public override initPriority: number = 1;\r\n\r\n constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config: IFlowGraphReceiveCustomEventBlockConfiguration\r\n ) {\r\n super(config);\r\n // use event data to register data outputs\r\n for (const key in this.config.eventData) {\r\n const entry = this.config.eventData[key];\r\n // Handle deserialized config where type may be a string typeName, a plain object\r\n // with a typeName property (from old JSON serialization), or a proper RichType instance.\r\n const typeKey = typeof entry.type === \"string\" ? entry.type : entry.type?.typeName;\r\n const richType = typeof entry.type?.serialize === \"function\" ? entry.type : getRichTypeByFlowGraphType(typeKey);\r\n entry.type = richType;\r\n this.registerDataOutput(key, richType);\r\n }\r\n }\r\n\r\n public override _preparePendingTasks(context: FlowGraphContext): void {\r\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\r\n // check if we are not exceeding the max number of events\r\n if (observable && observable.hasObservers() && observable.observers.length > FlowGraphCoordinator.MaxEventsPerType) {\r\n this._reportError(context, `FlowGraphReceiveCustomEventBlock: Too many observers for event ${this.config.eventId}. Max is ${FlowGraphCoordinator.MaxEventsPerType}.`);\r\n return;\r\n }\r\n\r\n const eventObserver = observable.add((eventData: { [key: string]: any }) => {\r\n const keys = Object.keys(eventData);\r\n for (const key of keys) {\r\n this.getDataOutput(key)?.setValue(eventData[key], context);\r\n }\r\n this._execute(context);\r\n });\r\n context._setExecutionVariable(this, \"_eventObserver\", eventObserver);\r\n }\r\n public override _cancelPendingTasks(context: FlowGraphContext): void {\r\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\r\n if (observable) {\r\n const eventObserver = context._getExecutionVariable<Nullable<Observer<any[]>>>(this, \"_eventObserver\", null);\r\n observable.remove(eventObserver);\r\n } else {\r\n Logger.Warn(`FlowGraphReceiveCustomEventBlock: Missing observable for event ${this.config.eventId}`);\r\n }\r\n }\r\n\r\n public override _executeEvent(_context: FlowGraphContext, _payload: any): boolean {\r\n return true;\r\n }\r\n\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n // Override the eventData in config to store typeName strings instead of RichType instances\r\n const serializedEventData: any = {};\r\n for (const key in this.config.eventData) {\r\n serializedEventData[key] = { type: this.config.eventData[key].type.typeName };\r\n }\r\n serializationObject.config.eventData = serializedEventData;\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.ReceiveCustomEvent;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphReceiveCustomEventBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphReceiveCustomEventBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.ReceiveCustomEvent, FlowGraphReceiveCustomEventBlock);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphReceiveCustomEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAiB,0BAA0B,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAI1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAiBxD;;;;GAIG;AACH,MAAM,OAAO,gCAAiC,SAAQ,mBAAmB;IAUrE;IACI;;OAEG;IACa,MAAsD;QAEtE,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAAgD;QAb1D,iBAAY,GAAW,CAAC,CAAC;QAgBrC,0CAA0C;QAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACzC,i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AQ,EAAE,CAAC;QAClF,CAAC;QACD,mBAAmB,CAAC,MAAM,CAAC,SAAS,GAAG,mBAAmB,CAAC;IAC/D,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,uFAA8C;IAClD,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,wCAAwC;IACpD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,kFAAyC,gCAAgC,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Observer } from \"../../../Misc/observable.pure\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type Nullable } from \"../../../types\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport { type RichType, getRichTypeByFlowGraphType, RichTypeString } from \"../../flowGraphRichTypes.pure\";\r\nimport { type FlowGraphDataConnection } from \"../../flowGraphDataConnection.pure\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { FlowGraphCoordinator } from \"core/FlowGraph/flowGraphCoordinator\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n/**\r\n * Parameters used to create a FlowGraphReceiveCustomEventBlock.\r\n */\r\nexport interface IFlowGraphReceiveCustomEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The id of the event to receive.\r\n * This event id is unique to the environment (not the context).\r\n */\r\n eventId: string;\r\n /**\r\n * The names of the data outputs for that event. Should be in the same order as the event data in\r\n * SendCustomEvent\r\n */\r\n eventData: { [key: string]: { type: RichType<any> } };\r\n}\r\n\r\n/**\r\n * A block that receives a custom event.\r\n * It saves the event data in the data outputs, based on the provided eventData in the configuration. For example, if the event data is\r\n * `{ x: { type: RichTypeNumber }, y: { type: RichTypeNumber } }`, the block will have two data outputs: x and y.\r\n */\r\nexport class FlowGraphReceiveCustomEventBlock extends FlowGraphEventBlock {\r\n public override initPriority: number = 1;\r\n\r\n /**\r\n * Output: the opaque reference identifying the received event source.\r\n * Receivers configured with the same event id share the same reference, so comparing their\r\n * `event` outputs for equality succeeds. The reference format is owned by the host environment.\r\n */\r\n public readonly eventRef: FlowGraphDataConnection<string>;\r\n\r\n constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config: IFlowGraphReceiveCustomEventBlockConfiguration\r\n ) {\r\n super(config);\r\n // use event data to register data outputs\r\n for (const key in this.config.eventData) {\r\n const entry = this.config.eventData[key];\r\n // Handle deserialized config where type may be a string typeName, a plain object\r\n // with a typeName property (from old JSON serialization), or a proper RichType instance.\r\n const typeKey = typeof entry.type === \"string\" ? entry.type : entry.type?.typeName;\r\n const richType = typeof entry.type?.serialize === \"function\" ? entry.type : getRichTypeByFlowGraphType(typeKey);\r\n entry.type = richType;\r\n // Pass default value from event data schema so outputs have the correct initial value\r\n this.registerDataOutput(key, richType, (entry as any).value);\r\n }\r\n // Reserved `event` output exposing the event reference. Guard against a\r\n // (pathological) custom event value socket literally named \"event\".\r\n this.eventRef =\r\n this.config.eventData && Object.prototype.hasOwnProperty.call(this.config.eventData, \"event\")\r\n ? this.getDataOutput(\"event\")!\r\n : this.registerDataOutput(\"event\", RichTypeString);\r\n }\r\n\r\n public override _updateOutputs(context: FlowGraphContext): void {\r\n this.eventRef.setValue(context.getEventReference(this.config.eventId), context);\r\n }\r\n\r\n public override _preparePendingTasks(context: FlowGraphContext): void {\r\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\r\n // check if we are not exceeding the max number of events\r\n if (observable && observable.hasObservers() && observable.observers.length > FlowGraphCoordinator.MaxEventsPerType) {\r\n this._reportError(context, `FlowGraphReceiveCustomEventBlock: Too many observers for event ${this.config.eventId}. Max is ${FlowGraphCoordinator.MaxEventsPerType}.`);\r\n return;\r\n }\r\n\r\n const eventObserver = observable.add((eventData: { [key: string]: any }, eventState) => {\r\n // Make this dispatch's EventState reachable by event/stopPropagation\r\n // for the duration of the synchronous receiver flow.\r\n context.configuration.coordinator._beginEventDispatch(this.config.eventId, eventState);\r\n try {\r\n // Drive the outputs from the configured payload schema rather than from the incoming\r\n // keys, so a key the sender omitted (or sent as undefined) resets to its configured\r\n // default instead of retaining the value from a previous dispatch.\r\n for (const key in this.config.eventData) {\r\n const output = this.getDataOutput(key);\r\n if (!output) {\r\n continue;\r\n }\r\n const incoming = eventData?.[key];\r\n output.setValue(incoming === undefined ? this._getEventDataDefault(key) : incoming, context);\r\n }\r\n // Expose the event reference before activating downstream flow.\r\n this.eventRef.setValue(context.getEventReference(this.config.eventId), context);\r\n this._execute(context);\r\n } finally {\r\n context.configuration.coordinator._endEventDispatch();\r\n }\r\n });\r\n context._setExecutionVariable(this, \"_eventObserver\", eventObserver);\r\n }\r\n\r\n /**\r\n * The value an output falls back to when the sender provides no value for it: the default\r\n * declared by the payload schema, or the socket type's default when the schema declares none.\r\n * @param key the payload key\r\n * @returns the default value for that key\r\n */\r\n private _getEventDataDefault(key: string): any {\r\n const entry = this.config.eventData?.[key] as { type: RichType<any>; value?: any } | undefined;\r\n return entry?.value !== undefined ? entry.value : entry?.type?.defaultValue;\r\n }\r\n public override _cancelPendingTasks(context: FlowGraphContext): void {\r\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\r\n if (observable) {\r\n const eventObserver = context._getExecutionVariable<Nullable<Observer<any[]>>>(this, \"_eventObserver\", null);\r\n observable.remove(eventObserver);\r\n } else {\r\n Logger.Warn(`FlowGraphReceiveCustomEventBlock: Missing observable for event ${this.config.eventId}`);\r\n }\r\n }\r\n\r\n public override _executeEvent(_context: FlowGraphContext, _payload: any): boolean {\r\n return true;\r\n }\r\n\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n // Override the eventData in config to store typeName strings instead of RichType instances\r\n const serializedEventData: any = {};\r\n for (const key in this.config.eventData) {\r\n serializedEventData[key] = { type: this.config.eventData[key].type.typeName };\r\n }\r\n serializationObject.config.eventData = serializedEventData;\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.ReceiveCustomEvent;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphReceiveCustomEventBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphReceiveCustomEventBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.ReceiveCustomEvent, FlowGraphReceiveCustomEventBlock);\r\n}\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
2
|
import { FlowGraphEventBlock } from "../../flowGraphEventBlock.js";
|
|
3
3
|
import { type FlowGraphContext } from "../../flowGraphContext.js";
|
|
4
|
+
import { type FlowGraphDataConnection } from "../../flowGraphDataConnection.pure.js";
|
|
4
5
|
import { FlowGraphBlockNames } from "../flowGraphBlockNames.js";
|
|
5
6
|
import { FlowGraphEventType } from "../../flowGraphEventType.js";
|
|
6
7
|
/**
|
|
@@ -9,6 +10,14 @@ import { FlowGraphEventType } from "../../flowGraphEventType.js";
|
|
|
9
10
|
export declare class FlowGraphSceneReadyEventBlock extends FlowGraphEventBlock {
|
|
10
11
|
initPriority: number;
|
|
11
12
|
readonly type: FlowGraphEventType;
|
|
13
|
+
/**
|
|
14
|
+
* Output: the opaque reference identifying this event source.
|
|
15
|
+
* All instances of this block share the same reference, so comparing the `event` output of two
|
|
16
|
+
* of them for equality succeeds. The reference format is owned by the host environment.
|
|
17
|
+
*/
|
|
18
|
+
readonly eventRef: FlowGraphDataConnection<string>;
|
|
19
|
+
constructor();
|
|
20
|
+
_updateOutputs(context: FlowGraphContext): void;
|
|
12
21
|
_executeEvent(context: FlowGraphContext, _payload: any): boolean;
|
|
13
22
|
_preparePendingTasks(context: FlowGraphContext): void;
|
|
14
23
|
_cancelPendingTasks(context: FlowGraphContext): void;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
2
|
import { FlowGraphEventBlock } from "../../flowGraphEventBlock.js";
|
|
3
|
+
import { RichTypeString } from "../../flowGraphRichTypes.pure.js";
|
|
3
4
|
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
5
|
+
/** Event source key used to build this block's event reference. */
|
|
6
|
+
const EventKey = "sceneReady";
|
|
4
7
|
/**
|
|
5
8
|
* Block that triggers when a scene is ready.
|
|
6
9
|
*/
|
|
7
10
|
export class FlowGraphSceneReadyEventBlock extends FlowGraphEventBlock {
|
|
8
11
|
constructor() {
|
|
9
|
-
super(
|
|
12
|
+
super();
|
|
10
13
|
this.initPriority = -1;
|
|
11
14
|
this.type = "SceneReady" /* FlowGraphEventType.SceneReady */;
|
|
15
|
+
this.eventRef = this.registerDataOutput("event", RichTypeString);
|
|
16
|
+
}
|
|
17
|
+
_updateOutputs(context) {
|
|
18
|
+
this.eventRef.setValue(context.getEventReference(EventKey), context);
|
|
12
19
|
}
|
|
13
20
|
_executeEvent(context, _payload) {
|
|
21
|
+
this.eventRef.setValue(context.getEventReference(EventKey), context);
|
|
14
22
|
this._execute(context);
|
|
15
23
|
return true;
|
|
16
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphSceneReadyEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"flowGraphSceneReadyEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphS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,CAAC;AACtF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\r\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\r\nimport { RichTypeString } from \"core/FlowGraph/flowGraphRichTypes.pure\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n\r\n/** Event source key used to build this block's event reference. */\r\nconst EventKey = \"sceneReady\";\r\n\r\n/**\r\n * Block that triggers when a scene is ready.\r\n */\r\nexport class FlowGraphSceneReadyEventBlock extends FlowGraphEventBlock {\r\n public override initPriority: number = -1;\r\n\r\n public override readonly type: FlowGraphEventType = FlowGraphEventType.SceneReady;\r\n\r\n /**\r\n * Output: the opaque reference identifying this event source.\r\n * All instances of this block share the same reference, so comparing the `event` output of two\r\n * of them for equality succeeds. The reference format is owned by the host environment.\r\n */\r\n public readonly eventRef: FlowGraphDataConnection<string>;\r\n\r\n constructor() {\r\n super();\r\n this.eventRef = this.registerDataOutput(\"event\", RichTypeString);\r\n }\r\n\r\n public override _updateOutputs(context: FlowGraphContext): void {\r\n this.eventRef.setValue(context.getEventReference(EventKey), context);\r\n }\r\n\r\n public override _executeEvent(context: FlowGraphContext, _payload: any): boolean {\r\n this.eventRef.setValue(context.getEventReference(EventKey), context);\r\n this._execute(context);\r\n return true;\r\n }\r\n public override _preparePendingTasks(context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n public override _cancelPendingTasks(context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName() {\r\n return FlowGraphBlockNames.SceneReadyEvent;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphSceneReadyEventBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphSceneReadyEventBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.SceneReadyEvent, FlowGraphSceneReadyEventBlock);\r\n}\r\n"]}
|
|
@@ -28,8 +28,15 @@ export declare class FlowGraphSceneTickEventBlock extends FlowGraphEventBlock {
|
|
|
28
28
|
* the time in seconds since the last frame.
|
|
29
29
|
*/
|
|
30
30
|
readonly deltaTime: FlowGraphDataConnection<number>;
|
|
31
|
+
/**
|
|
32
|
+
* Output: the opaque reference identifying this event source.
|
|
33
|
+
* All instances of this block share the same reference, so comparing the `event` output of two
|
|
34
|
+
* of them for equality succeeds. The reference format is owned by the host environment.
|
|
35
|
+
*/
|
|
36
|
+
readonly eventRef: FlowGraphDataConnection<string>;
|
|
31
37
|
readonly type: FlowGraphEventType;
|
|
32
38
|
constructor();
|
|
39
|
+
_updateOutputs(context: FlowGraphContext): void;
|
|
33
40
|
/**
|
|
34
41
|
* @internal
|
|
35
42
|
*/
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
2
|
import { FlowGraphEventBlock } from "../../flowGraphEventBlock.js";
|
|
3
|
-
import { RichTypeNumber } from "../../flowGraphRichTypes.pure.js";
|
|
3
|
+
import { RichTypeNumber, RichTypeString } from "../../flowGraphRichTypes.pure.js";
|
|
4
4
|
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
5
|
+
/** Event source key used to build this block's event reference. */
|
|
6
|
+
const EventKey = "sceneTick";
|
|
5
7
|
/**
|
|
6
8
|
* Block that triggers on scene tick (before each render).
|
|
7
9
|
*/
|
|
@@ -11,6 +13,10 @@ export class FlowGraphSceneTickEventBlock extends FlowGraphEventBlock {
|
|
|
11
13
|
this.type = "SceneBeforeRender" /* FlowGraphEventType.SceneBeforeRender */;
|
|
12
14
|
this.timeSinceStart = this.registerDataOutput("timeSinceStart", RichTypeNumber);
|
|
13
15
|
this.deltaTime = this.registerDataOutput("deltaTime", RichTypeNumber);
|
|
16
|
+
this.eventRef = this.registerDataOutput("event", RichTypeString);
|
|
17
|
+
}
|
|
18
|
+
_updateOutputs(context) {
|
|
19
|
+
this.eventRef.setValue(context.getEventReference(EventKey), context);
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* @internal
|
|
@@ -24,6 +30,7 @@ export class FlowGraphSceneTickEventBlock extends FlowGraphEventBlock {
|
|
|
24
30
|
_executeEvent(context, payload) {
|
|
25
31
|
this.timeSinceStart.setValue(payload.timeSinceStart, context);
|
|
26
32
|
this.deltaTime.setValue(payload.deltaTime, context);
|
|
33
|
+
this.eventRef.setValue(context.getEventReference(EventKey), context);
|
|
27
34
|
this._execute(context);
|
|
28
35
|
return true;
|
|
29
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphSceneTickEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"flowGraphSceneTickEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAIxF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,mEAAmE;AACnE,MAAM,QAAQ,GAAG,WAAW,CAAC;AAgB7B;;GAEG;AACH,MAAM,OAAO,4BAA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,GAAG,IAAI,CAAC;IAEnB,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;AACpF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\r\nimport { RichTypeNumber, RichTypeString } from \"core/FlowGraph/flowGraphRichTypes.pure\";\r\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n\r\n/** Event source key used to build this block's event reference. */\r\nconst EventKey = \"sceneTick\";\r\n\r\n/**\r\n * Payload for the scene tick event.\r\n */\r\nexport interface IFlowGraphOnTickEventPayload {\r\n /**\r\n * the time in seconds since the scene started.\r\n */\r\n timeSinceStart: number;\r\n /**\r\n * the time in seconds since the last frame.\r\n */\r\n deltaTime: number;\r\n}\r\n\r\n/**\r\n * Block that triggers on scene tick (before each render).\r\n */\r\nexport class FlowGraphSceneTickEventBlock extends FlowGraphEventBlock {\r\n /**\r\n * the time in seconds since the scene started.\r\n */\r\n public readonly timeSinceStart: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * the time in seconds since the last frame.\r\n */\r\n public readonly deltaTime: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output: the opaque reference identifying this event source.\r\n * All instances of this block share the same reference, so comparing the `event` output of two\r\n * of them for equality succeeds. The reference format is owned by the host environment.\r\n */\r\n public readonly eventRef: FlowGraphDataConnection<string>;\r\n\r\n public override readonly type: FlowGraphEventType = FlowGraphEventType.SceneBeforeRender;\r\n\r\n constructor() {\r\n super();\r\n this.timeSinceStart = this.registerDataOutput(\"timeSinceStart\", RichTypeNumber);\r\n this.deltaTime = this.registerDataOutput(\"deltaTime\", RichTypeNumber);\r\n this.eventRef = this.registerDataOutput(\"event\", RichTypeString);\r\n }\r\n\r\n public override _updateOutputs(context: FlowGraphContext): void {\r\n this.eventRef.setValue(context.getEventReference(EventKey), context);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _preparePendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _executeEvent(context: FlowGraphContext, payload: IFlowGraphOnTickEventPayload): boolean {\r\n this.timeSinceStart.setValue(payload.timeSinceStart, context);\r\n this.deltaTime.setValue(payload.deltaTime, context);\r\n this.eventRef.setValue(context.getEventReference(EventKey), context);\r\n this._execute(context);\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _cancelPendingTasks(_context: FlowGraphContext) {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.SceneTickEvent;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphSceneTickEventBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphSceneTickEventBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.SceneTickEvent, FlowGraphSceneTickEventBlock);\r\n}\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports pure implementation and applies runtime side effects.
|
|
3
|
+
* Import flowGraphStopEventPropagationBlock.pure for tree-shakeable, side-effect-free usage.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./flowGraphStopEventPropagationBlock.pure.js";
|
|
6
|
+
import { RegisterFlowGraphStopEventPropagationBlock } from "./flowGraphStopEventPropagationBlock.pure.js";
|
|
7
|
+
RegisterFlowGraphStopEventPropagationBlock();
|
|
8
|
+
//# sourceMappingURL=flowGraphStopEventPropagationBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphStopEventPropagationBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,2CAA2C,CAAC;AAE1D,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AACvG,0CAA0C,EAAE,CAAC","sourcesContent":["/**\r\n * Re-exports pure implementation and applies runtime side effects.\r\n * Import flowGraphStopEventPropagationBlock.pure for tree-shakeable, side-effect-free usage.\r\n */\r\nexport * from \"./flowGraphStopEventPropagationBlock.pure\";\r\n\r\nimport { RegisterFlowGraphStopEventPropagationBlock } from \"./flowGraphStopEventPropagationBlock.pure\";\r\nRegisterFlowGraphStopEventPropagationBlock();\r\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** This file must only contain pure code and pure imports */
|
|
2
|
+
import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphExecutionBlockWithOutSignal.js";
|
|
3
|
+
import { type FlowGraphContext } from "../../flowGraphContext.js";
|
|
4
|
+
import { type FlowGraphDataConnection } from "../../flowGraphDataConnection.pure.js";
|
|
5
|
+
import { type IFlowGraphBlockConfiguration } from "../../flowGraphBlock.js";
|
|
6
|
+
/**
|
|
7
|
+
* Stops the propagation of an in-flight custom event.
|
|
8
|
+
*
|
|
9
|
+
* When activated it asks the coordinator to skip the remaining handler nodes of
|
|
10
|
+
* the currently-dispatching event referenced by the `event` input, then activates
|
|
11
|
+
* its `out` flow. If the `event` input is not a valid, currently-dispatching event
|
|
12
|
+
* reference, activating this block only fires `out` with no other effect.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FlowGraphStopEventPropagationBlock extends FlowGraphExecutionBlockWithOutSignal {
|
|
15
|
+
/**
|
|
16
|
+
* Input: the event reference (produced by an event operation's `event` output)
|
|
17
|
+
* whose propagation should be stopped.
|
|
18
|
+
*/
|
|
19
|
+
readonly event: FlowGraphDataConnection<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Input: whether to also stop remaining immediate handlers. See
|
|
22
|
+
* `FlowGraphCoordinator.stopEventPropagation` for how this maps onto the
|
|
23
|
+
* Babylon single-Observable dispatch model.
|
|
24
|
+
*/
|
|
25
|
+
readonly stopImmediate: FlowGraphDataConnection<boolean>;
|
|
26
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
27
|
+
_execute(context: FlowGraphContext): void;
|
|
28
|
+
/**
|
|
29
|
+
* @returns class name of the block.
|
|
30
|
+
*/
|
|
31
|
+
getClassName(): string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register side effects for flowGraphStopEventPropagationBlock.
|
|
35
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
36
|
+
*/
|
|
37
|
+
export declare function RegisterFlowGraphStopEventPropagationBlock(): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** This file must only contain pure code and pure imports */
|
|
2
|
+
import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphExecutionBlockWithOutSignal.js";
|
|
3
|
+
import { RichTypeBoolean, RichTypeString } from "../../flowGraphRichTypes.pure.js";
|
|
4
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
5
|
+
/**
|
|
6
|
+
* Stops the propagation of an in-flight custom event.
|
|
7
|
+
*
|
|
8
|
+
* When activated it asks the coordinator to skip the remaining handler nodes of
|
|
9
|
+
* the currently-dispatching event referenced by the `event` input, then activates
|
|
10
|
+
* its `out` flow. If the `event` input is not a valid, currently-dispatching event
|
|
11
|
+
* reference, activating this block only fires `out` with no other effect.
|
|
12
|
+
*/
|
|
13
|
+
export class FlowGraphStopEventPropagationBlock extends FlowGraphExecutionBlockWithOutSignal {
|
|
14
|
+
constructor(config) {
|
|
15
|
+
super(config);
|
|
16
|
+
this.event = this.registerDataInput("event", RichTypeString);
|
|
17
|
+
this.stopImmediate = this.registerDataInput("stopImmediate", RichTypeBoolean, false);
|
|
18
|
+
}
|
|
19
|
+
_execute(context) {
|
|
20
|
+
const event = this.event.getValue(context);
|
|
21
|
+
const stopImmediate = this.stopImmediate.getValue(context);
|
|
22
|
+
context.configuration.coordinator.stopEventPropagation(event, stopImmediate);
|
|
23
|
+
this.out._activateSignal(context);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @returns class name of the block.
|
|
27
|
+
*/
|
|
28
|
+
getClassName() {
|
|
29
|
+
return "FlowGraphStopEventPropagationBlock" /* FlowGraphBlockNames.StopEventPropagation */;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
let _Registered = false;
|
|
33
|
+
/**
|
|
34
|
+
* Register side effects for flowGraphStopEventPropagationBlock.
|
|
35
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
36
|
+
*/
|
|
37
|
+
export function RegisterFlowGraphStopEventPropagationBlock() {
|
|
38
|
+
if (_Registered) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
_Registered = true;
|
|
42
|
+
RegisterClass("FlowGraphStopEventPropagationBlock" /* FlowGraphBlockNames.StopEventPropagation */, FlowGraphStopEventPropagationBlock);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=flowGraphStopEventPropagationBlock.pure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphStopEventPropagationBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAGlG,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGhF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,OAAO,kCAAmC,SAAQ,oCAAoC;IAcxF,YAAmB,MAAqC;QACpD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC7D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;IACzF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3D,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAC7E,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,2FAAgD;IACpD,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,0CAA0C;IACtD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,sFAA2C,kCAAkC,CAAC,CAAC;AAChG,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphExecutionBlockWithOutSignal\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type FlowGraphDataConnection } from \"../../flowGraphDataConnection.pure\";\r\nimport { RichTypeBoolean, RichTypeString } from \"../../flowGraphRichTypes.pure\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n\r\n/**\r\n * Stops the propagation of an in-flight custom event.\r\n *\r\n * When activated it asks the coordinator to skip the remaining handler nodes of\r\n * the currently-dispatching event referenced by the `event` input, then activates\r\n * its `out` flow. If the `event` input is not a valid, currently-dispatching event\r\n * reference, activating this block only fires `out` with no other effect.\r\n */\r\nexport class FlowGraphStopEventPropagationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input: the event reference (produced by an event operation's `event` output)\r\n * whose propagation should be stopped.\r\n */\r\n public readonly event: FlowGraphDataConnection<string>;\r\n\r\n /**\r\n * Input: whether to also stop remaining immediate handlers. See\r\n * `FlowGraphCoordinator.stopEventPropagation` for how this maps onto the\r\n * Babylon single-Observable dispatch model.\r\n */\r\n public readonly stopImmediate: FlowGraphDataConnection<boolean>;\r\n\r\n public constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.event = this.registerDataInput(\"event\", RichTypeString);\r\n this.stopImmediate = this.registerDataInput(\"stopImmediate\", RichTypeBoolean, false);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const event = this.event.getValue(context);\r\n const stopImmediate = this.stopImmediate.getValue(context);\r\n context.configuration.coordinator.stopEventPropagation(event, stopImmediate);\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.StopEventPropagation;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphStopEventPropagationBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphStopEventPropagationBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.StopEventPropagation, FlowGraphStopEventPropagationBlock);\r\n}\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./flowGraphMeshPickEventBlock.js";
|
|
2
2
|
export * from "./flowGraphSceneReadyEventBlock.js";
|
|
3
3
|
export * from "./flowGraphReceiveCustomEventBlock.js";
|
|
4
|
+
export * from "./flowGraphStopEventPropagationBlock.js";
|
|
4
5
|
export * from "./flowGraphSendCustomEventBlock.js";
|
|
5
6
|
export * from "./flowGraphSceneTickEventBlock.js";
|
|
6
7
|
export * from "./flowGraphPointerOutEventBlock.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./flowGraphMeshPickEventBlock.js";
|
|
2
2
|
export * from "./flowGraphSceneReadyEventBlock.js";
|
|
3
3
|
export * from "./flowGraphReceiveCustomEventBlock.js";
|
|
4
|
+
export * from "./flowGraphStopEventPropagationBlock.js";
|
|
4
5
|
export * from "./flowGraphSendCustomEventBlock.js";
|
|
5
6
|
export * from "./flowGraphSceneTickEventBlock.js";
|
|
6
7
|
export * from "./flowGraphPointerOutEventBlock.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"./flowGraphMeshPickEventBlock\";\r\nexport * from \"./flowGraphSceneReadyEventBlock\";\r\nexport * from \"./flowGraphReceiveCustomEventBlock\";\r\nexport * from \"./flowGraphSendCustomEventBlock\";\r\nexport * from \"./flowGraphSceneTickEventBlock\";\r\nexport * from \"./flowGraphPointerOutEventBlock\";\r\nexport * from \"./flowGraphPointerOverEventBlock\";\r\nexport * from \"./flowGraphPhysicsCollisionEventBlock\";\r\nexport * from \"./flowGraphSoundEndedEventBlock\";\r\nexport * from \"./flowGraphKeyboardEventBlock\";\r\nexport * from \"./flowGraphKeyDownEventBlock\";\r\nexport * from \"./flowGraphKeyUpEventBlock\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"./flowGraphMeshPickEventBlock\";\r\nexport * from \"./flowGraphSceneReadyEventBlock\";\r\nexport * from \"./flowGraphReceiveCustomEventBlock\";\r\nexport * from \"./flowGraphStopEventPropagationBlock\";\r\nexport * from \"./flowGraphSendCustomEventBlock\";\r\nexport * from \"./flowGraphSceneTickEventBlock\";\r\nexport * from \"./flowGraphPointerOutEventBlock\";\r\nexport * from \"./flowGraphPointerOverEventBlock\";\r\nexport * from \"./flowGraphPhysicsCollisionEventBlock\";\r\nexport * from \"./flowGraphSoundEndedEventBlock\";\r\nexport * from \"./flowGraphKeyboardEventBlock\";\r\nexport * from \"./flowGraphKeyDownEventBlock\";\r\nexport * from \"./flowGraphKeyUpEventBlock\";\r\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export * from "./flowGraphMeshPickEventBlock.pure.js";
|
|
3
3
|
export * from "./flowGraphSceneReadyEventBlock.pure.js";
|
|
4
4
|
export * from "./flowGraphReceiveCustomEventBlock.pure.js";
|
|
5
|
+
export * from "./flowGraphStopEventPropagationBlock.pure.js";
|
|
5
6
|
export * from "./flowGraphSendCustomEventBlock.pure.js";
|
|
6
7
|
export * from "./flowGraphSceneTickEventBlock.pure.js";
|
|
7
8
|
export * from "./flowGraphPointerOutEventBlock.pure.js";
|