@onerjs/core 8.56.4 → 9.0.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 (482) hide show
  1. package/Animations/animatable.core.js +36 -0
  2. package/Animations/animatable.core.js.map +1 -1
  3. package/Animations/animationGroup.pure.d.ts +61 -1
  4. package/Animations/animationGroup.pure.js +191 -2
  5. package/Animations/animationGroup.pure.js.map +1 -1
  6. package/Animations/index.d.ts +1 -0
  7. package/Animations/index.js +1 -0
  8. package/Animations/index.js.map +1 -1
  9. package/Animations/pure.d.ts +1 -0
  10. package/Animations/pure.js +1 -0
  11. package/Animations/pure.js.map +1 -1
  12. package/Animations/rootMotion.d.ts +560 -0
  13. package/Animations/rootMotion.js +1709 -0
  14. package/Animations/rootMotion.js.map +1 -0
  15. package/Animations/runtimeAnimation.d.ts +57 -0
  16. package/Animations/runtimeAnimation.js +127 -3
  17. package/Animations/runtimeAnimation.js.map +1 -1
  18. package/Cameras/arcRotateCamera.pure.d.ts +2 -0
  19. package/Cameras/arcRotateCamera.pure.js +2 -0
  20. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  21. package/Cameras/targetCamera.pure.d.ts +2 -0
  22. package/Cameras/targetCamera.pure.js +7 -1
  23. package/Cameras/targetCamera.pure.js.map +1 -1
  24. package/Collisions/gpuPicker.js +5 -5
  25. package/Collisions/gpuPicker.js.map +1 -1
  26. package/Engines/AbstractEngine/abstractEngine.query.pure.js +4 -2
  27. package/Engines/AbstractEngine/abstractEngine.query.pure.js.map +1 -1
  28. package/Engines/AbstractEngine/abstractEngine.query.types.d.ts +11 -2
  29. package/Engines/AbstractEngine/abstractEngine.query.types.js.map +1 -1
  30. package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js +1 -0
  31. package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js.map +1 -1
  32. package/Engines/Extensions/engine.multiRender.pure.js +63 -0
  33. package/Engines/Extensions/engine.multiRender.pure.js.map +1 -1
  34. package/Engines/Extensions/engine.multiRender.types.d.ts +13 -0
  35. package/Engines/Extensions/engine.multiRender.types.js.map +1 -1
  36. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +2 -2
  37. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
  38. package/Engines/Extensions/engine.prefilteredCubeTexture.types.d.ts +2 -1
  39. package/Engines/Extensions/engine.prefilteredCubeTexture.types.js.map +1 -1
  40. package/Engines/Extensions/index.d.ts +1 -0
  41. package/Engines/Extensions/index.js +1 -0
  42. package/Engines/Extensions/index.js.map +1 -1
  43. package/Engines/Extensions/pure.d.ts +1 -1
  44. package/Engines/Extensions/pure.js +1 -1
  45. package/Engines/Extensions/pure.js.map +1 -1
  46. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +88 -39
  47. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
  48. package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.d.ts +20 -2
  49. package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.js.map +1 -1
  50. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +4 -0
  51. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
  52. package/Engines/WebGPU/Extensions/engine.multiRender.types.d.ts +13 -0
  53. package/Engines/WebGPU/Extensions/engine.multiRender.types.js.map +1 -1
  54. package/Engines/WebGPU/Extensions/engine.query.pure.js +11 -3
  55. package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
  56. package/Engines/WebGPU/Extensions/index.d.ts +1 -0
  57. package/Engines/WebGPU/Extensions/index.js +1 -0
  58. package/Engines/WebGPU/Extensions/index.js.map +1 -1
  59. package/Engines/WebGPU/Extensions/pure.d.ts +1 -1
  60. package/Engines/WebGPU/Extensions/pure.js +1 -1
  61. package/Engines/WebGPU/Extensions/pure.js.map +1 -1
  62. package/Engines/WebGPU/webgpuBundleList.d.ts +2 -0
  63. package/Engines/WebGPU/webgpuBundleList.js +4 -0
  64. package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
  65. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +5 -2
  66. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  67. package/Engines/WebGPU/webgpuHardwareTexture.js +3 -1
  68. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  69. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -1
  70. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  71. package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +4 -0
  72. package/Engines/WebGPU/webgpuSnapshotRendering.js +40 -7
  73. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  74. package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -1
  75. package/Engines/WebGPU/webgpuTextureHelper.js +2 -2
  76. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  77. package/Engines/WebGPU/webgpuTextureManager.d.ts +2 -0
  78. package/Engines/WebGPU/webgpuTextureManager.js +286 -13
  79. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  80. package/Engines/abstractEngine.pure.d.ts +2 -0
  81. package/Engines/abstractEngine.pure.js +7 -3
  82. package/Engines/abstractEngine.pure.js.map +1 -1
  83. package/Engines/constants.d.ts +4 -0
  84. package/Engines/constants.js +4 -0
  85. package/Engines/constants.js.map +1 -1
  86. package/Engines/thinEngine.pure.d.ts +14 -0
  87. package/Engines/thinEngine.pure.js +48 -12
  88. package/Engines/thinEngine.pure.js.map +1 -1
  89. package/Engines/thinNativeEngine.pure.d.ts +1 -0
  90. package/Engines/thinNativeEngine.pure.js +7 -1
  91. package/Engines/thinNativeEngine.pure.js.map +1 -1
  92. package/Engines/thinWebGPUEngine.d.ts +4 -0
  93. package/Engines/thinWebGPUEngine.js +10 -1
  94. package/Engines/thinWebGPUEngine.js.map +1 -1
  95. package/Engines/webgpuEngine.pure.d.ts +5 -2
  96. package/Engines/webgpuEngine.pure.js +48 -13
  97. package/Engines/webgpuEngine.pure.js.map +1 -1
  98. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +2 -2
  99. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  100. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.d.ts +11 -2
  101. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +1 -1
  102. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  103. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.d.ts +9 -1
  104. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js +6 -8
  105. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js.map +1 -1
  106. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.d.ts +2 -0
  107. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js +5 -1
  108. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js.map +1 -1
  109. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.d.ts +2 -0
  110. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js +5 -1
  111. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js.map +1 -1
  112. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +9 -0
  113. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +34 -9
  114. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  115. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +2 -0
  116. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +4 -0
  117. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  118. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +2 -0
  119. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +4 -0
  120. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  121. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js +19 -7
  122. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js.map +1 -1
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +20 -2
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +53 -10
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.d.ts +16 -1
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +64 -14
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  129. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js +64 -16
  130. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js.map +1 -1
  131. package/FlowGraph/flowGraph.d.ts +4 -0
  132. package/FlowGraph/flowGraph.js +38 -7
  133. package/FlowGraph/flowGraph.js.map +1 -1
  134. package/FlowGraph/flowGraphBlock.js +3 -0
  135. package/FlowGraph/flowGraphBlock.js.map +1 -1
  136. package/FlowGraph/flowGraphConnection.d.ts +7 -0
  137. package/FlowGraph/flowGraphConnection.js +7 -0
  138. package/FlowGraph/flowGraphConnection.js.map +1 -1
  139. package/FlowGraph/flowGraphContext.d.ts +2 -1
  140. package/FlowGraph/flowGraphContext.js +4 -3
  141. package/FlowGraph/flowGraphContext.js.map +1 -1
  142. package/FlowGraph/flowGraphCoordinator.d.ts +15 -1
  143. package/FlowGraph/flowGraphCoordinator.js +47 -16
  144. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  145. package/FlowGraph/flowGraphEventBlock.d.ts +5 -0
  146. package/FlowGraph/flowGraphEventBlock.js +7 -0
  147. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  148. package/FlowGraph/flowGraphHostResolver.d.ts +2 -1
  149. package/FlowGraph/flowGraphHostResolver.js.map +1 -1
  150. package/FlowGraph/flowGraphParser.js +60 -2
  151. package/FlowGraph/flowGraphParser.js.map +1 -1
  152. package/FlowGraph/serialization.d.ts +2 -0
  153. package/FlowGraph/serialization.js +10 -22
  154. package/FlowGraph/serialization.js.map +1 -1
  155. package/FlowGraph/typeDefinitions.d.ts +8 -0
  156. package/FlowGraph/typeDefinitions.js.map +1 -1
  157. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.d.ts +5 -0
  158. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js +8 -0
  159. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js.map +1 -0
  160. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.d.ts +87 -0
  161. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js +295 -0
  162. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js.map +1 -0
  163. package/FrameGraph/Node/Blocks/PostProcesses/pure.d.ts +1 -0
  164. package/FrameGraph/Node/Blocks/PostProcesses/pure.js +1 -0
  165. package/FrameGraph/Node/Blocks/PostProcesses/pure.js.map +1 -1
  166. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +4 -4
  167. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  168. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.d.ts +5 -1
  169. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +13 -1
  170. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
  171. package/FrameGraph/Node/Blocks/allBlocks.pure.js +2 -0
  172. package/FrameGraph/Node/Blocks/allBlocks.pure.js.map +1 -1
  173. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  174. package/FrameGraph/Node/Blocks/index.js +1 -0
  175. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  176. package/FrameGraph/Node/Blocks/inputBlock.pure.js +20 -1
  177. package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
  178. package/FrameGraph/Node/Blocks/pure.d.ts +1 -0
  179. package/FrameGraph/Node/Blocks/pure.js +1 -0
  180. package/FrameGraph/Node/Blocks/pure.js.map +1 -1
  181. package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
  182. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +4 -2
  183. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
  184. package/FrameGraph/Node/nodeRenderGraph.js +1 -1
  185. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  186. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +1 -0
  187. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
  188. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +5 -1
  189. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  190. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +1 -0
  191. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -1
  192. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.d.ts +69 -0
  193. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js +223 -0
  194. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js.map +1 -0
  195. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +25 -3
  196. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +69 -33
  197. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  198. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -1
  199. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  200. package/FrameGraph/frameGraphObjectList.d.ts +6 -1
  201. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  202. package/FrameGraph/frameGraphRenderContext.d.ts +3 -1
  203. package/FrameGraph/frameGraphRenderContext.js +5 -5
  204. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  205. package/FrameGraph/index.d.ts +1 -0
  206. package/FrameGraph/index.js +1 -0
  207. package/FrameGraph/index.js.map +1 -1
  208. package/FrameGraph/pure.d.ts +1 -0
  209. package/FrameGraph/pure.js +1 -0
  210. package/FrameGraph/pure.js.map +1 -1
  211. package/Inputs/scene.inputManager.d.ts +4 -0
  212. package/Inputs/scene.inputManager.js +50 -8
  213. package/Inputs/scene.inputManager.js.map +1 -1
  214. package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js +5 -5
  215. package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js.map +1 -1
  216. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +5 -5
  217. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
  218. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +26 -1
  219. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +151 -47
  220. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  221. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +5 -5
  222. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
  223. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +11 -1
  224. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
  225. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js +17 -2
  226. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js.map +1 -1
  227. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +2 -2
  228. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
  229. package/Materials/Node/nodeMaterial.pure.d.ts +4 -0
  230. package/Materials/Node/nodeMaterial.pure.js +4 -0
  231. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  232. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
  233. package/Materials/Node/nodeMaterialBuildState.js +25 -3
  234. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  235. package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -0
  236. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -0
  237. package/Materials/Textures/Procedurals/proceduralTexture.pure.d.ts +13 -14
  238. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +6 -6
  239. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  240. package/Materials/Textures/baseTexture.pure.js +3 -0
  241. package/Materials/Textures/baseTexture.pure.js.map +1 -1
  242. package/Materials/Textures/cubeTexture.pure.js +1 -1
  243. package/Materials/Textures/cubeTexture.pure.js.map +1 -1
  244. package/Materials/Textures/internalTexture.d.ts +8 -1
  245. package/Materials/Textures/internalTexture.js +9 -2
  246. package/Materials/Textures/internalTexture.js.map +1 -1
  247. package/Materials/Textures/rawTexture2DArray.functions.d.ts +3 -3
  248. package/Materials/Textures/rawTexture2DArray.functions.js.map +1 -1
  249. package/Materials/Textures/rawTexture3D.d.ts +1 -1
  250. package/Materials/Textures/rawTexture3D.js +1 -1
  251. package/Materials/Textures/rawTexture3D.js.map +1 -1
  252. package/Materials/Textures/textureHelper.functions.d.ts +14 -0
  253. package/Materials/Textures/textureHelper.functions.js +24 -0
  254. package/Materials/Textures/textureHelper.functions.js.map +1 -1
  255. package/Materials/ditheredTileFadeMaterialPlugin.d.ts +210 -0
  256. package/Materials/ditheredTileFadeMaterialPlugin.js +509 -0
  257. package/Materials/ditheredTileFadeMaterialPlugin.js.map +1 -0
  258. package/Materials/index.d.ts +1 -0
  259. package/Materials/index.js +1 -0
  260. package/Materials/index.js.map +1 -1
  261. package/Materials/materialHelper.geometryrendering.d.ts +46 -1
  262. package/Materials/materialHelper.geometryrendering.js +105 -8
  263. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  264. package/Materials/prepass.defines.d.ts +2 -0
  265. package/Materials/prepass.defines.js +2 -0
  266. package/Materials/prepass.defines.js.map +1 -1
  267. package/Materials/pure.d.ts +1 -0
  268. package/Materials/pure.js +1 -0
  269. package/Materials/pure.js.map +1 -1
  270. package/Materials/standardMaterial.pure.d.ts +2 -0
  271. package/Materials/standardMaterial.pure.js +6 -3
  272. package/Materials/standardMaterial.pure.js.map +1 -1
  273. package/Meshes/Builders/polygonBuilder.pure.d.ts +4 -0
  274. package/Meshes/Builders/polygonBuilder.pure.js +4 -1
  275. package/Meshes/Builders/polygonBuilder.pure.js.map +1 -1
  276. package/Meshes/GaussianSplatting/gaussianSplatting.functions.d.ts +19 -0
  277. package/Meshes/GaussianSplatting/gaussianSplatting.functions.js +23 -0
  278. package/Meshes/GaussianSplatting/gaussianSplatting.functions.js.map +1 -0
  279. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -14
  280. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +20 -24
  281. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  282. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -0
  283. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +11 -4
  284. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  285. package/Meshes/abstractMesh.pure.d.ts +18 -0
  286. package/Meshes/abstractMesh.pure.js +22 -0
  287. package/Meshes/abstractMesh.pure.js.map +1 -1
  288. package/Meshes/index.d.ts +1 -0
  289. package/Meshes/index.js +1 -0
  290. package/Meshes/index.js.map +1 -1
  291. package/Meshes/instancedMesh.pure.d.ts +5 -0
  292. package/Meshes/instancedMesh.pure.js +12 -0
  293. package/Meshes/instancedMesh.pure.js.map +1 -1
  294. package/Meshes/mesh.pure.js +23 -8
  295. package/Meshes/mesh.pure.js.map +1 -1
  296. package/Meshes/meshBlendingTag.d.ts +47 -0
  297. package/Meshes/meshBlendingTag.js +64 -0
  298. package/Meshes/meshBlendingTag.js.map +1 -0
  299. package/Meshes/polygonMesh.js +2 -2
  300. package/Meshes/polygonMesh.js.map +1 -1
  301. package/Meshes/pure.d.ts +1 -0
  302. package/Meshes/pure.js +1 -0
  303. package/Meshes/pure.js.map +1 -1
  304. package/Misc/fileTools.pure.js +21 -0
  305. package/Misc/fileTools.pure.js.map +1 -1
  306. package/Misc/snapshotRenderingHelper.js +2 -2
  307. package/Misc/snapshotRenderingHelper.js.map +1 -1
  308. package/Misc/tools.pure.js +1 -1
  309. package/Misc/tools.pure.js.map +1 -1
  310. package/Particles/gpuParticleSystem.pure.d.ts +2 -0
  311. package/Particles/gpuParticleSystem.pure.js +89 -28
  312. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  313. package/Particles/thinParticleSystem.pure.d.ts +2 -0
  314. package/Particles/thinParticleSystem.pure.js +84 -19
  315. package/Particles/thinParticleSystem.pure.js.map +1 -1
  316. package/Particles/webgl2ParticleSystem.pure.d.ts +1 -0
  317. package/Particles/webgl2ParticleSystem.pure.js +12 -4
  318. package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
  319. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js +7 -0
  320. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js.map +1 -1
  321. package/PostProcesses/index.d.ts +2 -0
  322. package/PostProcesses/index.js +2 -0
  323. package/PostProcesses/index.js.map +1 -1
  324. package/PostProcesses/meshBlendingBlueNoise.d.ts +15 -0
  325. package/PostProcesses/meshBlendingBlueNoise.js +77 -0
  326. package/PostProcesses/meshBlendingBlueNoise.js.map +1 -0
  327. package/PostProcesses/meshBlendingPostProcess.d.ts +131 -0
  328. package/PostProcesses/meshBlendingPostProcess.js +315 -0
  329. package/PostProcesses/meshBlendingPostProcess.js.map +1 -0
  330. package/PostProcesses/pure.d.ts +2 -0
  331. package/PostProcesses/pure.js +2 -0
  332. package/PostProcesses/pure.js.map +1 -1
  333. package/PostProcesses/thinMeshBlendingPostProcess.d.ts +339 -0
  334. package/PostProcesses/thinMeshBlendingPostProcess.js +771 -0
  335. package/PostProcesses/thinMeshBlendingPostProcess.js.map +1 -0
  336. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +6 -6
  337. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  338. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +8 -8
  339. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  340. package/Rendering/boundingBoxRenderer.pure.js +2 -1
  341. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  342. package/Rendering/depthRenderer.pure.js +3 -4
  343. package/Rendering/depthRenderer.pure.js.map +1 -1
  344. package/Rendering/edgesRenderer.pure.d.ts +4 -2
  345. package/Rendering/edgesRenderer.pure.js +11 -2
  346. package/Rendering/edgesRenderer.pure.js.map +1 -1
  347. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +10 -0
  348. package/Rendering/fluidRenderer/fluidRenderingObject.js +20 -0
  349. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  350. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +9 -3
  351. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +14 -9
  352. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  353. package/Rendering/geometryBufferRenderer.pure.d.ts +38 -4
  354. package/Rendering/geometryBufferRenderer.pure.js +126 -17
  355. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  356. package/Rendering/objectRenderer.d.ts +7 -1
  357. package/Rendering/objectRenderer.js +45 -7
  358. package/Rendering/objectRenderer.js.map +1 -1
  359. package/Rendering/outlineRenderer.pure.js +6 -2
  360. package/Rendering/outlineRenderer.pure.js.map +1 -1
  361. package/Rendering/renderingManager.d.ts +1 -1
  362. package/Rendering/renderingManager.js +5 -4
  363. package/Rendering/renderingManager.js.map +1 -1
  364. package/Shaders/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
  365. package/Shaders/ShadersInclude/defaultFragmentAlpha.js +34 -0
  366. package/Shaders/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
  367. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +5 -1
  368. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  369. package/Shaders/ShadersInclude/geometryRenderingFragment.d.ts +5 -0
  370. package/Shaders/ShadersInclude/geometryRenderingFragment.js +74 -0
  371. package/Shaders/ShadersInclude/geometryRenderingFragment.js.map +1 -0
  372. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js +89 -0
  373. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js.map +1 -1
  374. package/Shaders/ShadersInclude/openpbrBlockPrePass.js +24 -17
  375. package/Shaders/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
  376. package/Shaders/ShadersInclude/pbrBlockPrePass.js +27 -20
  377. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  378. package/Shaders/ShadersInclude/pbrDebug.js +6 -2
  379. package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
  380. package/Shaders/ShadersInclude/prePassDeclaration.js +95 -2
  381. package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
  382. package/Shaders/default.fragment.js +31 -40
  383. package/Shaders/default.fragment.js.map +1 -1
  384. package/Shaders/depthOfField.fragment.js +13 -9
  385. package/Shaders/depthOfField.fragment.js.map +1 -1
  386. package/Shaders/fluidRenderingParticleDepth.vertex.js +16 -1
  387. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
  388. package/Shaders/fluidRenderingParticleThickness.vertex.js +16 -1
  389. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
  390. package/Shaders/gaussianSplatting.fragment.js +63 -3
  391. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  392. package/Shaders/gaussianSplatting.vertex.js +80 -0
  393. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  394. package/Shaders/geometry.fragment.js +17 -11
  395. package/Shaders/geometry.fragment.js.map +1 -1
  396. package/Shaders/gpuRenderParticles.fragment.js +43 -1
  397. package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
  398. package/Shaders/gpuRenderParticles.vertex.js +96 -16
  399. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  400. package/Shaders/meshBlending.fragment.d.ts +5 -0
  401. package/Shaders/meshBlending.fragment.js +519 -0
  402. package/Shaders/meshBlending.fragment.js.map +1 -0
  403. package/Shaders/particles.fragment.js +43 -1
  404. package/Shaders/particles.fragment.js.map +1 -1
  405. package/Shaders/particles.vertex.js +84 -3
  406. package/Shaders/particles.vertex.js.map +1 -1
  407. package/Shaders/sprites.fragment.js +52 -2
  408. package/Shaders/sprites.fragment.js.map +1 -1
  409. package/Shaders/sprites.vertex.js +62 -1
  410. package/Shaders/sprites.vertex.js.map +1 -1
  411. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
  412. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js +33 -0
  413. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
  414. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.d.ts +6 -0
  415. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js +76 -0
  416. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js.map +1 -0
  417. package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
  418. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  419. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.d.ts +5 -0
  420. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js +18 -0
  421. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js.map +1 -0
  422. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.d.ts +1 -0
  423. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js +11 -25
  424. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
  425. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +1 -0
  426. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +11 -25
  427. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  428. package/ShadersWGSL/ShadersInclude/pbrDebug.js +5 -1
  429. package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
  430. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +6 -1
  431. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
  432. package/ShadersWGSL/default.fragment.js +17 -48
  433. package/ShadersWGSL/default.fragment.js.map +1 -1
  434. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +15 -2
  435. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
  436. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -2
  437. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
  438. package/ShadersWGSL/gaussianSplatting.fragment.js +63 -2
  439. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  440. package/ShadersWGSL/gaussianSplatting.vertex.js +80 -0
  441. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  442. package/ShadersWGSL/geometry.fragment.js +37 -2
  443. package/ShadersWGSL/geometry.fragment.js.map +1 -1
  444. package/ShadersWGSL/gpuRenderParticles.fragment.js +47 -2
  445. package/ShadersWGSL/gpuRenderParticles.fragment.js.map +1 -1
  446. package/ShadersWGSL/gpuRenderParticles.vertex.js +110 -7
  447. package/ShadersWGSL/gpuRenderParticles.vertex.js.map +1 -1
  448. package/ShadersWGSL/meshBlending.fragment.d.ts +5 -0
  449. package/ShadersWGSL/meshBlending.fragment.js +576 -0
  450. package/ShadersWGSL/meshBlending.fragment.js.map +1 -0
  451. package/ShadersWGSL/openpbr.fragment.js +2 -1
  452. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  453. package/ShadersWGSL/particles.fragment.js +45 -1
  454. package/ShadersWGSL/particles.fragment.js.map +1 -1
  455. package/ShadersWGSL/particles.vertex.js +86 -4
  456. package/ShadersWGSL/particles.vertex.js.map +1 -1
  457. package/ShadersWGSL/pbr.fragment.js +2 -1
  458. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  459. package/ShadersWGSL/sprites.fragment.js +56 -2
  460. package/ShadersWGSL/sprites.fragment.js.map +1 -1
  461. package/ShadersWGSL/sprites.vertex.js +62 -1
  462. package/ShadersWGSL/sprites.vertex.js.map +1 -1
  463. package/Sprites/spriteManager.d.ts +13 -0
  464. package/Sprites/spriteManager.js +15 -0
  465. package/Sprites/spriteManager.js.map +1 -1
  466. package/Sprites/spriteRenderer.d.ts +24 -1
  467. package/Sprites/spriteRenderer.js +368 -50
  468. package/Sprites/spriteRenderer.js.map +1 -1
  469. package/Sprites/thinSprite.d.ts +4 -0
  470. package/Sprites/thinSprite.js +4 -0
  471. package/Sprites/thinSprite.js.map +1 -1
  472. package/States/alphaCullingState.d.ts +3 -1
  473. package/States/alphaCullingState.js +18 -3
  474. package/States/alphaCullingState.js.map +1 -1
  475. package/XR/webXRDefaultExperience.d.ts +5 -1
  476. package/XR/webXRDefaultExperience.js.map +1 -1
  477. package/XR/webXREnterExitUI.d.ts +2 -1
  478. package/XR/webXREnterExitUI.js.map +1 -1
  479. package/package.json +1 -1
  480. package/scene.pure.d.ts +23 -0
  481. package/scene.pure.js +35 -0
  482. package/scene.pure.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphCoord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E,CAAC;YAC9C,OAAO;QACX,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,oBAAoB,IAAI,2BAA2B,CAAC;QAC7F,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO;QACX,CAAC;QACD,qFAAqF;QACrF,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5D,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBAClD,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAC3D,OAAO;YACX,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,kBAAkB,CAAC,GAAW;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,oBAAoB,CAAC;QAC9D,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAChE,CAAC;;AA9RD;;;;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;AASjE,gDAA2B,GAAG,IAAI,UAAU,EAAa,AAA9B,CAA+B;AAS1D,kDAA6B,GAAG,IAAI,UAAU,EAAa,AAA9B,CAA+B","sourcesContent":["import { type EventState, type IReadonlyObservable, 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\nimport { type IFlowGraphHostResolver, GetDefaultEventReferenceKey, GetDefaultEventReference } from \"./flowGraphHostResolver\";\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 * Optional resolver letting the environment hosting the graphs decide how runtime entities are\r\n * represented as opaque reference values. When omitted, a neutral built-in representation is used.\r\n */\r\n hostResolver?: IFlowGraphHostResolver;\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 * Observable raised when a flow graph is added to any coordinator. Used by the inspector to keep\r\n * the flow graph list in sync. The payload is the newly added flow graph.\r\n */\r\n public static get OnFlowGraphAddedObservable(): IReadonlyObservable<FlowGraph> {\r\n return this._OnFlowGraphAddedObservable;\r\n }\r\n private static readonly _OnFlowGraphAddedObservable = new Observable<FlowGraph>();\r\n\r\n /**\r\n * Observable raised when a flow graph is removed from any coordinator. Used by the inspector to keep\r\n * the flow graph list in sync. The payload is the removed flow graph.\r\n */\r\n public static get OnFlowGraphRemovedObservable(): IReadonlyObservable<FlowGraph> {\r\n return this._OnFlowGraphRemovedObservable;\r\n }\r\n private static readonly _OnFlowGraphRemovedObservable = new Observable<FlowGraph>();\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 /**\r\n * Stack of custom-event dispatches currently in progress. Each entry pairs the\r\n * dispatched event id with the Observable's EventState so that\r\n * `event/stopPropagation` can stop the remaining handlers of an in-flight\r\n * dispatch. A stack (rather than a single value) tolerates re-entrant\r\n * dispatching, e.g. an event handler synchronously sending another event.\r\n * @internal\r\n */\r\n public _eventDispatchStack: { eventId: string; state: EventState }[] = [];\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 FlowGraphCoordinator._OnFlowGraphAddedObservable.notifyObservers(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 FlowGraphCoordinator._OnFlowGraphRemovedObservable.notifyObservers(graph);\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 FlowGraphCoordinator._OnFlowGraphRemovedObservable.notifyObservers(graph);\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 /**\r\n * @internal\r\n * Marks the beginning of a custom-event dispatch. Called by event receiver\r\n * blocks from within their Observable callback so that the dispatch's\r\n * EventState becomes reachable by `event/stopPropagation` while the receiver\r\n * flow executes synchronously.\r\n * @param eventId the id of the event being dispatched\r\n * @param state the Observable EventState for this dispatch\r\n */\r\n public _beginEventDispatch(eventId: string, state: EventState): void {\r\n this._eventDispatchStack.push({ eventId, state });\r\n }\r\n\r\n /**\r\n * @internal\r\n * Marks the end of the most recent custom-event dispatch started with\r\n * {@link _beginEventDispatch}.\r\n */\r\n public _endEventDispatch(): void {\r\n this._eventDispatchStack.pop();\r\n }\r\n\r\n /**\r\n * Stops the propagation of an in-flight custom event, preventing any event\r\n * handler nodes that have not been activated yet from running for the current\r\n * dispatch.\r\n *\r\n * The `event` argument is the opaque event reference produced by an event block on its `event`\r\n * output. If it does not reference an event that is currently being dispatched, this is a no-op.\r\n *\r\n * Babylon custom events have no scene-graph propagation layer, so there are\r\n * no transitive activations to cancel when `stopImmediate` is false. When it\r\n * is true, the remaining handlers in the Observable dispatch are skipped.\r\n * @param event the event reference to stop propagation for\r\n * @param stopImmediate whether to also stop remaining immediate handlers\r\n */\r\n public stopEventPropagation(event: string, stopImmediate: boolean): void {\r\n if (typeof event !== \"string\" || !stopImmediate) {\r\n return;\r\n }\r\n const decode = this.config.hostResolver?.decodeEventReference ?? GetDefaultEventReferenceKey;\r\n const eventId = decode(event);\r\n if (eventId === undefined) {\r\n return;\r\n }\r\n // Find the most recent matching in-flight dispatch and skip its remaining observers.\r\n for (let i = this._eventDispatchStack.length - 1; i >= 0; i--) {\r\n if (this._eventDispatchStack[i].eventId === eventId) {\r\n this._eventDispatchStack[i].state.skipNextObservers = true;\r\n return;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n * Encodes an event source key as the opaque reference exposed on an event block's `event`\r\n * output, delegating to the host resolver when one is configured.\r\n * @param key the event source key\r\n * @returns the event reference\r\n */\r\n public _getEventReference(key: string): string {\r\n const encode = this.config.hostResolver?.encodeEventReference;\r\n return encode ? encode(key) : GetDefaultEventReference(key);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE5G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAA+B,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAsC7H;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAkB7B;;;OAGG;IACI,MAAM,KAAK,0BAA0B;QACxC,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC5C,CAAC;IAGD;;;OAGG;IACI,MAAM,KAAK,4BAA4B;QAC1C,OAAO,IAAI,CAAC,6BAA6B,CAAC;IAC9C,CAAC;IA8BD;I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CAAiB,GAAuC,IAAI,GAAG,EAAE,AAAhD,CAAiD;AASjE,gDAA2B,GAAG,IAAI,UAAU,EAAa,AAA9B,CAA+B;AAS1D,kDAA6B,GAAG,IAAI,UAAU,EAAa,AAA9B,CAA+B","sourcesContent":["import { type EventState, type IReadonlyObservable, 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\nimport { type IFlowGraphHostResolver, GetDefaultEventReferenceKey, GetDefaultEventReference } from \"./flowGraphHostResolver\";\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 * Optional resolver letting the environment hosting the graphs decide how runtime entities are\r\n * represented as opaque reference values. When omitted, a neutral built-in representation is used.\r\n */\r\n hostResolver?: IFlowGraphHostResolver;\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 * Observable raised when a flow graph is added to any coordinator. Used by the inspector to keep\r\n * the flow graph list in sync. The payload is the newly added flow graph.\r\n */\r\n public static get OnFlowGraphAddedObservable(): IReadonlyObservable<FlowGraph> {\r\n return this._OnFlowGraphAddedObservable;\r\n }\r\n private static readonly _OnFlowGraphAddedObservable = new Observable<FlowGraph>();\r\n\r\n /**\r\n * Observable raised when a flow graph is removed from any coordinator. Used by the inspector to keep\r\n * the flow graph list in sync. The payload is the removed flow graph.\r\n */\r\n public static get OnFlowGraphRemovedObservable(): IReadonlyObservable<FlowGraph> {\r\n return this._OnFlowGraphRemovedObservable;\r\n }\r\n private static readonly _OnFlowGraphRemovedObservable = new Observable<FlowGraph>();\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 /**\r\n * Stack of custom-event dispatches currently in progress. Each entry pairs the\r\n * dispatched event id with the Observable's EventState so that\r\n * `event/stopPropagation` can stop the remaining handlers of an in-flight\r\n * dispatch. A stack (rather than a single value) tolerates re-entrant\r\n * dispatching, e.g. an event handler synchronously sending another event.\r\n * @internal\r\n */\r\n public _eventDispatchStack: { eventId: string; state: EventState; propagationStopped: boolean }[] = [];\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 this._attachToScene(this.config.scene);\r\n }\r\n\r\n private _attachToScene(scene: Scene): void {\r\n // When the scene is disposed, dispose all graphs currently running on it.\r\n this._disposeObserver = scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n this._onBeforeRenderObserver = 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(scene);\r\n if (!coordinators) {\r\n coordinators = [];\r\n FlowGraphCoordinator.SceneCoordinators.set(scene, coordinators);\r\n }\r\n coordinators.push(this);\r\n }\r\n\r\n private _detachFromScene(scene: Scene): void {\r\n this._disposeObserver.remove();\r\n this._onBeforeRenderObserver.remove();\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(scene);\r\n if (!coordinators) {\r\n return;\r\n }\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 * Reattaches this coordinator's lifecycle observers to another scene.\r\n * @param scene new scene owned by the coordinator\r\n * @param updateGraphs whether existing graphs should also be reattached\r\n * @internal\r\n */\r\n public _setScene(scene: Scene, updateGraphs = true): void {\r\n const previousScene = this.config.scene;\r\n if (scene === previousScene) {\r\n return;\r\n }\r\n this._detachFromScene(previousScene);\r\n this.config.scene = scene;\r\n if (updateGraphs) {\r\n for (const graph of this._flowGraphs) {\r\n graph.setScene(scene);\r\n }\r\n }\r\n this._attachToScene(scene);\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 FlowGraphCoordinator._OnFlowGraphAddedObservable.notifyObservers(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 FlowGraphCoordinator._OnFlowGraphRemovedObservable.notifyObservers(graph);\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 FlowGraphCoordinator._OnFlowGraphRemovedObservable.notifyObservers(graph);\r\n }\r\n this._flowGraphs.length = 0;\r\n this._detachFromScene(this.config.scene);\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 /**\r\n * @internal\r\n * Marks the beginning of a custom-event dispatch. Called by event receiver\r\n * blocks from within their Observable callback so that the dispatch's\r\n * EventState becomes reachable by `event/stopPropagation` while the receiver\r\n * flow executes synchronously.\r\n * @param eventId the id of the event being dispatched\r\n * @param state the Observable EventState for this dispatch\r\n */\r\n public _beginEventDispatch(eventId: string, state: EventState): void {\r\n this._eventDispatchStack.push({ eventId, state, propagationStopped: false });\r\n }\r\n\r\n /**\r\n * @internal\r\n * Marks the end of the most recent custom-event dispatch started with\r\n * {@link _beginEventDispatch}.\r\n */\r\n public _endEventDispatch(): { eventId: string; state: EventState; propagationStopped: boolean } | undefined {\r\n return this._eventDispatchStack.pop();\r\n }\r\n\r\n /**\r\n * Stops the propagation of an in-flight custom event, preventing any event\r\n * handler nodes that have not been activated yet from running for the current\r\n * dispatch.\r\n *\r\n * The `event` argument is the opaque event reference produced by an event block on its `event`\r\n * output. If it does not reference an event that is currently being dispatched, this is a no-op.\r\n *\r\n * Babylon custom events have no scene-graph propagation layer, so there are\r\n * no transitive activations to cancel when `stopImmediate` is false. When it\r\n * is true, the remaining handlers in the Observable dispatch are skipped.\r\n * @param event the event reference to stop propagation for\r\n * @param stopImmediate whether to also stop remaining immediate handlers\r\n */\r\n public stopEventPropagation(event: string, stopImmediate: boolean): void {\r\n if (typeof event !== \"string\") {\r\n return;\r\n }\r\n const decode = this.config.hostResolver?.decodeEventReference ?? GetDefaultEventReferenceKey;\r\n const eventId = decode(event);\r\n if (eventId === undefined) {\r\n return;\r\n }\r\n // Find the most recent matching in-flight dispatch and skip its remaining observers.\r\n for (let i = this._eventDispatchStack.length - 1; i >= 0; i--) {\r\n if (this._eventDispatchStack[i].eventId === eventId) {\r\n this._eventDispatchStack[i].propagationStopped = true;\r\n if (stopImmediate) {\r\n this._eventDispatchStack[i].state.skipNextObservers = true;\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n * Encodes an event source key as the opaque reference exposed on an event block's `event`\r\n * output, delegating to the host resolver when one is configured.\r\n * @param key the event source key\r\n * @returns the event reference\r\n */\r\n public _getEventReference(key: string): string {\r\n const encode = this.config.hostResolver?.encodeEventReference;\r\n return encode ? encode(key) : GetDefaultEventReference(key);\r\n }\r\n}\r\n"]}
@@ -28,6 +28,11 @@ export declare abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutio
28
28
  * The type of the event
29
29
  */
30
30
  readonly type: FlowGraphEventType;
31
+ /**
32
+ * Stable key used to represent this event during propagation.
33
+ * Event blocks with equivalent event sources should return the same key.
34
+ */
35
+ get eventKey(): string;
31
36
  /**
32
37
  * @internal
33
38
  */
@@ -35,6 +35,13 @@ export class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {
35
35
  filtered.signalInputs = (serializationObject.signalInputs ?? []).filter((s) => s.name !== "in");
36
36
  super.deserialize(filtered);
37
37
  }
38
+ /**
39
+ * Stable key used to represent this event during propagation.
40
+ * Event blocks with equivalent event sources should return the same key.
41
+ */
42
+ get eventKey() {
43
+ return this.config?.eventKey ?? this.type;
44
+ }
38
45
  /**
39
46
  * @internal
40
47
  */
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphEventBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAK9E;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAO1E;;;OAGG;IACH,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAXlB;;;WAGG;QACI,iBAAY,GAAW,CAAC,CAAC;QA0BhC;;WAEG;QACa,SAAI,kDAAoD;QArBpE,sEAAsE;QACtE,qEAAqE;QACrE,oCAAoC;QACpC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACa,WAAW,CAAC,mBAAwB;QAChD,MAAM,QAAQ,GAAG,EAAE,GAAG,mBAAmB,EAAE,CAAC;QAC5C,QAAQ,CAAC,YAAY,GAAG,CAAC,mBAAmB,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACrG,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAMD;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACjC,iEAAiE;QACjE,2DAA2D;QAC3D,8DAA8D;QAC9D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;OAQG;IACa,kBAAkB,CAAC,OAAyB;QACxD,IAAI,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC/B,mEAAmE;QACnE,mDAAmD;QACnD,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;CASJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\n\r\n/**\r\n * A type of block that listens to an event observable and activates\r\n * its output signal when the event is triggered.\r\n */\r\nexport abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * the priority of initialization of this block.\r\n * For example, scene start should have a negative priority because it should be initialized last.\r\n */\r\n public initPriority: number = 0;\r\n\r\n /**\r\n * Creates a new event block.\r\n * @param config optional configuration\r\n */\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n // Event blocks are driven by scene events, not by an incoming signal.\r\n // Remove the inherited `in` port so it is not shown in the editor UI\r\n // and cannot be accidentally wired.\r\n this._unregisterSignalInput(\"in\");\r\n }\r\n\r\n /**\r\n * Deserializes from an object.\r\n * Filters out the legacy \"in\" signal input that existed before event blocks\r\n * stopped exposing it, so old serialized graphs load without error.\r\n * @param serializationObject the object to deserialize from\r\n */\r\n public override deserialize(serializationObject: any) {\r\n const filtered = { ...serializationObject };\r\n filtered.signalInputs = (serializationObject.signalInputs ?? []).filter((s: any) => s.name !== \"in\");\r\n super.deserialize(filtered);\r\n }\r\n\r\n /**\r\n * The type of the event\r\n */\r\n public readonly type: FlowGraphEventType = FlowGraphEventType.NoTrigger;\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n context._notifyExecuteNode(this);\r\n // Fire both signals: KHR_interactivity graphs connect to `done`,\r\n // while editor-authored graphs typically connect to `out`.\r\n // Both must fire so that either wiring style works correctly.\r\n this.done._activateSignal(context);\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @internal\r\n * Override _startPendingTasks so that event blocks do NOT fire the\r\n * `out` signal at graph-start time. The base FlowGraphAsyncExecutionBlock\r\n * fires `out` immediately in _startPendingTasks (useful for async blocks\r\n * like PlayAnimation that start a task and let sync flow continue).\r\n * Event blocks should only fire their output signals when the actual\r\n * event occurs, which is handled by _execute.\r\n */\r\n public override _startPendingTasks(context: FlowGraphContext): void {\r\n if (context._getExecutionVariable(this, \"_initialized\", false)) {\r\n this._cancelPendingTasks(context);\r\n this._resetAfterCanceled(context);\r\n }\r\n this._preparePendingTasks(context);\r\n context._addPendingBlock(this);\r\n // Do NOT fire out._activateSignal — event blocks fire both out and\r\n // done in _execute when the actual event triggers.\r\n context._setExecutionVariable(this, \"_initialized\", true);\r\n }\r\n\r\n /**\r\n * Execute the event. This function should be called by the flow graph when the event is triggered.\r\n * @param context the context in which the event is executed\r\n * @param payload the payload of the event\r\n * @returns a boolean indicating if the event should stop propagation. if false, the event will stop propagating.\r\n */\r\n public abstract _executeEvent(context: FlowGraphContext, payload: any): boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphEventBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAK9E;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAO1E;;;OAGG;IACH,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAXlB;;;WAGG;QACI,iBAAY,GAAW,CAAC,CAAC;QA0BhC;;WAEG;QACa,SAAI,kDAAoD;QArBpE,sEAAsE;QACtE,qEAAqE;QACrE,oCAAoC;QACpC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACa,WAAW,CAAC,mBAAwB;QAChD,MAAM,QAAQ,GAAG,EAAE,GAAG,mBAAmB,EAAE,CAAC;QAC5C,QAAQ,CAAC,YAAY,GAAG,CAAC,mBAAmB,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACrG,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAOD;;;OAGG;IACH,IAAW,QAAQ;QACf,OAAQ,IAAI,CAAC,MAA4C,EAAE,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC;IACrF,CAAC;IACD;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACjC,iEAAiE;QACjE,2DAA2D;QAC3D,8DAA8D;QAC9D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;OAQG;IACa,kBAAkB,CAAC,OAAyB;QACxD,IAAI,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC/B,mEAAmE;QACnE,mDAAmD;QACnD,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;CASJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\n\r\n/**\r\n * A type of block that listens to an event observable and activates\r\n * its output signal when the event is triggered.\r\n */\r\nexport abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * the priority of initialization of this block.\r\n * For example, scene start should have a negative priority because it should be initialized last.\r\n */\r\n public initPriority: number = 0;\r\n\r\n /**\r\n * Creates a new event block.\r\n * @param config optional configuration\r\n */\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n // Event blocks are driven by scene events, not by an incoming signal.\r\n // Remove the inherited `in` port so it is not shown in the editor UI\r\n // and cannot be accidentally wired.\r\n this._unregisterSignalInput(\"in\");\r\n }\r\n\r\n /**\r\n * Deserializes from an object.\r\n * Filters out the legacy \"in\" signal input that existed before event blocks\r\n * stopped exposing it, so old serialized graphs load without error.\r\n * @param serializationObject the object to deserialize from\r\n */\r\n public override deserialize(serializationObject: any) {\r\n const filtered = { ...serializationObject };\r\n filtered.signalInputs = (serializationObject.signalInputs ?? []).filter((s: any) => s.name !== \"in\");\r\n super.deserialize(filtered);\r\n }\r\n\r\n /**\r\n * The type of the event\r\n */\r\n public readonly type: FlowGraphEventType = FlowGraphEventType.NoTrigger;\r\n\r\n /**\r\n * Stable key used to represent this event during propagation.\r\n * Event blocks with equivalent event sources should return the same key.\r\n */\r\n public get eventKey(): string {\r\n return (this.config as { eventKey?: string } | undefined)?.eventKey ?? this.type;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n context._notifyExecuteNode(this);\r\n // Fire both signals: KHR_interactivity graphs connect to `done`,\r\n // while editor-authored graphs typically connect to `out`.\r\n // Both must fire so that either wiring style works correctly.\r\n this.done._activateSignal(context);\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @internal\r\n * Override _startPendingTasks so that event blocks do NOT fire the\r\n * `out` signal at graph-start time. The base FlowGraphAsyncExecutionBlock\r\n * fires `out` immediately in _startPendingTasks (useful for async blocks\r\n * like PlayAnimation that start a task and let sync flow continue).\r\n * Event blocks should only fire their output signals when the actual\r\n * event occurs, which is handled by _execute.\r\n */\r\n public override _startPendingTasks(context: FlowGraphContext): void {\r\n if (context._getExecutionVariable(this, \"_initialized\", false)) {\r\n this._cancelPendingTasks(context);\r\n this._resetAfterCanceled(context);\r\n }\r\n this._preparePendingTasks(context);\r\n context._addPendingBlock(this);\r\n // Do NOT fire out._activateSignal — event blocks fire both out and\r\n // done in _execute when the actual event triggers.\r\n context._setExecutionVariable(this, \"_initialized\", true);\r\n }\r\n\r\n /**\r\n * Execute the event. This function should be called by the flow graph when the event is triggered.\r\n * @param context the context in which the event is executed\r\n * @param payload the payload of the event\r\n * @returns a boolean indicating if the event should stop propagation. if false, the event will stop propagating.\r\n */\r\n public abstract _executeEvent(context: FlowGraphContext, payload: any): boolean;\r\n}\r\n"]}
@@ -50,9 +50,10 @@ export interface IFlowGraphHostResolver {
50
50
  * element of one of the host's collections. Must return `undefined` for values the host does
51
51
  * not recognise as an indexed reference.
52
52
  * @param reference the reference to decode
53
+ * @param collection optional host collection the decoded reference must address
53
54
  * @returns the index the reference denotes, or `undefined` when it does not denote one
54
55
  */
55
- decodeIndexReference?(reference: string): number | undefined;
56
+ decodeIndexReference?(reference: string, collection?: string): number | undefined;
56
57
  /**
57
58
  * Maps a runtime object to the reference the host addresses it by, for example the JSON
58
59
  * Pointer of the resource a loaded object originates from.
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphHostResolver.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphHostResolver.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,qBAAqB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAChD,OAAO,oCAAoC,GAAG,GAAG,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAiB;IACzD,OAAO,SAAS,CAAC,UAAU,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,oCAAoC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrJ,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\n/**\r\n * Prefix used by the default event-reference format.\r\n *\r\n * A host that maps behavior graphs onto its own object model (for example the glTF\r\n * `KHR_interactivity` loader) supplies its own format through {@link IFlowGraphHostResolver}.\r\n */\r\nexport const FlowGraphDefaultEventReferencePrefix = \"flowgraph://events/\";\r\n\r\n/**\r\n * Builds the default reference for an event source key.\r\n * @param key the event source key (e.g. `\"sceneReady\"`, `\"sceneTick\"`, or a custom event id)\r\n * @returns the event reference\r\n */\r\nexport function GetDefaultEventReference(key: string): string {\r\n return FlowGraphDefaultEventReferencePrefix + key;\r\n}\r\n\r\n/**\r\n * Extracts the event source key from a default-format event reference.\r\n * @param reference the value to decode\r\n * @returns the event source key, or `undefined` when the value is not an event reference\r\n */\r\nexport function GetDefaultEventReferenceKey(reference: string): string | undefined {\r\n return reference.startsWith(FlowGraphDefaultEventReferencePrefix) ? reference.substring(FlowGraphDefaultEventReferencePrefix.length) : undefined;\r\n}\r\n\r\n/**\r\n * Lets the environment hosting a flow graph decide how runtime entities are represented as opaque\r\n * reference values, so the graph engine itself stays agnostic of the host's object model.\r\n *\r\n * A host (e.g. a glTF loader extension) provides an implementation through\r\n * {@link IFlowGraphCoordinatorConfiguration.hostResolver}. Every member is optional; the engine\r\n * falls back to a neutral built-in representation for anything the host does not provide.\r\n */\r\nexport interface IFlowGraphHostResolver {\r\n /**\r\n * Encodes an event source key as the opaque reference exposed by event blocks on their\r\n * `event` output.\r\n *\r\n * References must be stable: two calls with the same key must produce equal values so that\r\n * equality comparisons of two `event` outputs of the same source succeed.\r\n * @param key the event source key\r\n * @returns the reference representing the event source\r\n */\r\n encodeEventReference?(key: string): string;\r\n\r\n /**\r\n * Decodes an event reference produced by {@link IFlowGraphHostResolver.encodeEventReference}\r\n * back into its event source key. Must return `undefined` for values that are not event\r\n * references.\r\n * @param reference the reference to decode\r\n * @returns the event source key, or `undefined` when the value is not an event reference\r\n */\r\n decodeEventReference?(reference: string): string | undefined;\r\n\r\n /**\r\n * Decodes the array index denoted by a reference, for cases where a reference addresses an\r\n * element of one of the host's collections. Must return `undefined` for values the host does\r\n * not recognise as an indexed reference.\r\n * @param reference the reference to decode\r\n * @returns the index the reference denotes, or `undefined` when it does not denote one\r\n */\r\n decodeIndexReference?(reference: string): number | undefined;\r\n\r\n /**\r\n * Maps a runtime object to the reference the host addresses it by, for example the JSON\r\n * Pointer of the resource a loaded object originates from.\r\n *\r\n * Used when an object value is supplied to a templated path input. Returning `undefined`\r\n * means the host cannot address the object, and the value is rejected.\r\n * @param object the runtime object to address\r\n * @param hint optional disambiguation hint, taken from the path segment preceding the template\r\n * parameter being resolved. A single object may be addressable in several ways, and the hint\r\n * tells the host which kind of reference the graph is asking for.\r\n * @returns the reference for the object, or `undefined` when it cannot be addressed\r\n */\r\n getObjectReference?(object: object, hint?: string): string | undefined;\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphHostResolver.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphHostResolver.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,qBAAqB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAChD,OAAO,oCAAoC,GAAG,GAAG,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAiB;IACzD,OAAO,SAAS,CAAC,UAAU,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,oCAAoC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrJ,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\n/**\r\n * Prefix used by the default event-reference format.\r\n *\r\n * A host that maps behavior graphs onto its own object model (for example the glTF\r\n * `KHR_interactivity` loader) supplies its own format through {@link IFlowGraphHostResolver}.\r\n */\r\nexport const FlowGraphDefaultEventReferencePrefix = \"flowgraph://events/\";\r\n\r\n/**\r\n * Builds the default reference for an event source key.\r\n * @param key the event source key (e.g. `\"sceneReady\"`, `\"sceneTick\"`, or a custom event id)\r\n * @returns the event reference\r\n */\r\nexport function GetDefaultEventReference(key: string): string {\r\n return FlowGraphDefaultEventReferencePrefix + key;\r\n}\r\n\r\n/**\r\n * Extracts the event source key from a default-format event reference.\r\n * @param reference the value to decode\r\n * @returns the event source key, or `undefined` when the value is not an event reference\r\n */\r\nexport function GetDefaultEventReferenceKey(reference: string): string | undefined {\r\n return reference.startsWith(FlowGraphDefaultEventReferencePrefix) ? reference.substring(FlowGraphDefaultEventReferencePrefix.length) : undefined;\r\n}\r\n\r\n/**\r\n * Lets the environment hosting a flow graph decide how runtime entities are represented as opaque\r\n * reference values, so the graph engine itself stays agnostic of the host's object model.\r\n *\r\n * A host (e.g. a glTF loader extension) provides an implementation through\r\n * {@link IFlowGraphCoordinatorConfiguration.hostResolver}. Every member is optional; the engine\r\n * falls back to a neutral built-in representation for anything the host does not provide.\r\n */\r\nexport interface IFlowGraphHostResolver {\r\n /**\r\n * Encodes an event source key as the opaque reference exposed by event blocks on their\r\n * `event` output.\r\n *\r\n * References must be stable: two calls with the same key must produce equal values so that\r\n * equality comparisons of two `event` outputs of the same source succeed.\r\n * @param key the event source key\r\n * @returns the reference representing the event source\r\n */\r\n encodeEventReference?(key: string): string;\r\n\r\n /**\r\n * Decodes an event reference produced by {@link IFlowGraphHostResolver.encodeEventReference}\r\n * back into its event source key. Must return `undefined` for values that are not event\r\n * references.\r\n * @param reference the reference to decode\r\n * @returns the event source key, or `undefined` when the value is not an event reference\r\n */\r\n decodeEventReference?(reference: string): string | undefined;\r\n\r\n /**\r\n * Decodes the array index denoted by a reference, for cases where a reference addresses an\r\n * element of one of the host's collections. Must return `undefined` for values the host does\r\n * not recognise as an indexed reference.\r\n * @param reference the reference to decode\r\n * @param collection optional host collection the decoded reference must address\r\n * @returns the index the reference denotes, or `undefined` when it does not denote one\r\n */\r\n decodeIndexReference?(reference: string, collection?: string): number | undefined;\r\n\r\n /**\r\n * Maps a runtime object to the reference the host addresses it by, for example the JSON\r\n * Pointer of the resource a loaded object originates from.\r\n *\r\n * Used when an object value is supplied to a templated path input. Returning `undefined`\r\n * means the host cannot address the object, and the value is rejected.\r\n * @param object the runtime object to address\r\n * @param hint optional disambiguation hint, taken from the path segment preceding the template\r\n * parameter being resolved. A single object may be addressable in several ways, and the hint\r\n * tells the host which kind of reference the graph is asking for.\r\n * @returns the reference for the object, or `undefined` when it cannot be addressed\r\n */\r\n getObjectReference?(object: object, hint?: string): string | undefined;\r\n}\r\n"]}
@@ -2,10 +2,51 @@ import { blockFactory } from "./Blocks/flowGraphBlockFactory.js";
2
2
  import { FlowGraphCoordinator } from "./flowGraphCoordinator.js";
3
3
  import { FlowGraphEventBlock } from "./flowGraphEventBlock.js";
4
4
  import { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock.js";
5
- import { defaultValueParseFunction, needsPathConverter } from "./serialization.js";
5
+ import { _GetDefaultEventDataParseCount, defaultValueParseFunction, needsPathConverter } from "./serialization.js";
6
6
  import { getRichTypeByFlowGraphType, RichType } from "./flowGraphRichTypes.pure.js";
7
7
 
8
8
  import { WebRequest } from "../Misc/webRequest.js";
9
+ function ParseCustomEventData(serializedEventData, valueParseFunction, assetsContainer, scene) {
10
+ const eventData = Object.create(null);
11
+ if (Array.isArray(serializedEventData)) {
12
+ for (const serializedEntry of serializedEventData) {
13
+ if (!serializedEntry?.eventData) {
14
+ continue;
15
+ }
16
+ const entry = { type: getRichTypeByFlowGraphType(serializedEntry.type) };
17
+ if (serializedEntry.value !== undefined) {
18
+ entry.value = serializedEntry.value?.getClassName?.() ? serializedEntry.value : valueParseFunction("value", serializedEntry, assetsContainer, scene);
19
+ }
20
+ Object.defineProperty(eventData, serializedEntry.id, {
21
+ configurable: true,
22
+ enumerable: true,
23
+ value: entry,
24
+ writable: true,
25
+ });
26
+ }
27
+ return eventData;
28
+ }
29
+ if (serializedEventData === null || typeof serializedEventData !== "object") {
30
+ return eventData;
31
+ }
32
+ for (const eventKey of Object.keys(serializedEventData)) {
33
+ const serializedEntry = serializedEventData[eventKey];
34
+ if (serializedEntry === null || typeof serializedEntry !== "object") {
35
+ continue;
36
+ }
37
+ const entry = { type: serializedEntry.type };
38
+ if (serializedEntry.value !== undefined) {
39
+ entry.value = serializedEntry.value?.getClassName?.() ? serializedEntry.value : valueParseFunction("value", serializedEntry, assetsContainer, scene);
40
+ }
41
+ Object.defineProperty(eventData, eventKey, {
42
+ configurable: true,
43
+ enumerable: true,
44
+ value: entry,
45
+ writable: true,
46
+ });
47
+ }
48
+ return eventData;
49
+ }
9
50
  async function GetSerializedFlowGraphFromSnippetAsync(snippetId) {
10
51
  const response = await WebRequest.FetchAsync(`https://snippet.babylonjs.com` + "/" + snippetId.replace(/#/g, "/"));
11
52
  if (!response.ok) {
@@ -149,6 +190,7 @@ export function ParseFlowGraph(serializationObject, options, resolvedClasses) {
149
190
  if (serializationObject.uniqueId) {
150
191
  graph.uniqueId = serializationObject.uniqueId;
151
192
  }
193
+ graph.metadata = serializationObject.metadata;
152
194
  const blocks = [];
153
195
  const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;
154
196
  // Parse all blocks
@@ -323,9 +365,25 @@ export async function ParseBlockAsync(serializationObject, parseOptions) {
323
365
  export function ParseFlowGraphBlockWithClassType(serializationObject, parseOptions, classType) {
324
366
  const parsedConfig = {};
325
367
  const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;
368
+ const customValueParseFunction = parseOptions.valueParseFunction === defaultValueParseFunction ? undefined : parseOptions.valueParseFunction;
326
369
  if (serializationObject.config) {
327
370
  for (const key in serializationObject.config) {
328
- parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.assetsContainer || parseOptions.scene, parseOptions.scene);
371
+ const assetsContainer = parseOptions.assetsContainer || parseOptions.scene;
372
+ const isCustomEventData = key === "eventData" &&
373
+ (serializationObject.className === "FlowGraphSendCustomEventBlock" /* FlowGraphBlockNames.SendCustomEvent */ || serializationObject.className === "FlowGraphReceiveCustomEventBlock" /* FlowGraphBlockNames.ReceiveCustomEvent */);
374
+ if (isCustomEventData) {
375
+ const eventData = serializationObject.config[key];
376
+ const defaultParseCount = _GetDefaultEventDataParseCount(eventData);
377
+ const customParsedEventData = customValueParseFunction?.(key, serializationObject.config, assetsContainer, parseOptions.scene);
378
+ const delegatedToDefault = _GetDefaultEventDataParseCount(eventData) > defaultParseCount;
379
+ parsedConfig[key] =
380
+ customValueParseFunction && (!delegatedToDefault || customParsedEventData !== eventData)
381
+ ? customParsedEventData
382
+ : ParseCustomEventData(eventData, valueParseFunction, assetsContainer, parseOptions.scene);
383
+ }
384
+ else {
385
+ parsedConfig[key] = valueParseFunction(key, serializationObject.config, assetsContainer, parseOptions.scene);
386
+ }
329
387
  }
330
388
  }
331
389
  if (needsPathConverter(serializationObject.className)) {
@@ -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,2BAA2B,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,sCAAsC,CAAC,SAAiB;IACnE,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACxG,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;;;;;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.pure\";\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"]}
1
+ {"version":3,"file":"flowGraphParser.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphParser.ts"],"names":[],"m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AU,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 { 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 { _GetDefaultEventDataParseCount, defaultValueParseFunction, needsPathConverter } from \"./serialization\";\nimport { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport { type Node } from \"core/node\";\nimport { type Scene } from \"core/scene\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes.pure\";\nimport { type FlowGraphConnection } from \"./flowGraphConnection\";\nimport { Constants } from \"core/Engines/constants\";\nimport { WebRequest } from \"core/Misc/webRequest\";\n\nfunction ParseCustomEventData(\n serializedEventData: unknown,\n valueParseFunction: NonNullable<IFlowGraphBlockParseOptions[\"valueParseFunction\"]>,\n assetsContainer: IAssetContainer,\n scene: Scene\n): Record<string, { type: unknown; value?: unknown }> {\n const eventData: Record<string, { type: unknown; value?: unknown }> = Object.create(null);\n if (Array.isArray(serializedEventData)) {\n for (const serializedEntry of serializedEventData) {\n if (!serializedEntry?.eventData) {\n continue;\n }\n const entry: { type: unknown; value?: unknown } = { type: getRichTypeByFlowGraphType(serializedEntry.type) };\n if (serializedEntry.value !== undefined) {\n entry.value = serializedEntry.value?.getClassName?.() ? serializedEntry.value : valueParseFunction(\"value\", serializedEntry, assetsContainer, scene);\n }\n Object.defineProperty(eventData, serializedEntry.id, {\n configurable: true,\n enumerable: true,\n value: entry,\n writable: true,\n });\n }\n return eventData;\n }\n if (serializedEventData === null || typeof serializedEventData !== \"object\") {\n return eventData;\n }\n for (const eventKey of Object.keys(serializedEventData)) {\n const serializedEntry = (serializedEventData as Record<string, unknown>)[eventKey] as { type?: unknown; value?: unknown };\n if (serializedEntry === null || typeof serializedEntry !== \"object\") {\n continue;\n }\n const entry: { type: unknown; value?: unknown } = { type: serializedEntry.type };\n if (serializedEntry.value !== undefined) {\n entry.value = (serializedEntry.value as any)?.getClassName?.() ? serializedEntry.value : valueParseFunction(\"value\", serializedEntry, assetsContainer, scene);\n }\n Object.defineProperty(eventData, eventKey, {\n configurable: true,\n enumerable: true,\n value: entry,\n writable: true,\n });\n }\n return eventData;\n}\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 graph.metadata = serializationObject.metadata;\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 const customValueParseFunction = parseOptions.valueParseFunction === defaultValueParseFunction ? undefined : parseOptions.valueParseFunction;\n if (serializationObject.config) {\n for (const key in serializationObject.config) {\n const assetsContainer = parseOptions.assetsContainer || parseOptions.scene;\n const isCustomEventData =\n key === \"eventData\" &&\n (serializationObject.className === FlowGraphBlockNames.SendCustomEvent || serializationObject.className === FlowGraphBlockNames.ReceiveCustomEvent);\n if (isCustomEventData) {\n const eventData = serializationObject.config[key];\n const defaultParseCount = _GetDefaultEventDataParseCount(eventData);\n const customParsedEventData = customValueParseFunction?.(key, serializationObject.config, assetsContainer, parseOptions.scene);\n const delegatedToDefault = _GetDefaultEventDataParseCount(eventData) > defaultParseCount;\n parsedConfig[key] =\n customValueParseFunction && (!delegatedToDefault || customParsedEventData !== eventData)\n ? customParsedEventData\n : ParseCustomEventData(eventData, valueParseFunction, assetsContainer, parseOptions.scene);\n } else {\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, assetsContainer, parseOptions.scene);\n }\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"]}
@@ -2,6 +2,8 @@ import { type IAssetContainer } from "../IAssetContainer.js";
2
2
  import { type Scene } from "../scene.js";
3
3
  import { FlowGraphBlockNames } from "./Blocks/flowGraphBlockNames.js";
4
4
  import { type Node } from "../node.js";
5
+ /** @internal */
6
+ export declare function _GetDefaultEventDataParseCount(value: unknown): number;
5
7
  /**
6
8
  * Resolves a serialized node reference (`{ id, name, className, uniqueId }`) to an actual scene node.
7
9
  * Matching prefers `id` (falling back to `name`), then narrows by class name, then by `uniqueId`.
@@ -2,8 +2,12 @@ import { Logger } from "../Misc/logger.js";
2
2
  import { Color3, Color4 } from "../Maths/math.color.pure.js";
3
3
  import { Matrix, Quaternion, Vector2, Vector3, Vector4 } from "../Maths/math.vector.pure.js";
4
4
  import { FlowGraphInteger } from "./CustomTypes/flowGraphInteger.pure.js";
5
- import { getRichTypeByFlowGraphType } from "./flowGraphRichTypes.pure.js";
6
5
  import { FlowGraphMatrix2D, FlowGraphMatrix3D } from "./CustomTypes/flowGraphMatrix.js";
6
+ const _DefaultEventDataParseCounts = new WeakMap();
7
+ /** @internal */
8
+ export function _GetDefaultEventDataParseCount(value) {
9
+ return value !== null && typeof value === "object" ? (_DefaultEventDataParseCounts.get(value) ?? 0) : 0;
10
+ }
7
11
  function IsVectorClassName(className) {
8
12
  return (className === "Vector2" /* FlowGraphTypes.Vector2 */ ||
9
13
  className === "Vector3" /* FlowGraphTypes.Vector3 */ ||
@@ -170,32 +174,16 @@ export function defaultValueParseFunction(key, serializationObject, assetsContai
170
174
  else if (className === "number" /* FlowGraphTypes.Number */ || className === "string" /* FlowGraphTypes.String */ || className === "boolean" /* FlowGraphTypes.Boolean */) {
171
175
  finalValue = intermediateValue.value[0];
172
176
  }
177
+ else if (key === "eventData" && intermediateValue !== null && typeof intermediateValue === "object") {
178
+ _DefaultEventDataParseCounts.set(intermediateValue, _GetDefaultEventDataParseCount(intermediateValue) + 1);
179
+ finalValue = intermediateValue;
180
+ }
173
181
  else if (intermediateValue && intermediateValue.value !== undefined) {
174
182
  finalValue = intermediateValue.value;
175
183
  }
176
184
  else {
177
185
  if (Array.isArray(intermediateValue)) {
178
- // Check if this is an event configuration array (objects with id/eventData)
179
- // versus a plain array of primitives (e.g. variable name lists)
180
- if (intermediateValue.length > 0 && typeof intermediateValue[0] === "object" && intermediateValue[0] !== null && "eventData" in intermediateValue[0]) {
181
- // configuration data of an event
182
- finalValue = intermediateValue.reduce((acc, val) => {
183
- if (!val.eventData) {
184
- return acc;
185
- }
186
- acc[val.id] = {
187
- type: getRichTypeByFlowGraphType(val.type),
188
- };
189
- if (typeof val.value !== "undefined") {
190
- acc[val.id].value = defaultValueParseFunction("value", val, assetsContainer, scene);
191
- }
192
- return acc;
193
- }, {});
194
- }
195
- else {
196
- // Plain array of primitives — return as-is
197
- finalValue = intermediateValue;
198
- }
186
+ finalValue = intermediateValue;
199
187
  }
200
188
  else {
201
189
  finalValue = intermediateValue;