@babylonjs/core 9.5.1 → 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/Engines/abstractEngine.js +2 -2
  2. package/Engines/abstractEngine.js.map +1 -1
  3. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  4. package/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.js.map +1 -1
  5. package/FlowGraph/Blocks/Event/flowGraphPointerMoveEventBlock.js.map +1 -1
  6. package/FlowGraph/Blocks/Event/flowGraphPointerUpEventBlock.js.map +1 -1
  7. package/FlowGraph/flowGraphCoordinator.d.ts +1 -1
  8. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  9. package/FlowGraph/flowGraphParser.d.ts +15 -0
  10. package/FlowGraph/flowGraphParser.js +101 -14
  11. package/FlowGraph/flowGraphParser.js.map +1 -1
  12. package/FlowGraph/serialization.js +16 -18
  13. package/FlowGraph/serialization.js.map +1 -1
  14. package/Lights/Clustered/clusteredLightContainer.js +1 -1
  15. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  16. package/Materials/Background/backgroundMaterial.js +1 -0
  17. package/Materials/Background/backgroundMaterial.js.map +1 -1
  18. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +2 -0
  19. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +14 -0
  20. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  21. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
  22. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  23. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -0
  24. package/Materials/Node/Blocks/Dual/textureBlock.js +19 -4
  25. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  26. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +11 -6
  27. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  28. package/Materials/PBR/openpbrMaterial.js +1 -0
  29. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  30. package/Materials/PBR/pbrBaseMaterial.js +1 -0
  31. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  32. package/Materials/materialHelper.functions.d.ts +2 -1
  33. package/Materials/materialHelper.functions.js +8 -3
  34. package/Materials/materialHelper.functions.js.map +1 -1
  35. package/Materials/standardMaterial.js +1 -0
  36. package/Materials/standardMaterial.js.map +1 -1
  37. package/Meshes/Node/Blocks/bevelBlock.d.ts +52 -0
  38. package/Meshes/Node/Blocks/bevelBlock.js +1327 -0
  39. package/Meshes/Node/Blocks/bevelBlock.js.map +1 -0
  40. package/Meshes/Node/index.d.ts +1 -0
  41. package/Meshes/Node/index.js +1 -0
  42. package/Meshes/Node/index.js.map +1 -1
  43. package/Misc/tools.js +1 -1
  44. package/Misc/tools.js.map +1 -1
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphMeshPickEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAoB,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGpF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAiBjG;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,mBAAmB;IAoChE;IACI;;OAEG;IACa,MAAkD;QAElE,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAA4C;QATtE;;WAEG;QACsB,SAAI,gDAAmD;QAS5E,IAAI,CAAC,KAAK,GAAG,I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,2BAA2B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"../../../Meshes/abstractMesh\";\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type PointerInfo, PointerEventTypes } from \"../../../Events/pointerEvents\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { _IsDescendantOf } from \"../../utils\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { type Vector3 } from \"core/Maths/math.vector\";\r\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\r\n/**\r\n * Configuration for the mesh pick event block.\r\n */\r\nexport interface IFlowGraphMeshPickEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * Should this mesh block propagation of the event.\r\n */\r\n stopPropagation?: boolean;\r\n\r\n /**\r\n * The mesh to listen to. Can also be set by the asset input.\r\n */\r\n targetMesh?: AbstractMesh;\r\n}\r\n/**\r\n * A block that activates when a mesh is picked.\r\n */\r\nexport class FlowGraphMeshPickEventBlock extends FlowGraphEventBlock {\r\n /**\r\n * Input connection: The mesh to listen to.\r\n */\r\n public readonly asset: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Output connection: The picked point.\r\n */\r\n public readonly pickedPoint: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The picked origin.\r\n */\r\n public readonly pickOrigin: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The pointer id.\r\n */\r\n public readonly pointerId: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output connection: The picked mesh. Possibly NOT the same as the asset (could be a descendant).\r\n */\r\n public readonly pickedMesh: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Input connection: The type of the pointer event.\r\n */\r\n public readonly pointerType: FlowGraphDataConnection<PointerEventTypes>;\r\n\r\n /**\r\n * the type of the event this block reacts to\r\n */\r\n public override readonly type: FlowGraphEventType = FlowGraphEventType.MeshPick;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config?: IFlowGraphMeshPickEventBlockConfiguration\r\n ) {\r\n super(config);\r\n this.asset = this.registerDataInput(\"asset\", RichTypeAny, config?.targetMesh);\r\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeVector3);\r\n this.pickOrigin = this.registerDataOutput(\"pickOrigin\", RichTypeVector3);\r\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\r\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\r\n this.pointerType = this.registerDataInput(\"pointerType\", RichTypeAny, PointerEventTypes.POINTERPICK);\r\n }\r\n\r\n public _getReferencedMesh(context: FlowGraphContext): AbstractMesh {\r\n return this.asset.getValue(context);\r\n }\r\n\r\n public override _executeEvent(context: FlowGraphContext, pickedInfo: PointerInfo): boolean {\r\n // get the pointer type\r\n const pointerType = this.pointerType.getValue(context);\r\n if (pointerType !== pickedInfo.type) {\r\n // returning true here to continue the propagation of the pointer event to the rest of the blocks\r\n return true;\r\n }\r\n const mesh = this._getReferencedMesh(context);\r\n const pickedMesh = pickedInfo.pickInfo?.pickedMesh;\r\n // When no target mesh is configured, fire for any picked mesh.\r\n // When a target is configured, require an exact match or descendant match.\r\n // Match by reference first, then by descendant, then by stable name/id as a\r\n // fallback for scene reloads where the object reference changes but the mesh\r\n // identity (name) is preserved (uniqueId increments monotonically and is NOT\r\n // stable across reloads).\r\n const meshMatches = !mesh ? !!pickedMesh : !!(pickedMesh && (pickedMesh === mesh || _IsDescendantOf(pickedMesh, mesh) || pickedMesh.name === mesh.name));\r\n if (meshMatches && pickedMesh) {\r\n this.pointerId.setValue((pickedInfo.event as PointerEvent).pointerId, context);\r\n this.pickOrigin.setValue(pickedInfo.pickInfo!.ray?.origin!, context);\r\n this.pickedPoint.setValue(pickedInfo.pickInfo!.pickedPoint!, context);\r\n this.pickedMesh.setValue(pickedMesh, context);\r\n this._execute(context);\r\n // stop the propagation if the configuration says so\r\n return !this.config?.stopPropagation;\r\n } else {\r\n // reset the outputs\r\n this.pointerId.resetToDefaultValue(context);\r\n this.pickOrigin.resetToDefaultValue(context);\r\n this.pickedPoint.resetToDefaultValue(context);\r\n this.pickedMesh.resetToDefaultValue(context);\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _preparePendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.MeshPickEvent;\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.MeshPickEvent, FlowGraphMeshPickEventBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphMeshPickEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAoB,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIpF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAiBjG;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,mBAAmB;IAoChE;IACI;;OAEG;IACa,MAAkD;QAElE,KAAK,CAAC,MAAM,C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AA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,6EAAyC;IAC7C,CAAC;CACJ;AACD,aAAa,wEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"../../../Meshes/abstractMesh\";\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type PointerInfo, PointerEventTypes } from \"../../../Events/pointerEvents\";\r\nimport { type IPointerEvent } from \"../../../Events/deviceInputEvents\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { _IsDescendantOf } from \"../../utils\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { type Vector3 } from \"core/Maths/math.vector\";\r\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\r\n/**\r\n * Configuration for the mesh pick event block.\r\n */\r\nexport interface IFlowGraphMeshPickEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * Should this mesh block propagation of the event.\r\n */\r\n stopPropagation?: boolean;\r\n\r\n /**\r\n * The mesh to listen to. Can also be set by the asset input.\r\n */\r\n targetMesh?: AbstractMesh;\r\n}\r\n/**\r\n * A block that activates when a mesh is picked.\r\n */\r\nexport class FlowGraphMeshPickEventBlock extends FlowGraphEventBlock {\r\n /**\r\n * Input connection: The mesh to listen to.\r\n */\r\n public readonly asset: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Output connection: The picked point.\r\n */\r\n public readonly pickedPoint: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The picked origin.\r\n */\r\n public readonly pickOrigin: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The pointer id.\r\n */\r\n public readonly pointerId: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output connection: The picked mesh. Possibly NOT the same as the asset (could be a descendant).\r\n */\r\n public readonly pickedMesh: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Input connection: The type of the pointer event.\r\n */\r\n public readonly pointerType: FlowGraphDataConnection<PointerEventTypes>;\r\n\r\n /**\r\n * the type of the event this block reacts to\r\n */\r\n public override readonly type: FlowGraphEventType = FlowGraphEventType.MeshPick;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config?: IFlowGraphMeshPickEventBlockConfiguration\r\n ) {\r\n super(config);\r\n this.asset = this.registerDataInput(\"asset\", RichTypeAny, config?.targetMesh);\r\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeVector3);\r\n this.pickOrigin = this.registerDataOutput(\"pickOrigin\", RichTypeVector3);\r\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\r\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\r\n this.pointerType = this.registerDataInput(\"pointerType\", RichTypeAny, PointerEventTypes.POINTERPICK);\r\n }\r\n\r\n public _getReferencedMesh(context: FlowGraphContext): AbstractMesh {\r\n return this.asset.getValue(context);\r\n }\r\n\r\n public override _executeEvent(context: FlowGraphContext, pickedInfo: PointerInfo): boolean {\r\n // get the pointer type\r\n const pointerType = this.pointerType.getValue(context);\r\n if (pointerType !== pickedInfo.type) {\r\n // returning true here to continue the propagation of the pointer event to the rest of the blocks\r\n return true;\r\n }\r\n const mesh = this._getReferencedMesh(context);\r\n const pickedMesh = pickedInfo.pickInfo?.pickedMesh;\r\n // When no target mesh is configured, fire for any picked mesh.\r\n // When a target is configured, require an exact match or descendant match.\r\n // Match by reference first, then by descendant, then by stable name/id as a\r\n // fallback for scene reloads where the object reference changes but the mesh\r\n // identity (name) is preserved (uniqueId increments monotonically and is NOT\r\n // stable across reloads).\r\n const meshMatches = !mesh ? !!pickedMesh : !!(pickedMesh && (pickedMesh === mesh || _IsDescendantOf(pickedMesh, mesh) || pickedMesh.name === mesh.name));\r\n if (meshMatches && pickedMesh) {\r\n this.pointerId.setValue((pickedInfo.event as IPointerEvent).pointerId, context);\r\n this.pickOrigin.setValue(pickedInfo.pickInfo!.ray?.origin!, context);\r\n this.pickedPoint.setValue(pickedInfo.pickInfo!.pickedPoint!, context);\r\n this.pickedMesh.setValue(pickedMesh, context);\r\n this._execute(context);\r\n // stop the propagation if the configuration says so\r\n return !this.config?.stopPropagation;\r\n } else {\r\n // reset the outputs\r\n this.pointerId.resetToDefaultValue(context);\r\n this.pickOrigin.resetToDefaultValue(context);\r\n this.pickedPoint.resetToDefaultValue(context);\r\n this.pickedMesh.resetToDefaultValue(context);\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _preparePendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.MeshPickEvent;\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.MeshPickEvent, FlowGraphMeshPickEventBlock);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphPointerDownEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAIzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAqBhF;;;;G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C,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC;IACzC,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,mFAA4C;IAChD,CAAC;CACJ;AAED,aAAa,8EAAuC,8BAA8B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer down event block.\n */\nexport interface IFlowGraphPointerDownEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is pressed on this mesh or a descendant of it. If not set, fires on any pointer down.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer down event block.\n * This block fires when a pointer is pressed (mouse button down / touch start).\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerDownEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to this mesh (and its descendants).\n * Leave disconnected to fire on any pointer down.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh that was picked (if any).\n */\n public readonly pickedMesh: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point that was picked (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerDown;\n\n /**\n * Creates a new FlowGraphPointerDownEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerDownEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is picked.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as PointerEvent).pointerId, context);\n this.pickedMesh.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.stopPropagation;\n }\n\n /** @internal */\n public override _preparePendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /** @internal */\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerDownEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerDownEvent, FlowGraphPointerDownEventBlock);\n"]}
1
+ {"version":3,"file":"flowGraphPointerDownEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAKzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAqBhF;;;;GAIG;AACH,MAAM,OAAO,8BAA+B,SAAQ,mBAAmB;IAyBnE;;;OAGG;IACH,YAAmB,MAAqD;QACpE,KAAK,CAAC,MAAM,CAAC,CAAC;QARlB,gBAAgB;QACS,SAAI,sDAAsD;QAQ/E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACxF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACrE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC;IAED,gBAAgB;IACA,aAAa,CAAC,OAAyB,EAAE,WAAwB;QAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC;QAEpD,iFAAiF;QACjF,IAAI,IAAI,IAAI,CAAC,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACtF,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAE,WAAW,CAAC,KAAuB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACjF,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC;IACzC,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,mFAA4C;IAChD,CAAC;CACJ;AAED,aAAa,8EAAuC,8BAA8B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type IPointerEvent } from \"core/Events/deviceInputEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer down event block.\n */\nexport interface IFlowGraphPointerDownEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is pressed on this mesh or a descendant of it. If not set, fires on any pointer down.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer down event block.\n * This block fires when a pointer is pressed (mouse button down / touch start).\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerDownEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to this mesh (and its descendants).\n * Leave disconnected to fire on any pointer down.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh that was picked (if any).\n */\n public readonly pickedMesh: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point that was picked (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerDown;\n\n /**\n * Creates a new FlowGraphPointerDownEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerDownEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is picked.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as IPointerEvent).pointerId, context);\n this.pickedMesh.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.stopPropagation;\n }\n\n /** @internal */\n public override _preparePendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /** @internal */\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerDownEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerDownEvent, FlowGraphPointerDownEventBlock);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphPointerMoveEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphPointerMoveEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAIzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAqBhF;;;;GAIG;AACH,MAAM,OAAO,8BAA+B,SAAQ,mBAAmB;IAyBnE;;;OAGG;IACH,YAAmB,MAAqD;QACpE,KAAK,CAAC,MAAM,CAAC,CAAC;QARlB,gBAAgB;QACS,SAAI,sDAAsD;QAQ/E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,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AC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,mFAA4C;IAChD,CAAC;CACJ;AAED,aAAa,8EAAuC,8BAA8B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer move event block.\n */\nexport interface IFlowGraphPointerMoveEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is moving over this mesh or a descendant of it. If not set, fires on any pointer move.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer move event block.\n * This block fires when the pointer moves.\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerMoveEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to when the pointer is over this mesh (and its descendants).\n * Leave disconnected to fire on any pointer move.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh currently under the pointer (if any).\n */\n public readonly meshUnderPointer: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point under the pointer (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerMove;\n\n /**\n * Creates a new FlowGraphPointerMoveEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerMoveEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.meshUnderPointer = this.registerDataOutput(\"meshUnderPointer\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is under the pointer.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as PointerEvent).pointerId, context);\n this.meshUnderPointer.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.stopPropagation;\n }\n\n /** @internal */\n public override _preparePendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /** @internal */\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerMoveEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerMoveEvent, FlowGraphPointerMoveEventBlock);\n"]}
1
+ {"version":3,"file":"flowGraphPointerMoveEventBlock.js","sourceRoot":"","sources":["../../../../../../d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,CAAC,SAAS,CAAC,QAAQ,CAAE,WAAW,CAAC,KAAuB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACjF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC;IACzC,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,mFAA4C;IAChD,CAAC;CACJ;AAED,aAAa,8EAAuC,8BAA8B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type IPointerEvent } from \"core/Events/deviceInputEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer move event block.\n */\nexport interface IFlowGraphPointerMoveEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is moving over this mesh or a descendant of it. If not set, fires on any pointer move.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer move event block.\n * This block fires when the pointer moves.\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerMoveEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to when the pointer is over this mesh (and its descendants).\n * Leave disconnected to fire on any pointer move.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh currently under the pointer (if any).\n */\n public readonly meshUnderPointer: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point under the pointer (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerMove;\n\n /**\n * Creates a new FlowGraphPointerMoveEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerMoveEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.meshUnderPointer = this.registerDataOutput(\"meshUnderPointer\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is under the pointer.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as IPointerEvent).pointerId, context);\n this.meshUnderPointer.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.stopPropagation;\n }\n\n /** @internal */\n public override _preparePendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /** @internal */\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerMoveEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerMoveEvent, FlowGraphPointerMoveEventBlock);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphPointerUpEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphPointerUpEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAIzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAqBhF;;;;GAIG;AACH,MAAM,OAAO,4BAA6B,SAAQ,mBAAmB;IAyBjE;;;OAGG;IACH,YAAmB,MAAmD;QAClE,KAAK,CAAC,MAAM,CAAC,CAAC;QARlB,gBAAgB;QACS,SAAI,kDAAoD;QAQ7E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACxF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtE,IAAI,CAAC,UAAU,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import { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer up event block.\n */\nexport interface IFlowGraphPointerUpEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is released over this mesh or a descendant of it. If not set, fires on any pointer up.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer up event block.\n * This block fires when a pointer is released (mouse button up / touch end).\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerUpEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to this mesh (and its descendants).\n * Leave disconnected to fire on any pointer up.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh that was picked (if any).\n */\n public readonly pickedMesh: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point that was picked (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerUp;\n\n /**\n * Creates a new FlowGraphPointerUpEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerUpEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is picked.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as PointerEvent).pointerId, context);\n this.pickedMesh.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.stopPropagation;\n }\n\n /** @internal */\n public override _preparePendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /** @internal */\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerUpEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerUpEvent, FlowGraphPointerUpEventBlock);\n"]}
1
+ {"version":3,"file":"flowGraphPointerUpEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphPointerUpEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAKzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EA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AC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC;IACzC,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,+EAA0C;IAC9C,CAAC;CACJ;AAED,aAAa,0EAAqC,4BAA4B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type IPointerEvent } from \"core/Events/deviceInputEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer up event block.\n */\nexport interface IFlowGraphPointerUpEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is released over this mesh or a descendant of it. If not set, fires on any pointer up.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer up event block.\n * This block fires when a pointer is released (mouse button up / touch end).\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerUpEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to this mesh (and its descendants).\n * Leave disconnected to fire on any pointer up.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh that was picked (if any).\n */\n public readonly pickedMesh: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point that was picked (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerUp;\n\n /**\n * Creates a new FlowGraphPointerUpEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerUpEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is picked.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as IPointerEvent).pointerId, context);\n this.pickedMesh.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.stopPropagation;\n }\n\n /** @internal */\n public override _preparePendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /** @internal */\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerUpEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerUpEvent, FlowGraphPointerUpEventBlock);\n"]}
@@ -28,7 +28,7 @@ export interface IFlowGraphCoordinatorParseOptions {
28
28
  /**
29
29
  * The path converter to use to convert the path to an object accessor.
30
30
  */
31
- pathConverter: IPathToObjectConverter<IObjectAccessor>;
31
+ pathConverter?: IPathToObjectConverter<IObjectAccessor>;
32
32
  /**
33
33
  * The scene that the flow graph coordinator belongs to.
34
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAiC1C;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAmC7B;IACI;;OAEG;IACI,MAA0C;QAA1C,WAAM,GAAN,MAAM,CAAoC;QArBrD;;;WAGG;QACI,gCAA2B,GAAY,IAAI,CAAC;QAElC,gBAAW,GAAgB,EAAE,CAAC;QAEvC,qBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAC;QAE3D,2BAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC;QAIxD,wBAAmB,GAAmD,EAAE,CAAC;QACzE,mBAAc,GAAW,CAAC,CAAC;QAQ/B,0EAA0E;QAC1E,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE;YACnE,IAA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AAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAC7E,OAAO;QACX,CAAC;QACD,yDAAyD;QACzD,IAAI,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;YACnD,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC/C,IAAI,KAAK,IAAI,oBAAoB,CAAC,6BAA6B,EAAE,CAAC;gBAC9D,IAAI,KAAK,KAAK,oBAAoB,CAAC,6BAA6B,EAAE,CAAC;oBAC/D,MAAM,CAAC,IAAI,CAAC,uDAAuD,EAAE,IAAI,CAAC,CAAC;gBAC/E,CAAC;gBACD,OAAO;YACX,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE,CAAC;YACb,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;;AA7LD;;;;GAIG;AACW,qCAAgB,GAAW,EAAE,AAAb,CAAc;AAE5C;;GAEG;AACW,kDAA6B,GAAW,EAAE,AAAb,CAAc;AACzD;;;GAGG;AACoB,sCAAiB,GAAuC,IAAI,GAAG,EAAE,AAAhD,CAAiD","sourcesContent":["import { type Observer, Observable } from \"core/Misc/observable\";\r\nimport { type Scene } from \"../scene\";\r\nimport { FlowGraph } from \"./flowGraph\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Parameters used to create a flow graph engine.\r\n */\r\nexport interface IFlowGraphCoordinatorConfiguration {\r\n /**\r\n * The scene that the flow graph engine belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n\r\n/**\r\n * Parameters used to parse a flow graph coordinator.\r\n */\r\nexport interface IFlowGraphCoordinatorParseOptions {\r\n /**\r\n * A function that will be called to parse the value of a property.\r\n * @param key the key of the property\r\n * @param serializationObject the serialization object where the property is located\r\n * @param assetsContainer the assets container\r\n * @param scene the scene that the block is being parsed in\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\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 * The scene that the flow graph coordinator belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n/**\r\n * This class holds all of the existing flow graphs and is responsible for creating new ones.\r\n * It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator\r\n * This is the entry point for the flow graph system.\r\n * @experimental This class is still in development and is subject to change.\r\n */\r\nexport class FlowGraphCoordinator {\r\n /**\r\n * The maximum number of events per type.\r\n * This is used to limit the number of events that can be created in a single scene.\r\n * This is to prevent infinite loops.\r\n */\r\n public static MaxEventsPerType: number = 30;\r\n\r\n /**\r\n * The maximum number of execution of a specific event in a single frame.\r\n */\r\n public static MaxEventTypeExecutionPerFrame: number = 30;\r\n /**\r\n * @internal\r\n * A list of all the coordinators per scene. Will be used by the inspector\r\n */\r\n public static readonly SceneCoordinators: Map<Scene, FlowGraphCoordinator[]> = new Map();\r\n\r\n /**\r\n * When set to true (default) custom events will be dispatched synchronously.\r\n * This means that the events will be dispatched immediately when they are triggered.\r\n */\r\n public dispatchEventsSynchronously: boolean = true;\r\n\r\n private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\r\n\r\n private _eventExecutionCounter: Map<string, number> = new Map();\r\n\r\n private _disposeObserver: Observer<Scene>;\r\n private _onBeforeRenderObserver: Observer<Scene>;\r\n private _executeOnNextFrame: { id: string; data?: any; uniqueId: number }[] = [];\r\n private _eventUniqueId: number = 0;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public config: IFlowGraphCoordinatorConfiguration\r\n ) {\r\n // When the scene is disposed, dispose all graphs currently running on it.\r\n this._disposeObserver = this.config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n this._onBeforeRenderObserver = this.config.scene.onBeforeRenderObservable.add(() => {\r\n // Reset the event execution counter at the beginning of each frame.\r\n this._eventExecutionCounter.clear();\r\n // duplicate the _executeOnNextFrame array to avoid modifying it while iterating over it\r\n const executeOnNextFrame = this._executeOnNextFrame.slice(0);\r\n if (executeOnNextFrame.length) {\r\n // Execute the events that were triggered on the next frame.\r\n for (const event of executeOnNextFrame) {\r\n this.notifyCustomEvent(event.id, event.data, false);\r\n // remove the event from the array\r\n const index = this._executeOnNextFrame.findIndex((e) => e.uniqueId === event.uniqueId);\r\n if (index !== -1) {\r\n this._executeOnNextFrame.splice(index, 1);\r\n }\r\n }\r\n }\r\n });\r\n\r\n // Add itself to the SceneCoordinators list for the Inspector.\r\n let coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene);\r\n if (!coordinators) {\r\n coordinators = [];\r\n FlowGraphCoordinator.SceneCoordinators.set(this.config.scene, coordinators);\r\n }\r\n coordinators.push(this);\r\n }\r\n\r\n /**\r\n * Creates a new flow graph and adds it to the list of existing flow graphs\r\n * @param name - optional name for the new graph. If not provided, an auto-generated name is used.\r\n * @returns a new flow graph\r\n */\r\n public createGraph(name?: string): FlowGraph {\r\n const graphName = name ?? `Graph ${this._flowGraphs.length + 1}`;\r\n const graph = new FlowGraph({ scene: this.config.scene, coordinator: this, name: graphName });\r\n this._flowGraphs.push(graph);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Removes a flow graph from the list of existing flow graphs and disposes it\r\n * @param graph the graph to remove\r\n */\r\n public removeGraph(graph: FlowGraph) {\r\n const index = this._flowGraphs.indexOf(graph);\r\n if (index !== -1) {\r\n graph.dispose();\r\n this._flowGraphs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Starts all graphs\r\n */\r\n public start() {\r\n for (const graph of this._flowGraphs) {\r\n graph.start();\r\n }\r\n }\r\n\r\n /**\r\n * Disposes all graphs\r\n */\r\n public dispose() {\r\n for (const graph of this._flowGraphs) {\r\n graph.dispose();\r\n }\r\n this._flowGraphs.length = 0;\r\n this._disposeObserver?.remove();\r\n this._onBeforeRenderObserver?.remove();\r\n\r\n // Remove itself from the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\r\n const index = coordinators.indexOf(this);\r\n if (index !== -1) {\r\n coordinators.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this coordinator to a JSON object.\r\n * @param serializationObject the object to serialize to\r\n * @param valueSerializeFunction the function to use to serialize the value\r\n */\r\n public serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject._flowGraphs = [];\r\n for (const graph of this._flowGraphs) {\r\n const serializedGraph = {};\r\n graph.serialize(serializedGraph, valueSerializeFunction);\r\n serializationObject._flowGraphs.push(serializedGraph);\r\n }\r\n serializationObject.dispatchEventsSynchronously = this.dispatchEventsSynchronously;\r\n }\r\n\r\n /**\r\n * Gets the list of flow graphs\r\n */\r\n public get flowGraphs() {\r\n return this._flowGraphs;\r\n }\r\n\r\n /**\r\n * Get an observable that will be notified when the event with the given id is fired.\r\n * @param id the id of the event\r\n * @returns the observable for the event\r\n */\r\n public getCustomEventObservable(id: string): Observable<any> {\r\n let observable = this._customEventsMap.get(id);\r\n if (!observable) {\r\n // receive event is initialized before scene start, so no need to notify if triggered. but possible!\r\n observable = new Observable<any>(/*undefined, true*/);\r\n this._customEventsMap.set(id, observable);\r\n }\r\n return observable;\r\n }\r\n\r\n /**\r\n * Notifies the observable for the given event id with the given data.\r\n * @param id the id of the event\r\n * @param data the data to send with the event\r\n * @param async if true, the event will be dispatched asynchronously\r\n */\r\n public notifyCustomEvent(id: string, data: any, async: boolean = !this.dispatchEventsSynchronously) {\r\n if (async) {\r\n this._executeOnNextFrame.push({ id, data, uniqueId: this._eventUniqueId++ });\r\n return;\r\n }\r\n // check if we are not exceeding the max number of events\r\n if (this._eventExecutionCounter.has(id)) {\r\n const count = this._eventExecutionCounter.get(id)!;\r\n this._eventExecutionCounter.set(id, count + 1);\r\n if (count >= FlowGraphCoordinator.MaxEventTypeExecutionPerFrame) {\r\n if (count === FlowGraphCoordinator.MaxEventTypeExecutionPerFrame) {\r\n Logger.Warn(`FlowGraphCoordinator: Too many executions of event \"${id}\".`);\r\n }\r\n return;\r\n }\r\n } else {\r\n this._eventExecutionCounter.set(id, 1);\r\n }\r\n const observable = this._customEventsMap.get(id);\r\n if (observable) {\r\n observable.notifyObservers(data);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAiC1C;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAmC7B;IACI;;OAEG;IACI,MAA0C;QAA1C,WAAM,GAAN,MAAM,CAAoC;QArBrD;;;WAGG;QACI,gCAA2B,GAAY,IAAI,CAAC;QAElC,gBAAW,GAAgB,EAAE,CAAC;QAEvC,qBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAC;QAE3D,2BAAsB,GAAwB,IAAI,GAAG,EAAE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I,GAAG,EAAE,AAAhD,CAAiD","sourcesContent":["import { type Observer, Observable } from \"core/Misc/observable\";\r\nimport { type Scene } from \"../scene\";\r\nimport { FlowGraph } from \"./flowGraph\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Parameters used to create a flow graph engine.\r\n */\r\nexport interface IFlowGraphCoordinatorConfiguration {\r\n /**\r\n * The scene that the flow graph engine belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n\r\n/**\r\n * Parameters used to parse a flow graph coordinator.\r\n */\r\nexport interface IFlowGraphCoordinatorParseOptions {\r\n /**\r\n * A function that will be called to parse the value of a property.\r\n * @param key the key of the property\r\n * @param serializationObject the serialization object where the property is located\r\n * @param assetsContainer the assets container\r\n * @param scene the scene that the block is being parsed in\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\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 * The scene that the flow graph coordinator belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n/**\r\n * This class holds all of the existing flow graphs and is responsible for creating new ones.\r\n * It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator\r\n * This is the entry point for the flow graph system.\r\n * @experimental This class is still in development and is subject to change.\r\n */\r\nexport class FlowGraphCoordinator {\r\n /**\r\n * The maximum number of events per type.\r\n * This is used to limit the number of events that can be created in a single scene.\r\n * This is to prevent infinite loops.\r\n */\r\n public static MaxEventsPerType: number = 30;\r\n\r\n /**\r\n * The maximum number of execution of a specific event in a single frame.\r\n */\r\n public static MaxEventTypeExecutionPerFrame: number = 30;\r\n /**\r\n * @internal\r\n * A list of all the coordinators per scene. Will be used by the inspector\r\n */\r\n public static readonly SceneCoordinators: Map<Scene, FlowGraphCoordinator[]> = new Map();\r\n\r\n /**\r\n * When set to true (default) custom events will be dispatched synchronously.\r\n * This means that the events will be dispatched immediately when they are triggered.\r\n */\r\n public dispatchEventsSynchronously: boolean = true;\r\n\r\n private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\r\n\r\n private _eventExecutionCounter: Map<string, number> = new Map();\r\n\r\n private _disposeObserver: Observer<Scene>;\r\n private _onBeforeRenderObserver: Observer<Scene>;\r\n private _executeOnNextFrame: { id: string; data?: any; uniqueId: number }[] = [];\r\n private _eventUniqueId: number = 0;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public config: IFlowGraphCoordinatorConfiguration\r\n ) {\r\n // When the scene is disposed, dispose all graphs currently running on it.\r\n this._disposeObserver = this.config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n this._onBeforeRenderObserver = this.config.scene.onBeforeRenderObservable.add(() => {\r\n // Reset the event execution counter at the beginning of each frame.\r\n this._eventExecutionCounter.clear();\r\n // duplicate the _executeOnNextFrame array to avoid modifying it while iterating over it\r\n const executeOnNextFrame = this._executeOnNextFrame.slice(0);\r\n if (executeOnNextFrame.length) {\r\n // Execute the events that were triggered on the next frame.\r\n for (const event of executeOnNextFrame) {\r\n this.notifyCustomEvent(event.id, event.data, false);\r\n // remove the event from the array\r\n const index = this._executeOnNextFrame.findIndex((e) => e.uniqueId === event.uniqueId);\r\n if (index !== -1) {\r\n this._executeOnNextFrame.splice(index, 1);\r\n }\r\n }\r\n }\r\n });\r\n\r\n // Add itself to the SceneCoordinators list for the Inspector.\r\n let coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene);\r\n if (!coordinators) {\r\n coordinators = [];\r\n FlowGraphCoordinator.SceneCoordinators.set(this.config.scene, coordinators);\r\n }\r\n coordinators.push(this);\r\n }\r\n\r\n /**\r\n * Creates a new flow graph and adds it to the list of existing flow graphs\r\n * @param name - optional name for the new graph. If not provided, an auto-generated name is used.\r\n * @returns a new flow graph\r\n */\r\n public createGraph(name?: string): FlowGraph {\r\n const graphName = name ?? `Graph ${this._flowGraphs.length + 1}`;\r\n const graph = new FlowGraph({ scene: this.config.scene, coordinator: this, name: graphName });\r\n this._flowGraphs.push(graph);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Removes a flow graph from the list of existing flow graphs and disposes it\r\n * @param graph the graph to remove\r\n */\r\n public removeGraph(graph: FlowGraph) {\r\n const index = this._flowGraphs.indexOf(graph);\r\n if (index !== -1) {\r\n graph.dispose();\r\n this._flowGraphs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Starts all graphs\r\n */\r\n public start() {\r\n for (const graph of this._flowGraphs) {\r\n graph.start();\r\n }\r\n }\r\n\r\n /**\r\n * Disposes all graphs\r\n */\r\n public dispose() {\r\n for (const graph of this._flowGraphs) {\r\n graph.dispose();\r\n }\r\n this._flowGraphs.length = 0;\r\n this._disposeObserver?.remove();\r\n this._onBeforeRenderObserver?.remove();\r\n\r\n // Remove itself from the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\r\n const index = coordinators.indexOf(this);\r\n if (index !== -1) {\r\n coordinators.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this coordinator to a JSON object.\r\n * @param serializationObject the object to serialize to\r\n * @param valueSerializeFunction the function to use to serialize the value\r\n */\r\n public serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject._flowGraphs = [];\r\n for (const graph of this._flowGraphs) {\r\n const serializedGraph = {};\r\n graph.serialize(serializedGraph, valueSerializeFunction);\r\n serializationObject._flowGraphs.push(serializedGraph);\r\n }\r\n serializationObject.dispatchEventsSynchronously = this.dispatchEventsSynchronously;\r\n }\r\n\r\n /**\r\n * Gets the list of flow graphs\r\n */\r\n public get flowGraphs() {\r\n return this._flowGraphs;\r\n }\r\n\r\n /**\r\n * Get an observable that will be notified when the event with the given id is fired.\r\n * @param id the id of the event\r\n * @returns the observable for the event\r\n */\r\n public getCustomEventObservable(id: string): Observable<any> {\r\n let observable = this._customEventsMap.get(id);\r\n if (!observable) {\r\n // receive event is initialized before scene start, so no need to notify if triggered. but possible!\r\n observable = new Observable<any>(/*undefined, true*/);\r\n this._customEventsMap.set(id, observable);\r\n }\r\n return observable;\r\n }\r\n\r\n /**\r\n * Notifies the observable for the given event id with the given data.\r\n * @param id the id of the event\r\n * @param data the data to send with the event\r\n * @param async if true, the event will be dispatched asynchronously\r\n */\r\n public notifyCustomEvent(id: string, data: any, async: boolean = !this.dispatchEventsSynchronously) {\r\n if (async) {\r\n this._executeOnNextFrame.push({ id, data, uniqueId: this._eventUniqueId++ });\r\n return;\r\n }\r\n // check if we are not exceeding the max number of events\r\n if (this._eventExecutionCounter.has(id)) {\r\n const count = this._eventExecutionCounter.get(id)!;\r\n this._eventExecutionCounter.set(id, count + 1);\r\n if (count >= FlowGraphCoordinator.MaxEventTypeExecutionPerFrame) {\r\n if (count === FlowGraphCoordinator.MaxEventTypeExecutionPerFrame) {\r\n Logger.Warn(`FlowGraphCoordinator: Too many executions of event \"${id}\".`);\r\n }\r\n return;\r\n }\r\n } else {\r\n this._eventExecutionCounter.set(id, 1);\r\n }\r\n const observable = this._customEventsMap.get(id);\r\n if (observable) {\r\n observable.notifyObservers(data);\r\n }\r\n }\r\n}\r\n"]}
@@ -27,6 +27,21 @@ export declare function GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[]
27
27
  * @returns the parsed coordinator
28
28
  */
29
29
  export declare function ParseCoordinatorAsync(serializedObject: any, options: IFlowGraphCoordinatorParseOptions): Promise<FlowGraphCoordinator>;
30
+ /**
31
+ * Parses a flow graph coordinator from a snippet saved by the Flow Graph Editor.
32
+ * @param snippetId the snippet id to load. Versioned ids such as "ABC123#4" are supported.
33
+ * @param options options for parsing the coordinator.
34
+ * @returns the parsed flow graph coordinator.
35
+ */
36
+ export declare function ParseFlowGraphCoordinatorFromSnippetAsync(snippetId: string, options: IFlowGraphCoordinatorParseOptions): Promise<FlowGraphCoordinator>;
37
+ /**
38
+ * Parses a flow graph from a snippet saved by the Flow Graph Editor.
39
+ * If the snippet contains multiple graphs, all graphs are parsed into the provided coordinator and the active graph is returned.
40
+ * @param snippetId the snippet id to load. Versioned ids such as "ABC123#4" are supported.
41
+ * @param options options for parsing the graph.
42
+ * @returns the parsed flow graph.
43
+ */
44
+ export declare function ParseFlowGraphFromSnippetAsync(snippetId: string, options: IFlowGraphParseOptions): Promise<FlowGraph>;
30
45
  /**
31
46
  * Parses a graph from a given serialization object
32
47
  * @param serializationObject the object where the values are written
@@ -4,6 +4,32 @@ import { FlowGraphEventBlock } from "./flowGraphEventBlock.js";
4
4
  import { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock.js";
5
5
  import { defaultValueParseFunction, needsPathConverter } from "./serialization.js";
6
6
  import { getRichTypeByFlowGraphType, RichType } from "./flowGraphRichTypes.js";
7
+
8
+ import { WebRequest } from "../Misc/webRequest.js";
9
+ async function GetSerializedFlowGraphFromSnippetAsync(snippetId) {
10
+ const response = await WebRequest.FetchAsync(`https://snippet.babylonjs.com` + "/" + snippetId.replace(/#/g, "/"));
11
+ if (!response.ok) {
12
+ throw new Error("Unable to load the snippet " + snippetId);
13
+ }
14
+ const text = new TextDecoder().decode(await response.arrayBuffer());
15
+ const snippet = JSON.parse(text);
16
+ const snippetPayload = JSON.parse(snippet.jsonPayload);
17
+ const flowGraphPayload = snippetPayload.flowGraph;
18
+ if (!flowGraphPayload) {
19
+ throw new Error("Snippet " + snippetId + " does not contain a flow graph");
20
+ }
21
+ return typeof flowGraphPayload === "string" ? JSON.parse(flowGraphPayload) : flowGraphPayload;
22
+ }
23
+ function ApplyCoordinatorSerializationSettings(serializedObject, coordinator) {
24
+ if (serializedObject.dispatchEventsSynchronously !== undefined) {
25
+ coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;
26
+ }
27
+ if (serializedObject._defaultValues) {
28
+ for (const key in serializedObject._defaultValues) {
29
+ getRichTypeByFlowGraphType(key).defaultValue = serializedObject._defaultValues[key];
30
+ }
31
+ }
32
+ }
7
33
  /**
8
34
  * Given a list of blocks, find an output data connection that has a specific unique id
9
35
  * @param blocks a list of flow graph blocks
@@ -47,22 +73,51 @@ export function GetSignalInConnectionByUniqueId(blocks, uniqueId) {
47
73
  export async function ParseCoordinatorAsync(serializedObject, options) {
48
74
  const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;
49
75
  const coordinator = new FlowGraphCoordinator({ scene: options.scene });
50
- if (serializedObject.dispatchEventsSynchronously) {
51
- coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;
52
- }
76
+ ApplyCoordinatorSerializationSettings(serializedObject, coordinator);
53
77
  await options.scene.whenReadyAsync();
54
- // if custom default values are defined, set them in the global context
55
- if (serializedObject._defaultValues) {
56
- for (const key in serializedObject._defaultValues) {
57
- // key is the FlowGraphType, value is the default value
58
- const value = serializedObject._defaultValues[key];
59
- getRichTypeByFlowGraphType(key).defaultValue = value;
60
- }
61
- }
62
78
  // async-parse the flow graphs. This can be done in parallel
63
79
  await Promise.all(serializedObject._flowGraphs?.map(async (serializedGraph) => await ParseFlowGraphAsync(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter })));
64
80
  return coordinator;
65
81
  }
82
+ /**
83
+ * Parses a flow graph coordinator from a snippet saved by the Flow Graph Editor.
84
+ * @param snippetId the snippet id to load. Versioned ids such as "ABC123#4" are supported.
85
+ * @param options options for parsing the coordinator.
86
+ * @returns the parsed flow graph coordinator.
87
+ */
88
+ export async function ParseFlowGraphCoordinatorFromSnippetAsync(snippetId, options) {
89
+ const serializedObject = await GetSerializedFlowGraphFromSnippetAsync(snippetId);
90
+ if (serializedObject._flowGraphs) {
91
+ return await ParseCoordinatorAsync(serializedObject, options);
92
+ }
93
+ const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;
94
+ const coordinator = new FlowGraphCoordinator({ scene: options.scene });
95
+ await options.scene.whenReadyAsync();
96
+ await ParseFlowGraphAsync(serializedObject, { coordinator, valueParseFunction, pathConverter: options.pathConverter });
97
+ return coordinator;
98
+ }
99
+ /**
100
+ * Parses a flow graph from a snippet saved by the Flow Graph Editor.
101
+ * If the snippet contains multiple graphs, all graphs are parsed into the provided coordinator and the active graph is returned.
102
+ * @param snippetId the snippet id to load. Versioned ids such as "ABC123#4" are supported.
103
+ * @param options options for parsing the graph.
104
+ * @returns the parsed flow graph.
105
+ */
106
+ export async function ParseFlowGraphFromSnippetAsync(snippetId, options) {
107
+ const serializedObject = await GetSerializedFlowGraphFromSnippetAsync(snippetId);
108
+ const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;
109
+ if (!serializedObject._flowGraphs) {
110
+ return await ParseFlowGraphAsync(serializedObject, options);
111
+ }
112
+ ApplyCoordinatorSerializationSettings(serializedObject, options.coordinator);
113
+ const parsedGraphs = [];
114
+ for (const serializedGraph of serializedObject._flowGraphs) {
115
+ // eslint-disable-next-line no-await-in-loop -- graph order matters for the active graph index.
116
+ parsedGraphs.push(await ParseFlowGraphAsync(serializedGraph, { coordinator: options.coordinator, valueParseFunction, pathConverter: options.pathConverter }));
117
+ }
118
+ const activeGraphIndex = serializedObject.activeGraphIndex ?? 0;
119
+ return parsedGraphs[activeGraphIndex] ?? parsedGraphs[0];
120
+ }
66
121
  /**
67
122
  * Parses a graph from a given serialization object
68
123
  * @param serializationObject the object where the values are written
@@ -109,9 +164,14 @@ export function ParseFlowGraph(serializationObject, options, resolvedClasses) {
109
164
  }
110
165
  // After parsing all blocks, connect them.
111
166
  // Build lookup maps for O(1) connection resolution instead of O(B*P) linear scans.
167
+ const dataInMap = new Map();
112
168
  const dataOutMap = new Map();
113
169
  const signalInMap = new Map();
170
+ const signalOutMap = new Map();
114
171
  for (const block of blocks) {
172
+ for (const dataIn of block.dataInputs) {
173
+ dataInMap.set(dataIn.uniqueId, dataIn);
174
+ }
115
175
  for (const dataOut of block.dataOutputs) {
116
176
  dataOutMap.set(dataOut.uniqueId, dataOut);
117
177
  }
@@ -119,8 +179,17 @@ export function ParseFlowGraph(serializationObject, options, resolvedClasses) {
119
179
  for (const signalIn of block.signalInputs) {
120
180
  signalInMap.set(signalIn.uniqueId, signalIn);
121
181
  }
182
+ for (const signalOut of block.signalOutputs) {
183
+ signalOutMap.set(signalOut.uniqueId, signalOut);
184
+ }
122
185
  }
123
186
  }
187
+ const connectIfNeeded = (connection, connectedConnection) => {
188
+ if (connection._connectedPoint.indexOf(connectedConnection) !== -1) {
189
+ return;
190
+ }
191
+ connection.connectTo(connectedConnection);
192
+ };
124
193
  for (const block of blocks) {
125
194
  for (const dataIn of block.dataInputs) {
126
195
  for (const serializedConnection of dataIn.connectedPointIds) {
@@ -128,7 +197,16 @@ export function ParseFlowGraph(serializationObject, options, resolvedClasses) {
128
197
  if (!connection) {
129
198
  throw new Error("Could not find data out connection with unique id " + serializedConnection);
130
199
  }
131
- dataIn.connectTo(connection);
200
+ connectIfNeeded(dataIn, connection);
201
+ }
202
+ }
203
+ for (const dataOut of block.dataOutputs) {
204
+ for (const serializedConnection of dataOut.connectedPointIds) {
205
+ const connection = dataInMap.get(serializedConnection);
206
+ if (!connection) {
207
+ throw new Error("Could not find data in connection with unique id " + serializedConnection);
208
+ }
209
+ connectIfNeeded(dataOut, connection);
132
210
  }
133
211
  }
134
212
  if (block instanceof FlowGraphExecutionBlock) {
@@ -138,12 +216,21 @@ export function ParseFlowGraph(serializationObject, options, resolvedClasses) {
138
216
  if (!connection) {
139
217
  throw new Error("Could not find signal in connection with unique id " + serializedConnection);
140
218
  }
141
- signalOut.connectTo(connection);
219
+ connectIfNeeded(signalOut, connection);
220
+ }
221
+ }
222
+ for (const signalIn of block.signalInputs) {
223
+ for (const serializedConnection of signalIn.connectedPointIds) {
224
+ const connection = signalOutMap.get(serializedConnection);
225
+ if (!connection) {
226
+ throw new Error("Could not find signal out connection with unique id " + serializedConnection);
227
+ }
228
+ connectIfNeeded(connection, signalIn);
142
229
  }
143
230
  }
144
231
  }
145
232
  }
146
- for (const serializedContext of serializationObject.executionContexts) {
233
+ for (const serializedContext of serializationObject.executionContexts ?? []) {
147
234
  ParseFlowGraphContext(serializedContext, { graph, valueParseFunction }, serializationObject.rightHanded);
148
235
  }
149
236
  return graph;
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphParser.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAK9D,OAAO,EAA0C,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGhF,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG5E;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAwB,EAAE,QAAgB;IACrF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,OAAO,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,GAAG,QAAQ,CAAC,CAAC;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAwB,EAAE,QAAgB;IACtF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,KAAK,YAAY,uBAAuB,EAAE,CAAC;Y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AAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACrK,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,mBAAwB;IAC3C,OAAO,IAAI,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\nimport { blockFactory } from \"./Blocks/flowGraphBlockFactory\";\nimport { type FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\nimport { type FlowGraph, type IFlowGraphParseOptions } from \"./flowGraph\";\nimport { type FlowGraphBlock, type IFlowGraphBlockParseOptions } from \"./flowGraphBlock\";\nimport { type FlowGraphContext, type IFlowGraphContextParseOptions } from \"./flowGraphContext\";\nimport { type IFlowGraphCoordinatorParseOptions, FlowGraphCoordinator } from \"./flowGraphCoordinator\";\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\nimport { defaultValueParseFunction, needsPathConverter } from \"./serialization\";\nimport { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport { type Node } from \"core/node\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes\";\nimport { type FlowGraphConnection } from \"./flowGraphConnection\";\n\n/**\n * Given a list of blocks, find an output data connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n if (dataOut.uniqueId === uniqueId) {\n return dataOut;\n }\n }\n }\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\n}\n\n/**\n * Given a list of blocks, find an input signal connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\n for (const block of blocks) {\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n if (signalIn.uniqueId === uniqueId) {\n return signalIn;\n }\n }\n }\n }\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\n}\n\n/**\n * Parses a serialized coordinator.\n * @param serializedObject the object to parse\n * @param options the options to use when parsing\n * @returns the parsed coordinator\n */\nexport async function ParseCoordinatorAsync(serializedObject: any, options: IFlowGraphCoordinatorParseOptions) {\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\n\n if (serializedObject.dispatchEventsSynchronously) {\n coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;\n }\n\n await options.scene.whenReadyAsync();\n // if custom default values are defined, set them in the global context\n if (serializedObject._defaultValues) {\n for (const key in serializedObject._defaultValues) {\n // key is the FlowGraphType, value is the default value\n const value = serializedObject._defaultValues[key];\n getRichTypeByFlowGraphType(key).defaultValue = value;\n }\n }\n // async-parse the flow graphs. This can be done in parallel\n await Promise.all(\n serializedObject._flowGraphs?.map(\n async (serializedGraph: any) => await ParseFlowGraphAsync(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter })\n )\n );\n return coordinator;\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @returns the parsed graph\n */\nexport async function ParseFlowGraphAsync(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): Promise<FlowGraph> {\n // get all classes types needed for the blocks using the block factory\n const resolvedClasses = await Promise.all(\n serializationObject.allBlocks.map(async (serializedBlock) => {\n const classFactory = blockFactory(serializedBlock.className as FlowGraphBlockNames);\n return await classFactory();\n })\n );\n // async will be used when we start using the block async factory\n return ParseFlowGraph(serializationObject, options, resolvedClasses);\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @param resolvedClasses the resolved classes for the blocks\n * @returns the parsed graph\n */\nexport function ParseFlowGraph(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions, resolvedClasses: (typeof FlowGraphBlock)[]) {\n const graph = options.coordinator.createGraph();\n // Restore graph identity from serialized data\n if (serializationObject.name) {\n graph.name = serializationObject.name;\n }\n if (serializationObject.uniqueId) {\n graph.uniqueId = serializationObject.uniqueId;\n }\n const blocks: FlowGraphBlock[] = [];\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n // Parse all blocks\n // for (const serializedBlock of serializationObject.allBlocks) {\n for (let i = 0; i < serializationObject.allBlocks.length; i++) {\n const serializedBlock = serializationObject.allBlocks[i];\n const block = ParseFlowGraphBlockWithClassType(\n serializedBlock,\n { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, assetsContainer: options.coordinator.config.scene, valueParseFunction },\n resolvedClasses[i]\n );\n blocks.push(block);\n graph.addBlock(block);\n if (block instanceof FlowGraphEventBlock) {\n graph.addEventBlock(block);\n }\n }\n // After parsing all blocks, connect them.\n // Build lookup maps for O(1) connection resolution instead of O(B*P) linear scans.\n const dataOutMap = new Map<string, FlowGraphDataConnection<any>>();\n const signalInMap = new Map<string, FlowGraphSignalConnection>();\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n dataOutMap.set(dataOut.uniqueId, dataOut);\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n signalInMap.set(signalIn.uniqueId, signalIn);\n }\n }\n }\n for (const block of blocks) {\n for (const dataIn of block.dataInputs) {\n for (const serializedConnection of dataIn.connectedPointIds) {\n const connection = dataOutMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find data out connection with unique id \" + serializedConnection);\n }\n dataIn.connectTo(connection);\n }\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalOut of block.signalOutputs) {\n for (const serializedConnection of signalOut.connectedPointIds) {\n const connection = signalInMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find signal in connection with unique id \" + serializedConnection);\n }\n signalOut.connectTo(connection);\n }\n }\n }\n }\n for (const serializedContext of serializationObject.executionContexts) {\n ParseFlowGraphContext(serializedContext, { graph, valueParseFunction }, serializationObject.rightHanded);\n }\n return graph;\n}\n\n/**\n * Parses a context\n * @param serializationObject the object containing the context serialization values\n * @param options the options for parsing the context\n * @param rightHanded whether the serialized data is right handed\n * @returns\n */\nexport function ParseFlowGraphContext(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions, rightHanded?: boolean): FlowGraphContext {\n const result = options.graph.createContext();\n if (serializationObject.enableLogging) {\n result.enableLogging = true;\n }\n result.treatDataAsRightHanded = rightHanded || false;\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n result.uniqueId = serializationObject.uniqueId;\n result.name = serializationObject.name ?? \"\";\n const scene = result.getScene();\n // check if assets context is available\n if (serializationObject._assetsContext) {\n const ac = serializationObject._assetsContext;\n const assetsContext: IAssetContainer = {\n meshes: ac.meshes?.map((m: string) => scene.getMeshById(m)),\n lights: ac.lights?.map((l: string) => scene.getLightByName(l)),\n cameras: ac.cameras?.map((c: string) => scene.getCameraByName(c)),\n materials: ac.materials?.map((m: string) => scene.getMaterialById(m)),\n textures: ac.textures?.map((t: string) => scene.getTextureByName(t)),\n animations: ac.animations?.map((a: string) => scene.animations.find((anim) => anim.name === a)),\n skeletons: ac.skeletons?.map((s: string) => scene.getSkeletonByName(s)),\n particleSystems: ac.particleSystems?.map((ps: string) => scene.getParticleSystemById(ps)),\n animationGroups: ac.animationGroups?.map((ag: string) => scene.getAnimationGroupByName(ag)),\n transformNodes: ac.transformNodes?.map((tn: string) => scene.getTransformNodeById(tn)),\n rootNodes: [],\n multiMaterials: [],\n morphTargetManagers: [],\n geometries: [],\n actionManagers: [],\n environmentTexture: null,\n postProcesses: [],\n sounds: null,\n effectLayers: [],\n layers: [],\n reflectionProbes: [],\n lensFlareSystems: [],\n proceduralTextures: [],\n getNodes: function (): Array<Node> {\n throw new Error(\"Function not implemented.\");\n },\n };\n result.assetsContext = assetsContext;\n }\n for (const key in serializationObject._userVariables) {\n const value = valueParseFunction(key, serializationObject._userVariables, result.assetsContext, scene);\n result.userVariables[key] = value;\n }\n // Restore variable type annotations\n if (serializationObject._variableTypes) {\n for (const key in serializationObject._variableTypes) {\n result.setVariableType(key, serializationObject._variableTypes[key]);\n }\n }\n for (const key in serializationObject._connectionValues) {\n const value = valueParseFunction(key, serializationObject._connectionValues, result.assetsContext, scene);\n result._setConnectionValueByKey(key, value);\n }\n\n return result;\n}\n\n/**\n * Parses a block from a serialization object\n * This function is async due to the factory method that is used to create the block's class. If you load the class externally use ParseBlockWithClassType\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @returns the parsed block\n */\nexport async function ParseBlockAsync(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): Promise<FlowGraphBlock> {\n const classFactory = blockFactory(serializationObject.className as FlowGraphBlockNames);\n const classType = await classFactory();\n return ParseFlowGraphBlockWithClassType(serializationObject, parseOptions, classType);\n}\n\n/**\n * Parses a block from a serialization object\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @param classType the class type of the block. This is used when the class is not loaded asynchronously\n * @returns the parsed block\n */\nexport function ParseFlowGraphBlockWithClassType(\n serializationObject: ISerializedFlowGraphBlock,\n parseOptions: IFlowGraphBlockParseOptions,\n classType: typeof FlowGraphBlock\n): FlowGraphBlock {\n const parsedConfig: any = {};\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\n if (serializationObject.config) {\n for (const key in serializationObject.config) {\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.assetsContainer || parseOptions.scene, parseOptions.scene);\n }\n }\n if (needsPathConverter(serializationObject.className)) {\n if (!parseOptions.pathConverter) {\n throw new Error(\"Block \" + serializationObject.className + \" requires a path converter to be provided in parse options.\");\n }\n parsedConfig.pathConverter = parseOptions.pathConverter;\n }\n const obj = new classType(parsedConfig);\n obj.uniqueId = serializationObject.uniqueId;\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\n if (dataInput) {\n dataInput.deserialize(serializationObject.dataInputs[i]);\n // Restore _defaultValue if it was serialized. Without this, the\n // user-set inline value (e.g. \"2\" on an Add input, or \"position\"\n // on a GetProperty's propertyName) is lost during round-trips.\n if (serializationObject.dataInputs[i].defaultValue !== undefined) {\n (dataInput as any)._defaultValue = valueParseFunction(\n \"defaultValue\",\n serializationObject.dataInputs[i],\n parseOptions.assetsContainer || parseOptions.scene,\n parseOptions.scene\n );\n }\n } else {\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\n if (dataOutput) {\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\n } else {\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n obj.metadata = serializationObject.metadata;\n obj.deserialize && obj.deserialize(serializationObject);\n return obj;\n}\n\n/**\n * Parses a connection from an object\n * @param serializationObject the object to parse from.\n * @param ownerBlock the block that owns the connection.\n * @param classType the class type of the connection.\n * @returns the parsed connection.\n */\nexport function ParseGraphConnectionWithClassType<BlockT extends FlowGraphBlock>(serializationObject: any = {}, ownerBlock: BlockT, classType: typeof FlowGraphConnection) {\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @param classType the class type of the data connection\n * @returns the parsed connection\n */\nexport function ParseGraphDataConnection(serializationObject: any, ownerBlock: FlowGraphBlock, classType: typeof FlowGraphDataConnection): FlowGraphDataConnection<any> {\n const richType = ParseRichType(serializationObject.richType);\n const defaultValue = serializationObject.defaultValue;\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock, richType, defaultValue, !!serializationObject._optional);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\nfunction ParseRichType(serializationObject: any): RichType<any> {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n}\n"]}
1
+ {"version":3,"file":"flowGraphParser.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAK9D,OAAO,EAA0C,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGhF,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK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C;IACL,CAAC;IACD,GAAG,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IAC5C,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IACxD,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAAgC,sBAA2B,EAAE,EAAE,UAAkB,EAAE,SAAqC;IACrK,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC5G,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,mBAAwB,EAAE,UAA0B,EAAE,SAAyC;IACpI,MAAM,QAAQ,GAAG,aAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC;IACtD,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACrK,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,mBAAwB;IAC3C,OAAO,IAAI,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\nimport { blockFactory } from \"./Blocks/flowGraphBlockFactory\";\nimport { type FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\nimport { type FlowGraph, type IFlowGraphParseOptions } from \"./flowGraph\";\nimport { type FlowGraphBlock, type IFlowGraphBlockParseOptions } from \"./flowGraphBlock\";\nimport { type FlowGraphContext, type IFlowGraphContextParseOptions } from \"./flowGraphContext\";\nimport { type IFlowGraphCoordinatorParseOptions, FlowGraphCoordinator } from \"./flowGraphCoordinator\";\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\nimport { defaultValueParseFunction, needsPathConverter } from \"./serialization\";\nimport { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport { type Node } from \"core/node\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes\";\nimport { type FlowGraphConnection } from \"./flowGraphConnection\";\nimport { Constants } from \"core/Engines/constants\";\nimport { WebRequest } from \"core/Misc/webRequest\";\n\nasync function GetSerializedFlowGraphFromSnippetAsync(snippetId: string): Promise<any> {\n const response = await WebRequest.FetchAsync(Constants.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n if (!response.ok) {\n throw new Error(\"Unable to load the snippet \" + snippetId);\n }\n\n const text = new TextDecoder().decode(await response.arrayBuffer());\n const snippet = JSON.parse(text);\n const snippetPayload = JSON.parse(snippet.jsonPayload);\n const flowGraphPayload = snippetPayload.flowGraph;\n if (!flowGraphPayload) {\n throw new Error(\"Snippet \" + snippetId + \" does not contain a flow graph\");\n }\n\n return typeof flowGraphPayload === \"string\" ? JSON.parse(flowGraphPayload) : flowGraphPayload;\n}\n\nfunction ApplyCoordinatorSerializationSettings(serializedObject: any, coordinator: FlowGraphCoordinator): void {\n if (serializedObject.dispatchEventsSynchronously !== undefined) {\n coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;\n }\n\n if (serializedObject._defaultValues) {\n for (const key in serializedObject._defaultValues) {\n getRichTypeByFlowGraphType(key).defaultValue = serializedObject._defaultValues[key];\n }\n }\n}\n\n/**\n * Given a list of blocks, find an output data connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n if (dataOut.uniqueId === uniqueId) {\n return dataOut;\n }\n }\n }\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\n}\n\n/**\n * Given a list of blocks, find an input signal connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\n for (const block of blocks) {\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n if (signalIn.uniqueId === uniqueId) {\n return signalIn;\n }\n }\n }\n }\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\n}\n\n/**\n * Parses a serialized coordinator.\n * @param serializedObject the object to parse\n * @param options the options to use when parsing\n * @returns the parsed coordinator\n */\nexport async function ParseCoordinatorAsync(serializedObject: any, options: IFlowGraphCoordinatorParseOptions) {\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\n\n ApplyCoordinatorSerializationSettings(serializedObject, coordinator);\n\n await options.scene.whenReadyAsync();\n // async-parse the flow graphs. This can be done in parallel\n await Promise.all(\n serializedObject._flowGraphs?.map(\n async (serializedGraph: any) => await ParseFlowGraphAsync(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter })\n )\n );\n return coordinator;\n}\n\n/**\n * Parses a flow graph coordinator from a snippet saved by the Flow Graph Editor.\n * @param snippetId the snippet id to load. Versioned ids such as \"ABC123#4\" are supported.\n * @param options options for parsing the coordinator.\n * @returns the parsed flow graph coordinator.\n */\nexport async function ParseFlowGraphCoordinatorFromSnippetAsync(snippetId: string, options: IFlowGraphCoordinatorParseOptions): Promise<FlowGraphCoordinator> {\n const serializedObject = await GetSerializedFlowGraphFromSnippetAsync(snippetId);\n if (serializedObject._flowGraphs) {\n return await ParseCoordinatorAsync(serializedObject, options);\n }\n\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\n await options.scene.whenReadyAsync();\n await ParseFlowGraphAsync(serializedObject, { coordinator, valueParseFunction, pathConverter: options.pathConverter });\n return coordinator;\n}\n\n/**\n * Parses a flow graph from a snippet saved by the Flow Graph Editor.\n * If the snippet contains multiple graphs, all graphs are parsed into the provided coordinator and the active graph is returned.\n * @param snippetId the snippet id to load. Versioned ids such as \"ABC123#4\" are supported.\n * @param options options for parsing the graph.\n * @returns the parsed flow graph.\n */\nexport async function ParseFlowGraphFromSnippetAsync(snippetId: string, options: IFlowGraphParseOptions): Promise<FlowGraph> {\n const serializedObject = await GetSerializedFlowGraphFromSnippetAsync(snippetId);\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n\n if (!serializedObject._flowGraphs) {\n return await ParseFlowGraphAsync(serializedObject, options);\n }\n\n ApplyCoordinatorSerializationSettings(serializedObject, options.coordinator);\n const parsedGraphs: FlowGraph[] = [];\n for (const serializedGraph of serializedObject._flowGraphs) {\n // eslint-disable-next-line no-await-in-loop -- graph order matters for the active graph index.\n parsedGraphs.push(await ParseFlowGraphAsync(serializedGraph, { coordinator: options.coordinator, valueParseFunction, pathConverter: options.pathConverter }));\n }\n\n const activeGraphIndex = serializedObject.activeGraphIndex ?? 0;\n return parsedGraphs[activeGraphIndex] ?? parsedGraphs[0];\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @returns the parsed graph\n */\nexport async function ParseFlowGraphAsync(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): Promise<FlowGraph> {\n // get all classes types needed for the blocks using the block factory\n const resolvedClasses = await Promise.all(\n serializationObject.allBlocks.map(async (serializedBlock) => {\n const classFactory = blockFactory(serializedBlock.className as FlowGraphBlockNames);\n return await classFactory();\n })\n );\n // async will be used when we start using the block async factory\n return ParseFlowGraph(serializationObject, options, resolvedClasses);\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @param resolvedClasses the resolved classes for the blocks\n * @returns the parsed graph\n */\nexport function ParseFlowGraph(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions, resolvedClasses: (typeof FlowGraphBlock)[]) {\n const graph = options.coordinator.createGraph();\n // Restore graph identity from serialized data\n if (serializationObject.name) {\n graph.name = serializationObject.name;\n }\n if (serializationObject.uniqueId) {\n graph.uniqueId = serializationObject.uniqueId;\n }\n const blocks: FlowGraphBlock[] = [];\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n // Parse all blocks\n // for (const serializedBlock of serializationObject.allBlocks) {\n for (let i = 0; i < serializationObject.allBlocks.length; i++) {\n const serializedBlock = serializationObject.allBlocks[i];\n const block = ParseFlowGraphBlockWithClassType(\n serializedBlock,\n { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, assetsContainer: options.coordinator.config.scene, valueParseFunction },\n resolvedClasses[i]\n );\n blocks.push(block);\n graph.addBlock(block);\n if (block instanceof FlowGraphEventBlock) {\n graph.addEventBlock(block);\n }\n }\n // After parsing all blocks, connect them.\n // Build lookup maps for O(1) connection resolution instead of O(B*P) linear scans.\n const dataInMap = new Map<string, FlowGraphDataConnection<any>>();\n const dataOutMap = new Map<string, FlowGraphDataConnection<any>>();\n const signalInMap = new Map<string, FlowGraphSignalConnection>();\n const signalOutMap = new Map<string, FlowGraphSignalConnection>();\n for (const block of blocks) {\n for (const dataIn of block.dataInputs) {\n dataInMap.set(dataIn.uniqueId, dataIn);\n }\n for (const dataOut of block.dataOutputs) {\n dataOutMap.set(dataOut.uniqueId, dataOut);\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n signalInMap.set(signalIn.uniqueId, signalIn);\n }\n for (const signalOut of block.signalOutputs) {\n signalOutMap.set(signalOut.uniqueId, signalOut);\n }\n }\n }\n const connectIfNeeded = <ConnectionT extends FlowGraphConnection<any, any>>(connection: ConnectionT, connectedConnection: ConnectionT) => {\n if (connection._connectedPoint.indexOf(connectedConnection) !== -1) {\n return;\n }\n connection.connectTo(connectedConnection);\n };\n for (const block of blocks) {\n for (const dataIn of block.dataInputs) {\n for (const serializedConnection of dataIn.connectedPointIds) {\n const connection = dataOutMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find data out connection with unique id \" + serializedConnection);\n }\n connectIfNeeded(dataIn, connection);\n }\n }\n for (const dataOut of block.dataOutputs) {\n for (const serializedConnection of dataOut.connectedPointIds) {\n const connection = dataInMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find data in connection with unique id \" + serializedConnection);\n }\n connectIfNeeded(dataOut, connection);\n }\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalOut of block.signalOutputs) {\n for (const serializedConnection of signalOut.connectedPointIds) {\n const connection = signalInMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find signal in connection with unique id \" + serializedConnection);\n }\n connectIfNeeded(signalOut, connection);\n }\n }\n for (const signalIn of block.signalInputs) {\n for (const serializedConnection of signalIn.connectedPointIds) {\n const connection = signalOutMap.get(serializedConnection);\n if (!connection) {\n throw new Error(\"Could not find signal out connection with unique id \" + serializedConnection);\n }\n connectIfNeeded(connection, signalIn);\n }\n }\n }\n }\n for (const serializedContext of serializationObject.executionContexts ?? []) {\n ParseFlowGraphContext(serializedContext, { graph, valueParseFunction }, serializationObject.rightHanded);\n }\n return graph;\n}\n\n/**\n * Parses a context\n * @param serializationObject the object containing the context serialization values\n * @param options the options for parsing the context\n * @param rightHanded whether the serialized data is right handed\n * @returns\n */\nexport function ParseFlowGraphContext(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions, rightHanded?: boolean): FlowGraphContext {\n const result = options.graph.createContext();\n if (serializationObject.enableLogging) {\n result.enableLogging = true;\n }\n result.treatDataAsRightHanded = rightHanded || false;\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n result.uniqueId = serializationObject.uniqueId;\n result.name = serializationObject.name ?? \"\";\n const scene = result.getScene();\n // check if assets context is available\n if (serializationObject._assetsContext) {\n const ac = serializationObject._assetsContext;\n const assetsContext: IAssetContainer = {\n meshes: ac.meshes?.map((m: string) => scene.getMeshById(m)),\n lights: ac.lights?.map((l: string) => scene.getLightByName(l)),\n cameras: ac.cameras?.map((c: string) => scene.getCameraByName(c)),\n materials: ac.materials?.map((m: string) => scene.getMaterialById(m)),\n textures: ac.textures?.map((t: string) => scene.getTextureByName(t)),\n animations: ac.animations?.map((a: string) => scene.animations.find((anim) => anim.name === a)),\n skeletons: ac.skeletons?.map((s: string) => scene.getSkeletonByName(s)),\n particleSystems: ac.particleSystems?.map((ps: string) => scene.getParticleSystemById(ps)),\n animationGroups: ac.animationGroups?.map((ag: string) => scene.getAnimationGroupByName(ag)),\n transformNodes: ac.transformNodes?.map((tn: string) => scene.getTransformNodeById(tn)),\n rootNodes: [],\n multiMaterials: [],\n morphTargetManagers: [],\n geometries: [],\n actionManagers: [],\n environmentTexture: null,\n postProcesses: [],\n sounds: null,\n effectLayers: [],\n layers: [],\n reflectionProbes: [],\n lensFlareSystems: [],\n proceduralTextures: [],\n getNodes: function (): Array<Node> {\n throw new Error(\"Function not implemented.\");\n },\n };\n result.assetsContext = assetsContext;\n }\n for (const key in serializationObject._userVariables) {\n const value = valueParseFunction(key, serializationObject._userVariables, result.assetsContext, scene);\n result.userVariables[key] = value;\n }\n // Restore variable type annotations\n if (serializationObject._variableTypes) {\n for (const key in serializationObject._variableTypes) {\n result.setVariableType(key, serializationObject._variableTypes[key]);\n }\n }\n for (const key in serializationObject._connectionValues) {\n const value = valueParseFunction(key, serializationObject._connectionValues, result.assetsContext, scene);\n result._setConnectionValueByKey(key, value);\n }\n\n return result;\n}\n\n/**\n * Parses a block from a serialization object\n * This function is async due to the factory method that is used to create the block's class. If you load the class externally use ParseBlockWithClassType\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @returns the parsed block\n */\nexport async function ParseBlockAsync(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): Promise<FlowGraphBlock> {\n const classFactory = blockFactory(serializationObject.className as FlowGraphBlockNames);\n const classType = await classFactory();\n return ParseFlowGraphBlockWithClassType(serializationObject, parseOptions, classType);\n}\n\n/**\n * Parses a block from a serialization object\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @param classType the class type of the block. This is used when the class is not loaded asynchronously\n * @returns the parsed block\n */\nexport function ParseFlowGraphBlockWithClassType(\n serializationObject: ISerializedFlowGraphBlock,\n parseOptions: IFlowGraphBlockParseOptions,\n classType: typeof FlowGraphBlock\n): FlowGraphBlock {\n const parsedConfig: any = {};\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\n if (serializationObject.config) {\n for (const key in serializationObject.config) {\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.assetsContainer || parseOptions.scene, parseOptions.scene);\n }\n }\n if (needsPathConverter(serializationObject.className)) {\n if (!parseOptions.pathConverter) {\n throw new Error(\"Block \" + serializationObject.className + \" requires a path converter to be provided in parse options.\");\n }\n parsedConfig.pathConverter = parseOptions.pathConverter;\n }\n const obj = new classType(parsedConfig);\n obj.uniqueId = serializationObject.uniqueId;\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\n if (dataInput) {\n dataInput.deserialize(serializationObject.dataInputs[i]);\n // Restore _defaultValue if it was serialized. Without this, the\n // user-set inline value (e.g. \"2\" on an Add input, or \"position\"\n // on a GetProperty's propertyName) is lost during round-trips.\n if (serializationObject.dataInputs[i].defaultValue !== undefined) {\n (dataInput as any)._defaultValue = valueParseFunction(\n \"defaultValue\",\n serializationObject.dataInputs[i],\n parseOptions.assetsContainer || parseOptions.scene,\n parseOptions.scene\n );\n }\n } else {\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\n if (dataOutput) {\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\n } else {\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n obj.metadata = serializationObject.metadata;\n obj.deserialize && obj.deserialize(serializationObject);\n return obj;\n}\n\n/**\n * Parses a connection from an object\n * @param serializationObject the object to parse from.\n * @param ownerBlock the block that owns the connection.\n * @param classType the class type of the connection.\n * @returns the parsed connection.\n */\nexport function ParseGraphConnectionWithClassType<BlockT extends FlowGraphBlock>(serializationObject: any = {}, ownerBlock: BlockT, classType: typeof FlowGraphConnection) {\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @param classType the class type of the data connection\n * @returns the parsed connection\n */\nexport function ParseGraphDataConnection(serializationObject: any, ownerBlock: FlowGraphBlock, classType: typeof FlowGraphDataConnection): FlowGraphDataConnection<any> {\n const richType = ParseRichType(serializationObject.richType);\n const defaultValue = serializationObject.defaultValue;\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock, richType, defaultValue, !!serializationObject._optional);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\nfunction ParseRichType(serializationObject: any): RichType<any> {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n}\n"]}