@babylonjs/core 6.38.1 → 6.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Actions/action.js +3 -1
- package/Actions/action.js.map +1 -1
- package/Actions/condition.js +1 -0
- package/Actions/condition.js.map +1 -1
- package/Actions/directActions.d.ts +2 -2
- package/Actions/directActions.js +2 -2
- package/Actions/directActions.js.map +1 -1
- package/Animations/pathCursor.js +1 -0
- package/Animations/pathCursor.js.map +1 -1
- package/Animations/runtimeAnimation.js +1 -1
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioEngine.js +5 -0
- package/Audio/audioEngine.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.d.ts +3 -0
- package/Behaviors/Cameras/autoRotationBehavior.js +3 -0
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.d.ts +1 -0
- package/Behaviors/Meshes/pointerDragBehavior.js +2 -0
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +14 -20
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Bones/bone.d.ts +2 -0
- package/Bones/bone.js +2 -0
- package/Bones/bone.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.d.ts +11 -11
- package/Cameras/Inputs/BaseCameraPointersInput.js +12 -12
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +9 -9
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -9
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.d.ts +3 -0
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js +3 -0
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.d.ts +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +2 -2
- package/Cameras/VR/vrExperienceHelper.js +2 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +2 -0
- package/Cameras/arcRotateCamera.js +2 -0
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +2 -0
- package/Cameras/camera.js +4 -0
- package/Cameras/camera.js.map +1 -1
- package/Cameras/followCamera.d.ts +1 -0
- package/Cameras/followCamera.js +1 -0
- package/Cameras/followCamera.js.map +1 -1
- package/Culling/Octrees/octree.d.ts +4 -4
- package/Culling/Octrees/octree.js +4 -4
- package/Culling/Octrees/octree.js.map +1 -1
- package/Debug/debugLayer.d.ts +4 -1
- package/Debug/debugLayer.js +4 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/physicsViewer.d.ts +6 -1
- package/Debug/physicsViewer.js +6 -1
- package/Debug/physicsViewer.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +5 -4
- package/Decorators/nodeDecorator.js +5 -4
- package/Decorators/nodeDecorator.js.map +1 -1
- package/DeviceInput/eventFactory.d.ts +2 -0
- package/DeviceInput/eventFactory.js +3 -0
- package/DeviceInput/eventFactory.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +3 -0
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.multiview.js +2 -0
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Native/nativeDataStream.d.ts +32 -0
- package/Engines/Native/nativeDataStream.js +32 -0
- package/Engines/Native/nativeDataStream.js.map +1 -1
- package/Engines/Native/nativePipelineContext.d.ts +0 -3
- package/Engines/Native/nativePipelineContext.js +0 -3
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.js +2 -0
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGL/webGLHardwareTexture.js +1 -0
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/WebGL/webGLPipelineContext.d.ts +0 -3
- package/Engines/WebGL/webGLPipelineContext.js +0 -3
- package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.readTexture.js +1 -0
- package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.d.ts +1 -0
- package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -0
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.d.ts +0 -3
- package/Engines/WebGPU/webgpuPipelineContext.js +0 -3
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +1 -0
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +11 -2
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +22 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -1
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.d.ts +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js +5 -5
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/engine.d.ts +1 -0
- package/Engines/engine.js +1 -0
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +4 -0
- package/Engines/nativeEngine.js +5 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.js +7 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -1
- package/Engines/webgpuEngine.js +17 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +214 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +214 -6
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +15 -0
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +9 -0
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +6 -6
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +4 -0
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +4 -0
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +17 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +14 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +9 -0
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +9 -0
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +5 -0
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +5 -0
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +16 -1
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +13 -1
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +12 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +12 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +18 -0
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +9 -0
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +12 -0
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +9 -0
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +15 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +18 -2
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +15 -4
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +6 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +6 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +6 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +5 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +4 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +15 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +12 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +4 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +3 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +14 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +15 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +12 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +14 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +11 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +15 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +12 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +3 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +6 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +6 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +15 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +12 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +18 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +15 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +6 -0
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +6 -0
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +14 -2
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +11 -4
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +15 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +12 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +14 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +11 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +16 -8
- package/FlowGraph/flowGraph.js +13 -8
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +54 -5
- package/FlowGraph/flowGraphBlock.js +50 -11
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +10 -6
- package/FlowGraph/flowGraphConnection.js +10 -6
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +10 -8
- package/FlowGraph/flowGraphContext.js +10 -8
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +27 -1
- package/FlowGraph/flowGraphCoordinator.js +18 -2
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.d.ts +26 -1
- package/FlowGraph/flowGraphDataConnection.js +23 -1
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.d.ts +27 -1
- package/FlowGraph/flowGraphExecutionBlock.js +22 -4
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +24 -1
- package/FlowGraph/flowGraphRichTypes.js +18 -1
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.d.ts +2 -0
- package/FlowGraph/flowGraphSignalConnection.js +2 -0
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/Gamepads/gamepad.d.ts +2 -2
- package/Gamepads/gamepad.js +2 -2
- package/Gamepads/gamepad.js.map +1 -1
- package/Gamepads/gamepadSceneComponent.js +2 -0
- package/Gamepads/gamepadSceneComponent.js.map +1 -1
- package/Gizmos/axisScaleGizmo.d.ts +2 -0
- package/Gizmos/axisScaleGizmo.js +2 -0
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +19 -0
- package/Gizmos/boundingBoxGizmo.js +36 -15
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.js +1 -0
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/gizmo.d.ts +4 -1
- package/Gizmos/gizmo.js +1 -0
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.d.ts +18 -0
- package/Gizmos/gizmoManager.js +34 -0
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/lightGizmo.d.ts +1 -0
- package/Gizmos/lightGizmo.js +1 -0
- package/Gizmos/lightGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.d.ts +2 -0
- package/Gizmos/planeRotationGizmo.js +2 -0
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +11 -0
- package/Gizmos/positionGizmo.js +19 -0
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +14 -0
- package/Gizmos/rotationGizmo.js +14 -0
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +18 -1
- package/Gizmos/scaleGizmo.js +19 -1
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Helpers/environmentHelper.d.ts +4 -2
- package/Helpers/environmentHelper.js +4 -2
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -0
- package/Layers/effectLayer.js +1 -0
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +3 -1
- package/Layers/glowLayer.js +3 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +3 -2
- package/Layers/highlightLayer.js +3 -2
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/light.d.ts +1 -1
- package/Lights/light.js +1 -1
- package/Lights/light.js.map +1 -1
- package/Loading/sceneLoader.d.ts +9 -0
- package/Loading/sceneLoader.js +11 -0
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.d.ts +2 -2
- package/Materials/Background/backgroundMaterial.js +2 -2
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +72 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +230 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +2 -2
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +2 -2
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +0 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +0 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/index.d.ts +1 -0
- package/Materials/Node/Blocks/Dual/index.js +1 -0
- package/Materials/Node/Blocks/Dual/index.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +7 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +6 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -0
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -0
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -0
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +3 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +3 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -0
- package/Materials/Node/Blocks/triPlanarBlock.js +1 -0
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +2 -0
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +2 -0
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +11 -3
- package/Materials/Node/nodeMaterial.js +15 -3
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +3 -1
- package/Materials/Node/nodeMaterialBlock.js +4 -1
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -0
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.js +1 -0
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +10 -9
- package/Materials/PBR/pbrBaseMaterial.js +10 -9
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +2 -1
- package/Materials/PBR/pbrMaterial.js +3 -2
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +7 -4
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js +7 -4
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +7 -4
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js +7 -4
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/envTextureLoader.js +1 -0
- package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/hdrTextureLoader.js +1 -0
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/tgaTextureLoader.js +1 -0
- package/Materials/Textures/Loaders/tgaTextureLoader.js.map +1 -1
- package/Materials/Textures/Packer/packer.d.ts +0 -1
- package/Materials/Textures/Packer/packer.js +0 -1
- package/Materials/Textures/Packer/packer.js.map +1 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.d.ts +1 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js +1 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.js +3 -0
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.d.ts +4 -1
- package/Materials/Textures/colorGradingTexture.js +4 -1
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.d.ts +1 -0
- package/Materials/Textures/equiRectangularCubeTexture.js +1 -0
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.d.ts +3 -2
- package/Materials/Textures/hdrCubeTexture.js +3 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +1 -1
- package/Materials/Textures/htmlElementTexture.js +1 -1
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +1 -1
- package/Materials/Textures/multiRenderTarget.js +1 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/texture.d.ts +4 -1
- package/Materials/Textures/texture.js +4 -1
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinRenderTargetTexture.d.ts +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
- package/Materials/Textures/thinTexture.js +3 -0
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/material.d.ts +2 -1
- package/Materials/material.decalMapConfiguration.d.ts +0 -5
- package/Materials/material.decalMapConfiguration.js +5 -5
- package/Materials/material.decalMapConfiguration.js.map +1 -1
- package/Materials/material.js +3 -2
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.d.ts +1 -1
- package/Materials/materialHelper.js +4 -3
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginManager.js +1 -0
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/standardMaterial.d.ts +2 -2
- package/Materials/standardMaterial.js +3 -3
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.js +2 -1
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.like.d.ts +3 -0
- package/Maths/math.like.js.map +1 -1
- package/Maths/math.path.d.ts +2 -1
- package/Maths/math.path.js +2 -1
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.polar.d.ts +3 -2
- package/Maths/math.polar.js +8 -2
- package/Maths/math.polar.js.map +1 -1
- package/Maths/math.vector.d.ts +12 -5
- package/Maths/math.vector.js +12 -5
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/hemisphereBuilder.js +1 -0
- package/Meshes/Builders/hemisphereBuilder.js.map +1 -1
- package/Meshes/Builders/textBuilder.d.ts +26 -5
- package/Meshes/Builders/textBuilder.js +26 -5
- package/Meshes/Builders/textBuilder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +84 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +288 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +2 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +2 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +2 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +9 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +92 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js +292 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -0
- package/Meshes/Node/Blocks/noiseBlock.d.ts +5 -3
- package/Meshes/Node/Blocks/noiseBlock.js +5 -3
- package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +6 -2
- package/Meshes/Node/nodeGeometry.js +7 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +1 -0
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +1 -0
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -0
- package/Meshes/abstractMesh.js +3 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.d.ts +7 -1
- package/Meshes/csg.js +9 -1
- package/Meshes/csg.js.map +1 -1
- package/Meshes/geodesicMesh.d.ts +32 -1
- package/Meshes/geodesicMesh.js +17 -1
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +34 -17
- package/Meshes/instancedMesh.js +34 -17
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/linesMesh.d.ts +6 -5
- package/Meshes/linesMesh.js +6 -5
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +1 -0
- package/Meshes/mesh.js +1 -0
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +0 -145
- package/Meshes/mesh.vertexData.js +0 -145
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/transformNode.d.ts +1 -1
- package/Meshes/transformNode.js +19 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +1 -0
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -0
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.d.ts +1 -0
- package/Misc/HighDynamicRange/hdr.js +8 -0
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -0
- package/Misc/HighDynamicRange/panoramaToCubemap.js +3 -0
- package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
- package/Misc/assetsManager.d.ts +3 -0
- package/Misc/assetsManager.js +3 -0
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +1 -0
- package/Misc/basis.js.map +1 -1
- package/Misc/decorators.d.ts +2 -0
- package/Misc/decorators.js +3 -1
- package/Misc/decorators.js.map +1 -1
- package/Misc/fileTools.js +2 -0
- package/Misc/fileTools.js.map +1 -1
- package/Misc/filesInput.d.ts +7 -2
- package/Misc/filesInput.js +7 -2
- package/Misc/filesInput.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +6 -1
- package/Misc/greasedLineTools.js +6 -1
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/textureTools.d.ts +2 -0
- package/Misc/textureTools.js +2 -0
- package/Misc/textureTools.js.map +1 -1
- package/Misc/timer.d.ts +2 -1
- package/Misc/timer.js +1 -0
- package/Misc/timer.js.map +1 -1
- package/Misc/tools.d.ts +5 -1
- package/Misc/tools.js +9 -1
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.d.ts +4 -1
- package/Misc/videoRecorder.js +11 -5
- package/Misc/videoRecorder.js.map +1 -1
- package/Misc/webRequest.d.ts +3 -0
- package/Misc/webRequest.js +4 -1
- package/Misc/webRequest.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +11 -0
- package/Morph/morphTargetManager.js +22 -2
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/EmitterTypes/customParticleEmitter.js +10 -2
- package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/cylinderParticleEmitter.d.ts +3 -1
- package/Particles/EmitterTypes/cylinderParticleEmitter.js +7 -1
- package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +2 -2
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.js +1 -0
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +1 -2
- package/Particles/particleSystem.js +5 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +1 -1
- package/Particles/solidParticleSystem.js +1 -1
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Physics/physicsHelper.d.ts +3 -2
- package/Physics/physicsHelper.js +5 -4
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/physicsRaycastResult.d.ts +2 -1
- package/Physics/physicsRaycastResult.js +2 -1
- package/Physics/physicsRaycastResult.js.map +1 -1
- package/Physics/v1/Plugins/ammoJSPlugin.d.ts +5 -0
- package/Physics/v1/Plugins/ammoJSPlugin.js +6 -0
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/v1/physicsEngine.d.ts +2 -0
- package/Physics/v1/physicsEngine.js +2 -0
- package/Physics/v1/physicsEngine.js.map +1 -1
- package/Physics/v1/physicsImpostor.d.ts +2 -3
- package/Physics/v1/physicsImpostor.js +2 -3
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +61 -10
- package/Physics/v2/Plugins/havokPlugin.js +89 -10
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +41 -3
- package/Physics/v2/physicsBody.js +42 -9
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.d.ts +0 -2
- package/Physics/v2/physicsConstraint.js +0 -2
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Physics/v2/physicsEngine.d.ts +5 -3
- package/Physics/v2/physicsEngine.js +6 -3
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/Physics/v2/physicsShape.d.ts +2 -0
- package/Physics/v2/physicsShape.js +5 -0
- package/Physics/v2/physicsShape.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.d.ts +1 -0
- package/PostProcesses/motionBlurPostProcess.js +1 -0
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +0 -1
- package/PostProcesses/postProcess.js +0 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.d.ts +2 -1
- package/Rendering/GlobalIllumination/giRSMManager.js +5 -2
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
- package/Rendering/depthRendererSceneComponent.js +1 -0
- package/Rendering/depthRendererSceneComponent.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
- package/Rendering/geometryBufferRenderer.d.ts +2 -2
- package/Rendering/geometryBufferRenderer.js +2 -2
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/index.d.ts +0 -1
- package/Rendering/index.js +0 -1
- package/Rendering/index.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +2 -2
- package/Rendering/prePassRenderer.js +2 -2
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/reflectiveShadowMap.d.ts +4 -0
- package/Rendering/reflectiveShadowMap.js +7 -0
- package/Rendering/reflectiveShadowMap.js.map +1 -1
- package/Rendering/renderingGroup.d.ts +0 -1
- package/Rendering/renderingGroup.js +3 -4
- package/Rendering/renderingGroup.js.map +1 -1
- package/Rendering/renderingManager.d.ts +2 -1
- package/Rendering/renderingManager.js +2 -1
- package/Rendering/renderingManager.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.d.ts +1 -0
- package/Rendering/subSurfaceConfiguration.js +1 -0
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.d.ts +7 -0
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +13 -0
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -0
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.d.ts +5 -0
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +10 -0
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -0
- package/Shaders/ShadersInclude/morphTargetsVertex.js +8 -5
- package/Shaders/ShadersInclude/morphTargetsVertex.js.map +1 -1
- package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js +2 -0
- package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.d.ts +11 -0
- package/Shaders/gaussianSplatting.fragment.js +27 -0
- package/Shaders/gaussianSplatting.fragment.js.map +1 -0
- package/Shaders/gaussianSplatting.vertex.d.ts +13 -0
- package/Shaders/gaussianSplatting.vertex.js +49 -0
- package/Shaders/gaussianSplatting.vertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +5 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js +2 -0
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
- package/XR/features/WebXRAbstractFeature.d.ts +7 -1
- package/XR/features/WebXRAbstractFeature.js +20 -4
- package/XR/features/WebXRAbstractFeature.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.d.ts +1 -0
- package/XR/features/WebXRAnchorSystem.js +1 -0
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js +9 -2
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDepthSensing.d.ts +1 -1
- package/XR/features/WebXRDepthSensing.js +1 -1
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXREyeTracking.js +1 -1
- package/XR/features/WebXREyeTracking.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +4 -1
- package/XR/features/WebXRHandTracking.js +18 -4
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRHitTest.js +1 -1
- package/XR/features/WebXRHitTest.js.map +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +6 -3
- package/XR/features/WebXRNearInteraction.js +9 -4
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRPlaneDetector.d.ts +2 -0
- package/XR/features/WebXRPlaneDetector.js +2 -0
- package/XR/features/WebXRPlaneDetector.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.d.ts +2 -0
- package/XR/features/WebXRRawCameraAccess.js +2 -0
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.d.ts +0 -27
- package/XR/features/WebXRSpaceWarp.js +0 -27
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/index.d.ts +1 -0
- package/XR/index.js +1 -0
- package/XR/index.js.map +1 -1
- package/XR/motionController/webXROculusTouchMotionController.d.ts +1 -0
- package/XR/motionController/webXROculusTouchMotionController.js +1 -0
- package/XR/motionController/webXROculusTouchMotionController.js.map +1 -1
- package/XR/webXRCamera.d.ts +2 -0
- package/XR/webXRCamera.js +8 -6
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.js +1 -0
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRInput.js +1 -1
- package/XR/webXRInput.js.map +1 -1
- package/XR/webXRInputSource.d.ts +3 -1
- package/XR/webXRInputSource.js +6 -3
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +13 -0
- package/XR/webXRSessionManager.js +21 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/assetContainer.d.ts +5 -2
- package/assetContainer.js +5 -2
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -0
- package/scene.js +11 -0
- package/scene.js.map +1 -1
- package/Rendering/GaussianSplatting/gaussianSplatting.d.ts +0 -81
- package/Rendering/GaussianSplatting/gaussianSplatting.js +0 -400
- package/Rendering/GaussianSplatting/gaussianSplatting.js.map +0 -1
- package/Rendering/GaussianSplatting/index.d.ts +0 -1
- package/Rendering/GaussianSplatting/index.js +0 -2
- package/Rendering/GaussianSplatting/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAKpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACtB;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,yDAAO,CAAA;AACX,CAAC,EATW,cAAc,KAAd,cAAc,QASzB;AAmCD;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IAgBlB;;;OAGG;IACH,YAAmB,MAAwB;QAnB3C,gBAAgB;QACT,iBAAY,GAA0B,EAAE,CAAC;QAOxC,uBAAkB,GAAuB,EAAE,CAAC;QAEpD;;WAEG;QACH,UAAK,GAAmB,cAAc,CAAC,OAAO,CAAC;QAO3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW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CAAC;wBAC3F,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;qBACnC;iBACJ;aACJ;SACJ;QACD,KAAK,MAAM,iBAAiB,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACnE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;SAC5E;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { ISerializedFlowGraph, IObjectAccessor } from \"./typeDefinitions\";\r\nimport { FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _isADescendantOf } from \"./utils\";\r\nimport type { IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { defaultValueParseFunction } from \"./serialization\";\r\n\r\nexport enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface IFlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Options for parsing a flow graph.\r\n */\r\nexport interface IFlowGraphParseOptions {\r\n /**\r\n * A function that parses complex values in a scene.\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;\r\n /**\r\n * The flow graph coordinator.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * A function that converts a path to an object accessor.\r\n */\r\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n/**\r\n * @experimental\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n */\r\nexport class FlowGraph {\r\n /** @internal */\r\n public _eventBlocks: FlowGraphEventBlock[] = [];\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n private _coordinator: FlowGraphCoordinator;\r\n private _executionContexts: FlowGraphContext[] = [];\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: IFlowGraphParams) {\r\n this._scene = params.scene;\r\n this._coordinator = params.coordinator;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => this.dispose());\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n public getContext(index: number) {\r\n return this._executionContexts[index];\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n this._eventBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Started;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n for (const context of this._executionContexts) {\r\n const contextualOrder = this._getContextualOrder();\r\n for (const block of contextualOrder) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(): FlowGraphEventBlock[] {\r\n const order: FlowGraphEventBlock[] = [];\r\n\r\n for (const block1 of this._eventBlocks) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n if (block1.getClassName() === FlowGraphMeshPickEventBlock.ClassName) {\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock)._getReferencedMesh();\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock)._getReferencedMesh();\r\n if (mesh1 && mesh2 && _isADescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n order.splice(i, 0, block1);\r\n } else {\r\n order.push(block1);\r\n }\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n this._executionContexts.length = 0;\r\n this._eventBlocks.length = 0;\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n this._sceneDisposeObserver = null;\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const block of this._eventBlocks) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.allBlocks = [];\r\n this.visitAllBlocks((block) => {\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n });\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an output data connection that has a specific unique id\r\n * @param blocks\r\n * @param uniqueId\r\n * @returns\r\n */\r\n public static GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\r\n for (const block of blocks) {\r\n for (const dataOut of block.dataOutputs) {\r\n if (dataOut.uniqueId === uniqueId) {\r\n return dataOut;\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an input signal connection that has a specific unique id\r\n * @param blocks\r\n * @param uniqueId\r\n * @returns\r\n */\r\n public static GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\r\n for (const block of blocks) {\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n if (signalIn.uniqueId === uniqueId) {\r\n return signalIn;\r\n }\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Parses a graph from a given serialization object\r\n * @param serializationObject the object where the values are written\r\n * @param options options for parsing the graph\r\n * @returns\r\n */\r\n public static Parse(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): FlowGraph {\r\n const graph = options.coordinator.createGraph();\r\n const blocks: FlowGraphBlock[] = [];\r\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\r\n // Parse all blocks\r\n for (const serializedBlock of serializationObject.allBlocks) {\r\n const block = FlowGraphBlock.Parse(serializedBlock, { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, valueParseFunction });\r\n blocks.push(block);\r\n if (block instanceof FlowGraphEventBlock) {\r\n graph.addEventBlock(block);\r\n }\r\n }\r\n // After parsing all blocks, connect them\r\n for (const block of blocks) {\r\n for (const dataIn of block.dataInputs) {\r\n for (const serializedConnection of dataIn.connectedPointIds) {\r\n const connection = FlowGraph.GetDataOutConnectionByUniqueId(blocks, serializedConnection);\r\n dataIn.connectTo(connection);\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const serializedConnection of signalOut.connectedPointIds) {\r\n const connection = FlowGraph.GetSignalInConnectionByUniqueId(blocks, serializedConnection);\r\n signalOut.connectTo(connection);\r\n }\r\n }\r\n }\r\n }\r\n for (const serializedContext of serializationObject.executionContexts) {\r\n FlowGraphContext.Parse(serializedContext, { graph, valueParseFunction });\r\n }\r\n return graph;\r\n }\r\n}\r\n"]}
|
|
1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":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { ISerializedFlowGraph, IObjectAccessor } from \"./typeDefinitions\";\r\nimport { FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _isADescendantOf } from \"./utils\";\r\nimport type { IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { defaultValueParseFunction } from \"./serialization\";\r\n\r\nexport enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface IFlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Options for parsing a flow graph.\r\n */\r\nexport interface IFlowGraphParseOptions {\r\n /**\r\n * A function that parses complex values in a scene.\r\n * @param key the key of the value\r\n * @param serializationObject the object to read the value from\r\n * @param scene the scene to read the value from\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;\r\n /**\r\n * The flow graph coordinator.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * A function that converts a path to an object accessor.\r\n */\r\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n/**\r\n * @experimental\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n */\r\nexport class FlowGraph {\r\n /** @internal */\r\n public _eventBlocks: FlowGraphEventBlock[] = [];\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n private _coordinator: FlowGraphCoordinator;\r\n private _executionContexts: FlowGraphContext[] = [];\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: IFlowGraphParams) {\r\n this._scene = params.scene;\r\n this._coordinator = params.coordinator;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => this.dispose());\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n /**\r\n * Returns the execution context at a given index\r\n * @param index the index of the context\r\n * @returns the execution context at that index\r\n */\r\n public getContext(index: number) {\r\n return this._executionContexts[index];\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block the event block to be added\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n this._eventBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Started;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n for (const context of this._executionContexts) {\r\n const contextualOrder = this._getContextualOrder();\r\n for (const block of contextualOrder) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(): FlowGraphEventBlock[] {\r\n const order: FlowGraphEventBlock[] = [];\r\n\r\n for (const block1 of this._eventBlocks) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n if (block1.getClassName() === FlowGraphMeshPickEventBlock.ClassName) {\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock)._getReferencedMesh();\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock)._getReferencedMesh();\r\n if (mesh1 && mesh2 && _isADescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n order.splice(i, 0, block1);\r\n } else {\r\n order.push(block1);\r\n }\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n this._executionContexts.length = 0;\r\n this._eventBlocks.length = 0;\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n this._sceneDisposeObserver = null;\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const block of this._eventBlocks) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.allBlocks = [];\r\n this.visitAllBlocks((block) => {\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n });\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an output data connection that has a specific unique id\r\n * @param blocks a list of flow graph blocks\r\n * @param uniqueId the unique id of a connection\r\n * @returns the connection that has this unique id. throws an error if none was found\r\n */\r\n public static GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\r\n for (const block of blocks) {\r\n for (const dataOut of block.dataOutputs) {\r\n if (dataOut.uniqueId === uniqueId) {\r\n return dataOut;\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an input signal connection that has a specific unique id\r\n * @param blocks a list of flow graph blocks\r\n * @param uniqueId the unique id of a connection\r\n * @returns the connection that has this unique id. throws an error if none was found\r\n */\r\n public static GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\r\n for (const block of blocks) {\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n if (signalIn.uniqueId === uniqueId) {\r\n return signalIn;\r\n }\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Parses a graph from a given serialization object\r\n * @param serializationObject the object where the values are written\r\n * @param options options for parsing the graph\r\n * @returns the parsed graph\r\n */\r\n public static Parse(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): FlowGraph {\r\n const graph = options.coordinator.createGraph();\r\n const blocks: FlowGraphBlock[] = [];\r\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\r\n // Parse all blocks\r\n for (const serializedBlock of serializationObject.allBlocks) {\r\n const block = FlowGraphBlock.Parse(serializedBlock, { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, valueParseFunction });\r\n blocks.push(block);\r\n if (block instanceof FlowGraphEventBlock) {\r\n graph.addEventBlock(block);\r\n }\r\n }\r\n // After parsing all blocks, connect them\r\n for (const block of blocks) {\r\n for (const dataIn of block.dataInputs) {\r\n for (const serializedConnection of dataIn.connectedPointIds) {\r\n const connection = FlowGraph.GetDataOutConnectionByUniqueId(blocks, serializedConnection);\r\n dataIn.connectTo(connection);\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const serializedConnection of signalOut.connectedPointIds) {\r\n const connection = FlowGraph.GetSignalInConnectionByUniqueId(blocks, serializedConnection);\r\n signalOut.connectTo(connection);\r\n }\r\n }\r\n }\r\n }\r\n for (const serializedContext of serializationObject.executionContexts) {\r\n FlowGraphContext.Parse(serializedContext, { graph, valueParseFunction });\r\n }\r\n return graph;\r\n }\r\n}\r\n"]}
|
|
@@ -11,6 +11,10 @@ import type { IPathToObjectConverter } from "../ObjectModel/objectModelInterface
|
|
|
11
11
|
export interface IFlowGraphBlockParseOptions {
|
|
12
12
|
/**
|
|
13
13
|
* A function that parses a value from a serialization object.
|
|
14
|
+
* @param key the key of the property
|
|
15
|
+
* @param serializationObject the serialization object where the property is located
|
|
16
|
+
* @param scene the scene that the block is being parsed in
|
|
17
|
+
* @returns the parsed value
|
|
14
18
|
*/
|
|
15
19
|
valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;
|
|
16
20
|
/**
|
|
@@ -40,6 +44,9 @@ export interface IFlowGraphBlockConfiguration {
|
|
|
40
44
|
* data.
|
|
41
45
|
*/
|
|
42
46
|
export declare class FlowGraphBlock {
|
|
47
|
+
/**
|
|
48
|
+
* the configuration of the block
|
|
49
|
+
*/
|
|
43
50
|
config?: IFlowGraphBlockConfiguration | undefined;
|
|
44
51
|
/**
|
|
45
52
|
* A randomly generated GUID for each block.
|
|
@@ -61,18 +68,60 @@ export declare class FlowGraphBlock {
|
|
|
61
68
|
* Metadata that can be used by the block.
|
|
62
69
|
*/
|
|
63
70
|
metadata: any;
|
|
64
|
-
/** Constructor is protected so only subclasses can be instantiated
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
/** Constructor is protected so only subclasses can be instantiated
|
|
72
|
+
* @param config optional configuration for this block
|
|
73
|
+
*/
|
|
74
|
+
protected constructor(
|
|
75
|
+
/**
|
|
76
|
+
* the configuration of the block
|
|
77
|
+
*/
|
|
78
|
+
config?: IFlowGraphBlockConfiguration | undefined);
|
|
67
79
|
/**
|
|
68
80
|
* @internal
|
|
69
81
|
*/
|
|
70
82
|
_updateOutputs(_context: FlowGraphContext): void;
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Registers a data input on the block.
|
|
85
|
+
* @param name the name of the input
|
|
86
|
+
* @param richType the type of the input
|
|
87
|
+
* @returns the created connection
|
|
88
|
+
*/
|
|
89
|
+
registerDataInput<T>(name: string, richType: RichType<T>): FlowGraphDataConnection<T>;
|
|
90
|
+
/**
|
|
91
|
+
* Registers a data output on the block.
|
|
92
|
+
* @param name the name of the input
|
|
93
|
+
* @param richType the type of the input
|
|
94
|
+
* @returns the created connection
|
|
95
|
+
*/
|
|
96
|
+
registerDataOutput<T>(name: string, richType: RichType<T>): FlowGraphDataConnection<T>;
|
|
97
|
+
/**
|
|
98
|
+
* Given the name of a data input, returns the connection if it exists
|
|
99
|
+
* @param name the name of the input
|
|
100
|
+
* @returns the connection if it exists, undefined otherwise
|
|
101
|
+
*/
|
|
73
102
|
getDataInput(name: string): FlowGraphDataConnection<any> | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Given the name of a data output, returns the connection if it exists
|
|
105
|
+
* @param name the name of the output
|
|
106
|
+
* @returns the connection if it exists, undefined otherwise
|
|
107
|
+
*/
|
|
74
108
|
getDataOutput(name: string): FlowGraphDataConnection<any> | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Serializes this block
|
|
111
|
+
* @param serializationObject the object to serialize to
|
|
112
|
+
* @param _valueSerializeFunction a function that serializes a specific value
|
|
113
|
+
*/
|
|
75
114
|
serialize(serializationObject?: any, _valueSerializeFunction?: (key: string, value: any, serializationObject: any) => any): void;
|
|
115
|
+
/**
|
|
116
|
+
* Gets the class name of this block
|
|
117
|
+
* @returns the class name
|
|
118
|
+
*/
|
|
76
119
|
getClassName(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Parses a block from a serialization object
|
|
122
|
+
* @param serializationObject the object to parse from
|
|
123
|
+
* @param parseOptions options for parsing the block
|
|
124
|
+
* @returns the parsed block
|
|
125
|
+
*/
|
|
77
126
|
static Parse(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): FlowGraphBlock;
|
|
78
127
|
}
|
|
@@ -10,18 +10,20 @@ import { defaultValueParseFunction, defaultValueSerializationFunction, needsPath
|
|
|
10
10
|
* data.
|
|
11
11
|
*/
|
|
12
12
|
export class FlowGraphBlock {
|
|
13
|
-
/** Constructor is protected so only subclasses can be instantiated
|
|
14
|
-
|
|
13
|
+
/** Constructor is protected so only subclasses can be instantiated
|
|
14
|
+
* @param config optional configuration for this block
|
|
15
|
+
*/
|
|
16
|
+
constructor(
|
|
17
|
+
/**
|
|
18
|
+
* the configuration of the block
|
|
19
|
+
*/
|
|
20
|
+
config) {
|
|
21
|
+
var _a, _b;
|
|
15
22
|
this.config = config;
|
|
16
23
|
/**
|
|
17
24
|
* A randomly generated GUID for each block.
|
|
18
25
|
*/
|
|
19
26
|
this.uniqueId = RandomGUID();
|
|
20
|
-
this.configure();
|
|
21
|
-
}
|
|
22
|
-
configure() {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
// overriden in child classes, uses config
|
|
25
27
|
this.name = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.getClassName();
|
|
26
28
|
this.dataInputs = [];
|
|
27
29
|
this.dataOutputs = [];
|
|
@@ -32,22 +34,49 @@ export class FlowGraphBlock {
|
|
|
32
34
|
_updateOutputs(_context) {
|
|
33
35
|
// empty by default, overriden in data blocks
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Registers a data input on the block.
|
|
39
|
+
* @param name the name of the input
|
|
40
|
+
* @param richType the type of the input
|
|
41
|
+
* @returns the created connection
|
|
42
|
+
*/
|
|
43
|
+
registerDataInput(name, richType) {
|
|
44
|
+
const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input, this, richType);
|
|
37
45
|
this.dataInputs.push(input);
|
|
38
46
|
return input;
|
|
39
47
|
}
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Registers a data output on the block.
|
|
50
|
+
* @param name the name of the input
|
|
51
|
+
* @param richType the type of the input
|
|
52
|
+
* @returns the created connection
|
|
53
|
+
*/
|
|
54
|
+
registerDataOutput(name, richType) {
|
|
55
|
+
const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output, this, richType);
|
|
42
56
|
this.dataOutputs.push(output);
|
|
43
57
|
return output;
|
|
44
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Given the name of a data input, returns the connection if it exists
|
|
61
|
+
* @param name the name of the input
|
|
62
|
+
* @returns the connection if it exists, undefined otherwise
|
|
63
|
+
*/
|
|
45
64
|
getDataInput(name) {
|
|
46
65
|
return this.dataInputs.find((i) => i.name === name);
|
|
47
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Given the name of a data output, returns the connection if it exists
|
|
69
|
+
* @param name the name of the output
|
|
70
|
+
* @returns the connection if it exists, undefined otherwise
|
|
71
|
+
*/
|
|
48
72
|
getDataOutput(name) {
|
|
49
73
|
return this.dataOutputs.find((i) => i.name === name);
|
|
50
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Serializes this block
|
|
77
|
+
* @param serializationObject the object to serialize to
|
|
78
|
+
* @param _valueSerializeFunction a function that serializes a specific value
|
|
79
|
+
*/
|
|
51
80
|
serialize(serializationObject = {}, _valueSerializeFunction = defaultValueSerializationFunction) {
|
|
52
81
|
serializationObject.uniqueId = this.uniqueId;
|
|
53
82
|
serializationObject.config = {};
|
|
@@ -68,9 +97,19 @@ export class FlowGraphBlock {
|
|
|
68
97
|
serializationObject.dataOutputs.push(serializedOutput);
|
|
69
98
|
}
|
|
70
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets the class name of this block
|
|
102
|
+
* @returns the class name
|
|
103
|
+
*/
|
|
71
104
|
getClassName() {
|
|
72
105
|
return "FGBlock";
|
|
73
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Parses a block from a serialization object
|
|
109
|
+
* @param serializationObject the object to parse from
|
|
110
|
+
* @param parseOptions options for parsing the block
|
|
111
|
+
* @returns the parsed block
|
|
112
|
+
*/
|
|
74
113
|
static Parse(serializationObject, parseOptions) {
|
|
75
114
|
var _a;
|
|
76
115
|
const classType = Tools.Instantiate(serializationObject.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphBlock.js","sourceR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C,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;aACnJ;SACJ;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7D,MAAM,UAAU,GAAG,GAAG,CAAC,aAAa,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC9E,IAAI,UAAU,EAAE;gBACZ,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9D;iBAAM;gBACH,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;aACrJ;SACJ;QACD,GAAG,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAC5C,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;QACxD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { ISerializedFlowGraphBlock, IObjectAccessor } from \"./typeDefinitions\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction, needsPathConverter } from \"./serialization\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\n\r\n/**\r\n * @experimental\r\n * Options for parsing a block.\r\n */\r\nexport interface IFlowGraphBlockParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;\r\n /**\r\n * The scene that the block is being parsed in.\r\n */\r\n scene: Scene;\r\n /**\r\n * The path converter to use to convert the path to an object accessor.\r\n */\r\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Configuration for a block.\r\n */\r\nexport interface IFlowGraphBlockConfiguration {\r\n /**\r\n * The name of the block.\r\n */\r\n name?: string;\r\n [extraPropertyKey: string]: any;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * A block in a flow graph. The most basic form\r\n * of a block has inputs and outputs that contain\r\n * data.\r\n */\r\nexport class FlowGraphBlock {\r\n /**\r\n * A randomly generated GUID for each block.\r\n */\r\n public uniqueId = RandomGUID();\r\n /**\r\n * The name of the block.\r\n */\r\n public name: string;\r\n /**\r\n * The data inputs of the block.\r\n */\r\n public dataInputs: FlowGraphDataConnection<any>[];\r\n /**\r\n * The data outputs of the block.\r\n */\r\n public dataOutputs: FlowGraphDataConnection<any>[];\r\n\r\n /**\r\n * Metadata that can be used by the block.\r\n */\r\n public metadata: any;\r\n\r\n /** Constructor is protected so only subclasses can be instantiated */\r\n protected constructor(public config?: IFlowGraphBlockConfiguration) {\r\n this.configure();\r\n }\r\n\r\n public configure() {\r\n // overriden in child classes, uses config\r\n this.name = this.config?.name ?? this.getClassName();\r\n this.dataInputs = [];\r\n this.dataOutputs = [];\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n // empty by default, overriden in data blocks\r\n }\r\n\r\n public registerDataInput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T> {\r\n const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input, this, className);\r\n this.dataInputs.push(input);\r\n return input;\r\n }\r\n\r\n public registerDataOutput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T> {\r\n const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output, this, className);\r\n this.dataOutputs.push(output);\r\n return output;\r\n }\r\n\r\n public getDataInput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataInputs.find((i) => i.name === name);\r\n }\r\n\r\n public getDataOutput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataOutputs.find((i) => i.name === name);\r\n }\r\n\r\n public serialize(serializationObject: any = {}, _valueSerializeFunction: (key: string, value: any, serializationObject: any) => any = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.config = {};\r\n if (this.config) {\r\n serializationObject.config[\"name\"] = this.config.name;\r\n }\r\n serializationObject.dataInputs = [];\r\n serializationObject.dataOutputs = [];\r\n serializationObject.className = this.getClassName();\r\n for (const input of this.dataInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.dataInputs.push(serializedInput);\r\n }\r\n for (const output of this.dataOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.dataOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n public getClassName() {\r\n return \"FGBlock\";\r\n }\r\n\r\n public static Parse(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): FlowGraphBlock {\r\n const classType = Tools.Instantiate(serializationObject.className);\r\n const parsedConfig: any = {};\r\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\r\n if (serializationObject.config) {\r\n for (const key in serializationObject.config) {\r\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.scene);\r\n }\r\n }\r\n if (needsPathConverter(serializationObject.className)) {\r\n parsedConfig.pathConverter = parseOptions.pathConverter;\r\n }\r\n const obj = new classType(parsedConfig);\r\n obj.uniqueId = serializationObject.uniqueId;\r\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\r\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\r\n if (dataInput) {\r\n dataInput.deserialize(serializationObject.dataInputs[i]);\r\n } else {\r\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\r\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\r\n if (dataOutput) {\r\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\r\n } else {\r\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n obj.metadata = serializationObject.metadata;\r\n obj.deserialize && obj.deserialize(serializationObject);\r\n return obj;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,yBAAyB,EAAE,iCAAiC,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAuCnH;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IAuBvB;;OAEG;IACH;IACI;;OAEG;IACI,MAAqC;;QAArC,WAAM,GAAN,MAAM,CAA+B;QA7BhD;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QA4B3B,IAAI,CAAC,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,mCAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;OAE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I,GAAG,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;QACxD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { ISerializedFlowGraphBlock, IObjectAccessor } from \"./typeDefinitions\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction, needsPathConverter } from \"./serialization\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\n\r\n/**\r\n * @experimental\r\n * Options for parsing a block.\r\n */\r\nexport interface IFlowGraphBlockParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the property\r\n * @param serializationObject the serialization object where the property is located\r\n * @param scene the scene that the block is being parsed in\r\n * @returns the parsed value\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;\r\n /**\r\n * The scene that the block is being parsed in.\r\n */\r\n scene: Scene;\r\n /**\r\n * The path converter to use to convert the path to an object accessor.\r\n */\r\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Configuration for a block.\r\n */\r\nexport interface IFlowGraphBlockConfiguration {\r\n /**\r\n * The name of the block.\r\n */\r\n name?: string;\r\n [extraPropertyKey: string]: any;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * A block in a flow graph. The most basic form\r\n * of a block has inputs and outputs that contain\r\n * data.\r\n */\r\nexport class FlowGraphBlock {\r\n /**\r\n * A randomly generated GUID for each block.\r\n */\r\n public uniqueId = RandomGUID();\r\n /**\r\n * The name of the block.\r\n */\r\n public name: string;\r\n /**\r\n * The data inputs of the block.\r\n */\r\n public dataInputs: FlowGraphDataConnection<any>[];\r\n /**\r\n * The data outputs of the block.\r\n */\r\n public dataOutputs: FlowGraphDataConnection<any>[];\r\n\r\n /**\r\n * Metadata that can be used by the block.\r\n */\r\n public metadata: any;\r\n\r\n /** Constructor is protected so only subclasses can be instantiated\r\n * @param config optional configuration for this block\r\n */\r\n protected constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public config?: IFlowGraphBlockConfiguration\r\n ) {\r\n this.name = this.config?.name ?? this.getClassName();\r\n this.dataInputs = [];\r\n this.dataOutputs = [];\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n // empty by default, overriden in data blocks\r\n }\r\n\r\n /**\r\n * Registers a data input on the block.\r\n * @param name the name of the input\r\n * @param richType the type of the input\r\n * @returns the created connection\r\n */\r\n public registerDataInput<T>(name: string, richType: RichType<T>): FlowGraphDataConnection<T> {\r\n const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input, this, richType);\r\n this.dataInputs.push(input);\r\n return input;\r\n }\r\n\r\n /**\r\n * Registers a data output on the block.\r\n * @param name the name of the input\r\n * @param richType the type of the input\r\n * @returns the created connection\r\n */\r\n public registerDataOutput<T>(name: string, richType: RichType<T>): FlowGraphDataConnection<T> {\r\n const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output, this, richType);\r\n this.dataOutputs.push(output);\r\n return output;\r\n }\r\n\r\n /**\r\n * Given the name of a data input, returns the connection if it exists\r\n * @param name the name of the input\r\n * @returns the connection if it exists, undefined otherwise\r\n */\r\n public getDataInput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataInputs.find((i) => i.name === name);\r\n }\r\n\r\n /**\r\n * Given the name of a data output, returns the connection if it exists\r\n * @param name the name of the output\r\n * @returns the connection if it exists, undefined otherwise\r\n */\r\n public getDataOutput(name: string): FlowGraphDataConnection<any> | undefined {\r\n return this.dataOutputs.find((i) => i.name === name);\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @param serializationObject the object to serialize to\r\n * @param _valueSerializeFunction a function that serializes a specific value\r\n */\r\n public serialize(serializationObject: any = {}, _valueSerializeFunction: (key: string, value: any, serializationObject: any) => any = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.config = {};\r\n if (this.config) {\r\n serializationObject.config[\"name\"] = this.config.name;\r\n }\r\n serializationObject.dataInputs = [];\r\n serializationObject.dataOutputs = [];\r\n serializationObject.className = this.getClassName();\r\n for (const input of this.dataInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.dataInputs.push(serializedInput);\r\n }\r\n for (const output of this.dataOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.dataOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the class name of this block\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FGBlock\";\r\n }\r\n\r\n /**\r\n * Parses a block from a serialization object\r\n * @param serializationObject the object to parse from\r\n * @param parseOptions options for parsing the block\r\n * @returns the parsed block\r\n */\r\n public static Parse(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): FlowGraphBlock {\r\n const classType = Tools.Instantiate(serializationObject.className);\r\n const parsedConfig: any = {};\r\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\r\n if (serializationObject.config) {\r\n for (const key in serializationObject.config) {\r\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.scene);\r\n }\r\n }\r\n if (needsPathConverter(serializationObject.className)) {\r\n parsedConfig.pathConverter = parseOptions.pathConverter;\r\n }\r\n const obj = new classType(parsedConfig);\r\n obj.uniqueId = serializationObject.uniqueId;\r\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\r\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\r\n if (dataInput) {\r\n dataInput.deserialize(serializationObject.dataInputs[i]);\r\n } else {\r\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\r\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\r\n if (dataOutput) {\r\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\r\n } else {\r\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n obj.metadata = serializationObject.metadata;\r\n obj.deserialize && obj.deserialize(serializationObject);\r\n return obj;\r\n }\r\n}\r\n"]}
|
|
@@ -74,25 +74,29 @@ export declare class FlowGraphConnection<BlockT, ConnectedToT extends IConnectab
|
|
|
74
74
|
*/
|
|
75
75
|
isConnected(): boolean;
|
|
76
76
|
/**
|
|
77
|
-
* Connects two
|
|
78
|
-
* @param point
|
|
77
|
+
* Connects two connections together.
|
|
78
|
+
* @param point the connection to connect to.
|
|
79
79
|
*/
|
|
80
80
|
connectTo(point: ConnectedToT): void;
|
|
81
81
|
/**
|
|
82
82
|
* Saves the connection to a JSON object.
|
|
83
|
+
* @param serializationObject the object to serialize to.
|
|
83
84
|
*/
|
|
84
85
|
serialize(serializationObject?: any): void;
|
|
86
|
+
/**
|
|
87
|
+
* @returns class name of the connection.
|
|
88
|
+
*/
|
|
85
89
|
getClassName(): string;
|
|
86
90
|
/**
|
|
87
91
|
* Deserialize from a object into this
|
|
88
|
-
* @param serializationObject
|
|
92
|
+
* @param serializationObject the object to deserialize from.
|
|
89
93
|
*/
|
|
90
94
|
deserialize(serializationObject: any): void;
|
|
91
95
|
/**
|
|
92
96
|
* Parses a connection from an object
|
|
93
|
-
* @param serializationObject
|
|
94
|
-
* @param ownerBlock
|
|
95
|
-
* @returns
|
|
97
|
+
* @param serializationObject the object to parse from.
|
|
98
|
+
* @param ownerBlock the block that owns the connection.
|
|
99
|
+
* @returns the parsed connection.
|
|
96
100
|
*/
|
|
97
101
|
static Parse(serializationObject: any, ownerBlock: FlowGraphBlock): any;
|
|
98
102
|
}
|
|
@@ -54,8 +54,8 @@ export class FlowGraphConnection {
|
|
|
54
54
|
return this._connectedPoint.length > 0;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Connects two
|
|
58
|
-
* @param point
|
|
57
|
+
* Connects two connections together.
|
|
58
|
+
* @param point the connection to connect to.
|
|
59
59
|
*/
|
|
60
60
|
connectTo(point) {
|
|
61
61
|
if (this._connectionType === point._connectionType) {
|
|
@@ -69,6 +69,7 @@ export class FlowGraphConnection {
|
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Saves the connection to a JSON object.
|
|
72
|
+
* @param serializationObject the object to serialize to.
|
|
72
73
|
*/
|
|
73
74
|
serialize(serializationObject = {}) {
|
|
74
75
|
serializationObject.uniqueId = this.uniqueId;
|
|
@@ -80,12 +81,15 @@ export class FlowGraphConnection {
|
|
|
80
81
|
serializationObject.connectedPointIds.push(point.uniqueId);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* @returns class name of the connection.
|
|
86
|
+
*/
|
|
83
87
|
getClassName() {
|
|
84
88
|
return "FGConnection";
|
|
85
89
|
}
|
|
86
90
|
/**
|
|
87
91
|
* Deserialize from a object into this
|
|
88
|
-
* @param serializationObject
|
|
92
|
+
* @param serializationObject the object to deserialize from.
|
|
89
93
|
*/
|
|
90
94
|
deserialize(serializationObject) {
|
|
91
95
|
this.uniqueId = serializationObject.uniqueId;
|
|
@@ -95,9 +99,9 @@ export class FlowGraphConnection {
|
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
101
|
* Parses a connection from an object
|
|
98
|
-
* @param serializationObject
|
|
99
|
-
* @param ownerBlock
|
|
100
|
-
* @returns
|
|
102
|
+
* @param serializationObject the object to parse from.
|
|
103
|
+
* @param ownerBlock the block that owns the connection.
|
|
104
|
+
* @returns the parsed connection.
|
|
101
105
|
*/
|
|
102
106
|
static Parse(serializationObject = {}, ownerBlock) {
|
|
103
107
|
const type = Tools.Instantiate(serializationObject.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,uEAAK,CAAA;IACL,yEAAM,CAAA;AACV,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;AA6BD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IA0B5B,YACI,IAAY,EACZ,eAAwC;IACxC,eAAe,CAAQ,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;QA5B9C,gBAAgB;QACT,oBAAe,GAAwB,EAAE,CAAC;QACjD;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAY/B;;;WAGG;QACH,8CAA8C;QAC9C,6DAA6D;QACtD,sBAAiB,GAAU,EAAE,CAAC;QAOjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,WAAW;QACd,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,KAAmB;QAChC,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC,eAAe,EAAE;YAChD,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,CAAC,cAAc,EAAE,CAAC,C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;QACf,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,mBAAwB;QAChC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,iBAAiB,GAAG,mBAAmB,CAAC,iBAAiB,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,sBAA2B,EAAE,EAAE,UAA0B;QACzE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC9D,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QACvG,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n * The type of a connection point - inpput or output.\r\n */\r\nexport enum FlowGraphConnectionType {\r\n Input,\r\n Output,\r\n}\r\n\r\n/**\r\n * @experimental\r\n */\r\nexport interface IConnectable {\r\n /**\r\n * A uniquely identifying string for the connection.\r\n */\r\n uniqueId: string;\r\n /**\r\n * An array of the points that this point is connected to.\r\n */\r\n _connectedPoint: Array<IConnectable>;\r\n /**\r\n * Returns if the connection can only be connected to one other point.\r\n */\r\n _isSingularConnection(): boolean;\r\n /**\r\n * The type of the connection\r\n */\r\n _connectionType: FlowGraphConnectionType;\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n connectTo(point: IConnectable): void;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * The base connection class.\r\n */\r\nexport class FlowGraphConnection<BlockT, ConnectedToT extends IConnectable> implements IConnectable {\r\n /** @internal */\r\n public _connectedPoint: Array<ConnectedToT> = [];\r\n /**\r\n * A uniquely identifying string for the connection.\r\n */\r\n public uniqueId = RandomGUID();\r\n\r\n /**\r\n * The name of the connection.\r\n */\r\n public name: string;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _connectionType: FlowGraphConnectionType;\r\n\r\n /**\r\n * Used for parsing connections.\r\n * @internal\r\n */\r\n // disable warning as this is used for parsing\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public connectedPointIds: any[] = [];\r\n\r\n public constructor(\r\n name: string,\r\n _connectionType: FlowGraphConnectionType,\r\n /* @internal */ public _ownerBlock: BlockT\r\n ) {\r\n this.name = name;\r\n this._connectionType = _connectionType;\r\n }\r\n\r\n /**\r\n * The type of the connection\r\n */\r\n public get connectionType() {\r\n return this._connectionType;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Override this to indicate if a point can connect to more than one point.\r\n */\r\n public _isSingularConnection(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns if a point is connected to any other point.\r\n * @returns boolean indicating if the point is connected.\r\n */\r\n public isConnected(): boolean {\r\n return this._connectedPoint.length > 0;\r\n }\r\n\r\n /**\r\n * Connects two connections together.\r\n * @param point the connection to connect to.\r\n */\r\n public connectTo(point: ConnectedToT): void {\r\n if (this._connectionType === point._connectionType) {\r\n throw new Error(`Cannot connect two points of type ${this.connectionType}`);\r\n }\r\n if ((this._isSingularConnection() && this._connectedPoint.length > 0) || (point._isSingularConnection() && point._connectedPoint.length > 0)) {\r\n throw new Error(\"Max number of connections for point reached\");\r\n }\r\n this._connectedPoint.push(point);\r\n point._connectedPoint.push(this);\r\n }\r\n\r\n /**\r\n * Saves the connection to a JSON object.\r\n * @param serializationObject the object to serialize to.\r\n */\r\n public serialize(serializationObject: any = {}) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject._connectionType = this._connectionType;\r\n serializationObject.connectedPointIds = [];\r\n serializationObject.className = this.getClassName();\r\n for (const point of this._connectedPoint) {\r\n serializationObject.connectedPointIds.push(point.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the connection.\r\n */\r\n public getClassName(): string {\r\n return \"FGConnection\";\r\n }\r\n\r\n /**\r\n * Deserialize from a object into this\r\n * @param serializationObject the object to deserialize from.\r\n */\r\n deserialize(serializationObject: any) {\r\n this.uniqueId = serializationObject.uniqueId;\r\n this.name = serializationObject.name;\r\n this._connectionType = serializationObject._connectionType;\r\n this.connectedPointIds = serializationObject.connectedPointIds;\r\n }\r\n\r\n /**\r\n * Parses a connection from an object\r\n * @param serializationObject the object to parse from.\r\n * @param ownerBlock the block that owns the connection.\r\n * @returns the parsed connection.\r\n */\r\n public static Parse(serializationObject: any = {}, ownerBlock: FlowGraphBlock) {\r\n const type = Tools.Instantiate(serializationObject.className);\r\n const connection = new type(serializationObject.name, serializationObject._connectionType, ownerBlock);\r\n connection.deserialize(serializationObject);\r\n return connection;\r\n }\r\n}\r\n"]}
|
|
@@ -82,20 +82,20 @@ export declare class FlowGraphContext {
|
|
|
82
82
|
constructor(params: IFlowGraphContextConfiguration);
|
|
83
83
|
/**
|
|
84
84
|
* Check if a user-defined variable is defined.
|
|
85
|
-
* @param name
|
|
86
|
-
* @returns
|
|
85
|
+
* @param name the name of the variable
|
|
86
|
+
* @returns true if the variable is defined
|
|
87
87
|
*/
|
|
88
88
|
hasVariable(name: string): boolean;
|
|
89
89
|
/**
|
|
90
90
|
* Set a user-defined variable.
|
|
91
|
-
* @param name
|
|
92
|
-
* @param value
|
|
91
|
+
* @param name the name of the variable
|
|
92
|
+
* @param value the value of the variable
|
|
93
93
|
*/
|
|
94
94
|
setVariable(name: string, value: any): void;
|
|
95
95
|
/**
|
|
96
96
|
* Get a user-defined variable.
|
|
97
|
-
* @param name
|
|
98
|
-
* @returns
|
|
97
|
+
* @param name the name of the variable
|
|
98
|
+
* @returns the value of the variable
|
|
99
99
|
*/
|
|
100
100
|
getVariable(name: string): any;
|
|
101
101
|
/**
|
|
@@ -200,12 +200,14 @@ export declare class FlowGraphContext {
|
|
|
200
200
|
* @param valueSerializationFunction a function to serialize complex values
|
|
201
201
|
*/
|
|
202
202
|
serialize(serializationObject?: any, valueSerializationFunction?: (key: string, value: any, serializationObject: any) => void): void;
|
|
203
|
+
/**
|
|
204
|
+
* @returns the class name of the object.
|
|
205
|
+
*/
|
|
203
206
|
getClassName(): string;
|
|
204
207
|
/**
|
|
205
208
|
* Parses a context
|
|
206
209
|
* @param serializationObject the object containing the context serialization values
|
|
207
|
-
* @param
|
|
208
|
-
* @param valueParseFunction a function to parse complex values
|
|
210
|
+
* @param options the options for parsing the context
|
|
209
211
|
* @returns
|
|
210
212
|
*/
|
|
211
213
|
static Parse(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions): FlowGraphContext;
|
|
@@ -45,24 +45,24 @@ export class FlowGraphContext {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Check if a user-defined variable is defined.
|
|
48
|
-
* @param name
|
|
49
|
-
* @returns
|
|
48
|
+
* @param name the name of the variable
|
|
49
|
+
* @returns true if the variable is defined
|
|
50
50
|
*/
|
|
51
51
|
hasVariable(name) {
|
|
52
52
|
return name in this._userVariables;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Set a user-defined variable.
|
|
56
|
-
* @param name
|
|
57
|
-
* @param value
|
|
56
|
+
* @param name the name of the variable
|
|
57
|
+
* @param value the value of the variable
|
|
58
58
|
*/
|
|
59
59
|
setVariable(name, value) {
|
|
60
60
|
this._userVariables[name] = value;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Get a user-defined variable.
|
|
64
|
-
* @param name
|
|
65
|
-
* @returns
|
|
64
|
+
* @param name the name of the variable
|
|
65
|
+
* @returns the value of the variable
|
|
66
66
|
*/
|
|
67
67
|
getVariable(name) {
|
|
68
68
|
return this._userVariables[name];
|
|
@@ -220,14 +220,16 @@ export class FlowGraphContext {
|
|
|
220
220
|
valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* @returns the class name of the object.
|
|
225
|
+
*/
|
|
223
226
|
getClassName() {
|
|
224
227
|
return "FGContext";
|
|
225
228
|
}
|
|
226
229
|
/**
|
|
227
230
|
* Parses a context
|
|
228
231
|
* @param serializationObject the object containing the context serialization values
|
|
229
|
-
* @param
|
|
230
|
-
* @param valueParseFunction a function to parse complex values
|
|
232
|
+
* @param options the options for parsing the context
|
|
231
233
|
* @returns
|
|
232
234
|
*/
|
|
233
235
|
static Parse(serializationObject, options) {
|
|
@@ -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,EAAE,CAAC;QAC5D;;;WAGG;QACK,iBAAY,GAAG,CAAC,CAAC;QACzB;;WAEG;QACI,6BAAw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AkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACvG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACtC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACrD,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;SACzC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAhQU;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\r\n * @returns\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\r\n * @param value\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\r\n * @returns\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 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 graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\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;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,EAAE,CAA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/C,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,cAAc,EAAE;YAClD,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;SACtC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACrD,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;SACzC;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"]}
|