@babylonjs/core 7.51.0 → 7.51.2
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/abstractEngine.js +2 -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/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 +107 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +130 -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/Maths/math.path.js +3 -0
- package/Maths/math.path.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -1
- package/Meshes/geometry.js +8 -3
- package/Meshes/geometry.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/sceneOptimizer.js +1 -0
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/screenshotTools.d.ts +4 -2
- package/Misc/screenshotTools.js +8 -5
- package/Misc/screenshotTools.js.map +1 -1
- package/ObjectModel/objectModelInterfaces.d.ts +2 -2
- package/ObjectModel/objectModelInterfaces.js.map +1 -1
- package/Physics/v2/characterController.d.ts +8 -0
- package/Physics/v2/characterController.js +12 -5
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/package.json +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
|
@@ -3,12 +3,15 @@ import type { FlowGraphAsyncExecutionBlock } from "./flowGraphAsyncExecutionBloc
|
|
|
3
3
|
import type { FlowGraphBlock } from "./flowGraphBlock";
|
|
4
4
|
import type { FlowGraphDataConnection } from "./flowGraphDataConnection";
|
|
5
5
|
import type { FlowGraph } from "./flowGraph";
|
|
6
|
-
import type { ISerializedFlowGraphContext } from "./typeDefinitions";
|
|
7
6
|
import type { FlowGraphCoordinator } from "./flowGraphCoordinator";
|
|
8
7
|
import { Observable } from "../Misc/observable";
|
|
8
|
+
import type { AssetType, FlowGraphAssetType } from "./flowGraphAssetsContext";
|
|
9
|
+
import type { IAssetContainer } from "../IAssetContainer.js";
|
|
10
|
+
import type { Nullable } from "../types.js";
|
|
11
|
+
import { FlowGraphLogger } from "./flowGraphLogger";
|
|
12
|
+
import type { IFlowGraphOnTickEventPayload } from "./Blocks/Event/flowGraphSceneTickEventBlock";
|
|
9
13
|
/**
|
|
10
14
|
* Construction parameters for the context.
|
|
11
|
-
* @experimental
|
|
12
15
|
*/
|
|
13
16
|
export interface IFlowGraphContextConfiguration {
|
|
14
17
|
/**
|
|
@@ -19,9 +22,13 @@ export interface IFlowGraphContextConfiguration {
|
|
|
19
22
|
* The event coordinator used by the flow graph context.
|
|
20
23
|
*/
|
|
21
24
|
readonly coordinator: FlowGraphCoordinator;
|
|
25
|
+
/**
|
|
26
|
+
* The assets context used by the flow graph context.
|
|
27
|
+
* If none is provided, a default one will be created.
|
|
28
|
+
*/
|
|
29
|
+
readonly assetsContext?: IAssetContainer;
|
|
22
30
|
}
|
|
23
31
|
/**
|
|
24
|
-
* @experimental
|
|
25
32
|
* Options for parsing a context.
|
|
26
33
|
*/
|
|
27
34
|
export interface IFlowGraphContextParseOptions {
|
|
@@ -32,14 +39,13 @@ export interface IFlowGraphContextParseOptions {
|
|
|
32
39
|
* @param scene the current scene
|
|
33
40
|
* @returns
|
|
34
41
|
*/
|
|
35
|
-
readonly valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;
|
|
42
|
+
readonly valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;
|
|
36
43
|
/**
|
|
37
44
|
* The graph that the context is being parsed in.
|
|
38
45
|
*/
|
|
39
46
|
readonly graph: FlowGraph;
|
|
40
47
|
}
|
|
41
48
|
/**
|
|
42
|
-
* @experimental
|
|
43
49
|
* The context represents the current state and execution of the flow graph.
|
|
44
50
|
* It contains both user-defined variables, which are derived from
|
|
45
51
|
* a more general variable definition, and execution variables that
|
|
@@ -58,6 +64,10 @@ export declare class FlowGraphContext {
|
|
|
58
64
|
* These are the variables set by the blocks.
|
|
59
65
|
*/
|
|
60
66
|
private _executionVariables;
|
|
67
|
+
/**
|
|
68
|
+
* A context-specific global variables, available to all blocks in the context.
|
|
69
|
+
*/
|
|
70
|
+
private _globalContextVariables;
|
|
61
71
|
/**
|
|
62
72
|
* These are the values for the data connection points
|
|
63
73
|
*/
|
|
@@ -79,6 +89,27 @@ export declare class FlowGraphContext {
|
|
|
79
89
|
* Observable that is triggered when a node is executed.
|
|
80
90
|
*/
|
|
81
91
|
onNodeExecutedObservable: Observable<FlowGraphBlock>;
|
|
92
|
+
/**
|
|
93
|
+
* The assets context used by the flow graph context.
|
|
94
|
+
* Note that it can be shared between flow graph contexts.
|
|
95
|
+
*/
|
|
96
|
+
assetsContext: IAssetContainer;
|
|
97
|
+
/**
|
|
98
|
+
* Whether to treat data as right-handed.
|
|
99
|
+
* This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing.
|
|
100
|
+
* Default is false.
|
|
101
|
+
*/
|
|
102
|
+
treatDataAsRightHanded: boolean;
|
|
103
|
+
private _enableLogging;
|
|
104
|
+
/**
|
|
105
|
+
* The logger used by the context to log actions.
|
|
106
|
+
*/
|
|
107
|
+
logger: Nullable<FlowGraphLogger>;
|
|
108
|
+
/**
|
|
109
|
+
* Enable logging on this context
|
|
110
|
+
*/
|
|
111
|
+
get enableLogging(): boolean;
|
|
112
|
+
set enableLogging(value: boolean);
|
|
82
113
|
constructor(params: IFlowGraphContextConfiguration);
|
|
83
114
|
/**
|
|
84
115
|
* Check if a user-defined variable is defined.
|
|
@@ -92,6 +123,13 @@ export declare class FlowGraphContext {
|
|
|
92
123
|
* @param value the value of the variable
|
|
93
124
|
*/
|
|
94
125
|
setVariable(name: string, value: any): void;
|
|
126
|
+
/**
|
|
127
|
+
* Get an assets from the assets context based on its type and index in the array
|
|
128
|
+
* @param type The type of the asset
|
|
129
|
+
* @param index The index of the asset
|
|
130
|
+
* @returns The asset or null if not found
|
|
131
|
+
*/
|
|
132
|
+
getAsset<T extends FlowGraphAssetType>(type: T, index: number): Nullable<AssetType<T>>;
|
|
95
133
|
/**
|
|
96
134
|
* Get a user-defined variable.
|
|
97
135
|
* @param name the name of the variable
|
|
@@ -104,7 +142,39 @@ export declare class FlowGraphContext {
|
|
|
104
142
|
get userVariables(): {
|
|
105
143
|
[key: string]: any;
|
|
106
144
|
};
|
|
145
|
+
/**
|
|
146
|
+
* Get the scene that the context belongs to.
|
|
147
|
+
* @returns the scene
|
|
148
|
+
*/
|
|
149
|
+
getScene(): Scene;
|
|
107
150
|
private _getUniqueIdPrefixedName;
|
|
151
|
+
/**
|
|
152
|
+
* @internal
|
|
153
|
+
* @param name name of the variable
|
|
154
|
+
* @param defaultValue default value to return if the variable is not defined
|
|
155
|
+
* @returns the variable value or the default value if the variable is not defined
|
|
156
|
+
*/
|
|
157
|
+
_getGlobalContextVariable<T>(name: string, defaultValue: T): T;
|
|
158
|
+
/**
|
|
159
|
+
* Set a global context variable
|
|
160
|
+
* @internal
|
|
161
|
+
* @param name the name of the variable
|
|
162
|
+
* @param value the value of the variable
|
|
163
|
+
*/
|
|
164
|
+
_setGlobalContextVariable<T>(name: string, value: T): void;
|
|
165
|
+
/**
|
|
166
|
+
* Delete a global context variable
|
|
167
|
+
* @internal
|
|
168
|
+
* @param name the name of the variable
|
|
169
|
+
*/
|
|
170
|
+
_deleteGlobalContextVariable(name: string): void;
|
|
171
|
+
/**
|
|
172
|
+
* Check if a global context variable is defined
|
|
173
|
+
* @internal
|
|
174
|
+
* @param name the name of the variable
|
|
175
|
+
* @returns true if the variable is defined
|
|
176
|
+
*/
|
|
177
|
+
_hasGlobalContextVariable(name: string): boolean;
|
|
108
178
|
/**
|
|
109
179
|
* Set an internal execution variable
|
|
110
180
|
* @internal
|
|
@@ -118,7 +188,7 @@ export declare class FlowGraphContext {
|
|
|
118
188
|
* @param name
|
|
119
189
|
* @returns
|
|
120
190
|
*/
|
|
121
|
-
_getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue
|
|
191
|
+
_getExecutionVariable<T>(block: FlowGraphBlock, name: string, defaultValue: T): T;
|
|
122
192
|
/**
|
|
123
193
|
* Delete an internal execution variable
|
|
124
194
|
* @internal
|
|
@@ -148,6 +218,13 @@ export declare class FlowGraphContext {
|
|
|
148
218
|
* @param value
|
|
149
219
|
*/
|
|
150
220
|
_setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T): void;
|
|
221
|
+
/**
|
|
222
|
+
* Set a connection value by key
|
|
223
|
+
* @internal
|
|
224
|
+
* @param key the key of the connection value
|
|
225
|
+
* @param value the value of the connection
|
|
226
|
+
*/
|
|
227
|
+
_setConnectionValueByKey<T>(key: string, value: T): void;
|
|
151
228
|
/**
|
|
152
229
|
* Get a connection value
|
|
153
230
|
* @internal
|
|
@@ -162,6 +239,11 @@ export declare class FlowGraphContext {
|
|
|
162
239
|
* @param value
|
|
163
240
|
*/
|
|
164
241
|
get configuration(): IFlowGraphContextConfiguration;
|
|
242
|
+
/**
|
|
243
|
+
* Check if there are any pending blocks in this context
|
|
244
|
+
* @returns true if there are pending blocks
|
|
245
|
+
*/
|
|
246
|
+
get hasPendingBlocks(): boolean;
|
|
165
247
|
/**
|
|
166
248
|
* Add a block to the list of blocks that have pending tasks.
|
|
167
249
|
* @internal
|
|
@@ -185,6 +267,7 @@ export declare class FlowGraphContext {
|
|
|
185
267
|
* @param node
|
|
186
268
|
*/
|
|
187
269
|
_notifyExecuteNode(node: FlowGraphBlock): void;
|
|
270
|
+
_notifyOnTick(framePayload: IFlowGraphOnTickEventPayload): void;
|
|
188
271
|
/**
|
|
189
272
|
* @internal
|
|
190
273
|
*/
|
|
@@ -204,11 +287,4 @@ export declare class FlowGraphContext {
|
|
|
204
287
|
* @returns the class name of the object.
|
|
205
288
|
*/
|
|
206
289
|
getClassName(): string;
|
|
207
|
-
/**
|
|
208
|
-
* Parses a context
|
|
209
|
-
* @param serializationObject the object containing the context serialization values
|
|
210
|
-
* @param options the options for parsing the context
|
|
211
|
-
* @returns
|
|
212
|
-
*/
|
|
213
|
-
static Parse(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions): FlowGraphContext;
|
|
214
290
|
}
|
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
import { __decorate } from "../tslib.es6.js";
|
|
2
2
|
import { serialize } from "../Misc/decorators.js";
|
|
3
3
|
import { RandomGUID } from "../Misc/guid.js";
|
|
4
|
-
import {
|
|
4
|
+
import { defaultValueSerializationFunction } from "./serialization.js";
|
|
5
5
|
import { Observable } from "../Misc/observable.js";
|
|
6
|
+
import { GetFlowGraphAssetWithType } from "./flowGraphAssetsContext.js";
|
|
7
|
+
import { FlowGraphLogger } from "./flowGraphLogger.js";
|
|
6
8
|
/**
|
|
7
|
-
* @experimental
|
|
8
9
|
* The context represents the current state and execution of the flow graph.
|
|
9
10
|
* It contains both user-defined variables, which are derived from
|
|
10
11
|
* a more general variable definition, and execution variables that
|
|
11
12
|
* are set by the blocks.
|
|
12
13
|
*/
|
|
13
14
|
export class FlowGraphContext {
|
|
15
|
+
/**
|
|
16
|
+
* Enable logging on this context
|
|
17
|
+
*/
|
|
18
|
+
get enableLogging() {
|
|
19
|
+
return this._enableLogging;
|
|
20
|
+
}
|
|
21
|
+
set enableLogging(value) {
|
|
22
|
+
if (this._enableLogging === value) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this._enableLogging = value;
|
|
26
|
+
if (this._enableLogging) {
|
|
27
|
+
this.logger = new FlowGraphLogger();
|
|
28
|
+
this.logger.logToConsole = true;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.logger = null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
14
34
|
constructor(params) {
|
|
15
35
|
/**
|
|
16
36
|
* A randomly generated GUID for each context.
|
|
@@ -24,6 +44,10 @@ export class FlowGraphContext {
|
|
|
24
44
|
* These are the variables set by the blocks.
|
|
25
45
|
*/
|
|
26
46
|
this._executionVariables = {};
|
|
47
|
+
/**
|
|
48
|
+
* A context-specific global variables, available to all blocks in the context.
|
|
49
|
+
*/
|
|
50
|
+
this._globalContextVariables = {};
|
|
27
51
|
/**
|
|
28
52
|
* These are the values for the data connection points
|
|
29
53
|
*/
|
|
@@ -41,7 +65,15 @@ export class FlowGraphContext {
|
|
|
41
65
|
* Observable that is triggered when a node is executed.
|
|
42
66
|
*/
|
|
43
67
|
this.onNodeExecutedObservable = new Observable();
|
|
68
|
+
/**
|
|
69
|
+
* Whether to treat data as right-handed.
|
|
70
|
+
* This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing.
|
|
71
|
+
* Default is false.
|
|
72
|
+
*/
|
|
73
|
+
this.treatDataAsRightHanded = false;
|
|
74
|
+
this._enableLogging = false;
|
|
44
75
|
this._configuration = params;
|
|
76
|
+
this.assetsContext = params.assetsContext ?? params.scene;
|
|
45
77
|
}
|
|
46
78
|
/**
|
|
47
79
|
* Check if a user-defined variable is defined.
|
|
@@ -58,6 +90,25 @@ export class FlowGraphContext {
|
|
|
58
90
|
*/
|
|
59
91
|
setVariable(name, value) {
|
|
60
92
|
this._userVariables[name] = value;
|
|
93
|
+
this.logger?.addLogItem({
|
|
94
|
+
time: Date.now(),
|
|
95
|
+
className: this.getClassName(),
|
|
96
|
+
uniqueId: this.uniqueId,
|
|
97
|
+
action: "ContextVariableSet" /* FlowGraphAction.ContextVariableSet */,
|
|
98
|
+
payload: {
|
|
99
|
+
name,
|
|
100
|
+
value,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get an assets from the assets context based on its type and index in the array
|
|
106
|
+
* @param type The type of the asset
|
|
107
|
+
* @param index The index of the asset
|
|
108
|
+
* @returns The asset or null if not found
|
|
109
|
+
*/
|
|
110
|
+
getAsset(type, index) {
|
|
111
|
+
return GetFlowGraphAssetWithType(this.assetsContext, type, index);
|
|
61
112
|
}
|
|
62
113
|
/**
|
|
63
114
|
* Get a user-defined variable.
|
|
@@ -65,6 +116,16 @@ export class FlowGraphContext {
|
|
|
65
116
|
* @returns the value of the variable
|
|
66
117
|
*/
|
|
67
118
|
getVariable(name) {
|
|
119
|
+
this.logger?.addLogItem({
|
|
120
|
+
time: Date.now(),
|
|
121
|
+
className: this.getClassName(),
|
|
122
|
+
uniqueId: this.uniqueId,
|
|
123
|
+
action: "ContextVariableGet" /* FlowGraphAction.ContextVariableGet */,
|
|
124
|
+
payload: {
|
|
125
|
+
name,
|
|
126
|
+
value: this._userVariables[name],
|
|
127
|
+
},
|
|
128
|
+
});
|
|
68
129
|
return this._userVariables[name];
|
|
69
130
|
}
|
|
70
131
|
/**
|
|
@@ -73,9 +134,81 @@ export class FlowGraphContext {
|
|
|
73
134
|
get userVariables() {
|
|
74
135
|
return this._userVariables;
|
|
75
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Get the scene that the context belongs to.
|
|
139
|
+
* @returns the scene
|
|
140
|
+
*/
|
|
141
|
+
getScene() {
|
|
142
|
+
return this._configuration.scene;
|
|
143
|
+
}
|
|
76
144
|
_getUniqueIdPrefixedName(obj, name) {
|
|
77
145
|
return `${obj.uniqueId}_${name}`;
|
|
78
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* @internal
|
|
149
|
+
* @param name name of the variable
|
|
150
|
+
* @param defaultValue default value to return if the variable is not defined
|
|
151
|
+
* @returns the variable value or the default value if the variable is not defined
|
|
152
|
+
*/
|
|
153
|
+
_getGlobalContextVariable(name, defaultValue) {
|
|
154
|
+
this.logger?.addLogItem({
|
|
155
|
+
time: Date.now(),
|
|
156
|
+
className: this.getClassName(),
|
|
157
|
+
uniqueId: this.uniqueId,
|
|
158
|
+
action: "GlobalVariableGet" /* FlowGraphAction.GlobalVariableGet */,
|
|
159
|
+
payload: {
|
|
160
|
+
name,
|
|
161
|
+
defaultValue,
|
|
162
|
+
possibleValue: this._globalContextVariables[name],
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
if (this._hasGlobalContextVariable(name)) {
|
|
166
|
+
return this._globalContextVariables[name];
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
return defaultValue;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Set a global context variable
|
|
174
|
+
* @internal
|
|
175
|
+
* @param name the name of the variable
|
|
176
|
+
* @param value the value of the variable
|
|
177
|
+
*/
|
|
178
|
+
_setGlobalContextVariable(name, value) {
|
|
179
|
+
this.logger?.addLogItem({
|
|
180
|
+
time: Date.now(),
|
|
181
|
+
className: this.getClassName(),
|
|
182
|
+
uniqueId: this.uniqueId,
|
|
183
|
+
action: "GlobalVariableSet" /* FlowGraphAction.GlobalVariableSet */,
|
|
184
|
+
payload: { name, value },
|
|
185
|
+
});
|
|
186
|
+
this._globalContextVariables[name] = value;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Delete a global context variable
|
|
190
|
+
* @internal
|
|
191
|
+
* @param name the name of the variable
|
|
192
|
+
*/
|
|
193
|
+
_deleteGlobalContextVariable(name) {
|
|
194
|
+
this.logger?.addLogItem({
|
|
195
|
+
time: Date.now(),
|
|
196
|
+
className: this.getClassName(),
|
|
197
|
+
uniqueId: this.uniqueId,
|
|
198
|
+
action: "GlobalVariableDelete" /* FlowGraphAction.GlobalVariableDelete */,
|
|
199
|
+
payload: { name },
|
|
200
|
+
});
|
|
201
|
+
delete this._globalContextVariables[name];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Check if a global context variable is defined
|
|
205
|
+
* @internal
|
|
206
|
+
* @param name the name of the variable
|
|
207
|
+
* @returns true if the variable is defined
|
|
208
|
+
*/
|
|
209
|
+
_hasGlobalContextVariable(name) {
|
|
210
|
+
return name in this._globalContextVariables;
|
|
211
|
+
}
|
|
79
212
|
/**
|
|
80
213
|
* Set an internal execution variable
|
|
81
214
|
* @internal
|
|
@@ -135,6 +268,25 @@ export class FlowGraphContext {
|
|
|
135
268
|
*/
|
|
136
269
|
_setConnectionValue(connectionPoint, value) {
|
|
137
270
|
this._connectionValues[connectionPoint.uniqueId] = value;
|
|
271
|
+
this.logger?.addLogItem({
|
|
272
|
+
time: Date.now(),
|
|
273
|
+
className: this.getClassName(),
|
|
274
|
+
uniqueId: this.uniqueId,
|
|
275
|
+
action: "SetConnectionValue" /* FlowGraphAction.SetConnectionValue */,
|
|
276
|
+
payload: {
|
|
277
|
+
connectionPointId: connectionPoint.uniqueId,
|
|
278
|
+
value,
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Set a connection value by key
|
|
284
|
+
* @internal
|
|
285
|
+
* @param key the key of the connection value
|
|
286
|
+
* @param value the value of the connection
|
|
287
|
+
*/
|
|
288
|
+
_setConnectionValueByKey(key, value) {
|
|
289
|
+
this._connectionValues[key] = value;
|
|
138
290
|
}
|
|
139
291
|
/**
|
|
140
292
|
* Get a connection value
|
|
@@ -143,6 +295,16 @@ export class FlowGraphContext {
|
|
|
143
295
|
* @returns
|
|
144
296
|
*/
|
|
145
297
|
_getConnectionValue(connectionPoint) {
|
|
298
|
+
this.logger?.addLogItem({
|
|
299
|
+
time: Date.now(),
|
|
300
|
+
className: this.getClassName(),
|
|
301
|
+
uniqueId: this.uniqueId,
|
|
302
|
+
action: "GetConnectionValue" /* FlowGraphAction.GetConnectionValue */,
|
|
303
|
+
payload: {
|
|
304
|
+
connectionPointId: connectionPoint.uniqueId,
|
|
305
|
+
value: this._connectionValues[connectionPoint.uniqueId],
|
|
306
|
+
},
|
|
307
|
+
});
|
|
146
308
|
return this._connectionValues[connectionPoint.uniqueId];
|
|
147
309
|
}
|
|
148
310
|
/**
|
|
@@ -154,13 +316,26 @@ export class FlowGraphContext {
|
|
|
154
316
|
get configuration() {
|
|
155
317
|
return this._configuration;
|
|
156
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Check if there are any pending blocks in this context
|
|
321
|
+
* @returns true if there are pending blocks
|
|
322
|
+
*/
|
|
323
|
+
get hasPendingBlocks() {
|
|
324
|
+
return this._pendingBlocks.length > 0;
|
|
325
|
+
}
|
|
157
326
|
/**
|
|
158
327
|
* Add a block to the list of blocks that have pending tasks.
|
|
159
328
|
* @internal
|
|
160
329
|
* @param block
|
|
161
330
|
*/
|
|
162
331
|
_addPendingBlock(block) {
|
|
332
|
+
// check if block is already in the array
|
|
333
|
+
if (this._pendingBlocks.includes(block)) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
163
336
|
this._pendingBlocks.push(block);
|
|
337
|
+
// sort pending blocks by priority
|
|
338
|
+
this._pendingBlocks.sort((a, b) => a.priority - b.priority);
|
|
164
339
|
}
|
|
165
340
|
/**
|
|
166
341
|
* Remove a block from the list of blocks that have pending tasks.
|
|
@@ -190,6 +365,21 @@ export class FlowGraphContext {
|
|
|
190
365
|
*/
|
|
191
366
|
_notifyExecuteNode(node) {
|
|
192
367
|
this.onNodeExecutedObservable.notifyObservers(node);
|
|
368
|
+
this.logger?.addLogItem({
|
|
369
|
+
time: Date.now(),
|
|
370
|
+
className: node.getClassName(),
|
|
371
|
+
uniqueId: node.uniqueId,
|
|
372
|
+
action: "ExecuteBlock" /* FlowGraphAction.ExecuteBlock */,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
_notifyOnTick(framePayload) {
|
|
376
|
+
// set the values as global variables
|
|
377
|
+
this._setGlobalContextVariable("timeSinceStart", framePayload.timeSinceStart);
|
|
378
|
+
this._setGlobalContextVariable("deltaTime", framePayload.deltaTime);
|
|
379
|
+
// iterate the pending blocks and run each one's onFrame function
|
|
380
|
+
for (const block of this._pendingBlocks) {
|
|
381
|
+
block._executeOnTick?.(this);
|
|
382
|
+
}
|
|
193
383
|
}
|
|
194
384
|
/**
|
|
195
385
|
* @internal
|
|
@@ -219,32 +409,29 @@ export class FlowGraphContext {
|
|
|
219
409
|
for (const key in this._connectionValues) {
|
|
220
410
|
valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);
|
|
221
411
|
}
|
|
412
|
+
// serialize assets context, if not scene
|
|
413
|
+
if (this.assetsContext !== this.getScene()) {
|
|
414
|
+
serializationObject._assetsContext = {
|
|
415
|
+
meshes: this.assetsContext.meshes.map((m) => m.id),
|
|
416
|
+
materials: this.assetsContext.materials.map((m) => m.id),
|
|
417
|
+
textures: this.assetsContext.textures.map((m) => m.name),
|
|
418
|
+
animations: this.assetsContext.animations.map((m) => m.name),
|
|
419
|
+
lights: this.assetsContext.lights.map((m) => m.id),
|
|
420
|
+
cameras: this.assetsContext.cameras.map((m) => m.id),
|
|
421
|
+
sounds: this.assetsContext.sounds?.map((m) => m.name),
|
|
422
|
+
skeletons: this.assetsContext.skeletons.map((m) => m.id),
|
|
423
|
+
particleSystems: this.assetsContext.particleSystems.map((m) => m.name),
|
|
424
|
+
geometries: this.assetsContext.geometries.map((m) => m.id),
|
|
425
|
+
multiMaterials: this.assetsContext.multiMaterials.map((m) => m.id),
|
|
426
|
+
transformNodes: this.assetsContext.transformNodes.map((m) => m.id),
|
|
427
|
+
};
|
|
428
|
+
}
|
|
222
429
|
}
|
|
223
430
|
/**
|
|
224
431
|
* @returns the class name of the object.
|
|
225
432
|
*/
|
|
226
433
|
getClassName() {
|
|
227
|
-
return "
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Parses a context
|
|
231
|
-
* @param serializationObject the object containing the context serialization values
|
|
232
|
-
* @param options the options for parsing the context
|
|
233
|
-
* @returns
|
|
234
|
-
*/
|
|
235
|
-
static Parse(serializationObject, options) {
|
|
236
|
-
const result = options.graph.createContext();
|
|
237
|
-
const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;
|
|
238
|
-
result.uniqueId = serializationObject.uniqueId;
|
|
239
|
-
for (const key in serializationObject._userVariables) {
|
|
240
|
-
const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);
|
|
241
|
-
result._userVariables[key] = value;
|
|
242
|
-
}
|
|
243
|
-
for (const key in serializationObject._connectionValues) {
|
|
244
|
-
const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);
|
|
245
|
-
result._connectionValues[key] = value;
|
|
246
|
-
}
|
|
247
|
-
return result;
|
|
434
|
+
return "FlowGraphContext";
|
|
248
435
|
}
|
|
249
436
|
}
|
|
250
437
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EAAE,yBAAyB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAmChD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAoCzB,YAAY,MAAsC;QAnClD;;WAEG;QAEI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAC/B;;WAEG;QACK,mBAAc,GAA2B,EAAE,CAAC;QACpD;;WAEG;QACK,wBAAmB,GAA2B,EAAE,CAAC;QACzD;;WAEG;QACK,sBAAiB,GAA2B,EAAE,CAAC;QAKvD;;WAEG;QACK,mBAAc,GAAmC,E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AyB,CAAC;QACnF,MAAM,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAC/C,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,cAAc,EAAE,CAAC;YACnD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACvG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACvC,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;YACtD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC1G,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC1C,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAlQU;IADN,SAAS,EAAE;kDACmB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\nimport type { ISerializedFlowGraphContext } from \"./typeDefinitions\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction } from \"./serialization\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Options for parsing a context.\r\n */\r\nexport interface IFlowGraphContextParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the value\r\n * @param serializationObject the object containing the value\r\n * @param scene the current scene\r\n * @returns\r\n */\r\n readonly valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;\r\n /**\r\n * The graph that the context is being parsed in.\r\n */\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name the name of the variable\r\n * @returns the value of the variable\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name of the object.\r\n */\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param options the options for parsing the context\r\n * @returns\r\n */\r\n public static Parse(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions): FlowGraphContext {\r\n const result = options.graph.createContext();\r\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables[key] = value;\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues[key] = value;\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,EAAmB,eAAe,EAAE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CAAC;QACN,CAAC;IACL,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,kBAAkB,CAAC;IAC9B,CAAC;CACJ;AAjdU;IADN,SAAS,EAAE;kDACmB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { AssetType, FlowGraphAssetType } from \"./flowGraphAssetsContext\";\r\nimport { GetFlowGraphAssetWithType } from \"./flowGraphAssetsContext\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { FlowGraphAction, FlowGraphLogger } from \"./flowGraphLogger\";\r\nimport type { IFlowGraphOnTickEventPayload } from \"./Blocks/Event/flowGraphSceneTickEventBlock\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * If none is provided, a default one will be created.\r\n */\r\n readonly assetsContext?: IAssetContainer;\r\n}\r\n\r\n/**\r\n * Options for parsing a context.\r\n */\r\nexport interface IFlowGraphContextParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the value\r\n * @param serializationObject the object containing the value\r\n * @param scene the current scene\r\n * @returns\r\n */\r\n readonly valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The graph that the context is being parsed in.\r\n */\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n\r\n /**\r\n * A context-specific global variables, available to all blocks in the context.\r\n */\r\n private _globalContextVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * Note that it can be shared between flow graph contexts.\r\n */\r\n public assetsContext: IAssetContainer;\r\n\r\n /**\r\n * Whether to treat data as right-handed.\r\n * This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing.\r\n * Default is false.\r\n */\r\n public treatDataAsRightHanded = false;\r\n\r\n private _enableLogging = false;\r\n\r\n /**\r\n * The logger used by the context to log actions.\r\n */\r\n public logger: Nullable<FlowGraphLogger>;\r\n\r\n /**\r\n * Enable logging on this context\r\n */\r\n public get enableLogging() {\r\n return this._enableLogging;\r\n }\r\n\r\n public set enableLogging(value: boolean) {\r\n if (this._enableLogging === value) {\r\n return;\r\n }\r\n this._enableLogging = value;\r\n if (this._enableLogging) {\r\n this.logger = new FlowGraphLogger();\r\n this.logger.logToConsole = true;\r\n } else {\r\n this.logger = null;\r\n }\r\n }\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n this.assetsContext = params.assetsContext ?? params.scene;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableSet,\r\n payload: {\r\n name,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Get an assets from the assets context based on its type and index in the array\r\n * @param type The type of the asset\r\n * @param index The index of the asset\r\n * @returns The asset or null if not found\r\n */\r\n public getAsset<T extends FlowGraphAssetType>(type: T, index: number): Nullable<AssetType<T>> {\r\n return GetFlowGraphAssetWithType(this.assetsContext, type, index);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name the name of the variable\r\n * @returns the value of the variable\r\n */\r\n public getVariable(name: string): any {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableGet,\r\n payload: {\r\n name,\r\n value: this._userVariables[name],\r\n },\r\n });\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n /**\r\n * Get the scene that the context belongs to.\r\n * @returns the scene\r\n */\r\n public getScene() {\r\n return this._configuration.scene;\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param name name of the variable\r\n * @param defaultValue default value to return if the variable is not defined\r\n * @returns the variable value or the default value if the variable is not defined\r\n */\r\n public _getGlobalContextVariable<T>(name: string, defaultValue: T): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableGet,\r\n payload: {\r\n name,\r\n defaultValue,\r\n possibleValue: this._globalContextVariables[name],\r\n },\r\n });\r\n if (this._hasGlobalContextVariable(name)) {\r\n return this._globalContextVariables[name];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Set a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public _setGlobalContextVariable<T>(name: string, value: T) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableSet,\r\n payload: { name, value },\r\n });\r\n this._globalContextVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Delete a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n */\r\n public _deleteGlobalContextVariable(name: string) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableDelete,\r\n payload: { name },\r\n });\r\n delete this._globalContextVariables[name];\r\n }\r\n\r\n /**\r\n * Check if a global context variable is defined\r\n * @internal\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public _hasGlobalContextVariable(name: string) {\r\n return name in this._globalContextVariables;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable<T>(block: FlowGraphBlock, name: string, defaultValue: T): T {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.SetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Set a connection value by key\r\n * @internal\r\n * @param key the key of the connection value\r\n * @param value the value of the connection\r\n */\r\n public _setConnectionValueByKey<T>(key: string, value: T) {\r\n this._connectionValues[key] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value: this._connectionValues[connectionPoint.uniqueId],\r\n },\r\n });\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Check if there are any pending blocks in this context\r\n * @returns true if there are pending blocks\r\n */\r\n public get hasPendingBlocks() {\r\n return this._pendingBlocks.length > 0;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n // check if block is already in the array\r\n if (this._pendingBlocks.includes(block)) {\r\n return;\r\n }\r\n this._pendingBlocks.push(block);\r\n // sort pending blocks by priority\r\n this._pendingBlocks.sort((a, b) => a.priority - b.priority);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: node.getClassName(),\r\n uniqueId: node.uniqueId,\r\n action: FlowGraphAction.ExecuteBlock,\r\n });\r\n }\r\n\r\n public _notifyOnTick(framePayload: IFlowGraphOnTickEventPayload) {\r\n // set the values as global variables\r\n this._setGlobalContextVariable(\"timeSinceStart\", framePayload.timeSinceStart);\r\n this._setGlobalContextVariable(\"deltaTime\", framePayload.deltaTime);\r\n // iterate the pending blocks and run each one's onFrame function\r\n for (const block of this._pendingBlocks) {\r\n block._executeOnTick?.(this);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n // serialize assets context, if not scene\r\n if (this.assetsContext !== this.getScene()) {\r\n serializationObject._assetsContext = {\r\n meshes: this.assetsContext.meshes.map((m) => m.id),\r\n materials: this.assetsContext.materials.map((m) => m.id),\r\n textures: this.assetsContext.textures.map((m) => m.name),\r\n animations: this.assetsContext.animations.map((m) => m.name),\r\n lights: this.assetsContext.lights.map((m) => m.id),\r\n cameras: this.assetsContext.cameras.map((m) => m.id),\r\n sounds: this.assetsContext.sounds?.map((m) => m.name),\r\n skeletons: this.assetsContext.skeletons.map((m) => m.id),\r\n particleSystems: this.assetsContext.particleSystems.map((m) => m.name),\r\n geometries: this.assetsContext.geometries.map((m) => m.id),\r\n multiMaterials: this.assetsContext.multiMaterials.map((m) => m.id),\r\n transformNodes: this.assetsContext.transformNodes.map((m) => m.id),\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name of the object.\r\n */\r\n public getClassName() {\r\n return \"FlowGraphContext\";\r\n }\r\n}\r\n"]}
|
|
@@ -3,8 +3,8 @@ import type { Scene } from "../scene";
|
|
|
3
3
|
import { FlowGraph } from "./flowGraph";
|
|
4
4
|
import type { IPathToObjectConverter } from "../ObjectModel/objectModelInterfaces";
|
|
5
5
|
import type { IObjectAccessor } from "./typeDefinitions";
|
|
6
|
+
import type { IAssetContainer } from "../IAssetContainer.js";
|
|
6
7
|
/**
|
|
7
|
-
* @experimental
|
|
8
8
|
* Parameters used to create a flow graph engine.
|
|
9
9
|
*/
|
|
10
10
|
export interface IFlowGraphCoordinatorConfiguration {
|
|
@@ -14,7 +14,6 @@ export interface IFlowGraphCoordinatorConfiguration {
|
|
|
14
14
|
scene: Scene;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* @experimental
|
|
18
17
|
* Parameters used to parse a flow graph coordinator.
|
|
19
18
|
*/
|
|
20
19
|
export interface FlowGraphCoordinatorParseOptions {
|
|
@@ -24,7 +23,7 @@ export interface FlowGraphCoordinatorParseOptions {
|
|
|
24
23
|
* @param serializationObject the serialization object where the property is located
|
|
25
24
|
* @param scene the scene that the block is being parsed in
|
|
26
25
|
*/
|
|
27
|
-
valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;
|
|
26
|
+
valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;
|
|
28
27
|
/**
|
|
29
28
|
* The path converter to use to convert the path to an object accessor.
|
|
30
29
|
*/
|
|
@@ -37,6 +36,8 @@ export interface FlowGraphCoordinatorParseOptions {
|
|
|
37
36
|
/**
|
|
38
37
|
* This class holds all of the existing flow graphs and is responsible for creating new ones.
|
|
39
38
|
* It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator
|
|
39
|
+
* This is the entry point for the flow graph system.
|
|
40
|
+
* @experimental This class is still in development and is subject to change.
|
|
40
41
|
*/
|
|
41
42
|
export declare class FlowGraphCoordinator {
|
|
42
43
|
/**
|
|
@@ -79,13 +80,6 @@ export declare class FlowGraphCoordinator {
|
|
|
79
80
|
* @param valueSerializeFunction the function to use to serialize the value
|
|
80
81
|
*/
|
|
81
82
|
serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void): void;
|
|
82
|
-
/**
|
|
83
|
-
* Parses a serialized coordinator.
|
|
84
|
-
* @param serializedObject the object to parse
|
|
85
|
-
* @param options the options to use when parsing
|
|
86
|
-
* @returns the parsed coordinator
|
|
87
|
-
*/
|
|
88
|
-
static Parse(serializedObject: any, options: FlowGraphCoordinatorParseOptions): FlowGraphCoordinator;
|
|
89
83
|
/**
|
|
90
84
|
* Gets the list of flow graphs
|
|
91
85
|
*/
|