@babylonjs/core 7.12.0 → 7.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animation.js +1 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroupMask.d.ts +1 -1
- package/Animations/animationGroupMask.js +2 -2
- package/Animations/animationGroupMask.js.map +1 -1
- package/Animations/animationKey.d.ts +1 -1
- package/Animations/animationKey.js.map +1 -1
- package/Behaviors/Meshes/handConstraintBehavior.d.ts +3 -3
- package/Behaviors/Meshes/handConstraintBehavior.js +16 -17
- package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +2 -3
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Bones/bone.js +31 -32
- package/Bones/bone.js.map +1 -1
- package/Bones/boneIKController.js +5 -6
- package/Bones/boneIKController.js.map +1 -1
- package/Bones/boneLookController.js +13 -13
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/bufferUtils.d.ts +13 -0
- package/Buffers/bufferUtils.js +42 -0
- package/Buffers/bufferUtils.js.map +1 -0
- package/Buffers/index.d.ts +1 -0
- package/Buffers/index.js +1 -0
- package/Buffers/index.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.js +5 -6
- package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +5 -5
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +8 -10
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Compute/computeEffect.js +2 -3
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.js +19 -20
- package/Compute/computeShader.js.map +1 -1
- package/Culling/Helper/IBoundingInfoHelperPlatform.d.ts +4 -0
- package/Culling/Helper/IBoundingInfoHelperPlatform.js.map +1 -1
- package/Culling/Helper/boundingInfoHelper.d.ts +26 -4
- package/Culling/Helper/boundingInfoHelper.js +41 -10
- package/Culling/Helper/boundingInfoHelper.js.map +1 -1
- package/Culling/Helper/computeShaderBoundingHelper.d.ts +12 -3
- package/Culling/Helper/computeShaderBoundingHelper.js +164 -76
- package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
- package/Culling/Helper/transformFeedbackBoundingHelper.d.ts +11 -0
- package/Culling/Helper/transformFeedbackBoundingHelper.js +46 -14
- package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +1 -1
- package/Decorators/nodeDecorator.js +1 -1
- package/Decorators/nodeDecorator.js.map +1 -1
- package/DeviceInput/InputDevices/deviceEnums.d.ts +5 -5
- package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
- package/DeviceInput/eventFactory.js +3 -3
- package/DeviceInput/eventFactory.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +2 -2
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +1 -1
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +2 -2
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.dynamicTexture.js +2 -2
- package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +3 -3
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.multiview.js +2 -2
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.js +3 -3
- package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +4 -4
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +3 -3
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js +2 -2
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/Native/nativeShaderProcessors.js +1 -2
- package/Engines/Native/nativeShaderProcessors.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +2 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGL2ShaderProcessors.js +1 -2
- package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
- package/Engines/WebGL/webGLShaderProcessors.js +1 -2
- package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js +1 -2
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +2 -2
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +2 -2
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +2 -2
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +5 -5
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +2 -2
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +81 -82
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +60 -64
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +1 -2
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +13 -15
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +39 -39
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +6 -8
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -2
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js +15 -19
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +8 -10
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +26 -28
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +413 -416
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +50 -51
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +1 -2
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/abstractEngine.js +4 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +9 -9
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +5 -5
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +1 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/shaderStore.js +6 -7
- package/Engines/shaderStore.js.map +1 -1
- package/Engines/thinEngine.js +4 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +11 -0
- package/Engines/webgpuEngine.js +91 -72
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/deviceInputEvents.d.ts +1 -1
- package/Events/deviceInputEvents.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +1 -1
- package/FlowGraph/flowGraph.js +5 -5
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.js +2 -3
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +1 -1
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.js +3 -3
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.js +2 -3
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +3 -3
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/Gamepads/dualShockGamepad.d.ts +2 -2
- package/Gamepads/dualShockGamepad.js +14 -14
- package/Gamepads/dualShockGamepad.js.map +1 -1
- package/Gamepads/xboxGamepad.d.ts +2 -2
- package/Gamepads/xboxGamepad.js +14 -14
- package/Gamepads/xboxGamepad.js.map +1 -1
- package/Gizmos/gizmo.d.ts +2 -2
- package/Gizmos/gizmo.js +4 -4
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +2 -2
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/scaleGizmo.js +3 -3
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js +6 -6
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +3 -3
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +10 -11
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +8 -9
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +3 -4
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +2 -3
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +5 -6
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -5
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -8
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +4 -6
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -4
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +5 -6
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +5 -6
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +3 -4
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +7 -9
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +19 -21
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js +3 -4
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -3
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -29
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +5 -6
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +2 -3
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js +1 -2
- package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
- package/Materials/Node/Blocks/biPlanarBlock.js +3 -4
- package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +4 -5
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +3 -4
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +1 -2
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +1 -2
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -2
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +35 -35
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/modBlock.js +1 -2
- package/Materials/Node/Blocks/modBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.js +3 -3
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -2
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.js +1 -2
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +10 -12
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/voronoiNoiseBlock.js +3 -4
- package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.d.ts +1 -1
- package/Materials/Node/Blocks/waveBlock.js +4 -4
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +3 -4
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.d.ts +1 -1
- package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +3 -4
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +5 -6
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +2 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +10 -10
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +18 -19
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialConnectionPointCustomObject.js +3 -3
- package/Materials/Node/nodeMaterialConnectionPointCustomObject.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +3 -4
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +1 -1
- package/Materials/Textures/internalTexture.js +13 -13
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/ktx2decoderTypes.d.ts +1 -1
- package/Materials/Textures/ktx2decoderTypes.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -2
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/effect.functions.js +2 -3
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +3 -4
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +1 -2
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Materials/material.js +7 -9
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginEvent.d.ts +1 -1
- package/Materials/materialPluginEvent.js.map +1 -1
- package/Materials/materialPluginManager.js +9 -11
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.d.ts +1 -1
- package/Materials/meshDebugPluginMaterial.js +2 -2
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/shaderLanguage.d.ts +1 -1
- package/Materials/shaderLanguage.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +1 -2
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +2 -3
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.axis.d.ts +2 -2
- package/Maths/math.axis.js.map +1 -1
- package/Maths/math.path.d.ts +1 -1
- package/Maths/math.path.js +3 -3
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.vector.js +32 -6
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +2 -2
- package/Meshes/Builders/greasedLineBuilder.js +21 -23
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +3 -3
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +14 -14
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +2 -2
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +2 -2
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +3 -3
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +2 -2
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +2 -2
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +3 -3
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.js +2 -2
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.js +2 -2
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +2 -2
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +2 -2
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +2 -2
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +3 -3
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +2 -2
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +7 -7
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +49 -17
- package/Meshes/abstractMesh.js +128 -133
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +8 -0
- package/Meshes/geometry.js +17 -0
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +5 -8
- package/Meshes/instancedMesh.js +15 -9
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +7 -3
- package/Meshes/mesh.js +21 -13
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/meshSimplification.d.ts +1 -1
- package/Meshes/meshSimplification.js +1 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/meshSimplificationSceneComponent.js +2 -2
- package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
- package/Meshes/transformNode.js +7 -8
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/assetsManager.d.ts +1 -1
- package/Misc/assetsManager.js +9 -9
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +2 -2
- package/Misc/basis.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +1 -1
- package/Misc/copyTextureToTexture.js +1 -1
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/environmentTextureTools.js +3 -3
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/iInspectable.d.ts +1 -1
- package/Misc/iInspectable.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +2 -2
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/timer.d.ts +1 -1
- package/Misc/timer.js +5 -5
- package/Misc/timer.js.map +1 -1
- package/Misc/virtualJoystick.d.ts +1 -1
- package/Misc/virtualJoystick.js +16 -16
- package/Misc/virtualJoystick.js.map +1 -1
- package/Particles/particleSystem.js +3 -3
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.js +1 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/pointsCloudSystem.d.ts +1 -1
- package/Particles/pointsCloudSystem.js +14 -14
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/subEmitter.d.ts +1 -1
- package/Particles/subEmitter.js +1 -1
- package/Particles/subEmitter.js.map +1 -1
- package/Physics/physicsHelper.d.ts +2 -2
- package/Physics/physicsHelper.js +6 -7
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +4 -5
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +16 -8
- package/Physics/v2/IPhysicsEnginePlugin.js +9 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +96 -79
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +8 -9
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +14 -2
- package/Physics/v2/physicsBody.js +30 -11
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.js +8 -9
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Physics/v2/physicsMaterial.d.ts +1 -1
- package/Physics/v2/physicsMaterial.js.map +1 -1
- package/Physics/v2/physicsShape.js +9 -10
- package/Physics/v2/physicsShape.js.map +1 -1
- package/Physics/v2/ragdoll.js +11 -12
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -2
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.d.ts +1 -1
- package/PostProcesses/depthOfFieldEffect.js +3 -3
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/postProcess.js +2 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +1 -1
- package/PostProcesses/tonemapPostProcess.js +4 -4
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +10 -10
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Shaders/spriteMap.fragment.js +3 -2
- package/Shaders/spriteMap.fragment.js.map +1 -1
- package/ShadersWGSL/boundingInfo.compute.js +8 -8
- package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +2 -2
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +2 -2
- package/XR/features/WebXRHandTracking.js +76 -76
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js +2 -2
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +1 -1
- package/XR/features/WebXRNearInteraction.js +5 -5
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.js +2 -2
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/motionController/webXRProfiledMotionController.js +2 -2
- package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
- package/XR/webXRCamera.js +3 -4
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXREnterExitUI.js +3 -4
- package/XR/webXREnterExitUI.js.map +1 -1
- package/XR/webXRExperienceHelper.js +12 -13
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.d.ts +1 -1
- package/XR/webXRManagedOutputCanvas.js +15 -6
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js +2 -2
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRTypes.d.ts +2 -2
- package/XR/webXRTypes.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -1
- package/scene.js +4 -4
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../dev/core/src/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,
|
|
1
|
+
{"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../dev/core/src/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAkB,oBAQjB;AARD,WAAkB,oBAAoB;IAClC,WAAW;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,gBAAgB;IAChB,yEAAS,CAAA;AACb,CAAC,EARiB,oBAAoB,KAApB,oBAAoB,QAQrC;AA+QD;;GAEG;AACH,MAAM,OAAO,cAAc;;AACvB;;GAEG;AACW,8BAAe,GAAG,IAAI,CAAC;AAErC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC","sourcesContent":["import type { PointerInput } from \"../DeviceInput/InputDevices/deviceEnums\";\r\n\r\n/**\r\n * Event Types\r\n */\r\nexport const enum DeviceInputEventType {\r\n // Pointers\r\n /** PointerMove */\r\n PointerMove,\r\n /** PointerDown */\r\n PointerDown,\r\n /** PointerUp */\r\n PointerUp,\r\n}\r\n\r\n/**\r\n * Native friendly interface for Event Object\r\n */\r\nexport interface IUIEvent {\r\n /**\r\n * Input array index\r\n */\r\n inputIndex: number;\r\n\r\n /**\r\n * Current target for an event\r\n */\r\n currentTarget?: any;\r\n\r\n /**\r\n * Alias for target\r\n * @deprecated Use target instead\r\n */\r\n srcElement?: any;\r\n\r\n /**\r\n * Type of event\r\n */\r\n type: string;\r\n\r\n /**\r\n * Reference to object where object was dispatched\r\n */\r\n target: any;\r\n\r\n /**\r\n * Tells user agent what to do when not explicitly handled\r\n */\r\n preventDefault: () => void;\r\n}\r\n\r\n/**\r\n * Native friendly interface for KeyboardEvent Object\r\n */\r\nexport interface IKeyboardEvent extends IUIEvent {\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Unicode value of character pressed\r\n * @deprecated Required for event, use keyCode instead.\r\n */\r\n charCode?: number;\r\n\r\n /**\r\n * Code for key based on layout\r\n */\r\n code: string;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * String representation of key\r\n */\r\n key: string;\r\n /**\r\n * ASCII value of key\r\n * @deprecated Used with DeviceSourceManager\r\n */\r\n keyCode: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Native friendly interface for MouseEvent Object\r\n */\r\nexport interface IMouseEvent extends IUIEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical>;\r\n\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Value of single mouse button pressed\r\n */\r\n button: number;\r\n\r\n /**\r\n * Value of all mouse buttons pressed\r\n */\r\n buttons: number;\r\n\r\n /**\r\n * Current X coordinate\r\n */\r\n clientX: number;\r\n\r\n /**\r\n * Current Y coordinate\r\n */\r\n clientY: number;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * Provides current click count\r\n */\r\n detail?: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n movementX: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n movementY: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n mozMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n mozMovementY?: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n msMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n msMovementY?: number;\r\n\r\n /**\r\n * Current coordinate of X within container\r\n */\r\n offsetX: number;\r\n\r\n /**\r\n * Current coordinate of Y within container\r\n */\r\n offsetY: number;\r\n\r\n /**\r\n * Horizontal coordinate of event\r\n */\r\n pageX: number;\r\n\r\n /**\r\n * Vertical coordinate of event\r\n */\r\n pageY: number;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n webkitMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n webkitMovementY?: number;\r\n\r\n /**\r\n * Alias of clientX\r\n */\r\n x: number;\r\n\r\n /**\r\n * Alias of clientY\r\n */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Native friendly interface for PointerEvent Object\r\n */\r\nexport interface IPointerEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically and mouse wheel values\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>;\r\n\r\n /**\r\n * Pointer Event ID\r\n */\r\n pointerId: number;\r\n\r\n /**\r\n * Type of pointer\r\n */\r\n pointerType: string;\r\n}\r\n\r\n/**\r\n * Native friendly interface for WheelEvent Object\r\n */\r\nexport interface IWheelEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events that can only be used with mouse wheel\r\n */\r\n inputIndex: PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ;\r\n\r\n /**\r\n * Units for delta value\r\n */\r\n deltaMode: number;\r\n\r\n /**\r\n * Horizontal scroll delta\r\n */\r\n deltaX: number;\r\n\r\n /**\r\n * Vertical scroll delta\r\n */\r\n deltaY: number;\r\n\r\n /**\r\n * Z-Axis scroll delta\r\n */\r\n deltaZ: number;\r\n\r\n /**\r\n * WheelDelta (From MouseWheel Event)\r\n * @deprecated\r\n */\r\n wheelDelta?: number;\r\n}\r\n\r\n/**\r\n * Constants used for Events\r\n */\r\nexport class EventConstants {\r\n /**\r\n * Pixel delta for Wheel Events (Default)\r\n */\r\n public static DOM_DELTA_PIXEL = 0x00;\r\n\r\n /**\r\n * Line delta for Wheel Events\r\n */\r\n public static DOM_DELTA_LINE = 0x01;\r\n\r\n /**\r\n * Page delta for Wheel Events\r\n */\r\n public static DOM_DELTA_PAGE = 0x02;\r\n}\r\n"]}
|
package/FlowGraph/flowGraph.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { FlowGraphSignalConnection } from "./flowGraphSignalConnection";
|
|
|
7
7
|
import type { FlowGraphDataConnection } from "./flowGraphDataConnection";
|
|
8
8
|
import type { ISerializedFlowGraph, IObjectAccessor } from "./typeDefinitions";
|
|
9
9
|
import type { IPathToObjectConverter } from "../ObjectModel/objectModelInterfaces";
|
|
10
|
-
export declare enum FlowGraphState {
|
|
10
|
+
export declare const enum FlowGraphState {
|
|
11
11
|
/**
|
|
12
12
|
* The graph is stopped
|
|
13
13
|
*/
|
package/FlowGraph/flowGraph.js
CHANGED
|
@@ -35,7 +35,7 @@ export class FlowGraph {
|
|
|
35
35
|
/**
|
|
36
36
|
* The state of the graph
|
|
37
37
|
*/
|
|
38
|
-
this.state = FlowGraphState.Stopped
|
|
38
|
+
this.state = 0 /* FlowGraphState.Stopped */;
|
|
39
39
|
this._scene = params.scene;
|
|
40
40
|
this._coordinator = params.coordinator;
|
|
41
41
|
this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => this.dispose());
|
|
@@ -69,10 +69,10 @@ export class FlowGraph {
|
|
|
69
69
|
* Starts the flow graph. Initializes the event blocks and starts listening to events.
|
|
70
70
|
*/
|
|
71
71
|
start() {
|
|
72
|
-
if (this.state === FlowGraphState.Started) {
|
|
72
|
+
if (this.state === 1 /* FlowGraphState.Started */) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
this.state = FlowGraphState.Started
|
|
75
|
+
this.state = 1 /* FlowGraphState.Started */;
|
|
76
76
|
if (this._executionContexts.length === 0) {
|
|
77
77
|
this.createContext();
|
|
78
78
|
}
|
|
@@ -109,10 +109,10 @@ export class FlowGraph {
|
|
|
109
109
|
* Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.
|
|
110
110
|
*/
|
|
111
111
|
dispose() {
|
|
112
|
-
if (this.state === FlowGraphState.Stopped) {
|
|
112
|
+
if (this.state === 0 /* FlowGraphState.Stopped */) {
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
this.state = FlowGraphState.Stopped
|
|
115
|
+
this.state = 0 /* FlowGraphState.Stopped */;
|
|
116
116
|
for (const context of this._executionContexts) {
|
|
117
117
|
context._clearPendingBlocks();
|
|
118
118
|
}
|
|
@@ -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;AAsCD;;;;;;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,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED;;;OAGG;IACI,aAAa;QAChB,MAAM,OAAO,GAAG,IA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AAE,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 * @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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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 const 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"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RandomGUID } from "../Misc/guid.js";
|
|
2
|
-
import { FlowGraphConnectionType } from "./flowGraphConnection.js";
|
|
3
2
|
import { FlowGraphDataConnection } from "./flowGraphDataConnection.js";
|
|
4
3
|
import { Tools } from "../Misc/tools.js";
|
|
5
4
|
import { defaultValueParseFunction, defaultValueSerializationFunction, needsPathConverter } from "./serialization.js";
|
|
@@ -40,7 +39,7 @@ export class FlowGraphBlock {
|
|
|
40
39
|
* @returns the created connection
|
|
41
40
|
*/
|
|
42
41
|
registerDataInput(name, richType) {
|
|
43
|
-
const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input
|
|
42
|
+
const input = new FlowGraphDataConnection(name, 0 /* FlowGraphConnectionType.Input */, this, richType);
|
|
44
43
|
this.dataInputs.push(input);
|
|
45
44
|
return input;
|
|
46
45
|
}
|
|
@@ -51,7 +50,7 @@ export class FlowGraphBlock {
|
|
|
51
50
|
* @returns the created connection
|
|
52
51
|
*/
|
|
53
52
|
registerDataOutput(name, richType) {
|
|
54
|
-
const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output
|
|
53
|
+
const output = new FlowGraphDataConnection(name, 1 /* FlowGraphConnectionType.Output */, this, richType);
|
|
55
54
|
this.dataOutputs.push(output);
|
|
56
55
|
return output;
|
|
57
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;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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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 * @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"]}
|
|
1
|
+
{"version":3,"file":"flowGraphBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,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,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,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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 * @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"]}
|
|
@@ -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,
|
|
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,IAAkB,uBAGjB;AAHD,WAAkB,uBAAuB;IACrC,uEAAK,CAAA;IACL,yEAAM,CAAA;AACV,CAAC,EAHiB,uBAAuB,KAAvB,uBAAuB,QAGxC;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;QACj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e,CAAC;QAC3D,mBAAmB,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC3C,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACpD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,eAAe,EAAE;YACtC,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SAC9D;IACL,CAAC;IAED;;OAEG;IACI,YAAY;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 const 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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
2
|
-
import { FlowGraphConnection
|
|
2
|
+
import { FlowGraphConnection } from "./flowGraphConnection.js";
|
|
3
3
|
import { RichType } from "./flowGraphRichTypes.js";
|
|
4
4
|
/**
|
|
5
5
|
* @experimental
|
|
@@ -30,7 +30,7 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
30
30
|
* @returns true if the connection is singular
|
|
31
31
|
*/
|
|
32
32
|
_isSingularConnection() {
|
|
33
|
-
return this.connectionType === FlowGraphConnectionType.Input
|
|
33
|
+
return this.connectionType === 0 /* FlowGraphConnectionType.Input */;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Set the value of the connection in a specific context.
|
|
@@ -61,7 +61,7 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
61
61
|
* @returns the value of the connection
|
|
62
62
|
*/
|
|
63
63
|
getValue(context) {
|
|
64
|
-
if (this.connectionType === FlowGraphConnectionType.Output) {
|
|
64
|
+
if (this.connectionType === 1 /* FlowGraphConnectionType.Output */) {
|
|
65
65
|
context._notifyExecuteNode(this._ownerBlock);
|
|
66
66
|
this._ownerBlock._updateOutputs(context);
|
|
67
67
|
return this._getValueOrDefault(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD;;;;;;GAMG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAC3G;;;;;;OAMG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B;IAC1B;;OAEG;IACI,QAAqB;QAE5B,KAAK,CAAC,I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C,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAU,KAAK,CAAC,mBAAwB,EAAE,UAA0B;QAC7E,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QACvE,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { RichType } from \"./flowGraphRichTypes\";\r\n/**\r\n * @experimental\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n /**\r\n * Create a new data connection point.\r\n * @param name\r\n * @param connectionType\r\n * @param ownerBlock\r\n * @param richType\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n /**\r\n * the type of the data in this block\r\n */\r\n public richType: RichType<T>\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n context._setConnectionValue(this, value);\r\n }\r\n\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n public override connectTo(point: FlowGraphDataConnection<T>): void {\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n if (context._hasConnectionValue(this)) {\r\n return context._getConnectionValue(this);\r\n } else {\r\n return this.richType.defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n return this._getValueOrDefault(context);\r\n }\r\n\r\n if (!this.isConnected()) {\r\n return this._getValueOrDefault(context);\r\n } else {\r\n return this._connectedPoint[0].getValue(context);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the object.\r\n */\r\n public override getClassName(): string {\r\n return \"FGDataConnection\";\r\n }\r\n\r\n /**\r\n * Serializes this object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n }\r\n\r\n /**\r\n * Parses a data connection from a serialized 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 override Parse(serializationObject: any, ownerBlock: FlowGraphBlock): FlowGraphDataConnection<any> {\r\n const obj = FlowGraphConnection.Parse(serializationObject, ownerBlock);\r\n obj.richType = RichType.Parse(serializationObject.richType);\r\n return obj;\r\n }\r\n}\r\n\r\nRegisterClass(\"FGDataConnection\", FlowGraphDataConnection);\r\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FlowGraphBlock } from "./flowGraphBlock.js";
|
|
2
|
-
import { FlowGraphConnectionType } from "./flowGraphConnection.js";
|
|
3
2
|
import { FlowGraphSignalConnection } from "./flowGraphSignalConnection.js";
|
|
4
3
|
/**
|
|
5
4
|
* @experimental
|
|
@@ -14,12 +13,12 @@ export class FlowGraphExecutionBlock extends FlowGraphBlock {
|
|
|
14
13
|
this.in = this._registerSignalInput("in");
|
|
15
14
|
}
|
|
16
15
|
_registerSignalInput(name) {
|
|
17
|
-
const input = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Input
|
|
16
|
+
const input = new FlowGraphSignalConnection(name, 0 /* FlowGraphConnectionType.Input */, this);
|
|
18
17
|
this.signalInputs.push(input);
|
|
19
18
|
return input;
|
|
20
19
|
}
|
|
21
20
|
_registerSignalOutput(name) {
|
|
22
|
-
const output = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Output
|
|
21
|
+
const output = new FlowGraphSignalConnection(name, 1 /* FlowGraphConnectionType.Output */, this);
|
|
23
22
|
this.signalOutputs.push(output);
|
|
24
23
|
return output;
|
|
25
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphExecutionBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"flowGraphExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphExecutionBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;GAIG;AACH,MAAM,OAAgB,uBAAwB,SAA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ClE;iBAAM;gBACH,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;aACzJ;SACJ;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,kBAAkB,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * @experimental\r\n * A block that executes some action. Always has an input signal (which is not used by event blocks).\r\n * Can have one or more output signals.\r\n */\r\nexport abstract class FlowGraphExecutionBlock extends FlowGraphBlock {\r\n /**\r\n * Input connection: The input signal of the block.\r\n */\r\n public readonly in: FlowGraphSignalConnection;\r\n /**\r\n * Input connections that activate the block.\r\n */\r\n public signalInputs: FlowGraphSignalConnection[];\r\n /**\r\n * Output connections that can activate downstream blocks.\r\n */\r\n public signalOutputs: FlowGraphSignalConnection[];\r\n\r\n protected constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.signalInputs = [];\r\n this.signalOutputs = [];\r\n this.in = this._registerSignalInput(\"in\");\r\n }\r\n\r\n /**\r\n * @internal\r\n * Executes the flow graph execution block.\r\n */\r\n public abstract _execute(context: FlowGraphContext, callingSignal: FlowGraphSignalConnection): void;\r\n\r\n protected _registerSignalInput(name: string): FlowGraphSignalConnection {\r\n const input = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Input, this);\r\n this.signalInputs.push(input);\r\n return input;\r\n }\r\n\r\n protected _registerSignalOutput(name: string): FlowGraphSignalConnection {\r\n const output = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Output, this);\r\n this.signalOutputs.push(output);\r\n return output;\r\n }\r\n\r\n /**\r\n * Given a name of a signal input, return that input if it exists\r\n * @param name the name of the input\r\n * @returns if the input exists, the input. Otherwise, undefined.\r\n */\r\n public getSignalInput(name: string): FlowGraphSignalConnection | undefined {\r\n return this.signalInputs.find((input) => input.name === name);\r\n }\r\n\r\n /**\r\n * Given a name of a signal output, return that input if it exists\r\n * @param name the name of the input\r\n * @returns if the input exists, the input. Otherwise, undefined.\r\n */\r\n public getSignalOutput(name: string): FlowGraphSignalConnection | undefined {\r\n return this.signalOutputs.find((output) => output.name === name);\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @param serializationObject the object to serialize in\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.signalInputs = [];\r\n serializationObject.signalOutputs = [];\r\n for (const input of this.signalInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.signalInputs.push(serializedInput);\r\n }\r\n for (const output of this.signalOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.signalOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n /**\r\n * Deserializes from an object\r\n * @param serializationObject the object to deserialize from\r\n */\r\n public deserialize(serializationObject: any) {\r\n for (let i = 0; i < serializationObject.signalInputs.length; i++) {\r\n const signalInput = this.getSignalInput(serializationObject.signalInputs[i].name);\r\n if (signalInput) {\r\n signalInput.deserialize(serializationObject.signalInputs[i]);\r\n } else {\r\n throw new Error(\"Could not find signal input with name \" + serializationObject.signalInputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n for (let i = 0; i < serializationObject.signalOutputs.length; i++) {\r\n const signalOutput = this.getSignalOutput(serializationObject.signalOutputs[i].name);\r\n if (signalOutput) {\r\n signalOutput.deserialize(serializationObject.signalOutputs[i]);\r\n } else {\r\n throw new Error(\"Could not find signal output with name \" + serializationObject.signalOutputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"FGExecutionBlock\";\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FlowGraphConnection
|
|
1
|
+
import { FlowGraphConnection } from "./flowGraphConnection.js";
|
|
2
2
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
3
3
|
/**
|
|
4
4
|
* @experimental
|
|
@@ -14,13 +14,13 @@ export class FlowGraphSignalConnection extends FlowGraphConnection {
|
|
|
14
14
|
* @returns true if the connection is singular
|
|
15
15
|
*/
|
|
16
16
|
_isSingularConnection() {
|
|
17
|
-
return this.connectionType === FlowGraphConnectionType.Output
|
|
17
|
+
return this.connectionType === 1 /* FlowGraphConnectionType.Output */;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
_activateSignal(context) {
|
|
23
|
-
if (this.connectionType === FlowGraphConnectionType.Input) {
|
|
23
|
+
if (this.connectionType === 0 /* FlowGraphConnectionType.Input */) {
|
|
24
24
|
context._notifyExecuteNode(this._ownerBlock);
|
|
25
25
|
this._ownerBlock._execute(context, this);
|
|
26
26
|
context._increaseExecutionId();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphSignalConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"flowGraphSignalConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAuE;IAClH;;;;;OAKG;IACa,qBAAqB;QACjC,OAAO,IAAI,CAAC,cAAc,2CAAmC,CAAC;IAClE,CAAC;IAED;;OAEG;IACI,eAAe,CAAC,OAAyB;QAC5C,IAAI,IAAI,CAAC,cAAc,0CAAkC,EAAE;YACvD,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO,CAAC,oBAAoB,EAAE,CAAC;SAClC;aAAM;YACH,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;SACrD;IACL,CAAC;CACJ;AAED,aAAa,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * @experimental\r\n * Represents a connection point for a signal.\r\n * When an output point is activated, it will activate the connected input point.\r\n * When an input point is activated, it will execute the block it belongs to.\r\n */\r\nexport class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {\r\n /**\r\n * @internal\r\n * A signal input can be connected to more than one signal output,\r\n * but a signal output can only connect to one signal input\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Output;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _activateSignal(context: FlowGraphContext): void {\r\n if (this.connectionType === FlowGraphConnectionType.Input) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._execute(context, this);\r\n context._increaseExecutionId();\r\n } else {\r\n this._connectedPoint[0]?._activateSignal(context);\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"FlowGraphSignalConnection\", FlowGraphSignalConnection);\r\n"]}
|
|
@@ -3,7 +3,7 @@ import { Gamepad } from "./gamepad";
|
|
|
3
3
|
/**
|
|
4
4
|
* Defines supported buttons for DualShock compatible gamepads
|
|
5
5
|
*/
|
|
6
|
-
export declare enum DualShockButton {
|
|
6
|
+
export declare const enum DualShockButton {
|
|
7
7
|
/** Cross */
|
|
8
8
|
Cross = 0,
|
|
9
9
|
/** Circle */
|
|
@@ -26,7 +26,7 @@ export declare enum DualShockButton {
|
|
|
26
26
|
RightStick = 11
|
|
27
27
|
}
|
|
28
28
|
/** Defines values for DualShock DPad */
|
|
29
|
-
export declare enum DualShockDpad {
|
|
29
|
+
export declare const enum DualShockDpad {
|
|
30
30
|
/** Up */
|
|
31
31
|
Up = 12,
|
|
32
32
|
/** Down */
|