@babylonjs/core 7.51.1 → 7.51.3
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/animation.js +2 -1
- package/Animations/animation.js.map +1 -1
- package/Buffers/bufferUtils.d.ts +7 -5
- package/Buffers/bufferUtils.js +13 -9
- package/Buffers/bufferUtils.js.map +1 -1
- package/Engines/ICanvas.d.ts +96 -1
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +7 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +3 -3
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +7 -1
- package/Engines/abstractEngine.js +10 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +32 -0
- package/Engines/constants.js +33 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/nativeEngine.d.ts +7 -1
- package/Engines/nativeEngine.js +12 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +6 -3
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +148 -465
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +394 -691
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.d.ts +142 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js +342 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +111 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +141 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +77 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +139 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Math/index.d.ts +3 -0
- package/FlowGraph/Blocks/Data/Math/index.js +3 -0
- package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +85 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +133 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.d.ts +49 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js +71 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Transformers/index.d.ts +2 -0
- package/FlowGraph/Blocks/Data/Transformers/index.js +3 -0
- package/FlowGraph/Blocks/Data/Transformers/index.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.d.ts +39 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js +46 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.d.ts +35 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +34 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.d.ts +20 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js +25 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.d.ts +34 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js +35 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.d.ts +39 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js +42 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/index.d.ts +5 -0
- package/FlowGraph/Blocks/Data/Utils/index.js +6 -0
- package/FlowGraph/Blocks/Data/Utils/index.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +0 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -2
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +4 -4
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +6 -3
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +12 -6
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +0 -2
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +2 -3
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +5 -4
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -4
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.d.ts +62 -0
- package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js +41 -0
- package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +38 -33
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +42 -25
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -16
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +9 -17
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +1 -1
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.d.ts → flowGraphTransformCoordinatesSystemBlock.d.ts} +1 -2
- package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.js → flowGraphTransformCoordinatesSystemBlock.js} +4 -5
- package/FlowGraph/Blocks/Data/flowGraphTransformCoordinatesSystemBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/index.d.ts +7 -3
- package/FlowGraph/Blocks/Data/index.js +9 -4
- package/FlowGraph/Blocks/Data/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +45 -24
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +45 -51
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.d.ts +61 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js +39 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.d.ts +61 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js +40 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +12 -14
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +19 -26
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -12
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +13 -24
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +31 -7
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +22 -20
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/{Execution → Event}/flowGraphSendCustomEventBlock.d.ts +12 -7
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +39 -0
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/index.d.ts +3 -0
- package/FlowGraph/Blocks/Event/index.js +3 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.d.ts +44 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js +46 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.d.ts +60 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js +93 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.d.ts +82 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +105 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +2 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +40 -42
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +116 -50
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +12 -4
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +86 -8
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/index.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/Animation/index.js +3 -0
- package/FlowGraph/Blocks/Execution/Animation/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +1 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/{Audio/flowGraphStopAudioBlock.d.ts → ControlFlow/flowGraphCancelDelayBlock.d.ts} +6 -8
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +31 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +5 -5
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +0 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +5 -10
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -15
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +11 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +5 -6
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +27 -7
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +28 -30
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +13 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +50 -52
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +8 -9
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -13
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +32 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +84 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +20 -6
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +55 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +36 -13
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +13 -5
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +22 -17
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +12 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +21 -21
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +2 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.js +2 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -5
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +13 -8
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +33 -36
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +42 -26
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +10 -25
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +38 -24
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/index.d.ts +0 -3
- package/FlowGraph/Blocks/Execution/index.js +0 -3
- package/FlowGraph/Blocks/Execution/index.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +16 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +292 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +145 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +147 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -0
- package/FlowGraph/Blocks/index.d.ts +2 -0
- package/FlowGraph/Blocks/index.js +2 -0
- package/FlowGraph/Blocks/index.js.map +1 -1
- package/FlowGraph/{flowGraphInteger.d.ts → CustomTypes/flowGraphInteger.d.ts} +2 -3
- package/FlowGraph/{flowGraphInteger.js → CustomTypes/flowGraphInteger.js} +4 -5
- package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +196 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +272 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -0
- package/FlowGraph/CustomTypes/index.d.ts +2 -0
- package/FlowGraph/CustomTypes/index.js +3 -0
- package/FlowGraph/CustomTypes/index.js.map +1 -0
- package/FlowGraph/flowGraph.d.ts +29 -34
- package/FlowGraph/flowGraph.js +120 -104
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphAssetsContext.d.ts +29 -0
- package/FlowGraph/flowGraphAssetsContext.js +52 -0
- package/FlowGraph/flowGraphAssetsContext.js.map +1 -0
- package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +15 -8
- package/FlowGraph/flowGraphAsyncExecutionBlock.js +25 -5
- package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +22 -15
- package/FlowGraph/flowGraphBlock.js +31 -52
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +13 -12
- package/FlowGraph/flowGraphConnection.js +31 -16
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +89 -13
- package/FlowGraph/flowGraphContext.js +210 -23
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +4 -10
- package/FlowGraph/flowGraphCoordinator.js +4 -16
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.d.ts +52 -14
- package/FlowGraph/flowGraphDataConnection.js +73 -26
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphEventBlock.d.ts +17 -1
- package/FlowGraph/flowGraphEventBlock.js +13 -2
- package/FlowGraph/flowGraphEventBlock.js.map +1 -1
- package/FlowGraph/flowGraphEventType.d.ts +16 -0
- package/FlowGraph/flowGraphEventType.js +18 -0
- package/FlowGraph/flowGraphEventType.js.map +1 -0
- package/FlowGraph/flowGraphExecutionBlock.d.ts +11 -1
- package/FlowGraph/flowGraphExecutionBlock.js +21 -2
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlockWithOutSignal.d.ts +2 -2
- package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js +0 -1
- package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -1
- package/FlowGraph/flowGraphLogger.d.ts +60 -0
- package/FlowGraph/flowGraphLogger.js +53 -0
- package/FlowGraph/flowGraphLogger.js.map +1 -0
- package/FlowGraph/flowGraphParser.d.ts +85 -0
- package/FlowGraph/flowGraphParser.js +271 -0
- package/FlowGraph/flowGraphParser.js.map +1 -0
- package/FlowGraph/flowGraphPathConverter.d.ts +1 -1
- package/FlowGraph/flowGraphPathConverter.js +3 -2
- package/FlowGraph/flowGraphPathConverter.js.map +1 -1
- package/FlowGraph/flowGraphPathConverterComponent.d.ts +8 -1
- package/FlowGraph/flowGraphPathConverterComponent.js +18 -2
- package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +51 -9
- package/FlowGraph/flowGraphRichTypes.js +160 -50
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +45 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js +77 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -0
- package/FlowGraph/flowGraphSignalConnection.d.ts +8 -5
- package/FlowGraph/flowGraphSignalConnection.js +26 -9
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/FlowGraph/index.d.ts +6 -1
- package/FlowGraph/index.js +7 -1
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/serialization.d.ts +5 -2
- package/FlowGraph/serialization.js +94 -22
- package/FlowGraph/serialization.js.map +1 -1
- package/FlowGraph/typeDefinitions.d.ts +74 -12
- package/FlowGraph/typeDefinitions.js.map +1 -1
- package/FlowGraph/utils.d.ts +47 -0
- package/FlowGraph/utils.js +55 -0
- package/FlowGraph/utils.js.map +1 -1
- package/Layers/effectLayer.d.ts +5 -0
- package/Layers/effectLayer.js +7 -0
- package/Layers/effectLayer.js.map +1 -1
- package/Loading/sceneLoader.d.ts +25 -11
- package/Loading/sceneLoader.js +28 -11
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/material.js +1 -0
- package/Materials/material.js.map +1 -1
- package/Maths/math.path.js +3 -0
- package/Maths/math.path.js.map +1 -1
- package/Meshes/csg2.d.ts +2 -2
- package/Meshes/csg2.js +2 -2
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -1
- package/Meshes/geometry.js +8 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +5 -0
- package/Meshes/instancedMesh.js +6 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -1
- package/Meshes/mesh.js +3 -2
- package/Meshes/mesh.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/ObjectModel/objectModelInterfaces.d.ts +2 -2
- package/ObjectModel/objectModelInterfaces.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +26 -18
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +8 -0
- package/scene.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +0 -24
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +0 -39
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +0 -1
- package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
- package/FlowGraph/Blocks/Data/Logic/index.js +0 -2
- package/FlowGraph/Blocks/Data/Logic/index.js.map +0 -1
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +0 -19
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +0 -26
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +0 -25
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/Audio/index.d.ts +0 -2
- package/FlowGraph/Blocks/Execution/Audio/index.js +0 -3
- package/FlowGraph/Blocks/Execution/Audio/index.js.map +0 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +0 -31
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +0 -69
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +0 -38
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +0 -1
- package/FlowGraph/flowGraphContextLogger.d.ts +0 -9
- package/FlowGraph/flowGraphContextLogger.js +0 -14
- package/FlowGraph/flowGraphContextLogger.js.map +0 -1
- package/FlowGraph/flowGraphInteger.js.map +0 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
2
2
|
import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock.js";
|
|
3
|
-
import {
|
|
3
|
+
import { RichTypeFlowGraphInteger } from "../../../flowGraphRichTypes.js";
|
|
4
|
+
import { FlowGraphInteger } from "../../../CustomTypes/flowGraphInteger.js";
|
|
4
5
|
/**
|
|
5
|
-
* @experimental
|
|
6
6
|
* A block that has an input flow and routes it to any potential output flows, randomly or sequentially
|
|
7
|
-
* @see https://docs.google.com/document/d/1MT7gL-IEn_PUw-4XGBazMxsyqsxqgAVGYcNeC4Cj_9Q/edit#heading=h.i2sn85fbjo60
|
|
8
7
|
*/
|
|
9
8
|
export class FlowGraphMultiGateBlock extends FlowGraphExecutionBlock {
|
|
10
9
|
constructor(
|
|
@@ -14,72 +13,71 @@ export class FlowGraphMultiGateBlock extends FlowGraphExecutionBlock {
|
|
|
14
13
|
config) {
|
|
15
14
|
super(config);
|
|
16
15
|
this.config = config;
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Output connections: The output signals.
|
|
18
|
+
*/
|
|
19
|
+
this.outputSignals = [];
|
|
18
20
|
this.reset = this._registerSignalInput("reset");
|
|
19
|
-
this.
|
|
20
|
-
this.config
|
|
21
|
-
this.config.startIndex = Math.max(0, Math.min(this.config.startIndex, this.config.numberOutputFlows - 1));
|
|
22
|
-
this.outFlows = [];
|
|
23
|
-
for (let i = 0; i < this.config.numberOutputFlows; i++) {
|
|
24
|
-
this.outFlows.push(this._registerSignalOutput(`out${i}`));
|
|
25
|
-
}
|
|
21
|
+
this.lastIndex = this.registerDataOutput("lastIndex", RichTypeFlowGraphInteger, new FlowGraphInteger(-1));
|
|
22
|
+
this.setNumberOfOutputSignals(config?.outputSignalCount);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
_getNextIndex(indexesUsed) {
|
|
25
|
+
// find the next index available from the indexes used array
|
|
26
|
+
// if all outputs were used, reset the indexes used array if we are in a loop multi gate
|
|
27
|
+
if (!indexesUsed.includes(false)) {
|
|
28
|
+
if (this.config.isLoop) {
|
|
29
|
+
indexesUsed.fill(false);
|
|
33
30
|
}
|
|
34
31
|
}
|
|
32
|
+
if (!this.config.isRandom) {
|
|
33
|
+
return indexesUsed.indexOf(false);
|
|
34
|
+
}
|
|
35
35
|
else {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
result.push(contextUnusedIndexes[i]);
|
|
39
|
-
}
|
|
36
|
+
const unusedIndexes = indexesUsed.map((used, index) => (used ? -1 : index)).filter((index) => index !== -1);
|
|
37
|
+
return unusedIndexes.length ? unusedIndexes[Math.floor(Math.random() * unusedIndexes.length)] : -1;
|
|
40
38
|
}
|
|
41
|
-
return result;
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Sets the block's output signals. Would usually be passed from the constructor but can be changed afterwards.
|
|
42
|
+
* @param numberOutputSignals the number of output flows
|
|
43
|
+
*/
|
|
44
|
+
setNumberOfOutputSignals(numberOutputSignals = 1) {
|
|
45
|
+
// check the size of the outFlow Array, see if it is not larger than needed
|
|
46
|
+
while (this.outputSignals.length > numberOutputSignals) {
|
|
47
|
+
const flow = this.outputSignals.pop();
|
|
48
|
+
if (flow) {
|
|
49
|
+
flow.disconnectFromAll();
|
|
50
|
+
this._unregisterSignalOutput(flow.name);
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
while (this.outputSignals.length < numberOutputSignals) {
|
|
54
|
+
this.outputSignals.push(this._registerSignalOutput(`out_${this.outputSignals.length}`));
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
_execute(context, callingSignal) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
context._deleteExecutionVariable(this, "currentIndex");
|
|
57
|
-
context._deleteExecutionVariable(this, "unusedIndexes");
|
|
58
|
-
return;
|
|
58
|
+
// set the state(s) of the block
|
|
59
|
+
if (!context._hasExecutionVariable(this, "indexesUsed")) {
|
|
60
|
+
context._setExecutionVariable(this, "indexesUsed", this.outputSignals.map(() => false));
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
else if (nextIndex >= this.config.numberOutputFlows && !this.config.loop) {
|
|
62
|
+
if (callingSignal === this.reset) {
|
|
63
|
+
context._deleteExecutionVariable(this, "indexesUsed");
|
|
64
|
+
this.lastIndex.setValue(new FlowGraphInteger(-1), context);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
const indexesUsed = context._getExecutionVariable(this, "indexesUsed", []);
|
|
68
|
+
const nextIndex = this._getNextIndex(indexesUsed);
|
|
69
|
+
if (nextIndex > -1) {
|
|
70
|
+
this.lastIndex.setValue(new FlowGraphInteger(nextIndex), context);
|
|
71
|
+
indexesUsed[nextIndex] = true;
|
|
72
|
+
context._setExecutionVariable(this, "indexesUsed", indexesUsed);
|
|
73
|
+
this.outputSignals[nextIndex]._activateSignal(context);
|
|
72
74
|
}
|
|
73
|
-
context._setExecutionVariable(this, "unusedIndexes", unusedIndexes);
|
|
74
|
-
context._setExecutionVariable(this, "currentIndex", nextIndex);
|
|
75
|
-
this.currentIndex.setValue(nextIndex, context);
|
|
76
|
-
this.outFlows[nextIndex]._activateSignal(context);
|
|
77
75
|
}
|
|
78
76
|
/**
|
|
79
77
|
* @returns class name of the block.
|
|
80
78
|
*/
|
|
81
79
|
getClassName() {
|
|
82
|
-
return "
|
|
80
|
+
return "FlowGraphMultiGateBlock" /* FlowGraphBlockNames.MultiGate */;
|
|
83
81
|
}
|
|
84
82
|
/**
|
|
85
83
|
* Serializes the block.
|
|
@@ -87,11 +85,11 @@ export class FlowGraphMultiGateBlock extends FlowGraphExecutionBlock {
|
|
|
87
85
|
*/
|
|
88
86
|
serialize(serializationObject) {
|
|
89
87
|
super.serialize(serializationObject);
|
|
90
|
-
serializationObject.config.
|
|
88
|
+
serializationObject.config.outputSignalCount = this.config.outputSignalCount;
|
|
91
89
|
serializationObject.config.isRandom = this.config.isRandom;
|
|
92
|
-
serializationObject.config.loop = this.config.
|
|
90
|
+
serializationObject.config.loop = this.config.isLoop;
|
|
93
91
|
serializationObject.config.startIndex = this.config.startIndex;
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
|
-
RegisterClass("
|
|
94
|
+
RegisterClass("FlowGraphMultiGateBlock" /* FlowGraphBlockNames.MultiGate */, FlowGraphMultiGateBlock);
|
|
97
95
|
//# sourceMappingURL=flowGraphMultiGateBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphMultiGateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"flowGraphMultiGateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAIvE,OAAO,EAAE,gBAAgB,EAAE,iDAAoD;AAmB/E;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,uBAAuB;IAchE;IACI;;OAEG;IACa,MAA6C;QAE7D,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAAuC;QAbjE;;WAEG;QACa,kBAAa,GAAgC,EAAE,CAAC;QAa5D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,wBAAwB,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1G,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7D,CAAC;IAEO,aAAa,CAAC,WAAsB;QACxC,4DAA4D;QAE5D,wFAAwF;QACxF,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACrB,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;QACL,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,WAAW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C3D,mBAAmB,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACrD,mBAAmB,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IACnE,CAAC;CACJ;AACD,aAAa,gEAAgC,uBAAuB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlock } from \"../../../flowGraphExecutionBlock\";\r\nimport { RichTypeFlowGraphInteger } from \"../../../flowGraphRichTypes\";\r\nimport type { FlowGraphSignalConnection } from \"../../../flowGraphSignalConnection\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\r\nimport { FlowGraphInteger } from \"core/FlowGraph/CustomTypes/flowGraphInteger\";\r\n/**\r\n * Configuration for the multi gate block.\r\n */\r\nexport interface IFlowGraphMultiGateBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The number of output signals. Required.\r\n */\r\n outputSignalCount: number;\r\n /**\r\n * If the block should pick a random output flow from the ones that haven't been executed. Default to false.\r\n */\r\n isRandom?: boolean;\r\n /**\r\n * If the block should loop back to the first output flow after executing the last one. Default to false.\r\n */\r\n isLoop?: boolean;\r\n}\r\n\r\n/**\r\n * A block that has an input flow and routes it to any potential output flows, randomly or sequentially\r\n */\r\nexport class FlowGraphMultiGateBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * Input connection: Resets the gate.\r\n */\r\n public readonly reset: FlowGraphSignalConnection;\r\n /**\r\n * Output connections: The output signals.\r\n */\r\n public readonly outputSignals: FlowGraphSignalConnection[] = [];\r\n /**\r\n * Output connection: The index of the current output flow.\r\n */\r\n public readonly lastIndex: FlowGraphDataConnection<FlowGraphInteger>;\r\n\r\n constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config: IFlowGraphMultiGateBlockConfiguration\r\n ) {\r\n super(config);\r\n this.reset = this._registerSignalInput(\"reset\");\r\n this.lastIndex = this.registerDataOutput(\"lastIndex\", RichTypeFlowGraphInteger, new FlowGraphInteger(-1));\r\n this.setNumberOfOutputSignals(config?.outputSignalCount);\r\n }\r\n\r\n private _getNextIndex(indexesUsed: boolean[]): number {\r\n // find the next index available from the indexes used array\r\n\r\n // if all outputs were used, reset the indexes used array if we are in a loop multi gate\r\n if (!indexesUsed.includes(false)) {\r\n if (this.config.isLoop) {\r\n indexesUsed.fill(false);\r\n }\r\n }\r\n if (!this.config.isRandom) {\r\n return indexesUsed.indexOf(false);\r\n } else {\r\n const unusedIndexes = indexesUsed.map((used, index) => (used ? -1 : index)).filter((index) => index !== -1);\r\n return unusedIndexes.length ? unusedIndexes[Math.floor(Math.random() * unusedIndexes.length)] : -1;\r\n }\r\n }\r\n\r\n /**\r\n * Sets the block's output signals. Would usually be passed from the constructor but can be changed afterwards.\r\n * @param numberOutputSignals the number of output flows\r\n */\r\n public setNumberOfOutputSignals(numberOutputSignals: number = 1) {\r\n // check the size of the outFlow Array, see if it is not larger than needed\r\n while (this.outputSignals.length > numberOutputSignals) {\r\n const flow = this.outputSignals.pop();\r\n if (flow) {\r\n flow.disconnectFromAll();\r\n this._unregisterSignalOutput(flow.name);\r\n }\r\n }\r\n\r\n while (this.outputSignals.length < numberOutputSignals) {\r\n this.outputSignals.push(this._registerSignalOutput(`out_${this.outputSignals.length}`));\r\n }\r\n }\r\n\r\n public _execute(context: FlowGraphContext, callingSignal: FlowGraphSignalConnection): void {\r\n // set the state(s) of the block\r\n if (!context._hasExecutionVariable(this, \"indexesUsed\")) {\r\n context._setExecutionVariable(\r\n this,\r\n \"indexesUsed\",\r\n this.outputSignals.map(() => false)\r\n );\r\n }\r\n\r\n if (callingSignal === this.reset) {\r\n context._deleteExecutionVariable(this, \"indexesUsed\");\r\n this.lastIndex.setValue(new FlowGraphInteger(-1), context);\r\n return;\r\n }\r\n const indexesUsed = context._getExecutionVariable(this, \"indexesUsed\", [] as boolean[]);\r\n const nextIndex = this._getNextIndex(indexesUsed);\r\n if (nextIndex > -1) {\r\n this.lastIndex.setValue(new FlowGraphInteger(nextIndex), context);\r\n indexesUsed[nextIndex] = true;\r\n context._setExecutionVariable(this, \"indexesUsed\", indexesUsed);\r\n this.outputSignals[nextIndex]._activateSignal(context);\r\n }\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.MultiGate;\r\n }\r\n\r\n /**\r\n * Serializes the block.\r\n * @param serializationObject the object to serialize to.\r\n */\r\n public override serialize(serializationObject?: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.config.outputSignalCount = this.config.outputSignalCount;\r\n serializationObject.config.isRandom = this.config.isRandom;\r\n serializationObject.config.loop = this.config.isLoop;\r\n serializationObject.config.startIndex = this.config.startIndex;\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.MultiGate, FlowGraphMultiGateBlock);\r\n"]}
|
|
@@ -3,17 +3,15 @@ import type { FlowGraphContext } from "../../../flowGraphContext";
|
|
|
3
3
|
import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock";
|
|
4
4
|
import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnection";
|
|
5
5
|
/**
|
|
6
|
-
* @experimental
|
|
7
6
|
* Configuration for the sequence block.
|
|
8
7
|
*/
|
|
9
8
|
export interface IFlowGraphSequenceBlockConfiguration extends IFlowGraphBlockConfiguration {
|
|
10
9
|
/**
|
|
11
|
-
* The number of output
|
|
10
|
+
* The number of output signals. Defaults to 1.
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
outputSignalCount?: number;
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
|
-
* @experimental
|
|
17
15
|
* A block that executes its output flows in sequence.
|
|
18
16
|
*/
|
|
19
17
|
export declare class FlowGraphSequenceBlock extends FlowGraphExecutionBlock {
|
|
@@ -24,7 +22,7 @@ export declare class FlowGraphSequenceBlock extends FlowGraphExecutionBlock {
|
|
|
24
22
|
/**
|
|
25
23
|
* The output flows.
|
|
26
24
|
*/
|
|
27
|
-
|
|
25
|
+
executionSignals: FlowGraphSignalConnection[];
|
|
28
26
|
constructor(
|
|
29
27
|
/**
|
|
30
28
|
* the configuration of the block
|
|
@@ -32,11 +30,12 @@ export declare class FlowGraphSequenceBlock extends FlowGraphExecutionBlock {
|
|
|
32
30
|
config: IFlowGraphSequenceBlockConfiguration);
|
|
33
31
|
_execute(context: FlowGraphContext): void;
|
|
34
32
|
/**
|
|
35
|
-
*
|
|
33
|
+
* Sets the block's output flows. Would usually be passed from the constructor but can be changed afterwards.
|
|
34
|
+
* @param outputSignalCount the number of output flows
|
|
36
35
|
*/
|
|
37
|
-
|
|
36
|
+
setNumberOfOutputSignals(outputSignalCount?: number): void;
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
38
|
+
* @returns class name of the block.
|
|
40
39
|
*/
|
|
41
|
-
|
|
40
|
+
getClassName(): string;
|
|
42
41
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
2
2
|
import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock.js";
|
|
3
3
|
/**
|
|
4
|
-
* @experimental
|
|
5
4
|
* A block that executes its output flows in sequence.
|
|
6
5
|
*/
|
|
7
6
|
export class FlowGraphSequenceBlock extends FlowGraphExecutionBlock {
|
|
@@ -12,26 +11,40 @@ export class FlowGraphSequenceBlock extends FlowGraphExecutionBlock {
|
|
|
12
11
|
config) {
|
|
13
12
|
super(config);
|
|
14
13
|
this.config = config;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The output flows.
|
|
16
|
+
*/
|
|
17
|
+
this.executionSignals = [];
|
|
18
|
+
this.setNumberOfOutputSignals(this.config.outputSignalCount);
|
|
19
19
|
}
|
|
20
20
|
_execute(context) {
|
|
21
|
-
for (let i = 0; i < this.
|
|
22
|
-
this.
|
|
21
|
+
for (let i = 0; i < this.executionSignals.length; i++) {
|
|
22
|
+
this.executionSignals[i]._activateSignal(context);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets the block's output flows. Would usually be passed from the constructor but can be changed afterwards.
|
|
27
|
+
* @param outputSignalCount the number of output flows
|
|
28
|
+
*/
|
|
29
|
+
setNumberOfOutputSignals(outputSignalCount = 1) {
|
|
30
|
+
// check the size of the outFlow Array, see if it is not larger than needed
|
|
31
|
+
while (this.executionSignals.length > outputSignalCount) {
|
|
32
|
+
const flow = this.executionSignals.pop();
|
|
33
|
+
if (flow) {
|
|
34
|
+
flow.disconnectFromAll();
|
|
35
|
+
this._unregisterSignalOutput(flow.name);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
while (this.executionSignals.length < outputSignalCount) {
|
|
39
|
+
this.executionSignals.push(this._registerSignalOutput(`out_${this.executionSignals.length}`));
|
|
23
40
|
}
|
|
24
41
|
}
|
|
25
42
|
/**
|
|
26
43
|
* @returns class name of the block.
|
|
27
44
|
*/
|
|
28
45
|
getClassName() {
|
|
29
|
-
return FlowGraphSequenceBlock.
|
|
46
|
+
return "FlowGraphSequenceBlock" /* FlowGraphBlockNames.Sequence */;
|
|
30
47
|
}
|
|
31
48
|
}
|
|
32
|
-
|
|
33
|
-
* the class name of the block.
|
|
34
|
-
*/
|
|
35
|
-
FlowGraphSequenceBlock.ClassName = "FGSequenceBlock";
|
|
36
|
-
RegisterClass(FlowGraphSequenceBlock.ClassName, FlowGraphSequenceBlock);
|
|
49
|
+
RegisterClass("FlowGraphSequenceBlock" /* FlowGraphBlockNames.Sequence */, FlowGraphSequenceBlock);
|
|
37
50
|
//# sourceMappingURL=flowGraphSequenceBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphSequenceBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"flowGraphSequenceBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAa3E;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAM/D;IACI;;OAEG;IACa,MAA4C;QAE5D,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAAsC;QAThE;;WAEG;QACI,qBAAgB,GAAgC,EAAE,CAAC;QAStD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACjE,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpD,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,wBAAwB,CAAC,oBAA4B,CAAC;QACzD,2EAA2E;QAC3E,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;YACtD,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;YACzC,IAAI,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACzB,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;YACtD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,mEAAoC;IACxC,CAAC;CACJ;AAED,aAAa,8DAA+B,sBAAsB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport { FlowGraphExecutionBlock } from \"../../../flowGraphExecutionBlock\";\r\nimport type { FlowGraphSignalConnection } from \"../../../flowGraphSignalConnection\";\r\n\r\n/**\r\n * Configuration for the sequence block.\r\n */\r\nexport interface IFlowGraphSequenceBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The number of output signals. Defaults to 1.\r\n */\r\n outputSignalCount?: number;\r\n}\r\n\r\n/**\r\n * A block that executes its output flows in sequence.\r\n */\r\nexport class FlowGraphSequenceBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * The output flows.\r\n */\r\n public executionSignals: FlowGraphSignalConnection[] = [];\r\n\r\n constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config: IFlowGraphSequenceBlockConfiguration\r\n ) {\r\n super(config);\r\n this.setNumberOfOutputSignals(this.config.outputSignalCount);\r\n }\r\n\r\n public _execute(context: FlowGraphContext) {\r\n for (let i = 0; i < this.executionSignals.length; i++) {\r\n this.executionSignals[i]._activateSignal(context);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the block's output flows. Would usually be passed from the constructor but can be changed afterwards.\r\n * @param outputSignalCount the number of output flows\r\n */\r\n public setNumberOfOutputSignals(outputSignalCount: number = 1) {\r\n // check the size of the outFlow Array, see if it is not larger than needed\r\n while (this.executionSignals.length > outputSignalCount) {\r\n const flow = this.executionSignals.pop();\r\n if (flow) {\r\n flow.disconnectFromAll();\r\n this._unregisterSignalOutput(flow.name);\r\n }\r\n }\r\n\r\n while (this.executionSignals.length < outputSignalCount) {\r\n this.executionSignals.push(this._registerSignalOutput(`out_${this.executionSignals.length}`));\r\n }\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.Sequence;\r\n }\r\n}\r\n\r\nRegisterClass(FlowGraphBlockNames.Sequence, FlowGraphSequenceBlock);\r\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock";
|
|
2
|
+
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
|
|
3
|
+
import type { FlowGraphContext } from "../../../flowGraphContext";
|
|
4
|
+
import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
|
|
5
|
+
import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnection";
|
|
6
|
+
/**
|
|
7
|
+
* Block that sets a delay in seconds before activating the output signal.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FlowGraphSetDelayBlock extends FlowGraphAsyncExecutionBlock {
|
|
10
|
+
/**
|
|
11
|
+
* The maximum number of parallel delays that can be set per node.
|
|
12
|
+
*/
|
|
13
|
+
static MaxParallelDelayCount: number;
|
|
14
|
+
/**
|
|
15
|
+
* Input signal: If activated the delayed activations set by this block will be canceled.
|
|
16
|
+
*/
|
|
17
|
+
readonly cancel: FlowGraphSignalConnection;
|
|
18
|
+
/**
|
|
19
|
+
* Input connection: The duration of the delay in seconds.
|
|
20
|
+
*/
|
|
21
|
+
readonly duration: FlowGraphDataConnection<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Output connection: The last delay index that was set.
|
|
24
|
+
*/
|
|
25
|
+
readonly lastDelayIndex: FlowGraphDataConnection<number>;
|
|
26
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
27
|
+
_preparePendingTasks(context: FlowGraphContext): void;
|
|
28
|
+
_cancelPendingTasks(context: FlowGraphContext): void;
|
|
29
|
+
_execute(context: FlowGraphContext, callingSignal: FlowGraphSignalConnection): void;
|
|
30
|
+
getClassName(): string;
|
|
31
|
+
private _onEnded;
|
|
32
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock.js";
|
|
2
|
+
import { RichTypeNumber } from "../../../flowGraphRichTypes.js";
|
|
3
|
+
import { AdvancedTimer } from "../../../../Misc/timer.js";
|
|
4
|
+
import { Logger } from "../../../../Misc/logger.js";
|
|
5
|
+
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
6
|
+
/**
|
|
7
|
+
* Block that sets a delay in seconds before activating the output signal.
|
|
8
|
+
*/
|
|
9
|
+
export class FlowGraphSetDelayBlock extends FlowGraphAsyncExecutionBlock {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
this.cancel = this._registerSignalInput("cancel");
|
|
13
|
+
this.duration = this.registerDataInput("duration", RichTypeNumber);
|
|
14
|
+
this.lastDelayIndex = this.registerDataOutput("lastDelayIndex", RichTypeNumber, -1);
|
|
15
|
+
}
|
|
16
|
+
_preparePendingTasks(context) {
|
|
17
|
+
const duration = this.duration.getValue(context);
|
|
18
|
+
if (duration < 0 || isNaN(duration) || !isFinite(duration)) {
|
|
19
|
+
this.error.payload = { message: "Invalid duration" };
|
|
20
|
+
return this.error._activateSignal(context);
|
|
21
|
+
}
|
|
22
|
+
// active delays are global to the context
|
|
23
|
+
const activeDelays = context._getGlobalContextVariable("activeDelays", 0);
|
|
24
|
+
if (activeDelays >= FlowGraphSetDelayBlock.MaxParallelDelayCount) {
|
|
25
|
+
this.error.payload = { message: "Max parallel delays reached" };
|
|
26
|
+
return this.error._activateSignal(context);
|
|
27
|
+
}
|
|
28
|
+
// get the last global delay index
|
|
29
|
+
const lastDelayIndex = context._getGlobalContextVariable("lastDelayIndex", -1);
|
|
30
|
+
// these are block-specific and not global
|
|
31
|
+
const timers = context._getExecutionVariable(this, "pendingDelays", []);
|
|
32
|
+
const scene = context.configuration.scene;
|
|
33
|
+
const timer = new AdvancedTimer({
|
|
34
|
+
timeout: duration * 1000, // duration is in seconds
|
|
35
|
+
contextObservable: scene.onBeforeRenderObservable,
|
|
36
|
+
onEnded: () => this._onEnded(timer, context),
|
|
37
|
+
});
|
|
38
|
+
timer.start();
|
|
39
|
+
const newIndex = lastDelayIndex + 1;
|
|
40
|
+
this.lastDelayIndex.setValue(newIndex, context);
|
|
41
|
+
context._setGlobalContextVariable("lastDelayIndex", newIndex);
|
|
42
|
+
timers[newIndex] = timer;
|
|
43
|
+
context._setExecutionVariable(this, "pendingDelays", timers);
|
|
44
|
+
}
|
|
45
|
+
_cancelPendingTasks(context) {
|
|
46
|
+
const timers = context._getExecutionVariable(this, "pendingDelays", []);
|
|
47
|
+
for (const timer of timers) {
|
|
48
|
+
timer?.dispose();
|
|
49
|
+
}
|
|
50
|
+
context._deleteExecutionVariable(this, "pendingDelays");
|
|
51
|
+
this.lastDelayIndex.setValue(-1, context);
|
|
52
|
+
}
|
|
53
|
+
_execute(context, callingSignal) {
|
|
54
|
+
if (callingSignal === this.cancel) {
|
|
55
|
+
this._cancelPendingTasks(context);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this._preparePendingTasks(context);
|
|
60
|
+
this.out._activateSignal(context);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
getClassName() {
|
|
64
|
+
return "FlowGraphSetDelayBlock" /* FlowGraphBlockNames.SetDelay */;
|
|
65
|
+
}
|
|
66
|
+
_onEnded(timer, context) {
|
|
67
|
+
const timers = context._getExecutionVariable(this, "pendingDelays", []);
|
|
68
|
+
const index = timers.indexOf(timer);
|
|
69
|
+
if (index !== -1) {
|
|
70
|
+
timers.splice(index, 1);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
Logger.Warn("FlowGraphTimerBlock: Timer ended but was not found in the running timers list");
|
|
74
|
+
}
|
|
75
|
+
context._removePendingBlock(this);
|
|
76
|
+
this.done._activateSignal(context);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The maximum number of parallel delays that can be set per node.
|
|
81
|
+
*/
|
|
82
|
+
FlowGraphSetDelayBlock.MaxParallelDelayCount = 100;
|
|
83
|
+
RegisterClass("FlowGraphSetDelayBlock" /* FlowGraphBlockNames.SetDelay */, FlowGraphSetDelayBlock);
|
|
84
|
+
//# sourceMappingURL=flowGraphSetDelayBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphSetDelayBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAIrF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAEpD;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,4BAA4B;IAoBpE,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,iBAAiB,C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AQ,CAAC,KAAoB,EAAE,OAAyB;QAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,EAAqB,CAAC,CAAC;QAC3F,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;QACjG,CAAC;QACD,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;;AA5FD;;GAEG;AACW,4CAAqB,GAAG,GAAG,CAAC;AA4F9C,aAAa,8DAA+B,sBAAsB,CAAC,CAAC","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"../../../flowGraphAsyncExecutionBlock\";\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\nimport { RichTypeNumber } from \"../../../flowGraphRichTypes\";\nimport type { FlowGraphSignalConnection } from \"../../../flowGraphSignalConnection\";\nimport { AdvancedTimer } from \"../../../../Misc/timer\";\nimport { Logger } from \"../../../../Misc/logger\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\n/**\n * Block that sets a delay in seconds before activating the output signal.\n */\nexport class FlowGraphSetDelayBlock extends FlowGraphAsyncExecutionBlock {\n /**\n * The maximum number of parallel delays that can be set per node.\n */\n public static MaxParallelDelayCount = 100;\n /**\n * Input signal: If activated the delayed activations set by this block will be canceled.\n */\n public readonly cancel: FlowGraphSignalConnection;\n\n /**\n * Input connection: The duration of the delay in seconds.\n */\n public readonly duration: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The last delay index that was set.\n */\n public readonly lastDelayIndex: FlowGraphDataConnection<number>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.cancel = this._registerSignalInput(\"cancel\");\n this.duration = this.registerDataInput(\"duration\", RichTypeNumber);\n this.lastDelayIndex = this.registerDataOutput(\"lastDelayIndex\", RichTypeNumber, -1);\n }\n\n public _preparePendingTasks(context: FlowGraphContext): void {\n const duration = this.duration.getValue(context);\n if (duration < 0 || isNaN(duration) || !isFinite(duration)) {\n this.error.payload = { message: \"Invalid duration\" };\n return this.error._activateSignal(context);\n }\n\n // active delays are global to the context\n const activeDelays: number = context._getGlobalContextVariable(\"activeDelays\", 0);\n if (activeDelays >= FlowGraphSetDelayBlock.MaxParallelDelayCount) {\n this.error.payload = { message: \"Max parallel delays reached\" };\n return this.error._activateSignal(context);\n }\n // get the last global delay index\n const lastDelayIndex: number = context._getGlobalContextVariable(\"lastDelayIndex\", -1);\n\n // these are block-specific and not global\n const timers = context._getExecutionVariable(this, \"pendingDelays\", [] as AdvancedTimer[]);\n const scene = context.configuration.scene;\n const timer: AdvancedTimer = new AdvancedTimer({\n timeout: duration * 1000, // duration is in seconds\n contextObservable: scene.onBeforeRenderObservable,\n onEnded: () => this._onEnded(timer, context),\n });\n timer.start();\n const newIndex = lastDelayIndex + 1;\n this.lastDelayIndex.setValue(newIndex, context);\n context._setGlobalContextVariable(\"lastDelayIndex\", newIndex);\n\n timers[newIndex] = timer;\n context._setExecutionVariable(this, \"pendingDelays\", timers);\n }\n\n public _cancelPendingTasks(context: FlowGraphContext): void {\n const timers = context._getExecutionVariable(this, \"pendingDelays\", [] as AdvancedTimer[]);\n for (const timer of timers) {\n timer?.dispose();\n }\n context._deleteExecutionVariable(this, \"pendingDelays\");\n this.lastDelayIndex.setValue(-1, context);\n }\n\n public _execute(context: FlowGraphContext, callingSignal: FlowGraphSignalConnection): void {\n if (callingSignal === this.cancel) {\n this._cancelPendingTasks(context);\n return;\n } else {\n this._preparePendingTasks(context);\n this.out._activateSignal(context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.SetDelay;\n }\n\n private _onEnded(timer: AdvancedTimer, context: FlowGraphContext) {\n const timers = context._getExecutionVariable(this, \"pendingDelays\", [] as AdvancedTimer[]);\n const index = timers.indexOf(timer);\n if (index !== -1) {\n timers.splice(index, 1);\n } else {\n Logger.Warn(\"FlowGraphTimerBlock: Timer ended but was not found in the running timers list\");\n }\n context._removePendingBlock(this);\n this.done._activateSignal(context);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.SetDelay, FlowGraphSetDelayBlock);\n"]}
|
|
@@ -3,8 +3,8 @@ import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
|
|
|
3
3
|
import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock";
|
|
4
4
|
import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnection";
|
|
5
5
|
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
|
|
6
|
+
import type { FlowGraphNumber } from "../../../utils.js";
|
|
6
7
|
/**
|
|
7
|
-
* @experimental
|
|
8
8
|
* Configuration for a switch block.
|
|
9
9
|
*/
|
|
10
10
|
export interface IFlowGraphSwitchBlockConfiguration<T> extends IFlowGraphBlockConfiguration {
|
|
@@ -14,10 +14,9 @@ export interface IFlowGraphSwitchBlockConfiguration<T> extends IFlowGraphBlockCo
|
|
|
14
14
|
cases: T[];
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* @experimental
|
|
18
17
|
* A block that executes a branch based on a selection.
|
|
19
18
|
*/
|
|
20
|
-
export declare class FlowGraphSwitchBlock<T> extends FlowGraphExecutionBlock {
|
|
19
|
+
export declare class FlowGraphSwitchBlock<T extends FlowGraphNumber> extends FlowGraphExecutionBlock {
|
|
21
20
|
/**
|
|
22
21
|
* the configuration of the block
|
|
23
22
|
*/
|
|
@@ -25,17 +24,32 @@ export declare class FlowGraphSwitchBlock<T> extends FlowGraphExecutionBlock {
|
|
|
25
24
|
/**
|
|
26
25
|
* Input connection: The value of the selection.
|
|
27
26
|
*/
|
|
28
|
-
readonly
|
|
27
|
+
readonly case: FlowGraphDataConnection<T>;
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
29
|
+
* The default case to execute if no other case is found.
|
|
31
30
|
*/
|
|
32
|
-
|
|
31
|
+
readonly default: FlowGraphSignalConnection;
|
|
32
|
+
private _caseToOutputFlow;
|
|
33
33
|
constructor(
|
|
34
34
|
/**
|
|
35
35
|
* the configuration of the block
|
|
36
36
|
*/
|
|
37
37
|
config: IFlowGraphSwitchBlockConfiguration<T>);
|
|
38
38
|
_execute(context: FlowGraphContext, _callingSignal: FlowGraphSignalConnection): void;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a new case to the switch block.
|
|
41
|
+
* @param newCase the new case to add.
|
|
42
|
+
*/
|
|
43
|
+
addCase(newCase: T): void;
|
|
44
|
+
/**
|
|
45
|
+
* Removes a case from the switch block.
|
|
46
|
+
* @param caseToRemove the case to remove.
|
|
47
|
+
*/
|
|
48
|
+
removeCase(caseToRemove: T): void;
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
_getOutputFlowForCase(caseValue: T): FlowGraphSignalConnection | undefined;
|
|
39
53
|
/**
|
|
40
54
|
* @returns class name of the block.
|
|
41
55
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock.js";
|
|
2
2
|
import { RichTypeAny } from "../../../flowGraphRichTypes.js";
|
|
3
3
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
4
|
+
import { getNumericValue, isNumeric } from "../../../utils.js";
|
|
4
5
|
/**
|
|
5
|
-
* @experimental
|
|
6
6
|
* A block that executes a branch based on a selection.
|
|
7
7
|
*/
|
|
8
8
|
export class FlowGraphSwitchBlock extends FlowGraphExecutionBlock {
|
|
@@ -13,28 +13,67 @@ export class FlowGraphSwitchBlock extends FlowGraphExecutionBlock {
|
|
|
13
13
|
config) {
|
|
14
14
|
super(config);
|
|
15
15
|
this.config = config;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The default case to execute if no other case is found.
|
|
18
|
+
*/
|
|
19
|
+
this.default = this._registerSignalOutput("default");
|
|
20
|
+
this._caseToOutputFlow = new Map();
|
|
21
|
+
this.case = this.registerDataInput("case", RichTypeAny);
|
|
22
|
+
// iterate the set not using for of
|
|
23
|
+
(this.config.cases || []).forEach((caseValue) => {
|
|
24
|
+
this._caseToOutputFlow.set(caseValue, this._registerSignalOutput(`out_${caseValue}`));
|
|
25
|
+
});
|
|
21
26
|
}
|
|
22
27
|
_execute(context, _callingSignal) {
|
|
23
|
-
const selectionValue = this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const selectionValue = this.case.getValue(context);
|
|
29
|
+
let outputFlow;
|
|
30
|
+
if (isNumeric(selectionValue)) {
|
|
31
|
+
outputFlow = this._getOutputFlowForCase(getNumericValue(selectionValue));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
outputFlow = this._getOutputFlowForCase(selectionValue);
|
|
35
|
+
}
|
|
36
|
+
if (outputFlow) {
|
|
37
|
+
outputFlow._activateSignal(context);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.default._activateSignal(context);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Adds a new case to the switch block.
|
|
45
|
+
* @param newCase the new case to add.
|
|
46
|
+
*/
|
|
47
|
+
addCase(newCase) {
|
|
48
|
+
if (this.config.cases.includes(newCase)) {
|
|
49
|
+
return;
|
|
29
50
|
}
|
|
30
|
-
|
|
31
|
-
this.
|
|
51
|
+
this.config.cases.push(newCase);
|
|
52
|
+
this._caseToOutputFlow.set(newCase, this._registerSignalOutput(`out_${newCase}`));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Removes a case from the switch block.
|
|
56
|
+
* @param caseToRemove the case to remove.
|
|
57
|
+
*/
|
|
58
|
+
removeCase(caseToRemove) {
|
|
59
|
+
if (!this.config.cases.includes(caseToRemove)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const index = this.config.cases.indexOf(caseToRemove);
|
|
63
|
+
this.config.cases.splice(index, 1);
|
|
64
|
+
this._caseToOutputFlow.delete(caseToRemove);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
_getOutputFlowForCase(caseValue) {
|
|
70
|
+
return this._caseToOutputFlow.get(caseValue);
|
|
32
71
|
}
|
|
33
72
|
/**
|
|
34
73
|
* @returns class name of the block.
|
|
35
74
|
*/
|
|
36
75
|
getClassName() {
|
|
37
|
-
return "
|
|
76
|
+
return "FlowGraphSwitchBlock" /* FlowGraphBlockNames.Switch */;
|
|
38
77
|
}
|
|
39
78
|
/**
|
|
40
79
|
* Serialize the block to a JSON representation.
|
|
@@ -45,5 +84,5 @@ export class FlowGraphSwitchBlock extends FlowGraphExecutionBlock {
|
|
|
45
84
|
serializationObject.cases = this.config.cases;
|
|
46
85
|
}
|
|
47
86
|
}
|
|
48
|
-
RegisterClass("
|
|
87
|
+
RegisterClass("FlowGraphSwitchBlock" /* FlowGraphBlockNames.Switch */, FlowGraphSwitchBlock);
|
|
49
88
|
//# sourceMappingURL=flowGraphSwitchBlock.js.map
|