@babylonjs/core 6.37.1 → 6.38.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/Behaviors/Meshes/baseSixDofDragBehavior.js +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +26 -6
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Bones/skeleton.js +2 -2
- package/Bones/skeleton.js.map +1 -1
- package/Buffers/buffer.align.js +4 -1
- package/Buffers/buffer.align.js.map +1 -1
- package/Buffers/buffer.d.ts +10 -3
- package/Buffers/buffer.js +34 -5
- package/Buffers/buffer.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.d.ts +1 -3
- package/Engines/Extensions/engine.cubeTexture.js +1 -3
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +6 -17
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/ICanvas.d.ts +60 -0
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/IPipelineContext.d.ts +3 -3
- package/Engines/IPipelineContext.js.map +1 -1
- package/Engines/Native/nativePipelineContext.d.ts +4 -5
- package/Engines/Native/nativePipelineContext.js +2 -9
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/Native/validatedNativeDataStream.d.ts +3 -0
- package/Engines/Native/validatedNativeDataStream.js +3 -0
- package/Engines/Native/validatedNativeDataStream.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +11 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js +27 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +8 -4
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +3 -1
- package/Engines/WebGPU/webgpuConstants.js +2 -0
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +3 -0
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/engine.d.ts +10 -45
- package/Engines/nativeEngine.d.ts +3 -1
- package/Engines/nativeEngine.js +29 -30
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +7 -1
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +3 -3
- package/Engines/thinEngine.js +16 -8
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +2 -2
- package/Engines/webgpuEngine.js +7 -13
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
- package/FlowGraph/Blocks/Data/Logic/index.js +0 -1
- package/FlowGraph/Blocks/Data/Logic/index.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +327 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +465 -74
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +2 -2
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +7 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +7 -6
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +14 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +4 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +16 -0
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +14 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphInteger.d.ts +62 -0
- package/FlowGraph/flowGraphInteger.js +76 -0
- package/FlowGraph/flowGraphInteger.js.map +1 -0
- package/FlowGraph/flowGraphPathConverterComponent.d.ts +2 -1
- package/FlowGraph/flowGraphPathConverterComponent.js +3 -3
- package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +2 -0
- package/FlowGraph/flowGraphRichTypes.js +5 -0
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/serialization.js +8 -1
- package/FlowGraph/serialization.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +1 -1
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.d.ts +9 -2
- package/Gizmos/cameraGizmo.js +29 -10
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.js +1 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Lights/shadowLight.d.ts +2 -2
- package/Lights/shadowLight.js +1 -1
- package/Lights/shadowLight.js.map +1 -1
- package/Lights/spotLight.js +1 -1
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Node/Blocks/addBlock.js +1 -1
- package/Materials/Node/Blocks/addBlock.js.map +1 -1
- package/Materials/Node/Blocks/divideBlock.js +1 -1
- package/Materials/Node/Blocks/divideBlock.js.map +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/subtractBlock.js +1 -1
- package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +1 -0
- package/Materials/PBR/pbrMaterial.js +1 -0
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +1 -1
- package/Materials/Textures/baseTexture.js +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.js +5 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +1 -1
- package/Materials/Textures/multiRenderTarget.js +4 -4
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/videoTexture.js +2 -0
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/effect.js +2 -1
- package/Materials/effect.js.map +1 -1
- package/Materials/materialPluginManager.d.ts +1 -1
- package/Materials/materialPluginManager.js.map +1 -1
- package/Meshes/Node/Blocks/geometryArcTan2Block.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryArcTan2Block.js +81 -0
- package/Meshes/Node/Blocks/geometryArcTan2Block.js.map +1 -0
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +33 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js +101 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryCrossBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryCrossBlock.js +76 -0
- package/Meshes/Node/Blocks/geometryCrossBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryLerpBlock.d.ts +34 -0
- package/Meshes/Node/Blocks/geometryLerpBlock.js +90 -0
- package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryModBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryModBlock.js +82 -0
- package/Meshes/Node/Blocks/geometryModBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryNLerpBlock.d.ts +34 -0
- package/Meshes/Node/Blocks/geometryNLerpBlock.js +96 -0
- package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryPowBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryPowBlock.js +82 -0
- package/Meshes/Node/Blocks/geometryPowBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.d.ts +34 -0
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +91 -0
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryStepBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryStepBlock.js +84 -0
- package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +19 -15
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +37 -17
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/index.d.ts +9 -0
- package/Meshes/Node/index.js +9 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/geometry.js +8 -5
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/thinInstanceMesh.d.ts +1 -1
- package/Meshes/thinInstanceMesh.js +2 -2
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Navigation/INavigationEngine.d.ts +10 -1
- package/Navigation/INavigationEngine.js.map +1 -1
- package/Navigation/Plugins/recastJSPlugin.d.ts +20 -0
- package/Navigation/Plugins/recastJSPlugin.js +43 -8
- package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
- package/ObjectModel/objectModelInterfaces.d.ts +5 -0
- package/ObjectModel/objectModelInterfaces.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -0
- package/Particles/gpuParticleSystem.js +10 -3
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Physics/v2/ragdoll.js +4 -0
- package/Physics/v2/ragdoll.js.map +1 -1
- package/Rendering/GaussianSplatting/gaussianSplatting.d.ts +6 -0
- package/Rendering/GaussianSplatting/gaussianSplatting.js +124 -39
- package/Rendering/GaussianSplatting/gaussianSplatting.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSM.d.ts +54 -0
- package/Rendering/GlobalIllumination/giRSM.js +54 -0
- package/Rendering/GlobalIllumination/giRSM.js.map +1 -0
- package/Rendering/GlobalIllumination/giRSMManager.d.ts +256 -0
- package/Rendering/GlobalIllumination/giRSMManager.js +715 -0
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -0
- package/Rendering/GlobalIllumination/index.d.ts +2 -0
- package/Rendering/GlobalIllumination/index.js +3 -0
- package/Rendering/GlobalIllumination/index.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderer.js +20 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/index.d.ts +2 -0
- package/Rendering/index.js +2 -0
- package/Rendering/index.js.map +1 -1
- package/Rendering/prePassRendererSceneComponent.js +1 -4
- package/Rendering/prePassRendererSceneComponent.js.map +1 -1
- package/Rendering/reflectiveShadowMap.d.ts +152 -0
- package/Rendering/reflectiveShadowMap.js +389 -0
- package/Rendering/reflectiveShadowMap.js.map +1 -0
- package/Shaders/bilateralBlur.fragment.d.ts +5 -0
- package/Shaders/bilateralBlur.fragment.js +20 -0
- package/Shaders/bilateralBlur.fragment.js.map +1 -0
- package/Shaders/bilateralBlurQuality.fragment.d.ts +5 -0
- package/Shaders/bilateralBlurQuality.fragment.js +20 -0
- package/Shaders/bilateralBlurQuality.fragment.js.map +1 -0
- package/Shaders/rsmFullGlobalIllumination.fragment.d.ts +5 -0
- package/Shaders/rsmFullGlobalIllumination.fragment.js +28 -0
- package/Shaders/rsmFullGlobalIllumination.fragment.js.map +1 -0
- package/Shaders/rsmGlobalIllumination.fragment.d.ts +5 -0
- package/Shaders/rsmGlobalIllumination.fragment.js +33 -0
- package/Shaders/rsmGlobalIllumination.fragment.js.map +1 -0
- package/XR/features/WebXRControllerPointerSelection.js +1 -0
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +9 -1
- package/XR/features/WebXRControllerTeleportation.js +3 -0
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/webXRCamera.d.ts +2 -0
- package/XR/webXRCamera.js +2 -0
- package/XR/webXRCamera.js.map +1 -1
- package/node.d.ts +3 -0
- package/node.js +3 -0
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +1 -1
- package/scene.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.d.ts +0 -60
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js +0 -104
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js.map +0 -1
|
@@ -7,6 +7,9 @@ import type { IFlowGraphBlockConfiguration } from "../../flowGraphBlock";
|
|
|
7
7
|
* The variable block configuration.
|
|
8
8
|
*/
|
|
9
9
|
export interface IFlowGraphSetVariableBlockConfiguration extends IFlowGraphBlockConfiguration {
|
|
10
|
+
/**
|
|
11
|
+
* The name of the variable to set.
|
|
12
|
+
*/
|
|
10
13
|
variableName: string;
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphSetVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,mCAA4B;
|
|
1
|
+
{"version":3,"file":"flowGraphSetVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,mCAA4B;AAcpD;;;GAGG;AACH,MAAM,OAAO,yBAA6B,SAAQ,oCAAoC;IAMlF,YAAmB,MAA+C;QAC9D,KAAK,CAAC,MAAM,CAAC,CAAC;QADC,WAAM,GAAN,MAAM,CAAyC;QAG9D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QACnD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,yBAAyB,CAAC,SAAS,CAAC;IAC/C,CAAC;;AAEa,mCAAS,GAAG,oBAAoB,CAAC;AAEnD,aAAa,CAAC,yBAAyB,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphExecutionBlockWithOutSignal\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n * The variable block configuration.\r\n */\r\nexport interface IFlowGraphSetVariableBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The name of the variable to set.\r\n */\r\n variableName: string;\r\n}\r\n\r\n/**\r\n * Block to set a variable.\r\n * @experimental\r\n */\r\nexport class FlowGraphSetVariableBlock<T> extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The value to set on the variable.\r\n */\r\n public readonly input: FlowGraphDataConnection<T>;\r\n\r\n constructor(public config: IFlowGraphSetVariableBlockConfiguration) {\r\n super(config);\r\n\r\n this.input = this.registerDataInput(config.variableName, RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const variableNameValue = this.config.variableName;\r\n const inputValue = this.input.getValue(context);\r\n context.setVariable(variableNameValue, inputValue);\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public getClassName(): string {\r\n return FlowGraphSetVariableBlock.ClassName;\r\n }\r\n\r\n public static ClassName = \"FGSetVariableBlock\";\r\n}\r\nRegisterClass(FlowGraphSetVariableBlock.ClassName, FlowGraphSetVariableBlock);\r\n"]}
|
|
@@ -11,10 +11,26 @@ export declare enum FlowGraphConnectionType {
|
|
|
11
11
|
* @experimental
|
|
12
12
|
*/
|
|
13
13
|
export interface IConnectable {
|
|
14
|
+
/**
|
|
15
|
+
* A uniquely identifying string for the connection.
|
|
16
|
+
*/
|
|
14
17
|
uniqueId: string;
|
|
18
|
+
/**
|
|
19
|
+
* An array of the points that this point is connected to.
|
|
20
|
+
*/
|
|
15
21
|
_connectedPoint: Array<IConnectable>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns if the connection can only be connected to one other point.
|
|
24
|
+
*/
|
|
16
25
|
_isSingularConnection(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The type of the connection
|
|
28
|
+
*/
|
|
17
29
|
_connectionType: FlowGraphConnectionType;
|
|
30
|
+
/**
|
|
31
|
+
* Connect this point to another point.
|
|
32
|
+
* @param point the point to connect to.
|
|
33
|
+
*/
|
|
18
34
|
connectTo(point: IConnectable): void;
|
|
19
35
|
}
|
|
20
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,uEAAK,CAAA;IACL,yEAAM,CAAA;AACV,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;
|
|
1
|
+
{"version":3,"file":"flowGraphConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,uEAAK,CAAA;IACL,yEAAM,CAAA;AACV,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;AA6BD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IA0B5B,YACI,IAAY,EACZ,eAAwC;IACxC,eAAe,CAAQ,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;QA5B9C,gBAAgB;QACT,oBAAe,GAAwB,EAAE,CAAC;QACjD;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAY/B;;;WAGG;QACH,8CAA8C;QAC9C,6DAA6D;QACtD,sBAAiB,GAAU,EAAE,CAAC;QAOjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe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AAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SAC9D;IACL,CAAC;IAEM,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 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 points together.\r\n * @param point\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 */\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 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\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\r\n * @param ownerBlock\r\n * @returns\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"]}
|
|
@@ -20,8 +20,22 @@ export interface IFlowGraphContextConfiguration {
|
|
|
20
20
|
*/
|
|
21
21
|
readonly coordinator: FlowGraphCoordinator;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @experimental
|
|
25
|
+
* Options for parsing a context.
|
|
26
|
+
*/
|
|
23
27
|
export interface IFlowGraphContextParseOptions {
|
|
28
|
+
/**
|
|
29
|
+
* A function that parses a value from a serialization object.
|
|
30
|
+
* @param key the key of the value
|
|
31
|
+
* @param serializationObject the object containing the value
|
|
32
|
+
* @param scene the current scene
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
24
35
|
readonly valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;
|
|
36
|
+
/**
|
|
37
|
+
* The graph that the context is being parsed in.
|
|
38
|
+
*/
|
|
25
39
|
readonly graph: FlowGraph;
|
|
26
40
|
}
|
|
27
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EAAE,yBAAyB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAqBhD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAoCzB,YAAY,MAAsC;QAnClD;;WAEG;QAEI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAC/B;;WAEG;QACK,mBAAc,GAA2B,EAAE,CAAC;QACpD;;WAEG;QACK,wBAAmB,GAA2B,EAAE,CAAC;QACzD;;WAEG;QACK,sBAAiB,GAA2B,EAAE,CAAC;QAKvD;;WAEG;QACK,mBAAc,GAAmC,EAAE,CAAC;QAC5D;;;WAGG;QACK,iBAAY,GAAG,CAAC,CAAC;QACzB;;WAEG;QACI,6BAAwB,GAA+B,IAAI,UAAU,EAAkB,CAAC;QAG3F,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAY;QAC3B,OAAO,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAY,EAAE,KAAU;QACvC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAY;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CA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B","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\nimport type { ISerializedFlowGraphContext } from \"./typeDefinitions\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction } from \"./serialization\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n}\r\n\r\nexport interface IFlowGraphContextParseOptions {\r\n readonly valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n }\r\n\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\r\n * @returns\r\n */\r\n public static Parse(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions): FlowGraphContext {\r\n const result = options.graph.createContext();\r\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables[key] = value;\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues[key] = value;\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphContext.js","sour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,CAAC,CAAC;SACjG;QACD,mBAAmB,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC3C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,iBAAiB,EAAE;YACtC,0BAA0B,CAAC,GAAG,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;SACvG;IACL,CAAC;IAEM,YAAY;QACf,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,mBAAgD,EAAE,OAAsC;;QACxG,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,kBAAkB,mCAAI,yBAAyB,CAAC;QACnF,MAAM,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAC/C,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,cAAc,EAAE;YAClD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACvG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACtC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACrD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC1G,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACzC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAhQU;IADN,SAAS,EAAE;kDACmB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\nimport type { ISerializedFlowGraphContext } from \"./typeDefinitions\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction } from \"./serialization\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Options for parsing a context.\r\n */\r\nexport interface IFlowGraphContextParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the value\r\n * @param serializationObject the object containing the value\r\n * @param scene the current scene\r\n * @returns\r\n */\r\n readonly valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any;\r\n /**\r\n * The graph that the context is being parsed in.\r\n */\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n }\r\n\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\r\n * @returns\r\n */\r\n public static Parse(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions): FlowGraphContext {\r\n const result = options.graph.createContext();\r\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables[key] = value;\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues[key] = value;\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @experimental
|
|
3
|
+
* Class that represents an integer value.
|
|
4
|
+
*/
|
|
5
|
+
export declare class FlowGraphInteger {
|
|
6
|
+
/**
|
|
7
|
+
* The value of the integer. Its type
|
|
8
|
+
* is a javascript number. Shouldn't be
|
|
9
|
+
* directly modified - it is populated by
|
|
10
|
+
* the constructor.
|
|
11
|
+
*/
|
|
12
|
+
readonly value: number;
|
|
13
|
+
constructor(value: number);
|
|
14
|
+
/**
|
|
15
|
+
* Converts a float to an integer.
|
|
16
|
+
* @param n the float to convert
|
|
17
|
+
* @returns the result of n | 0 - converting it to a int
|
|
18
|
+
*/
|
|
19
|
+
private _toInt;
|
|
20
|
+
/**
|
|
21
|
+
* Adds two integers together.
|
|
22
|
+
* @param other the other integer to add
|
|
23
|
+
* @returns a FlowGraphInteger with the result of the addition
|
|
24
|
+
*/
|
|
25
|
+
add(other: FlowGraphInteger): FlowGraphInteger;
|
|
26
|
+
/**
|
|
27
|
+
* Subtracts two integers.
|
|
28
|
+
* @param other the other integer to subtract
|
|
29
|
+
* @returns a FlowGraphInteger with the result of the subtraction
|
|
30
|
+
*/
|
|
31
|
+
subtract(other: FlowGraphInteger): FlowGraphInteger;
|
|
32
|
+
/**
|
|
33
|
+
* Multiplies two integers.
|
|
34
|
+
* @param other the other integer to multiply
|
|
35
|
+
* @returns a FlowGraphInteger with the result of the multiplication
|
|
36
|
+
*/
|
|
37
|
+
multiply(other: FlowGraphInteger): FlowGraphInteger;
|
|
38
|
+
/**
|
|
39
|
+
* Divides two integers.
|
|
40
|
+
* @param other the other integer to divide
|
|
41
|
+
* @returns a FlowGraphInteger with the result of the division
|
|
42
|
+
*/
|
|
43
|
+
divide(other: FlowGraphInteger): FlowGraphInteger;
|
|
44
|
+
/**
|
|
45
|
+
* The class name of this type.
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
getClassName(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Compares two integers for equality.
|
|
51
|
+
* @param other the other integer to compare
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
equals(other: FlowGraphInteger): boolean;
|
|
55
|
+
static ClassName: string;
|
|
56
|
+
/**
|
|
57
|
+
* Parses a FlowGraphInteger from a serialization object.
|
|
58
|
+
* @param serializationObject
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
static Parse(serializationObject: any): FlowGraphInteger;
|
|
62
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { RegisterClass } from "../Misc/typeStore.js";
|
|
2
|
+
/**
|
|
3
|
+
* @experimental
|
|
4
|
+
* Class that represents an integer value.
|
|
5
|
+
*/
|
|
6
|
+
export class FlowGraphInteger {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
this.value = this._toInt(value);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Converts a float to an integer.
|
|
12
|
+
* @param n the float to convert
|
|
13
|
+
* @returns the result of n | 0 - converting it to a int
|
|
14
|
+
*/
|
|
15
|
+
_toInt(n) {
|
|
16
|
+
return n | 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Adds two integers together.
|
|
20
|
+
* @param other the other integer to add
|
|
21
|
+
* @returns a FlowGraphInteger with the result of the addition
|
|
22
|
+
*/
|
|
23
|
+
add(other) {
|
|
24
|
+
return new FlowGraphInteger(this.value + other.value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Subtracts two integers.
|
|
28
|
+
* @param other the other integer to subtract
|
|
29
|
+
* @returns a FlowGraphInteger with the result of the subtraction
|
|
30
|
+
*/
|
|
31
|
+
subtract(other) {
|
|
32
|
+
return new FlowGraphInteger(this.value - other.value);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Multiplies two integers.
|
|
36
|
+
* @param other the other integer to multiply
|
|
37
|
+
* @returns a FlowGraphInteger with the result of the multiplication
|
|
38
|
+
*/
|
|
39
|
+
multiply(other) {
|
|
40
|
+
return new FlowGraphInteger(Math.imul(this.value, other.value));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Divides two integers.
|
|
44
|
+
* @param other the other integer to divide
|
|
45
|
+
* @returns a FlowGraphInteger with the result of the division
|
|
46
|
+
*/
|
|
47
|
+
divide(other) {
|
|
48
|
+
return new FlowGraphInteger(this.value / other.value);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The class name of this type.
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
getClassName() {
|
|
55
|
+
return FlowGraphInteger.ClassName;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Compares two integers for equality.
|
|
59
|
+
* @param other the other integer to compare
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
equals(other) {
|
|
63
|
+
return this.value === other.value;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Parses a FlowGraphInteger from a serialization object.
|
|
67
|
+
* @param serializationObject
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
static Parse(serializationObject) {
|
|
71
|
+
return new FlowGraphInteger(serializationObject.value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
FlowGraphInteger.ClassName = "FlowGraphInteger";
|
|
75
|
+
RegisterClass("FlowGraphInteger", FlowGraphInteger);
|
|
76
|
+
//# sourceMappingURL=flowGraphInteger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphInteger.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IASzB,YAAY,KAAa;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,CAAS;QACpB,OAAO,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,KAAuB;QAC9B,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAuB;QACnC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAuB;QACnC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,KAAuB;QACjC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,gBAAgB,CAAC,SAAS,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,KAAuB;QACjC,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC;IACtC,CAAC;IAID;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,mBAAwB;QACxC,OAAO,IAAI,gBAAgB,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC;;AATa,0BAAS,GAAG,kBAAkB,CAAC;AAWjD,aAAa,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * @experimental\r\n * Class that represents an integer value.\r\n */\r\nexport class FlowGraphInteger {\r\n /**\r\n * The value of the integer. Its type\r\n * is a javascript number. Shouldn't be\r\n * directly modified - it is populated by\r\n * the constructor.\r\n */\r\n readonly value: number;\r\n\r\n constructor(value: number) {\r\n this.value = this._toInt(value);\r\n }\r\n\r\n /**\r\n * Converts a float to an integer.\r\n * @param n the float to convert\r\n * @returns the result of n | 0 - converting it to a int\r\n */\r\n private _toInt(n: number): number {\r\n return n | 0;\r\n }\r\n\r\n /**\r\n * Adds two integers together.\r\n * @param other the other integer to add\r\n * @returns a FlowGraphInteger with the result of the addition\r\n */\r\n public add(other: FlowGraphInteger): FlowGraphInteger {\r\n return new FlowGraphInteger(this.value + other.value);\r\n }\r\n\r\n /**\r\n * Subtracts two integers.\r\n * @param other the other integer to subtract\r\n * @returns a FlowGraphInteger with the result of the subtraction\r\n */\r\n public subtract(other: FlowGraphInteger): FlowGraphInteger {\r\n return new FlowGraphInteger(this.value - other.value);\r\n }\r\n\r\n /**\r\n * Multiplies two integers.\r\n * @param other the other integer to multiply\r\n * @returns a FlowGraphInteger with the result of the multiplication\r\n */\r\n public multiply(other: FlowGraphInteger): FlowGraphInteger {\r\n return new FlowGraphInteger(Math.imul(this.value, other.value));\r\n }\r\n\r\n /**\r\n * Divides two integers.\r\n * @param other the other integer to divide\r\n * @returns a FlowGraphInteger with the result of the division\r\n */\r\n public divide(other: FlowGraphInteger): FlowGraphInteger {\r\n return new FlowGraphInteger(this.value / other.value);\r\n }\r\n\r\n /**\r\n * The class name of this type.\r\n * @returns\r\n */\r\n public getClassName() {\r\n return FlowGraphInteger.ClassName;\r\n }\r\n\r\n /**\r\n * Compares two integers for equality.\r\n * @param other the other integer to compare\r\n * @returns\r\n */\r\n public equals(other: FlowGraphInteger): boolean {\r\n return this.value === other.value;\r\n }\r\n\r\n public static ClassName = \"FlowGraphInteger\";\r\n\r\n /**\r\n * Parses a FlowGraphInteger from a serialization object.\r\n * @param serializationObject\r\n * @returns\r\n */\r\n public static Parse(serializationObject: any): FlowGraphInteger {\r\n return new FlowGraphInteger(serializationObject.value);\r\n }\r\n}\r\nRegisterClass(\"FlowGraphInteger\", FlowGraphInteger);\r\n"]}
|
|
@@ -2,6 +2,7 @@ import type { IObjectInfo, IPathToObjectConverter } from "../ObjectModel/objectM
|
|
|
2
2
|
import type { FlowGraphBlock } from "./flowGraphBlock";
|
|
3
3
|
import type { FlowGraphContext } from "./flowGraphContext";
|
|
4
4
|
import type { FlowGraphDataConnection } from "./flowGraphDataConnection";
|
|
5
|
+
import type { FlowGraphInteger } from "./flowGraphInteger";
|
|
5
6
|
import type { IObjectAccessor } from "./typeDefinitions";
|
|
6
7
|
/**
|
|
7
8
|
* @experimental
|
|
@@ -13,7 +14,7 @@ export declare class FlowGraphPathConverterComponent {
|
|
|
13
14
|
/**
|
|
14
15
|
* The templated inputs for the provided path.
|
|
15
16
|
*/
|
|
16
|
-
readonly templatedInputs: FlowGraphDataConnection<
|
|
17
|
+
readonly templatedInputs: FlowGraphDataConnection<FlowGraphInteger>[];
|
|
17
18
|
constructor(path: string, ownerBlock: FlowGraphBlock);
|
|
18
19
|
getAccessor(pathConverter: IPathToObjectConverter<IObjectAccessor>, context: FlowGraphContext): IObjectInfo<IObjectAccessor>;
|
|
19
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RichTypeFlowGraphInteger } from "./flowGraphRichTypes.js";
|
|
2
2
|
const pathHasTemplatesRegex = new RegExp(/\{(\w+)\}/g);
|
|
3
3
|
/**
|
|
4
4
|
* @experimental
|
|
@@ -15,14 +15,14 @@ export class FlowGraphPathConverterComponent {
|
|
|
15
15
|
let match = pathHasTemplatesRegex.exec(path);
|
|
16
16
|
while (match) {
|
|
17
17
|
const [, matchGroup] = match;
|
|
18
|
-
this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup,
|
|
18
|
+
this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger));
|
|
19
19
|
match = pathHasTemplatesRegex.exec(path);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
getAccessor(pathConverter, context) {
|
|
23
23
|
let finalPath = this.path;
|
|
24
24
|
for (const templatedInput of this.templatedInputs) {
|
|
25
|
-
const valueToReplace = templatedInput.getValue(context);
|
|
25
|
+
const valueToReplace = templatedInput.getValue(context).value;
|
|
26
26
|
finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());
|
|
27
27
|
}
|
|
28
28
|
return pathConverter.convert(finalPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphPathConverterComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPathConverterComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowGraphPathConverterComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPathConverterComponent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,qBAAqB,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IAKxC,YACW,IAAY,EACZ,UAA0B;QAD1B,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAgB;QANrC;;WAEG;QACa,oBAAe,GAAgD,EAAE,CAAC;QAK9E,IAAI,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,KAAK,EAAE;YACV,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC;YAC7B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC;YAC9F,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC5C;IACL,CAAC;IAEM,WAAW,CAAC,aAAsD,EAAE,OAAyB;QAChG,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE;YAC/C,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;YAC9D,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC,IAAI,GAAG,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;SACxF;QACD,OAAO,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import type { IObjectInfo, IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraphInteger } from \"./flowGraphInteger\";\r\nimport { RichTypeFlowGraphInteger } from \"./flowGraphRichTypes\";\r\nimport type { IObjectAccessor } from \"./typeDefinitions\";\r\n\r\nconst pathHasTemplatesRegex = new RegExp(/\\{(\\w+)\\}/g);\r\n\r\n/**\r\n * @experimental\r\n * A component that converts a path to an object accessor.\r\n */\r\nexport class FlowGraphPathConverterComponent {\r\n /**\r\n * The templated inputs for the provided path.\r\n */\r\n public readonly templatedInputs: FlowGraphDataConnection<FlowGraphInteger>[] = [];\r\n public constructor(\r\n public path: string,\r\n public ownerBlock: FlowGraphBlock\r\n ) {\r\n let match = pathHasTemplatesRegex.exec(path);\r\n while (match) {\r\n const [, matchGroup] = match;\r\n this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger));\r\n match = pathHasTemplatesRegex.exec(path);\r\n }\r\n }\r\n\r\n public getAccessor(pathConverter: IPathToObjectConverter<IObjectAccessor>, context: FlowGraphContext): IObjectInfo<IObjectAccessor> {\r\n let finalPath = this.path;\r\n for (const templatedInput of this.templatedInputs) {\r\n const valueToReplace = templatedInput.getValue(context).value;\r\n finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());\r\n }\r\n return pathConverter.convert(finalPath);\r\n }\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Vector2, Vector3, Vector4, Matrix, Quaternion } from "../Maths/math.vector";
|
|
2
2
|
import { Color3, Color4 } from "../Maths/math.color";
|
|
3
|
+
import { FlowGraphInteger } from "./flowGraphInteger";
|
|
3
4
|
/**
|
|
4
5
|
* A rich type represents extra information about a type,
|
|
5
6
|
* such as its name and a default value constructor.
|
|
@@ -23,6 +24,7 @@ export declare const RichTypeMatrix: RichType<Matrix>;
|
|
|
23
24
|
export declare const RichTypeColor3: RichType<Color3>;
|
|
24
25
|
export declare const RichTypeColor4: RichType<Color4>;
|
|
25
26
|
export declare const RichTypeQuaternion: RichType<Quaternion>;
|
|
27
|
+
export declare const RichTypeFlowGraphInteger: RichType<FlowGraphInteger>;
|
|
26
28
|
/**
|
|
27
29
|
* Given a value, try to deduce its rich type.
|
|
28
30
|
* @param value the value to deduce the rich type from
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Vector2, Vector3, Vector4, Matrix, Quaternion } from "../Maths/math.vector.js";
|
|
2
2
|
import { Color3, Color4 } from "../Maths/math.color.js";
|
|
3
|
+
import { FlowGraphInteger } from "./flowGraphInteger.js";
|
|
3
4
|
/**
|
|
4
5
|
* A rich type represents extra information about a type,
|
|
5
6
|
* such as its name and a default value constructor.
|
|
@@ -29,6 +30,7 @@ export const RichTypeMatrix = new RichType("Matrix", Matrix.Identity());
|
|
|
29
30
|
export const RichTypeColor3 = new RichType("Color3", Color3.Black());
|
|
30
31
|
export const RichTypeColor4 = new RichType("Color4", new Color4(0, 0, 0, 0));
|
|
31
32
|
export const RichTypeQuaternion = new RichType("Quaternion", Quaternion.Identity());
|
|
33
|
+
export const RichTypeFlowGraphInteger = new RichType("FlowGraphInteger", new FlowGraphInteger(0));
|
|
32
34
|
/**
|
|
33
35
|
* Given a value, try to deduce its rich type.
|
|
34
36
|
* @param value the value to deduce the rich type from
|
|
@@ -61,6 +63,9 @@ export function getRichTypeFromValue(value) {
|
|
|
61
63
|
else if (value instanceof Quaternion) {
|
|
62
64
|
return RichTypeQuaternion;
|
|
63
65
|
}
|
|
66
|
+
else if (value instanceof FlowGraphInteger) {
|
|
67
|
+
return RichTypeFlowGraphInteger;
|
|
68
|
+
}
|
|
64
69
|
else {
|
|
65
70
|
return RichTypeAny;
|
|
66
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphRichTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphRichTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"flowGraphRichTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphRichTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IACjB,YACW,QAAgB,EAChB,YAAe;QADf,aAAQ,GAAR,QAAQ,CAAQ;QAChB,iBAAY,GAAZ,YAAY,CAAG;IACvB,CAAC;IAEJ,SAAS,CAAC,mBAAwB;QAC9B,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7C,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;IACzD,CA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AAQ,CAAC,YAAY,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,wBAAwB,GAA+B,IAAI,QAAQ,CAAC,kBAAkB,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9H;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAI,KAAQ;IAC5C,QAAQ,OAAO,KAAK,EAAE;QAClB,KAAK,QAAQ;YACT,OAAO,cAA6B,CAAC;QACzC,KAAK,QAAQ;YACT,OAAO,cAA6B,CAAC;QACzC,KAAK,SAAS;YACV,OAAO,eAA8B,CAAC;QAC1C,KAAK,QAAQ;YACT,IAAI,KAAK,YAAY,OAAO,EAAE;gBAC1B,OAAO,eAA8B,CAAC;aACzC;iBAAM,IAAI,KAAK,YAAY,OAAO,EAAE;gBACjC,OAAO,eAA8B,CAAC;aACzC;iBAAM,IAAI,KAAK,YAAY,OAAO,EAAE;gBACjC,OAAO,eAA8B,CAAC;aACzC;iBAAM,IAAI,KAAK,YAAY,MAAM,EAAE;gBAChC,OAAO,cAA6B,CAAC;aACxC;iBAAM,IAAI,KAAK,YAAY,MAAM,EAAE;gBAChC,OAAO,cAA6B,CAAC;aACxC;iBAAM,IAAI,KAAK,YAAY,UAAU,EAAE;gBACpC,OAAO,kBAAiC,CAAC;aAC5C;iBAAM,IAAI,KAAK,YAAY,gBAAgB,EAAE;gBAC1C,OAAO,wBAAuC,CAAC;aAClD;iBAAM;gBACH,OAAO,WAA0B,CAAC;aACrC;QACL;YACI,OAAO,WAA0B,CAAC;KACzC;AACL,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4, Matrix, Quaternion } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { FlowGraphInteger } from \"./flowGraphInteger\";\r\n\r\n/**\r\n * A rich type represents extra information about a type,\r\n * such as its name and a default value constructor.\r\n * @experimental\r\n */\r\nexport class RichType<T> {\r\n constructor(\r\n public typeName: string,\r\n public defaultValue: T\r\n ) {}\r\n\r\n serialize(serializationObject: any) {\r\n serializationObject.typeName = this.typeName;\r\n serializationObject.defaultValue = this.defaultValue;\r\n }\r\n\r\n static Parse(serializationObject: any): RichType<any> {\r\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\r\n }\r\n}\r\n\r\nexport const RichTypeAny: RichType<any> = new RichType(\"any\", undefined);\r\n\r\nexport const RichTypeString: RichType<string> = new RichType(\"string\", \"\");\r\n\r\nexport const RichTypeNumber: RichType<number> = new RichType(\"number\", 0);\r\n\r\nexport const RichTypeBoolean: RichType<boolean> = new RichType(\"boolean\", false);\r\n\r\nexport const RichTypeVector2: RichType<Vector2> = new RichType(\"Vector2\", Vector2.Zero());\r\n\r\nexport const RichTypeVector3: RichType<Vector3> = new RichType(\"Vector3\", Vector3.Zero());\r\n\r\nexport const RichTypeVector4: RichType<Vector4> = new RichType(\"Vector4\", Vector4.Zero());\r\n\r\nexport const RichTypeMatrix: RichType<Matrix> = new RichType(\"Matrix\", Matrix.Identity());\r\n\r\nexport const RichTypeColor3: RichType<Color3> = new RichType(\"Color3\", Color3.Black());\r\n\r\nexport const RichTypeColor4: RichType<Color4> = new RichType(\"Color4\", new Color4(0, 0, 0, 0));\r\n\r\nexport const RichTypeQuaternion: RichType<Quaternion> = new RichType(\"Quaternion\", Quaternion.Identity());\r\n\r\nexport const RichTypeFlowGraphInteger: RichType<FlowGraphInteger> = new RichType(\"FlowGraphInteger\", new FlowGraphInteger(0));\r\n\r\n/**\r\n * Given a value, try to deduce its rich type.\r\n * @param value the value to deduce the rich type from\r\n * @returns the value's rich type, or RichTypeAny if the type could not be deduced.\r\n */\r\nexport function getRichTypeFromValue<T>(value: T): RichType<T> {\r\n switch (typeof value) {\r\n case \"string\":\r\n return RichTypeString as RichType<T>;\r\n case \"number\":\r\n return RichTypeNumber as RichType<T>;\r\n case \"boolean\":\r\n return RichTypeBoolean as RichType<T>;\r\n case \"object\":\r\n if (value instanceof Vector2) {\r\n return RichTypeVector2 as RichType<T>;\r\n } else if (value instanceof Vector3) {\r\n return RichTypeVector3 as RichType<T>;\r\n } else if (value instanceof Vector4) {\r\n return RichTypeVector4 as RichType<T>;\r\n } else if (value instanceof Color3) {\r\n return RichTypeColor3 as RichType<T>;\r\n } else if (value instanceof Color4) {\r\n return RichTypeColor4 as RichType<T>;\r\n } else if (value instanceof Quaternion) {\r\n return RichTypeQuaternion as RichType<T>;\r\n } else if (value instanceof FlowGraphInteger) {\r\n return RichTypeFlowGraphInteger as RichType<T>;\r\n } else {\r\n return RichTypeAny as RichType<T>;\r\n }\r\n default:\r\n return RichTypeAny as RichType<T>;\r\n }\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Color3, Color4 } from "../Maths/math.color.js";
|
|
2
|
-
import { Quaternion, Vector2, Vector3, Vector4 } from "../Maths/math.vector.js";
|
|
2
|
+
import { Matrix, Quaternion, Vector2, Vector3, Vector4 } from "../Maths/math.vector.js";
|
|
3
|
+
import { FlowGraphInteger } from "./flowGraphInteger.js";
|
|
3
4
|
function isMeshClassName(className) {
|
|
4
5
|
return (className === "Mesh" ||
|
|
5
6
|
className === "AbstractMesh" ||
|
|
@@ -78,6 +79,12 @@ export function defaultValueParseFunction(key, serializationObject, scene) {
|
|
|
78
79
|
else if (isVectorClassName(className)) {
|
|
79
80
|
finalValue = parseVector(className, intermediateValue.value);
|
|
80
81
|
}
|
|
82
|
+
else if (className === "Matrix") {
|
|
83
|
+
finalValue = Matrix.FromArray(intermediateValue.value);
|
|
84
|
+
}
|
|
85
|
+
else if (className === FlowGraphInteger.ClassName) {
|
|
86
|
+
finalValue = FlowGraphInteger.Parse(intermediateValue);
|
|
87
|
+
}
|
|
81
88
|
else if (intermediateValue && intermediateValue.value !== undefined) {
|
|
82
89
|
finalValue = intermediateValue.value;
|
|
83
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,SAAS,eAAe,CAAC,SAAiB;IACtC,OAAO,CACH,SAAS,KAAK,MAAM;QACpB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,YAAY;QAC1B,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,WAAW;QACzB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,iBAAiB;QAC/B,SAAS,KAAK,WAAW,CAC5B,CAAC;AACN,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAiB;IACxC,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,YAAY,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,CAAC;AAC3K,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB,EAAE,KAAoB;IACxD,IAAI,SAAS,KAAK,SAAS,EAAE;QACzB,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACnC;SAAM,IAAI,SAAS,KAAK,SAAS,EAAE;QAChC,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACnC;SAAM,IAAI,SAAS,KAAK,SA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,GAAW,EAAE,mBAAwB,EAAE,KAAY;IACzF,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,UAAU,CAAC;IACf,MAAM,SAAS,GAAG,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,SAAS,CAAC;IAC/C,IAAI,eAAe,CAAC,SAAS,CAAC,EAAE;QAC5B,UAAU,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;KAC5D;SAAM,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;QACrC,UAAU,GAAG,WAAW,CAAC,SAAS,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;KAChE;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE;QAC/B,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;KAC1D;SAAM,IAAI,SAAS,KAAK,gBAAgB,CAAC,SAAS,EAAE;QACjD,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;KAC1D;SAAM,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,KAAK,KAAK,SAAS,EAAE;QACnE,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC;KACxC;SAAM;QACH,UAAU,GAAG,iBAAiB,CAAC;KAClC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAChD,0FAA0F;IAC1F,yBAAyB;IACzB,OAAO,SAAS,KAAK,oBAAoB,IAAI,SAAS,KAAK,oBAAoB,IAAI,SAAS,KAAK,sBAAsB,IAAI,SAAS,KAAK,sBAAsB,CAAC;AACpK,CAAC","sourcesContent":["import { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { Matrix, Quaternion, Vector2, Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\nimport { FlowGraphInteger } from \"./flowGraphInteger\";\r\n\r\nfunction isMeshClassName(className: string) {\r\n return (\r\n className === \"Mesh\" ||\r\n className === \"AbstractMesh\" ||\r\n className === \"GroundMesh\" ||\r\n className === \"InstanceMesh\" ||\r\n className === \"LinesMesh\" ||\r\n className === \"GoldbergMesh\" ||\r\n className === \"GreasedLineMesh\" ||\r\n className === \"TrailMesh\"\r\n );\r\n}\r\n\r\nfunction isVectorClassName(className: string) {\r\n return className === \"Vector2\" || className === \"Vector3\" || className === \"Vector4\" || className === \"Quaternion\" || className === \"Color3\" || className === \"Color4\";\r\n}\r\n\r\nfunction parseVector(className: string, value: Array<number>) {\r\n if (className === \"Vector2\") {\r\n return Vector2.FromArray(value);\r\n } else if (className === \"Vector3\") {\r\n return Vector3.FromArray(value);\r\n } else if (className === \"Vector4\") {\r\n return Vector4.FromArray(value);\r\n } else if (className === \"Quaternion\") {\r\n return Quaternion.FromArray(value);\r\n } else if (className === \"Color3\") {\r\n return new Color3(value[0], value[1], value[2]);\r\n } else if (className === \"Color4\") {\r\n return new Color4(value[0], value[1], value[2], value[3]);\r\n } else {\r\n throw new Error(`Unknown vector class name ${className}`);\r\n }\r\n}\r\n\r\n/**\r\n * The default function that serializes values in a context object to a serialization object\r\n * @param key the key where the value should be stored in the serialization object\r\n * @param value the value to store\r\n * @param serializationObject the object where the value will be stored\r\n */\r\nexport function defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n const className = value?.getClassName?.() ?? \"\";\r\n if (isMeshClassName(className)) {\r\n serializationObject[key] = {\r\n name: value.name,\r\n className,\r\n };\r\n } else if (isVectorClassName(className)) {\r\n serializationObject[key] = {\r\n value: value.asArray(),\r\n className,\r\n };\r\n } else {\r\n serializationObject[key] = value;\r\n }\r\n}\r\n\r\n/**\r\n * The default function that parses values stored in a serialization object\r\n * @param key the key to the value that will be parsed\r\n * @param serializationObject the object that will be parsed\r\n * @param scene\r\n * @returns\r\n */\r\nexport function defaultValueParseFunction(key: string, serializationObject: any, scene: Scene) {\r\n const intermediateValue = serializationObject[key];\r\n let finalValue;\r\n const className = intermediateValue?.className;\r\n if (isMeshClassName(className)) {\r\n finalValue = scene.getMeshByName(intermediateValue.name);\r\n } else if (isVectorClassName(className)) {\r\n finalValue = parseVector(className, intermediateValue.value);\r\n } else if (className === \"Matrix\") {\r\n finalValue = Matrix.FromArray(intermediateValue.value);\r\n } else if (className === FlowGraphInteger.ClassName) {\r\n finalValue = FlowGraphInteger.Parse(intermediateValue);\r\n } else if (intermediateValue && intermediateValue.value !== undefined) {\r\n finalValue = intermediateValue.value;\r\n } else {\r\n finalValue = intermediateValue;\r\n }\r\n return finalValue;\r\n}\r\n\r\n/**\r\n * Given a name of a flow graph block class, return if this\r\n * class needs to be created with a path converter. Used in\r\n * parsing.\r\n * @param className the name of the flow graph block class\r\n * @returns a boolean indicating if the class needs a path converter\r\n */\r\nexport function needsPathConverter(className: string) {\r\n // I am not using the ClassName property here because it was causing a circular dependency\r\n // that jest didn't like!\r\n return className === \"FGSetPropertyBlock\" || className === \"FGGetPropertyBlock\" || className === \"FGPlayAnimationBlock\" || className === \"FGMeshPickEventBlock\";\r\n}\r\n"]}
|
|
@@ -619,7 +619,7 @@ export class BoundingBoxGizmo extends Gizmo {
|
|
|
619
619
|
scaleBoxes[index].position.set(this._boundingDimensions.x * (i / 2), this._boundingDimensions.y * (j / 2), this._boundingDimensions.z * (k / 2));
|
|
620
620
|
scaleBoxes[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
|
|
621
621
|
if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
|
|
622
|
-
scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.
|
|
622
|
+
scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.globalPosition, this._tmpVector);
|
|
623
623
|
const distanceFromCamera = (this.scaleBoxSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;
|
|
624
624
|
scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
|
|
625
625
|
}
|