@babylonjs/core 6.24.0 → 6.25.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 (344) hide show
  1. package/Buffers/buffer.align.d.ts +25 -0
  2. package/Buffers/buffer.align.js +120 -0
  3. package/Buffers/buffer.align.js.map +1 -0
  4. package/Buffers/buffer.d.ts +15 -3
  5. package/Buffers/buffer.js +27 -7
  6. package/Buffers/buffer.js.map +1 -1
  7. package/Buffers/index.d.ts +1 -0
  8. package/Buffers/index.js +1 -0
  9. package/Buffers/index.js.map +1 -1
  10. package/Cameras/Inputs/BaseCameraPointersInput.js +0 -3
  11. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  12. package/Cameras/Inputs/flyCameraMouseInput.js +1 -4
  13. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  14. package/Cameras/Inputs/freeCameraMouseInput.js +0 -6
  15. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  16. package/Cameras/RigModes/index.d.ts +0 -1
  17. package/Cameras/RigModes/index.js +0 -1
  18. package/Cameras/RigModes/index.js.map +1 -1
  19. package/Cameras/RigModes/vrRigMode.js +1 -1
  20. package/Cameras/RigModes/vrRigMode.js.map +1 -1
  21. package/Cameras/VR/index.d.ts +0 -1
  22. package/Cameras/VR/index.js +0 -1
  23. package/Cameras/VR/index.js.map +1 -1
  24. package/Cameras/VR/vrExperienceHelper.d.ts +7 -66
  25. package/Cameras/VR/vrExperienceHelper.js +17 -702
  26. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  27. package/Cameras/camera.d.ts +15 -20
  28. package/Cameras/camera.js +41 -36
  29. package/Cameras/camera.js.map +1 -1
  30. package/Cameras/targetCamera.js +1 -1
  31. package/Cameras/targetCamera.js.map +1 -1
  32. package/Engines/Extensions/index.d.ts +0 -1
  33. package/Engines/Extensions/index.js +0 -1
  34. package/Engines/Extensions/index.js.map +1 -1
  35. package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +4 -0
  36. package/Engines/WebGL/webGLRenderTargetWrapper.js +4 -0
  37. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  38. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +8 -7
  39. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  40. package/Engines/WebGPU/webgpuCacheSampler.js +1 -1
  41. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  42. package/Engines/constants.d.ts +0 -4
  43. package/Engines/constants.js +0 -4
  44. package/Engines/constants.js.map +1 -1
  45. package/Engines/engine.d.ts +38 -258
  46. package/Engines/engine.js +0 -65
  47. package/Engines/engine.js.map +1 -1
  48. package/Engines/engineFactory.js +9 -14
  49. package/Engines/engineFactory.js.map +1 -1
  50. package/Engines/engineFeatures.d.ts +2 -0
  51. package/Engines/engineFeatures.js.map +1 -1
  52. package/Engines/nativeEngine.js +1 -0
  53. package/Engines/nativeEngine.js.map +1 -1
  54. package/Engines/nullEngine.js +1 -0
  55. package/Engines/nullEngine.js.map +1 -1
  56. package/Engines/thinEngine.d.ts +22 -5
  57. package/Engines/thinEngine.js +55 -22
  58. package/Engines/thinEngine.js.map +1 -1
  59. package/Engines/webgpuEngine.d.ts +1 -0
  60. package/Engines/webgpuEngine.js +4 -2
  61. package/Engines/webgpuEngine.js.map +1 -1
  62. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.d.ts +9 -8
  63. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js +34 -16
  64. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js.map +1 -1
  65. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +4 -3
  66. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +14 -6
  67. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +1 -1
  68. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.d.ts +19 -14
  69. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +64 -27
  70. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +1 -1
  71. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.d.ts +39 -41
  72. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +152 -74
  73. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +1 -1
  74. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.d.ts +12 -12
  75. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +42 -21
  76. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
  77. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.d.ts +17 -14
  78. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +62 -26
  79. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
  80. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.d.ts +13 -10
  81. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +46 -18
  82. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
  83. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +4 -1
  84. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +6 -2
  85. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +3 -1
  87. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +7 -2
  88. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  89. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +5 -3
  90. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +10 -5
  91. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +4 -1
  93. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +6 -2
  94. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  95. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +3 -1
  96. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +7 -2
  97. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  98. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +3 -1
  99. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +7 -2
  100. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  101. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +4 -1
  102. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +6 -2
  103. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  104. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +6 -2
  105. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -3
  106. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  107. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +5 -3
  108. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +11 -6
  109. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  110. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +1 -0
  111. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +7 -2
  112. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  113. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +1 -0
  114. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +7 -2
  115. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  116. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +3 -1
  117. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +7 -2
  118. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  119. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +3 -1
  120. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +8 -3
  121. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  122. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +3 -1
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +7 -2
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  125. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +3 -1
  126. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +7 -2
  127. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  128. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +3 -1
  129. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +7 -2
  130. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  131. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -1
  132. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +7 -2
  133. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  134. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -1
  135. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +7 -2
  136. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  137. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -1
  138. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +7 -2
  139. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  140. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +3 -1
  141. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +7 -2
  142. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  143. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -1
  144. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +7 -2
  145. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -1
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +7 -2
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  149. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +6 -3
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +22 -16
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +7 -4
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +15 -10
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -1
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +7 -2
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +3 -1
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +8 -3
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +7 -4
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +14 -7
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +5 -3
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +9 -4
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  167. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.d.ts +3 -1
  168. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +7 -2
  169. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
  170. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +3 -1
  171. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +8 -3
  172. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  173. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +3 -1
  174. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +7 -2
  175. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  176. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +3 -1
  177. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +7 -2
  178. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  179. package/FlowGraph/flowGraph.d.ts +41 -3
  180. package/FlowGraph/flowGraph.js +135 -0
  181. package/FlowGraph/flowGraph.js.map +1 -1
  182. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +2 -1
  183. package/FlowGraph/flowGraphAsyncExecutionBlock.js +2 -2
  184. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  185. package/FlowGraph/flowGraphBlock.d.ts +15 -3
  186. package/FlowGraph/flowGraphBlock.js +50 -7
  187. package/FlowGraph/flowGraphBlock.js.map +1 -1
  188. package/FlowGraph/flowGraphConnection.d.ts +34 -4
  189. package/FlowGraph/flowGraphConnection.js +49 -3
  190. package/FlowGraph/flowGraphConnection.js.map +1 -1
  191. package/FlowGraph/flowGraphContext.d.ts +25 -5
  192. package/FlowGraph/flowGraphContext.js +86 -4
  193. package/FlowGraph/flowGraphContext.js.map +1 -1
  194. package/FlowGraph/flowGraphCoordinator.d.ts +7 -1
  195. package/FlowGraph/flowGraphCoordinator.js +18 -2
  196. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  197. package/FlowGraph/flowGraphDataConnection.d.ts +4 -11
  198. package/FlowGraph/flowGraphDataConnection.js +16 -14
  199. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  200. package/FlowGraph/flowGraphExecutionBlock.d.ts +8 -3
  201. package/FlowGraph/flowGraphExecutionBlock.js +37 -6
  202. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  203. package/FlowGraph/flowGraphRichTypes.d.ts +5 -9
  204. package/FlowGraph/flowGraphRichTypes.js +29 -44
  205. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  206. package/FlowGraph/flowGraphSignalConnection.js +2 -0
  207. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  208. package/FlowGraph/flowGraphVariableDefinitions.d.ts +22 -2
  209. package/FlowGraph/flowGraphVariableDefinitions.js +29 -0
  210. package/FlowGraph/flowGraphVariableDefinitions.js.map +1 -1
  211. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +2 -1
  212. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +2 -2
  213. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
  214. package/Gamepads/gamepadManager.js +0 -5
  215. package/Gamepads/gamepadManager.js.map +1 -1
  216. package/Gamepads/index.d.ts +0 -1
  217. package/Gamepads/index.js +0 -2
  218. package/Gamepads/index.js.map +1 -1
  219. package/Gizmos/gizmo.js +1 -4
  220. package/Gizmos/gizmo.js.map +1 -1
  221. package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +24 -0
  222. package/Materials/GreasedLine/greasedLineMaterialDefaults.js +19 -0
  223. package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -0
  224. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +243 -0
  225. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js +55 -0
  226. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -0
  227. package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +253 -0
  228. package/Materials/{greasedLinePluginMaterial.js → GreasedLine/greasedLinePluginMaterial.js} +148 -205
  229. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -0
  230. package/Materials/{greasedLineSimpleMaterial.d.ts → GreasedLine/greasedLineSimpleMaterial.d.ts} +20 -48
  231. package/Materials/{greasedLineSimpleMaterial.js → GreasedLine/greasedLineSimpleMaterial.js} +74 -91
  232. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -0
  233. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
  234. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  235. package/Materials/Textures/texture.js +1 -0
  236. package/Materials/Textures/texture.js.map +1 -1
  237. package/Materials/index.d.ts +4 -1
  238. package/Materials/index.js +4 -1
  239. package/Materials/index.js.map +1 -1
  240. package/Maths/math.vector.d.ts +32 -22
  241. package/Maths/math.vector.js +54 -43
  242. package/Maths/math.vector.js.map +1 -1
  243. package/Meshes/Builders/greasedLineBuilder.d.ts +7 -6
  244. package/Meshes/Builders/greasedLineBuilder.js +65 -31
  245. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  246. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +216 -0
  247. package/Meshes/GreasedLine/greasedLineBaseMesh.js +247 -0
  248. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -0
  249. package/Meshes/GreasedLine/greasedLineMesh.d.ts +92 -0
  250. package/Meshes/{greasedLineMesh.js → GreasedLine/greasedLineMesh.js} +29 -223
  251. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -0
  252. package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +107 -0
  253. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +462 -0
  254. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -0
  255. package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +9 -2
  256. package/Meshes/Node/Blocks/Sources/meshBlock.js +17 -5
  257. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  258. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +15 -0
  259. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +50 -1
  260. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  261. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +5 -5
  262. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  263. package/Meshes/Node/nodeGeometry.d.ts +1 -2
  264. package/Meshes/Node/nodeGeometry.js +3 -4
  265. package/Meshes/Node/nodeGeometry.js.map +1 -1
  266. package/Meshes/Node/nodeGeometryBlock.d.ts +1 -2
  267. package/Meshes/Node/nodeGeometryBlock.js +1 -2
  268. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  269. package/Meshes/geometry.js +6 -12
  270. package/Meshes/geometry.js.map +1 -1
  271. package/Meshes/index.d.ts +3 -1
  272. package/Meshes/index.js +3 -1
  273. package/Meshes/index.js.map +1 -1
  274. package/Meshes/mesh.d.ts +4 -0
  275. package/Meshes/mesh.js +7 -0
  276. package/Meshes/mesh.js.map +1 -1
  277. package/Misc/deepCopier.js +3 -0
  278. package/Misc/deepCopier.js.map +1 -1
  279. package/Misc/greasedLineTools.d.ts +52 -5
  280. package/Misc/greasedLineTools.js +180 -10
  281. package/Misc/greasedLineTools.js.map +1 -1
  282. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +9 -2
  283. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  284. package/PostProcesses/motionBlurPostProcess.js +4 -1
  285. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  286. package/PostProcesses/postProcess.js +1 -6
  287. package/PostProcesses/postProcess.js.map +1 -1
  288. package/Rendering/geometryBufferRenderer.js +4 -0
  289. package/Rendering/geometryBufferRenderer.js.map +1 -1
  290. package/Shaders/greasedLine.fragment.js +2 -5
  291. package/Shaders/greasedLine.fragment.js.map +1 -1
  292. package/Shaders/greasedLine.vertex.js +15 -4
  293. package/Shaders/greasedLine.vertex.js.map +1 -1
  294. package/XR/webXRDefaultExperience.d.ts +1 -1
  295. package/XR/webXRDefaultExperience.js +1 -1
  296. package/XR/webXRDefaultExperience.js.map +1 -1
  297. package/package.json +1 -1
  298. package/scene.d.ts +17 -10
  299. package/scene.js +25 -30
  300. package/scene.js.map +1 -1
  301. package/Cameras/RigModes/webVRRigMode.d.ts +0 -5
  302. package/Cameras/RigModes/webVRRigMode.js +0 -34
  303. package/Cameras/RigModes/webVRRigMode.js.map +0 -1
  304. package/Cameras/VR/webVRCamera.d.ts +0 -316
  305. package/Cameras/VR/webVRCamera.js +0 -618
  306. package/Cameras/VR/webVRCamera.js.map +0 -1
  307. package/Engines/Extensions/engine.webVR.d.ts +0 -91
  308. package/Engines/Extensions/engine.webVR.js +0 -195
  309. package/Engines/Extensions/engine.webVR.js.map +0 -1
  310. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.d.ts +0 -23
  311. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js +0 -18
  312. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js.map +0 -1
  313. package/Gamepads/Controllers/daydreamController.d.ts +0 -38
  314. package/Gamepads/Controllers/daydreamController.js +0 -70
  315. package/Gamepads/Controllers/daydreamController.js.map +0 -1
  316. package/Gamepads/Controllers/gearVRController.d.ts +0 -39
  317. package/Gamepads/Controllers/gearVRController.js +0 -79
  318. package/Gamepads/Controllers/gearVRController.js.map +0 -1
  319. package/Gamepads/Controllers/genericController.d.ts +0 -34
  320. package/Gamepads/Controllers/genericController.js +0 -48
  321. package/Gamepads/Controllers/genericController.js.map +0 -1
  322. package/Gamepads/Controllers/index.d.ts +0 -8
  323. package/Gamepads/Controllers/index.js +0 -9
  324. package/Gamepads/Controllers/index.js.map +0 -1
  325. package/Gamepads/Controllers/oculusTouchController.d.ts +0 -78
  326. package/Gamepads/Controllers/oculusTouchController.js +0 -196
  327. package/Gamepads/Controllers/oculusTouchController.js.map +0 -1
  328. package/Gamepads/Controllers/poseEnabledController.d.ts +0 -219
  329. package/Gamepads/Controllers/poseEnabledController.js +0 -293
  330. package/Gamepads/Controllers/poseEnabledController.js.map +0 -1
  331. package/Gamepads/Controllers/viveController.d.ts +0 -52
  332. package/Gamepads/Controllers/viveController.js +0 -115
  333. package/Gamepads/Controllers/viveController.js.map +0 -1
  334. package/Gamepads/Controllers/webVRController.d.ts +0 -85
  335. package/Gamepads/Controllers/webVRController.js +0 -122
  336. package/Gamepads/Controllers/webVRController.js.map +0 -1
  337. package/Gamepads/Controllers/windowsMotionController.d.ts +0 -212
  338. package/Gamepads/Controllers/windowsMotionController.js +0 -519
  339. package/Gamepads/Controllers/windowsMotionController.js.map +0 -1
  340. package/Materials/greasedLinePluginMaterial.d.ts +0 -496
  341. package/Materials/greasedLinePluginMaterial.js.map +0 -1
  342. package/Materials/greasedLineSimpleMaterial.js.map +0 -1
  343. package/Meshes/greasedLineMesh.d.ts +0 -204
  344. package/Meshes/greasedLineMesh.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphAsyncExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphAsyncExecutionBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;;GAIG;AACH,MAAM,OAAgB,4BAA6B,SAAQ,uBAAuB;IAM9E;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAUD;;;OAGG;IACI,kBAAkB,CAAC,OAAyB;QAC/C,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CAGJ","sourcesContent":["import type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * An async execution block can start tasks that will be executed asynchronously.\r\n * It should also be responsible for clearing it in _cancelPendingTasks.\r\n * @experimental\r\n */\r\nexport abstract class FlowGraphAsyncExecutionBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * Output connection: The signal that is triggered when the execution of this block is done.\r\n */\r\n public onDone: FlowGraphSignalConnection;\r\n\r\n constructor() {\r\n super();\r\n this.onDone = this._registerSignalOutput(\"onDone\");\r\n }\r\n /**\r\n * @internal\r\n * This function can be overridden to start any\r\n * pending tasks this node might have, such as\r\n * timeouts and playing animations.\r\n * @param context\r\n */\r\n public abstract _preparePendingTasks(context: FlowGraphContext): void;\r\n\r\n /**\r\n * @internal\r\n * @param context\r\n */\r\n public _startPendingTasks(context: FlowGraphContext) {\r\n this._preparePendingTasks(context);\r\n context._addPendingBlock(this);\r\n }\r\n\r\n public abstract _cancelPendingTasks(context: FlowGraphContext): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphAsyncExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphAsyncExecutionBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;;GAIG;AACH,MAAM,OAAgB,4BAA6B,SAAQ,uBAAuB;IAM9E,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAUD;;;OAGG;IACI,kBAAkB,CAAC,OAAyB;QAC/C,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CAGJ","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * An async execution block can start tasks that will be executed asynchronously.\r\n * It should also be responsible for clearing it in _cancelPendingTasks.\r\n * @experimental\r\n */\r\nexport abstract class FlowGraphAsyncExecutionBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * Output connection: The signal that is triggered when the execution of this block is done.\r\n */\r\n public onDone: FlowGraphSignalConnection;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.onDone = this._registerSignalOutput(\"onDone\");\r\n }\r\n /**\r\n * @internal\r\n * This function can be overridden to start any\r\n * pending tasks this node might have, such as\r\n * timeouts and playing animations.\r\n * @param context\r\n */\r\n public abstract _preparePendingTasks(context: FlowGraphContext): void;\r\n\r\n /**\r\n * @internal\r\n * @param context\r\n */\r\n public _startPendingTasks(context: FlowGraphContext) {\r\n this._preparePendingTasks(context);\r\n context._addPendingBlock(this);\r\n }\r\n\r\n public abstract _cancelPendingTasks(context: FlowGraphContext): void;\r\n}\r\n"]}
@@ -1,6 +1,9 @@
1
1
  import type { FlowGraphContext } from "./flowGraphContext";
2
2
  import { FlowGraphDataConnection } from "./flowGraphDataConnection";
3
3
  import type { RichType } from "./flowGraphRichTypes";
4
+ export interface IFlowGraphBlockConfiguration {
5
+ name?: string;
6
+ }
4
7
  /**
5
8
  * @experimental
6
9
  * A block in a flow graph. The most basic form
@@ -8,24 +11,33 @@ import type { RichType } from "./flowGraphRichTypes";
8
11
  * data.
9
12
  */
10
13
  export declare class FlowGraphBlock {
14
+ config?: IFlowGraphBlockConfiguration | undefined;
11
15
  /**
12
16
  * A randomly generated GUID for each block.
13
17
  */
14
18
  uniqueId: string;
19
+ /**
20
+ * The name of the block.
21
+ */
22
+ name: string;
15
23
  /**
16
24
  * The data inputs of the block.
17
25
  */
18
- readonly dataInputs: FlowGraphDataConnection<any>[];
26
+ dataInputs: FlowGraphDataConnection<any>[];
19
27
  /**
20
28
  * The data outputs of the block.
21
29
  */
22
- readonly dataOutputs: FlowGraphDataConnection<any>[];
30
+ dataOutputs: FlowGraphDataConnection<any>[];
23
31
  /** Constructor is protected so only subclasses can be instantiated */
24
- protected constructor();
32
+ protected constructor(config?: IFlowGraphBlockConfiguration | undefined);
33
+ configure(): void;
25
34
  /**
26
35
  * @internal
27
36
  */
28
37
  _updateOutputs(_context: FlowGraphContext): void;
29
38
  protected _registerDataInput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T>;
30
39
  protected _registerDataOutput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T>;
40
+ serialize(serializationObject?: any): void;
41
+ getClassName(): string;
42
+ static Parse(serializationObject: any): FlowGraphBlock;
31
43
  }
@@ -1,6 +1,8 @@
1
1
  import { RandomGUID } from "../Misc/guid.js";
2
2
  import { FlowGraphConnectionType } from "./flowGraphConnection.js";
3
3
  import { FlowGraphDataConnection } from "./flowGraphDataConnection.js";
4
+ import { Tools } from "../Misc/tools.js";
5
+ import { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock.js";
4
6
  /**
5
7
  * @experimental
6
8
  * A block in a flow graph. The most basic form
@@ -9,18 +11,19 @@ import { FlowGraphDataConnection } from "./flowGraphDataConnection.js";
9
11
  */
10
12
  export class FlowGraphBlock {
11
13
  /** Constructor is protected so only subclasses can be instantiated */
12
- constructor() {
14
+ constructor(config) {
15
+ this.config = config;
13
16
  /**
14
17
  * A randomly generated GUID for each block.
15
18
  */
16
19
  this.uniqueId = RandomGUID();
17
- /**
18
- * The data inputs of the block.
19
- */
20
+ this.configure();
21
+ }
22
+ configure() {
23
+ var _a, _b;
24
+ // overriden in child classes, uses config
25
+ this.name = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.getClassName();
20
26
  this.dataInputs = [];
21
- /**
22
- * The data outputs of the block.
23
- */
24
27
  this.dataOutputs = [];
25
28
  }
26
29
  /**
@@ -39,5 +42,45 @@ export class FlowGraphBlock {
39
42
  this.dataOutputs.push(output);
40
43
  return output;
41
44
  }
45
+ serialize(serializationObject = {}) {
46
+ serializationObject.uniqueId = this.uniqueId;
47
+ serializationObject.config = this.config;
48
+ serializationObject.dataInputs = [];
49
+ serializationObject.dataOutputs = [];
50
+ serializationObject.className = this.getClassName();
51
+ for (const input of this.dataInputs) {
52
+ const serializedInput = {};
53
+ input.serialize(serializedInput);
54
+ serializationObject.dataInputs.push(serializedInput);
55
+ }
56
+ for (const output of this.dataOutputs) {
57
+ const serializedOutput = {};
58
+ output.serialize(serializedOutput);
59
+ serializationObject.dataOutputs.push(serializedOutput);
60
+ }
61
+ }
62
+ getClassName() {
63
+ return "FGBlock";
64
+ }
65
+ static Parse(serializationObject) {
66
+ const classType = Tools.Instantiate(serializationObject.className);
67
+ const obj = new classType(serializationObject.config);
68
+ obj.uniqueId = serializationObject.uniqueId;
69
+ for (let i = 0; i < serializationObject.dataInputs.length; i++) {
70
+ obj.dataInputs[i].deserialize(serializationObject.dataInputs[i]);
71
+ }
72
+ for (let i = 0; i < serializationObject.dataOutputs.length; i++) {
73
+ obj.dataOutputs[i].deserialize(serializationObject.dataOutputs[i]);
74
+ }
75
+ if (obj instanceof FlowGraphExecutionBlock) {
76
+ for (let i = 0; i < serializationObject.signalInputs.length; i++) {
77
+ obj.signalInputs[i].deserialize(serializationObject.signalInputs[i]);
78
+ }
79
+ for (let i = 0; i < serializationObject.signalOutputs.length; i++) {
80
+ obj.signalOutputs[i].deserialize(serializationObject.signalOutputs[i]);
81
+ }
82
+ }
83
+ return obj;
84
+ }
42
85
  }
43
86
  //# sourceMappingURL=flowGraphBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IAcvB,sEAAsE;IACtE;QAdA;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAC/B;;WAEG;QACa,eAAU,GAAmC,EAAE,CAAC;QAChE;;WAEG;QACa,gBAAW,GAAmC,EAAE,CAAC;IAGxC,CAAC;IAE1B;;OAEG;IACI,cAAc,CAAC,QAA0B;QAC5C,6CAA6C;IACjD,CAAC;IAES,kBAAkB,CAAI,IAAY,EAAE,SAAsB;QAChE,MAAM,KAAK,GAAG,IAAI,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAChG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,mBAAmB,CAAI,IAAY,EAAE,SAAsB;QACjE,MAAM,MAAM,GAAG,IAAI,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAClG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\n\r\n/**\r\n * @experimental\r\n * A block in a flow graph. The most basic form\r\n * of a block has inputs and outputs that contain\r\n * data.\r\n */\r\nexport class FlowGraphBlock {\r\n /**\r\n * A randomly generated GUID for each block.\r\n */\r\n public uniqueId = RandomGUID();\r\n /**\r\n * The data inputs of the block.\r\n */\r\n public readonly dataInputs: FlowGraphDataConnection<any>[] = [];\r\n /**\r\n * The data outputs of the block.\r\n */\r\n public readonly dataOutputs: FlowGraphDataConnection<any>[] = [];\r\n\r\n /** Constructor is protected so only subclasses can be instantiated */\r\n protected constructor() {}\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n // empty by default, overriden in data blocks\r\n }\r\n\r\n protected _registerDataInput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T> {\r\n const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input, this, className);\r\n this.dataInputs.push(input);\r\n return input;\r\n }\r\n\r\n protected _registerDataOutput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T> {\r\n const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output, this, className);\r\n this.dataOutputs.push(output);\r\n return output;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,KAAK,EAAE,yBAAwB;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAMpE;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IAkBvB,sEAAsE;IACtE,YAA6B,MAAqC;QAArC,WAAM,GAAN,MAAM,CAA+B;QAlBlE;;WAEG;QACI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAgB3B,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAEM,SAAS;;QACZ,0CAA0C;QAC1C,IAAI,CAAC,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,mCAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,QAA0B;QAC5C,6CAA6C;IACjD,CAAC;IAES,kBAAkB,CAAI,IAAY,EAAE,SAAsB;QAChE,MAAM,KAAK,GAAG,IAAI,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAChG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,mB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AAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5D,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SACpE;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7D,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;SACtE;QACD,IAAI,GAAG,YAAY,uBAAuB,EAAE;YACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC9D,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;aACxE;YACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/D,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;aAC1E;SACJ;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\n\r\nexport interface IFlowGraphBlockConfiguration {\r\n name?: string;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * A block in a flow graph. The most basic form\r\n * of a block has inputs and outputs that contain\r\n * data.\r\n */\r\nexport class FlowGraphBlock {\r\n /**\r\n * A randomly generated GUID for each block.\r\n */\r\n public uniqueId = RandomGUID();\r\n /**\r\n * The name of the block.\r\n */\r\n public name: string;\r\n /**\r\n * The data inputs of the block.\r\n */\r\n public dataInputs: FlowGraphDataConnection<any>[];\r\n /**\r\n * The data outputs of the block.\r\n */\r\n public dataOutputs: FlowGraphDataConnection<any>[];\r\n\r\n /** Constructor is protected so only subclasses can be instantiated */\r\n protected constructor(public config?: IFlowGraphBlockConfiguration) {\r\n this.configure();\r\n }\r\n\r\n public configure() {\r\n // overriden in child classes, uses config\r\n this.name = this.config?.name ?? this.getClassName();\r\n this.dataInputs = [];\r\n this.dataOutputs = [];\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n // empty by default, overriden in data blocks\r\n }\r\n\r\n protected _registerDataInput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T> {\r\n const input = new FlowGraphDataConnection(name, FlowGraphConnectionType.Input, this, className);\r\n this.dataInputs.push(input);\r\n return input;\r\n }\r\n\r\n protected _registerDataOutput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T> {\r\n const output = new FlowGraphDataConnection(name, FlowGraphConnectionType.Output, this, className);\r\n this.dataOutputs.push(output);\r\n return output;\r\n }\r\n\r\n public serialize(serializationObject: any = {}) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.config = this.config;\r\n serializationObject.dataInputs = [];\r\n serializationObject.dataOutputs = [];\r\n serializationObject.className = this.getClassName();\r\n for (const input of this.dataInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.dataInputs.push(serializedInput);\r\n }\r\n for (const output of this.dataOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.dataOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n public getClassName() {\r\n return \"FGBlock\";\r\n }\r\n\r\n public static Parse(serializationObject: any): FlowGraphBlock {\r\n const classType = Tools.Instantiate(serializationObject.className);\r\n const obj = new classType(serializationObject.config);\r\n obj.uniqueId = serializationObject.uniqueId;\r\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\r\n obj.dataInputs[i].deserialize(serializationObject.dataInputs[i]);\r\n }\r\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\r\n obj.dataOutputs[i].deserialize(serializationObject.dataOutputs[i]);\r\n }\r\n if (obj instanceof FlowGraphExecutionBlock) {\r\n for (let i = 0; i < serializationObject.signalInputs.length; i++) {\r\n obj.signalInputs[i].deserialize(serializationObject.signalInputs[i]);\r\n }\r\n for (let i = 0; i < serializationObject.signalOutputs.length; i++) {\r\n obj.signalOutputs[i].deserialize(serializationObject.signalOutputs[i]);\r\n }\r\n }\r\n return obj;\r\n }\r\n}\r\n"]}
@@ -1,3 +1,4 @@
1
+ import type { FlowGraphBlock } from "./flowGraphBlock";
1
2
  /**
2
3
  * @experimental
3
4
  * The type of a connection point - inpput or output.
@@ -10,6 +11,7 @@ export declare enum FlowGraphConnectionType {
10
11
  * @experimental
11
12
  */
12
13
  export interface IConnectable {
14
+ uniqueId: string;
13
15
  _connectedPoint: Array<IConnectable>;
14
16
  _isSingularConnection(): boolean;
15
17
  _connectionType: FlowGraphConnectionType;
@@ -20,16 +22,27 @@ export interface IConnectable {
20
22
  * The base connection class.
21
23
  */
22
24
  export declare class FlowGraphConnection<BlockT, ConnectedToT extends IConnectable> implements IConnectable {
23
- name: string;
24
- _connectionType: FlowGraphConnectionType;
25
- protected _ownerBlock: BlockT;
25
+ _ownerBlock: BlockT;
26
26
  /** @internal */
27
27
  _connectedPoint: Array<ConnectedToT>;
28
28
  /**
29
29
  * A uniquely identifying string for the connection.
30
30
  */
31
31
  uniqueId: string;
32
- constructor(name: string, /** @internal */ _connectionType: FlowGraphConnectionType, _ownerBlock: BlockT);
32
+ /**
33
+ * The name of the connection.
34
+ */
35
+ name: string;
36
+ /**
37
+ * @internal
38
+ */
39
+ _connectionType: FlowGraphConnectionType;
40
+ /**
41
+ * Used for parsing connections.
42
+ * @internal
43
+ */
44
+ connectedPointIds: any[];
45
+ constructor(name: string, _connectionType: FlowGraphConnectionType, /* @internal */ _ownerBlock: BlockT);
33
46
  /**
34
47
  * The type of the connection
35
48
  */
@@ -49,4 +62,21 @@ export declare class FlowGraphConnection<BlockT, ConnectedToT extends IConnectab
49
62
  * @param point
50
63
  */
51
64
  connectTo(point: ConnectedToT): void;
65
+ /**
66
+ * Saves the connection to a JSON object.
67
+ */
68
+ serialize(serializationObject?: any): void;
69
+ getClassName(): string;
70
+ /**
71
+ * Deserialize from a object into this
72
+ * @param serializationObject
73
+ */
74
+ deserialize(serializationObject: any): void;
75
+ /**
76
+ * Parses a connection from an object
77
+ * @param serializationObject
78
+ * @param ownerBlock
79
+ * @returns
80
+ */
81
+ static Parse(serializationObject: any, ownerBlock: FlowGraphBlock): any;
52
82
  }
@@ -1,3 +1,4 @@
1
+ import { Tools } from "../Misc/tools.js";
1
2
  import { RandomGUID } from "../Misc/guid.js";
2
3
  /**
3
4
  * @experimental
@@ -13,9 +14,7 @@ export var FlowGraphConnectionType;
13
14
  * The base connection class.
14
15
  */
15
16
  export class FlowGraphConnection {
16
- constructor(name, /** @internal */ _connectionType, _ownerBlock) {
17
- this.name = name;
18
- this._connectionType = _connectionType;
17
+ constructor(name, _connectionType, /* @internal */ _ownerBlock) {
19
18
  this._ownerBlock = _ownerBlock;
20
19
  /** @internal */
21
20
  this._connectedPoint = [];
@@ -23,6 +22,15 @@ export class FlowGraphConnection {
23
22
  * A uniquely identifying string for the connection.
24
23
  */
25
24
  this.uniqueId = RandomGUID();
25
+ /**
26
+ * Used for parsing connections.
27
+ * @internal
28
+ */
29
+ // disable warning as this is used for parsing
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
+ this.connectedPointIds = [];
32
+ this.name = name;
33
+ this._connectionType = _connectionType;
26
34
  }
27
35
  /**
28
36
  * The type of the connection
@@ -58,5 +66,43 @@ export class FlowGraphConnection {
58
66
  this._connectedPoint.push(point);
59
67
  point._connectedPoint.push(this);
60
68
  }
69
+ /**
70
+ * Saves the connection to a JSON object.
71
+ */
72
+ serialize(serializationObject = {}) {
73
+ serializationObject.uniqueId = this.uniqueId;
74
+ serializationObject.name = this.name;
75
+ serializationObject._connectionType = this._connectionType;
76
+ serializationObject.connectedPointIds = [];
77
+ serializationObject.className = this.getClassName();
78
+ for (const point of this._connectedPoint) {
79
+ serializationObject.connectedPointIds.push(point.uniqueId);
80
+ }
81
+ }
82
+ getClassName() {
83
+ return "FGConnection";
84
+ }
85
+ /**
86
+ * Deserialize from a object into this
87
+ * @param serializationObject
88
+ */
89
+ deserialize(serializationObject) {
90
+ this.uniqueId = serializationObject.uniqueId;
91
+ this.name = serializationObject.name;
92
+ this._connectionType = serializationObject._connectionType;
93
+ this.connectedPointIds = serializationObject.connectedPointIds;
94
+ }
95
+ /**
96
+ * Parses a connection from an object
97
+ * @param serializationObject
98
+ * @param ownerBlock
99
+ * @returns
100
+ */
101
+ static Parse(serializationObject = {}, ownerBlock) {
102
+ const type = Tools.Instantiate(serializationObject.className);
103
+ const connection = new type(serializationObject.name, serializationObject._connectionType, ownerBlock);
104
+ connection.deserialize(serializationObject);
105
+ return connection;
106
+ }
61
107
  }
62
108
  //# sourceMappingURL=flowGraphConnection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAN,IA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;CACJ","sourcesContent":["import { RandomGUID } from \"../Misc/guid\";\r\n\r\n/**\r\n * @experimental\r\n * The type of a connection point - inpput or output.\r\n */\r\nexport enum FlowGraphConnectionType {\r\n Input,\r\n Output,\r\n}\r\n\r\n/**\r\n * @experimental\r\n */\r\nexport interface IConnectable {\r\n _connectedPoint: Array<IConnectable>;\r\n _isSingularConnection(): boolean;\r\n _connectionType: FlowGraphConnectionType;\r\n connectTo(point: IConnectable): void;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * The base connection class.\r\n */\r\nexport class FlowGraphConnection<BlockT, ConnectedToT extends IConnectable> implements IConnectable {\r\n /** @internal */\r\n public _connectedPoint: Array<ConnectedToT> = [];\r\n /**\r\n * A uniquely identifying string for the connection.\r\n */\r\n public uniqueId = RandomGUID();\r\n\r\n public constructor(public name: string, /** @internal */ public _connectionType: FlowGraphConnectionType, protected _ownerBlock: BlockT) {}\r\n\r\n /**\r\n * The type of the connection\r\n */\r\n public get connectionType() {\r\n return this._connectionType;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Override this to indicate if a point can connect to more than one point.\r\n */\r\n public _isSingularConnection(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns if a point is connected to any other point.\r\n * @returns boolean indicating if the point is connected.\r\n */\r\n public isConnected(): boolean {\r\n return this._connectedPoint.length > 0;\r\n }\r\n\r\n /**\r\n * Connects two points together.\r\n * @param point\r\n */\r\n public connectTo(point: ConnectedToT): void {\r\n if (this._connectionType === point._connectionType) {\r\n throw new Error(`Cannot connect two points of type ${this.connectionType}`);\r\n }\r\n if ((this._isSingularConnection() && this._connectedPoint.length > 0) || (point._isSingularConnection() && point._connectedPoint.length > 0)) {\r\n throw new Error(\"Max number of connections for point reached\");\r\n }\r\n this._connectedPoint.push(point);\r\n point._connectedPoint.push(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphConnection.ts"],"names":[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IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QACvG,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n * The type of a connection point - inpput or output.\r\n */\r\nexport enum FlowGraphConnectionType {\r\n Input,\r\n Output,\r\n}\r\n\r\n/**\r\n * @experimental\r\n */\r\nexport interface IConnectable {\r\n uniqueId: string;\r\n _connectedPoint: Array<IConnectable>;\r\n _isSingularConnection(): boolean;\r\n _connectionType: FlowGraphConnectionType;\r\n connectTo(point: IConnectable): void;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * The base connection class.\r\n */\r\nexport class FlowGraphConnection<BlockT, ConnectedToT extends IConnectable> implements IConnectable {\r\n /** @internal */\r\n public _connectedPoint: Array<ConnectedToT> = [];\r\n /**\r\n * A uniquely identifying string for the connection.\r\n */\r\n public uniqueId = RandomGUID();\r\n\r\n /**\r\n * The name of the connection.\r\n */\r\n public name: string;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _connectionType: FlowGraphConnectionType;\r\n\r\n /**\r\n * Used for parsing connections.\r\n * @internal\r\n */\r\n // disable warning as this is used for parsing\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public connectedPointIds: any[] = [];\r\n\r\n public constructor(name: string, _connectionType: FlowGraphConnectionType, /* @internal */ public _ownerBlock: BlockT) {\r\n this.name = name;\r\n this._connectionType = _connectionType;\r\n }\r\n\r\n /**\r\n * The type of the connection\r\n */\r\n public get connectionType() {\r\n return this._connectionType;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Override this to indicate if a point can connect to more than one point.\r\n */\r\n public _isSingularConnection(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns if a point is connected to any other point.\r\n * @returns boolean indicating if the point is connected.\r\n */\r\n public isConnected(): boolean {\r\n return this._connectedPoint.length > 0;\r\n }\r\n\r\n /**\r\n * Connects two points together.\r\n * @param point\r\n */\r\n public connectTo(point: ConnectedToT): void {\r\n if (this._connectionType === point._connectionType) {\r\n throw new Error(`Cannot connect two points of type ${this.connectionType}`);\r\n }\r\n if ((this._isSingularConnection() && this._connectedPoint.length > 0) || (point._isSingularConnection() && point._connectedPoint.length > 0)) {\r\n throw new Error(\"Max number of connections for point reached\");\r\n }\r\n this._connectedPoint.push(point);\r\n point._connectedPoint.push(this);\r\n }\r\n\r\n /**\r\n * Saves the connection to a JSON object.\r\n */\r\n public serialize(serializationObject: any = {}) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject._connectionType = this._connectionType;\r\n serializationObject.connectedPointIds = [];\r\n serializationObject.className = this.getClassName();\r\n for (const point of this._connectedPoint) {\r\n serializationObject.connectedPointIds.push(point.uniqueId);\r\n }\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FGConnection\";\r\n }\r\n\r\n /**\r\n * Deserialize from a object into this\r\n * @param serializationObject\r\n */\r\n deserialize(serializationObject: any) {\r\n this.uniqueId = serializationObject.uniqueId;\r\n this.name = serializationObject.name;\r\n this._connectionType = serializationObject._connectionType;\r\n this.connectedPointIds = serializationObject.connectedPointIds;\r\n }\r\n\r\n /**\r\n * Parses a connection from an object\r\n * @param serializationObject\r\n * @param ownerBlock\r\n * @returns\r\n */\r\n public static Parse(serializationObject: any = {}, ownerBlock: FlowGraphBlock) {\r\n const type = Tools.Instantiate(serializationObject.className);\r\n const connection = new type(serializationObject.name, serializationObject._connectionType, ownerBlock);\r\n connection.deserialize(serializationObject);\r\n return connection;\r\n }\r\n}\r\n"]}
@@ -3,11 +3,12 @@ import type { FlowGraphAsyncExecutionBlock } from "./flowGraphAsyncExecutionBloc
3
3
  import type { FlowGraphBlock } from "./flowGraphBlock";
4
4
  import type { FlowGraphDataConnection } from "./flowGraphDataConnection";
5
5
  import type { FlowGraphEventCoordinator } from "./flowGraphEventCoordinator";
6
+ import type { FlowGraph } from "./flowGraph";
6
7
  /**
7
8
  * Construction parameters for the context.
8
9
  * @experimental
9
10
  */
10
- export interface IFlowGraphGraphVariables {
11
+ export interface IFlowGraphContextConfiguration {
11
12
  /**
12
13
  * The scene that the flow graph context belongs to.
13
14
  */
@@ -25,6 +26,10 @@ export interface IFlowGraphGraphVariables {
25
26
  * are set by the blocks.
26
27
  */
27
28
  export declare class FlowGraphContext {
29
+ /**
30
+ * A randomly generated GUID for each context.
31
+ */
32
+ uniqueId: string;
28
33
  /**
29
34
  * These are the variables defined by a user.
30
35
  */
@@ -40,12 +45,12 @@ export declare class FlowGraphContext {
40
45
  /**
41
46
  * These are the variables set by the graph.
42
47
  */
43
- private readonly _graphVariables;
48
+ private readonly _configuration;
44
49
  /**
45
50
  * These are blocks that have currently pending tasks/listeners that need to be cleaned up.
46
51
  */
47
52
  private _pendingBlocks;
48
- constructor(params: IFlowGraphGraphVariables);
53
+ constructor(params: IFlowGraphContextConfiguration);
49
54
  /**
50
55
  * Check if a user-defined variable is defined.
51
56
  * @param name
@@ -116,12 +121,12 @@ export declare class FlowGraphContext {
116
121
  */
117
122
  _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T;
118
123
  /**
119
- * Get the graph set variables
124
+ * Get the configuration
120
125
  * @internal
121
126
  * @param name
122
127
  * @param value
123
128
  */
124
- get graphVariables(): IFlowGraphGraphVariables;
129
+ get configuration(): IFlowGraphContextConfiguration;
125
130
  /**
126
131
  * Add a block to the list of blocks that have pending tasks.
127
132
  * @internal
@@ -139,4 +144,19 @@ export declare class FlowGraphContext {
139
144
  * @internal
140
145
  */
141
146
  _clearPendingBlocks(): void;
147
+ /**
148
+ * Serializes a context
149
+ * @param serializationObject the object to write the values in
150
+ * @param valueSerializationFunction a function to serialize complex values
151
+ */
152
+ serialize(serializationObject?: any, valueSerializationFunction?: (key: string, value: any, serializationObject: any) => void): void;
153
+ getClassName(): string;
154
+ /**
155
+ * Parses a context
156
+ * @param serializationObject the object containing the context serialization values
157
+ * @param graph the graph to which the context should belong
158
+ * @param valueParseFunction a function to parse complex values
159
+ * @returns
160
+ */
161
+ static Parse(serializationObject: any, graph: FlowGraph, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any): FlowGraphContext;
142
162
  }
@@ -1,3 +1,39 @@
1
+ import { __decorate } from "../tslib.es6.js";
2
+ import { serialize } from "../Misc/decorators.js";
3
+ import { RandomGUID } from "../Misc/guid.js";
4
+ function isMeshClassName(className) {
5
+ return (className === "Mesh" ||
6
+ className === "AbstractMesh" ||
7
+ className === "GroundMesh" ||
8
+ className === "InstanceMesh" ||
9
+ className === "LinesMesh" ||
10
+ className === "GoldbergMesh" ||
11
+ className === "GreasedLineMesh" ||
12
+ className === "TrailMesh");
13
+ }
14
+ function defaultValueSerializationFunction(key, value, serializationObject) {
15
+ if ((value === null || value === void 0 ? void 0 : value.getClassName) && isMeshClassName(value === null || value === void 0 ? void 0 : value.getClassName())) {
16
+ serializationObject[key] = {
17
+ name: value.name,
18
+ className: value.getClassName(),
19
+ };
20
+ }
21
+ else {
22
+ serializationObject[key] = value;
23
+ }
24
+ }
25
+ function defaultValueParseFunction(key, serializationObject, scene) {
26
+ const value = serializationObject[key];
27
+ let finalValue;
28
+ const className = value === null || value === void 0 ? void 0 : value.className;
29
+ if (isMeshClassName(className)) {
30
+ finalValue = scene.getMeshByName(value.name);
31
+ }
32
+ else {
33
+ finalValue = value;
34
+ }
35
+ return finalValue;
36
+ }
1
37
  /**
2
38
  * @experimental
3
39
  * The context represents the current state and execution of the flow graph.
@@ -7,6 +43,10 @@
7
43
  */
8
44
  export class FlowGraphContext {
9
45
  constructor(params) {
46
+ /**
47
+ * A randomly generated GUID for each context.
48
+ */
49
+ this.uniqueId = RandomGUID();
10
50
  /**
11
51
  * These are the variables defined by a user.
12
52
  */
@@ -23,7 +63,7 @@ export class FlowGraphContext {
23
63
  * These are blocks that have currently pending tasks/listeners that need to be cleaned up.
24
64
  */
25
65
  this._pendingBlocks = [];
26
- this._graphVariables = params;
66
+ this._configuration = params;
27
67
  }
28
68
  /**
29
69
  * Check if a user-defined variable is defined.
@@ -122,13 +162,13 @@ export class FlowGraphContext {
122
162
  return this._connectionValues.get(connectionPoint.uniqueId);
123
163
  }
124
164
  /**
125
- * Get the graph set variables
165
+ * Get the configuration
126
166
  * @internal
127
167
  * @param name
128
168
  * @param value
129
169
  */
130
- get graphVariables() {
131
- return this._graphVariables;
170
+ get configuration() {
171
+ return this._configuration;
132
172
  }
133
173
  /**
134
174
  * Add a block to the list of blocks that have pending tasks.
@@ -159,5 +199,47 @@ export class FlowGraphContext {
159
199
  }
160
200
  this._pendingBlocks.length = 0;
161
201
  }
202
+ /**
203
+ * Serializes a context
204
+ * @param serializationObject the object to write the values in
205
+ * @param valueSerializationFunction a function to serialize complex values
206
+ */
207
+ serialize(serializationObject = {}, valueSerializationFunction = defaultValueSerializationFunction) {
208
+ serializationObject.uniqueId = this.uniqueId;
209
+ serializationObject._userVariables = {};
210
+ this._userVariables.forEach((value, key) => {
211
+ valueSerializationFunction(key, value, serializationObject._userVariables);
212
+ });
213
+ serializationObject._connectionValues = {};
214
+ this._connectionValues.forEach((value, key) => {
215
+ valueSerializationFunction(key, value, serializationObject._connectionValues);
216
+ });
217
+ }
218
+ getClassName() {
219
+ return "FGContext";
220
+ }
221
+ /**
222
+ * Parses a context
223
+ * @param serializationObject the object containing the context serialization values
224
+ * @param graph the graph to which the context should belong
225
+ * @param valueParseFunction a function to parse complex values
226
+ * @returns
227
+ */
228
+ static Parse(serializationObject = {}, graph, valueParseFunction = defaultValueParseFunction) {
229
+ const result = graph.createContext();
230
+ result.uniqueId = serializationObject.uniqueId;
231
+ for (const key in serializationObject._userVariables) {
232
+ const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);
233
+ result._userVariables.set(key, value);
234
+ }
235
+ for (const key in serializationObject._connectionValues) {
236
+ const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);
237
+ result._connectionValues.set(key, value);
238
+ }
239
+ return result;
240
+ }
162
241
  }
242
+ __decorate([
243
+ serialize()
244
+ ], FlowGraphContext.prototype, "uniqueId", void 0);
163
245
  //# sourceMappingURL=flowGraphContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAsBzB,YAAY,MAAgC;QArB5C;;WAEG;QACK,mBAAc,GAAqB,IAAI,GAAG,EAAE,CAAC;QACrD;;WAEG;QACK,wBAAmB,GAAqB,IAAI,GAAG,EAAE,CAAC;QAC1D;;WAEG;QACK,sBAAiB,GAAqB,IAAI,GAAG,EAAE,CAAC;QAKxD;;WAEG;QACK,mBAAc,GAAmC,EAAE,CAAC;QAGxD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAY;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAY,EAAE,KAAU;QACvC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAY;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAEO,wBAAwB,CAAC,GAAmB,EAAE,IAAY;QAC9D,OAAO,GAAG,GAAG,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,KAAqB,EAAE,IAAY,EAAE,KAAU;Q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ACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,KAAmC;QACvD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,KAAmC;QAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACxC;IACL,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACtB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE;YACrC,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;SACnC;QACD,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;IACnC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraphEventCoordinator } from \"./flowGraphEventCoordinator\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphGraphVariables {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly eventCoordinator: FlowGraphEventCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _graphVariables: IFlowGraphGraphVariables;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n\r\n constructor(params: IFlowGraphGraphVariables) {\r\n this._graphVariables = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return this._userVariables.has(name);\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables.set(name, value);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables.get(name);\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables.set(this._getUniqueIdPrefixedName(block, name), value);\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables.get(this._getUniqueIdPrefixedName(block, name));\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n this._executionVariables.delete(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._executionVariables.has(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return this._connectionValues.has(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues.set(connectionPoint.uniqueId, value);\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues.get(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Get the graph set variables\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get graphVariables() {\r\n return this._graphVariables;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,SAAS,eAAe,CAAC,SAAiB;IACtC,OAAO,CACH,SAAS,KAAK,MAAM;QACpB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,YAAY;QAC1B,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,WAAW;QACzB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,iBAAiB;QAC/B,SAAS,KAAK,WAAW,CAC5B,CAAC;AACN,CAAC;AAED,SAAS,iCAAiC,CAAC,GAAW,EAAE,KAAU,EAAE,mBAAwB;IACxF,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,KAAI,eAAe,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,EAAE,CAAC,EAAE;QAC/D,mBAAmB,CAAC,GAAG,CAAC,GAAG;YACvB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,YAAY,EAAE;SAClC,CAAC;KACL;SAAM;QACH,mBAAmB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KACpC;AACL,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAW,EAAE,mBAAwB,EAAE,KAAY;IAClF,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,UAAU,CAAC;IACf,MAAM,SAAS,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC;IACnC,IAAI,eAAe,CAAC,SAAS,CAAC,EAAE;QAC5B,UAAU,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,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ACrC,MAAM,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAC/C,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,cAAc,EAAE;YAClD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACvG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACrD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC1G,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC5C;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA5NU;IADN,SAAS,EAAE;kDACmB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraphEventCoordinator } from \"./flowGraphEventCoordinator\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\n\r\nfunction isMeshClassName(className: string) {\r\n return (\r\n className === \"Mesh\" ||\r\n className === \"AbstractMesh\" ||\r\n className === \"GroundMesh\" ||\r\n className === \"InstanceMesh\" ||\r\n className === \"LinesMesh\" ||\r\n className === \"GoldbergMesh\" ||\r\n className === \"GreasedLineMesh\" ||\r\n className === \"TrailMesh\"\r\n );\r\n}\r\n\r\nfunction defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n if (value?.getClassName && isMeshClassName(value?.getClassName())) {\r\n serializationObject[key] = {\r\n name: value.name,\r\n className: value.getClassName(),\r\n };\r\n } else {\r\n serializationObject[key] = value;\r\n }\r\n}\r\n\r\nfunction defaultValueParseFunction(key: string, serializationObject: any, scene: Scene) {\r\n const value = serializationObject[key];\r\n let finalValue;\r\n const className = value?.className;\r\n if (isMeshClassName(className)) {\r\n finalValue = scene.getMeshByName(value.name);\r\n } else {\r\n finalValue = value;\r\n }\r\n return finalValue;\r\n}\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly eventCoordinator: FlowGraphEventCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return this._userVariables.has(name);\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables.set(name, value);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables.get(name);\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables.set(this._getUniqueIdPrefixedName(block, name), value);\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables.get(this._getUniqueIdPrefixedName(block, name));\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n this._executionVariables.delete(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._executionVariables.has(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return this._connectionValues.has(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues.set(connectionPoint.uniqueId, value);\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues.get(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n this._userVariables.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._userVariables);\r\n });\r\n serializationObject._connectionValues = {};\r\n this._connectionValues.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._connectionValues);\r\n });\r\n }\r\n\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\r\n * @returns\r\n */\r\n public static Parse(\r\n serializationObject: any = {},\r\n graph: FlowGraph,\r\n valueParseFunction: (key: string, serializationObject: any, scene: Scene) => any = defaultValueParseFunction\r\n ): FlowGraphContext {\r\n const result = graph.createContext();\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables.set(key, value);\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues.set(key, value);\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { Scene } from "../scene";
2
2
  import { FlowGraph } from "./flowGraph";
3
+ import { FlowGraphEventCoordinator } from "./flowGraphEventCoordinator";
3
4
  /**
4
5
  * @experimental
5
6
  * Parameters used to create a flow graph engine.
@@ -21,7 +22,10 @@ export declare class FlowGraphCoordinator {
21
22
  * A list of all the coordinators per scene. Will be used by the inspector
22
23
  */
23
24
  static readonly SceneCoordinators: Map<Scene, FlowGraphCoordinator[]>;
24
- private readonly _eventCoordinator;
25
+ /**
26
+ * The event coordinator used by the flow graph coordinator.
27
+ */
28
+ readonly eventCoordinator: FlowGraphEventCoordinator;
25
29
  private readonly _flowGraphs;
26
30
  constructor(_config: IFlowGraphCoordinatorConfiguration);
27
31
  /**
@@ -42,4 +46,6 @@ export declare class FlowGraphCoordinator {
42
46
  * Disposes all graphs
43
47
  */
44
48
  dispose(): void;
49
+ serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void): void;
50
+ static Parse(serializedObject: any, scene: Scene, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any): FlowGraphCoordinator;
45
51
  }