@babylonjs/core 7.51.0 → 7.51.2

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 (325) hide show
  1. package/Animations/animation.js +2 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/Buffers/bufferUtils.d.ts +7 -5
  4. package/Buffers/bufferUtils.js +13 -9
  5. package/Buffers/bufferUtils.js.map +1 -1
  6. package/Engines/abstractEngine.js +2 -2
  7. package/Engines/abstractEngine.js.map +1 -1
  8. package/Engines/constants.d.ts +32 -0
  9. package/Engines/constants.js +33 -0
  10. package/Engines/constants.js.map +1 -1
  11. package/Engines/webgpuEngine.js +6 -3
  12. package/Engines/webgpuEngine.js.map +1 -1
  13. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +148 -465
  14. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +394 -691
  15. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  16. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.d.ts +142 -0
  17. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js +342 -0
  18. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js.map +1 -0
  19. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +107 -0
  20. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +130 -0
  21. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -0
  22. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +77 -0
  23. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +139 -0
  24. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -0
  25. package/FlowGraph/Blocks/Data/Math/index.d.ts +3 -0
  26. package/FlowGraph/Blocks/Data/Math/index.js +3 -0
  27. package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
  28. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +85 -0
  29. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +133 -0
  30. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -0
  31. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.d.ts +49 -0
  32. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js +71 -0
  33. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js.map +1 -0
  34. package/FlowGraph/Blocks/Data/Transformers/index.d.ts +2 -0
  35. package/FlowGraph/Blocks/Data/Transformers/index.js +3 -0
  36. package/FlowGraph/Blocks/Data/Transformers/index.js.map +1 -0
  37. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.d.ts +39 -0
  38. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js +46 -0
  39. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js.map +1 -0
  40. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.d.ts +35 -0
  41. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +34 -0
  42. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -0
  43. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.d.ts +20 -0
  44. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js +25 -0
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js.map +1 -0
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.d.ts +34 -0
  47. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js +35 -0
  48. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js.map +1 -0
  49. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.d.ts +39 -0
  50. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js +42 -0
  51. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js.map +1 -0
  52. package/FlowGraph/Blocks/Data/Utils/index.d.ts +5 -0
  53. package/FlowGraph/Blocks/Data/Utils/index.js +6 -0
  54. package/FlowGraph/Blocks/Data/Utils/index.js.map +1 -0
  55. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +0 -1
  56. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -2
  57. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  58. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
  59. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +4 -4
  60. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  61. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +6 -3
  62. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +12 -6
  63. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  64. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +0 -2
  65. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +2 -3
  66. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +5 -4
  68. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -4
  69. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.d.ts +62 -0
  71. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js +41 -0
  72. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js.map +1 -0
  73. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +38 -33
  74. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +42 -25
  75. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -16
  77. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +9 -17
  78. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  79. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +1 -1
  80. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +1 -1
  81. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.d.ts → flowGraphTransformCoordinatesSystemBlock.d.ts} +1 -2
  83. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.js → flowGraphTransformCoordinatesSystemBlock.js} +4 -5
  84. package/FlowGraph/Blocks/Data/flowGraphTransformCoordinatesSystemBlock.js.map +1 -0
  85. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
  86. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
  87. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  88. package/FlowGraph/Blocks/Data/index.d.ts +7 -3
  89. package/FlowGraph/Blocks/Data/index.js +9 -4
  90. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  91. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +45 -24
  92. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +45 -51
  93. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  94. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.d.ts +61 -0
  95. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js +39 -0
  96. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js.map +1 -0
  97. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.d.ts +61 -0
  98. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js +40 -0
  99. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js.map +1 -0
  100. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +12 -14
  101. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +19 -26
  102. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  103. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -12
  104. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +13 -24
  105. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  106. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +31 -7
  107. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +22 -20
  108. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  109. package/FlowGraph/Blocks/{Execution → Event}/flowGraphSendCustomEventBlock.d.ts +12 -7
  110. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +39 -0
  111. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -0
  112. package/FlowGraph/Blocks/Event/index.d.ts +3 -0
  113. package/FlowGraph/Blocks/Event/index.js +3 -0
  114. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  115. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.d.ts +44 -0
  116. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js +46 -0
  117. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js.map +1 -0
  118. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.d.ts +60 -0
  119. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js +93 -0
  120. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js.map +1 -0
  121. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.d.ts +82 -0
  122. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +105 -0
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -0
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +2 -2
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +40 -42
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +116 -50
  129. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  130. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +12 -4
  131. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +86 -8
  132. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  133. package/FlowGraph/Blocks/Execution/Animation/index.d.ts +3 -0
  134. package/FlowGraph/Blocks/Execution/Animation/index.js +3 -0
  135. package/FlowGraph/Blocks/Execution/Animation/index.js.map +1 -1
  136. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +1 -2
  137. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -4
  138. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  139. package/FlowGraph/Blocks/Execution/{Audio/flowGraphStopAudioBlock.d.ts → ControlFlow/flowGraphCancelDelayBlock.d.ts} +6 -8
  140. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +31 -0
  141. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -0
  142. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
  143. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +5 -5
  144. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  145. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +0 -1
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -3
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +5 -10
  149. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -15
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +11 -3
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +5 -6
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +27 -7
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +28 -30
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +13 -16
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +50 -52
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +8 -9
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -13
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +32 -0
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +84 -0
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -0
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +20 -6
  167. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +55 -16
  168. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -4
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +36 -13
  171. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  172. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +13 -5
  173. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +22 -17
  174. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  175. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +12 -16
  176. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +21 -21
  177. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  178. package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +2 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/index.js +2 -1
  180. package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
  181. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -5
  182. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +13 -8
  183. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  184. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +33 -36
  185. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +42 -26
  186. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  187. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +10 -25
  188. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +38 -24
  189. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  190. package/FlowGraph/Blocks/Execution/index.d.ts +0 -3
  191. package/FlowGraph/Blocks/Execution/index.js +0 -3
  192. package/FlowGraph/Blocks/Execution/index.js.map +1 -1
  193. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +16 -0
  194. package/FlowGraph/Blocks/flowGraphBlockFactory.js +292 -0
  195. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -0
  196. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +145 -0
  197. package/FlowGraph/Blocks/flowGraphBlockNames.js +147 -0
  198. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -0
  199. package/FlowGraph/Blocks/index.d.ts +2 -0
  200. package/FlowGraph/Blocks/index.js +2 -0
  201. package/FlowGraph/Blocks/index.js.map +1 -1
  202. package/FlowGraph/{flowGraphInteger.d.ts → CustomTypes/flowGraphInteger.d.ts} +2 -3
  203. package/FlowGraph/{flowGraphInteger.js → CustomTypes/flowGraphInteger.js} +4 -5
  204. package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -0
  205. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +196 -0
  206. package/FlowGraph/CustomTypes/flowGraphMatrix.js +272 -0
  207. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -0
  208. package/FlowGraph/CustomTypes/index.d.ts +2 -0
  209. package/FlowGraph/CustomTypes/index.js +3 -0
  210. package/FlowGraph/CustomTypes/index.js.map +1 -0
  211. package/FlowGraph/flowGraph.d.ts +29 -34
  212. package/FlowGraph/flowGraph.js +120 -104
  213. package/FlowGraph/flowGraph.js.map +1 -1
  214. package/FlowGraph/flowGraphAssetsContext.d.ts +29 -0
  215. package/FlowGraph/flowGraphAssetsContext.js +52 -0
  216. package/FlowGraph/flowGraphAssetsContext.js.map +1 -0
  217. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +15 -8
  218. package/FlowGraph/flowGraphAsyncExecutionBlock.js +25 -5
  219. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  220. package/FlowGraph/flowGraphBlock.d.ts +22 -15
  221. package/FlowGraph/flowGraphBlock.js +31 -52
  222. package/FlowGraph/flowGraphBlock.js.map +1 -1
  223. package/FlowGraph/flowGraphConnection.d.ts +13 -12
  224. package/FlowGraph/flowGraphConnection.js +31 -16
  225. package/FlowGraph/flowGraphConnection.js.map +1 -1
  226. package/FlowGraph/flowGraphContext.d.ts +89 -13
  227. package/FlowGraph/flowGraphContext.js +210 -23
  228. package/FlowGraph/flowGraphContext.js.map +1 -1
  229. package/FlowGraph/flowGraphCoordinator.d.ts +4 -10
  230. package/FlowGraph/flowGraphCoordinator.js +4 -16
  231. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  232. package/FlowGraph/flowGraphDataConnection.d.ts +52 -14
  233. package/FlowGraph/flowGraphDataConnection.js +73 -26
  234. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  235. package/FlowGraph/flowGraphEventBlock.d.ts +17 -1
  236. package/FlowGraph/flowGraphEventBlock.js +13 -2
  237. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  238. package/FlowGraph/flowGraphEventType.d.ts +16 -0
  239. package/FlowGraph/flowGraphEventType.js +18 -0
  240. package/FlowGraph/flowGraphEventType.js.map +1 -0
  241. package/FlowGraph/flowGraphExecutionBlock.d.ts +11 -1
  242. package/FlowGraph/flowGraphExecutionBlock.js +21 -2
  243. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  244. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.d.ts +2 -2
  245. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js +0 -1
  246. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -1
  247. package/FlowGraph/flowGraphLogger.d.ts +60 -0
  248. package/FlowGraph/flowGraphLogger.js +53 -0
  249. package/FlowGraph/flowGraphLogger.js.map +1 -0
  250. package/FlowGraph/flowGraphParser.d.ts +85 -0
  251. package/FlowGraph/flowGraphParser.js +271 -0
  252. package/FlowGraph/flowGraphParser.js.map +1 -0
  253. package/FlowGraph/flowGraphPathConverter.d.ts +1 -1
  254. package/FlowGraph/flowGraphPathConverter.js +3 -2
  255. package/FlowGraph/flowGraphPathConverter.js.map +1 -1
  256. package/FlowGraph/flowGraphPathConverterComponent.d.ts +8 -1
  257. package/FlowGraph/flowGraphPathConverterComponent.js +18 -2
  258. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  259. package/FlowGraph/flowGraphRichTypes.d.ts +51 -9
  260. package/FlowGraph/flowGraphRichTypes.js +160 -50
  261. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  262. package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +45 -0
  263. package/FlowGraph/flowGraphSceneEventCoordinator.js +77 -0
  264. package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -0
  265. package/FlowGraph/flowGraphSignalConnection.d.ts +8 -5
  266. package/FlowGraph/flowGraphSignalConnection.js +26 -9
  267. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  268. package/FlowGraph/index.d.ts +6 -1
  269. package/FlowGraph/index.js +7 -1
  270. package/FlowGraph/index.js.map +1 -1
  271. package/FlowGraph/serialization.d.ts +5 -2
  272. package/FlowGraph/serialization.js +94 -22
  273. package/FlowGraph/serialization.js.map +1 -1
  274. package/FlowGraph/typeDefinitions.d.ts +74 -12
  275. package/FlowGraph/typeDefinitions.js.map +1 -1
  276. package/FlowGraph/utils.d.ts +47 -0
  277. package/FlowGraph/utils.js +55 -0
  278. package/FlowGraph/utils.js.map +1 -1
  279. package/Maths/math.path.js +3 -0
  280. package/Maths/math.path.js.map +1 -1
  281. package/Meshes/geometry.d.ts +2 -1
  282. package/Meshes/geometry.js +8 -3
  283. package/Meshes/geometry.js.map +1 -1
  284. package/Meshes/mesh.d.ts +2 -1
  285. package/Meshes/mesh.js +3 -2
  286. package/Meshes/mesh.js.map +1 -1
  287. package/Misc/sceneOptimizer.js +1 -0
  288. package/Misc/sceneOptimizer.js.map +1 -1
  289. package/Misc/screenshotTools.d.ts +4 -2
  290. package/Misc/screenshotTools.js +8 -5
  291. package/Misc/screenshotTools.js.map +1 -1
  292. package/ObjectModel/objectModelInterfaces.d.ts +2 -2
  293. package/ObjectModel/objectModelInterfaces.js.map +1 -1
  294. package/Physics/v2/characterController.d.ts +8 -0
  295. package/Physics/v2/characterController.js +12 -5
  296. package/Physics/v2/characterController.js.map +1 -1
  297. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
  298. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  299. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +1 -1
  300. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  301. package/package.json +1 -1
  302. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +0 -24
  303. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +0 -39
  304. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +0 -1
  305. package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
  306. package/FlowGraph/Blocks/Data/Logic/index.js +0 -2
  307. package/FlowGraph/Blocks/Data/Logic/index.js.map +0 -1
  308. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +0 -1
  309. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +0 -19
  310. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +0 -26
  311. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +0 -1
  312. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +0 -25
  313. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +0 -1
  314. package/FlowGraph/Blocks/Execution/Audio/index.d.ts +0 -2
  315. package/FlowGraph/Blocks/Execution/Audio/index.js +0 -3
  316. package/FlowGraph/Blocks/Execution/Audio/index.js.map +0 -1
  317. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +0 -31
  318. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +0 -69
  319. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +0 -1
  320. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +0 -38
  321. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +0 -1
  322. package/FlowGraph/flowGraphContextLogger.d.ts +0 -9
  323. package/FlowGraph/flowGraphContextLogger.js +0 -14
  324. package/FlowGraph/flowGraphContextLogger.js.map +0 -1
  325. package/FlowGraph/flowGraphInteger.js.map +0 -1
@@ -1,9 +1,10 @@
1
1
  import { Observable } from "../Misc/observable.js";
2
2
  import { FlowGraph } from "./flowGraph.js";
3
- import { defaultValueParseFunction } from "./serialization.js";
4
3
  /**
5
4
  * This class holds all of the existing flow graphs and is responsible for creating new ones.
6
5
  * It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator
6
+ * This is the entry point for the flow graph system.
7
+ * @experimental This class is still in development and is subject to change.
7
8
  */
8
9
  export class FlowGraphCoordinator {
9
10
  constructor(
@@ -74,20 +75,6 @@ export class FlowGraphCoordinator {
74
75
  serializationObject._flowGraphs.push(serializedGraph);
75
76
  });
76
77
  }
77
- /**
78
- * Parses a serialized coordinator.
79
- * @param serializedObject the object to parse
80
- * @param options the options to use when parsing
81
- * @returns the parsed coordinator
82
- */
83
- static Parse(serializedObject, options) {
84
- const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;
85
- const coordinator = new FlowGraphCoordinator({ scene: options.scene });
86
- serializedObject._flowGraphs?.forEach((serializedGraph) => {
87
- FlowGraph.Parse(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter });
88
- });
89
- return coordinator;
90
- }
91
78
  /**
92
79
  * Gets the list of flow graphs
93
80
  */
@@ -102,7 +89,8 @@ export class FlowGraphCoordinator {
102
89
  getCustomEventObservable(id) {
103
90
  let observable = this._customEventsMap.get(id);
104
91
  if (!observable) {
105
- observable = new Observable();
92
+ // receive event is initialized before scene start, so no need to notify if triggered. but possible!
93
+ observable = new Observable( /*undefined, true*/);
106
94
  this._customEventsMap.set(id, observable);
107
95
  }
108
96
  return observable;
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAmC5D;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAW7B;IACI;;OAEG;IACI,MAA0C;QAA1C,WAAM,GAAN,MAAM,CAAoC;QARpC,gBAAW,GAAgB,EAAE,CAAC;QAEvC,qBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAC;QAQ/D,0EAA0E;QAC1E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,8DAA8D;QAC9D,MAAM,YAAY,GAAG,oBAAoB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,UAAU,EAAO,CAAC;YACnC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,EAAU,EAAE,IAAS;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE,CAAC;YACb,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;;AAlID;;;GAGG;AACoB,sCAAiB,GAAuC,IAAI,GAAG,EAAE,AAAhD,CAAiD","sourcesContent":["import { 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 { defaultValueParseFunction } from \"./serialization\";\r\nimport type { IObjectAccessor } from \"./typeDefinitions\";\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to create a flow graph engine.\r\n */\r\nexport interface IFlowGraphCoordinatorConfiguration {\r\n /**\r\n * The scene that the flow graph engine belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to parse a flow graph coordinator.\r\n */\r\nexport interface FlowGraphCoordinatorParseOptions {\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 scene the scene that the block is being parsed in\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, 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 */\r\nexport class FlowGraphCoordinator {\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 private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\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.config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n // Add itself to the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\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 * @returns a new flow graph\r\n */\r\n public createGraph(): FlowGraph {\r\n const graph = new FlowGraph({ scene: this.config.scene, coordinator: this });\r\n this._flowGraphs.push(graph);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Removes a flow graph from the list of existing flow graphs and disposes it\r\n * @param graph the graph to remove\r\n */\r\n public removeGraph(graph: FlowGraph) {\r\n const index = this._flowGraphs.indexOf(graph);\r\n if (index !== -1) {\r\n graph.dispose();\r\n this._flowGraphs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Starts all graphs\r\n */\r\n public start() {\r\n this._flowGraphs.forEach((graph) => graph.start());\r\n }\r\n\r\n /**\r\n * Disposes all graphs\r\n */\r\n public dispose() {\r\n this._flowGraphs.forEach((graph) => graph.dispose());\r\n this._flowGraphs.length = 0;\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 this._flowGraphs.forEach((graph) => {\r\n const serializedGraph = {};\r\n graph.serialize(serializedGraph, valueSerializeFunction);\r\n serializationObject._flowGraphs.push(serializedGraph);\r\n });\r\n }\r\n\r\n /**\r\n * Parses a serialized coordinator.\r\n * @param serializedObject the object to parse\r\n * @param options the options to use when parsing\r\n * @returns the parsed coordinator\r\n */\r\n public static Parse(serializedObject: any, options: FlowGraphCoordinatorParseOptions) {\r\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\r\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\r\n serializedObject._flowGraphs?.forEach((serializedGraph: any) => {\r\n FlowGraph.Parse(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter });\r\n });\r\n return coordinator;\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 observable = new Observable<any>();\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 */\r\n public notifyCustomEvent(id: string, data: any) {\r\n const observable = this._customEventsMap.get(id);\r\n if (observable) {\r\n observable.notifyObservers(data);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO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,UAAU,EAAM,mBAAmB,CAAC,CAAC;YACtD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,EAAU,EAAE,IAAS;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE,CAAC;YACb,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;;AApHD;;;GAGG;AACoB,sCAAiB,GAAuC,IAAI,GAAG,EAAE,AAAhD,CAAiD","sourcesContent":["import { 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\n\r\n/**\r\n * Parameters used to create a flow graph engine.\r\n */\r\nexport interface IFlowGraphCoordinatorConfiguration {\r\n /**\r\n * The scene that the flow graph engine belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n\r\n/**\r\n * Parameters used to parse a flow graph coordinator.\r\n */\r\nexport interface FlowGraphCoordinatorParseOptions {\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 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 * @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 private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\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.config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n // Add itself to the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\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 * @returns a new flow graph\r\n */\r\n public createGraph(): FlowGraph {\r\n const graph = new FlowGraph({ scene: this.config.scene, coordinator: this });\r\n this._flowGraphs.push(graph);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Removes a flow graph from the list of existing flow graphs and disposes it\r\n * @param graph the graph to remove\r\n */\r\n public removeGraph(graph: FlowGraph) {\r\n const index = this._flowGraphs.indexOf(graph);\r\n if (index !== -1) {\r\n graph.dispose();\r\n this._flowGraphs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Starts all graphs\r\n */\r\n public start() {\r\n this._flowGraphs.forEach((graph) => graph.start());\r\n }\r\n\r\n /**\r\n * Disposes all graphs\r\n */\r\n public dispose() {\r\n this._flowGraphs.forEach((graph) => graph.dispose());\r\n this._flowGraphs.length = 0;\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 this._flowGraphs.forEach((graph) => {\r\n const serializedGraph = {};\r\n graph.serialize(serializedGraph, valueSerializeFunction);\r\n serializationObject._flowGraphs.push(serializedGraph);\r\n });\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 */\r\n public notifyCustomEvent(id: string, data: any) {\r\n const observable = this._customEventsMap.get(id);\r\n if (observable) {\r\n observable.notifyObservers(data);\r\n }\r\n }\r\n}\r\n"]}
@@ -1,9 +1,10 @@
1
+ import type { Nullable } from "../types.js";
1
2
  import type { FlowGraphBlock } from "./flowGraphBlock";
2
3
  import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnection";
3
4
  import type { FlowGraphContext } from "./flowGraphContext";
4
- import { RichType } from "./flowGraphRichTypes";
5
+ import type { RichType } from "./flowGraphRichTypes";
6
+ import { Observable } from "../Misc/observable.js";
5
7
  /**
6
- * @experimental
7
8
  * Represents a connection point for data.
8
9
  * An unconnected input point can have a default value.
9
10
  * An output point will only have a value if it is connected to an input point. Furthermore,
@@ -14,18 +15,57 @@ export declare class FlowGraphDataConnection<T> extends FlowGraphConnection<Flow
14
15
  * the type of the data in this block
15
16
  */
16
17
  richType: RichType<T>;
18
+ /**
19
+ * [any] the default value of the connection
20
+ */
21
+ private _defaultValue;
22
+ /**
23
+ * [false] if the connection is optional
24
+ */
25
+ private _optional;
26
+ private _isDiabled;
27
+ /**
28
+ * a data transformer function, if needed.
29
+ * This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.
30
+ */
31
+ dataTransformer: Nullable<(value: T) => T>;
32
+ /**
33
+ * An observable that is triggered when the value of the connection changes.
34
+ */
35
+ onValueChangedObservable: Observable<T>;
17
36
  /**
18
37
  * Create a new data connection point.
19
- * @param name
20
- * @param connectionType
21
- * @param ownerBlock
22
- * @param richType
38
+ * @param name the name of the connection
39
+ * @param connectionType the type of the connection
40
+ * @param ownerBlock the block that owns this connection
41
+ * @param richType the type of the data in this block
42
+ * @param _defaultValue the default value of the connection
43
+ * @param _optional if the connection is optional
23
44
  */
24
45
  constructor(name: string, connectionType: FlowGraphConnectionType, ownerBlock: FlowGraphBlock,
25
46
  /**
26
47
  * the type of the data in this block
27
48
  */
28
- richType: RichType<T>);
49
+ richType: RichType<T>,
50
+ /**
51
+ * [any] the default value of the connection
52
+ */
53
+ _defaultValue?: T,
54
+ /**
55
+ * [false] if the connection is optional
56
+ */
57
+ _optional?: boolean);
58
+ /**
59
+ * Whether or not the connection is optional.
60
+ * Currently only used for UI control.
61
+ */
62
+ get optional(): boolean;
63
+ /**
64
+ * is this connection disabled
65
+ * If the connection is disabled you will not be able to connect anything to it.
66
+ */
67
+ get isDisabled(): boolean;
68
+ set isDisabled(value: boolean);
29
69
  /**
30
70
  * An output data block can connect to multiple input data blocks,
31
71
  * but an input data block can only connect to one output data block.
@@ -38,6 +78,11 @@ export declare class FlowGraphDataConnection<T> extends FlowGraphConnection<Flow
38
78
  * @param context the context to which the value is set
39
79
  */
40
80
  setValue(value: T, context: FlowGraphContext): void;
81
+ /**
82
+ * Reset the value of the connection to the default value.
83
+ * @param context the context in which the value is reset
84
+ */
85
+ resetToDefaultValue(context: FlowGraphContext): void;
41
86
  /**
42
87
  * Connect this point to another point.
43
88
  * @param point the point to connect to.
@@ -59,11 +104,4 @@ export declare class FlowGraphDataConnection<T> extends FlowGraphConnection<Flow
59
104
  * @param serializationObject the object to serialize to
60
105
  */
61
106
  serialize(serializationObject?: any): void;
62
- /**
63
- * Parses a data connection from a serialized object.
64
- * @param serializationObject the object to parse from
65
- * @param ownerBlock the block that owns the connection
66
- * @returns the parsed connection
67
- */
68
- static Parse(serializationObject: any, ownerBlock: FlowGraphBlock): FlowGraphDataConnection<any>;
69
107
  }
@@ -1,8 +1,8 @@
1
1
  import { RegisterClass } from "../Misc/typeStore.js";
2
2
  import { FlowGraphConnection } from "./flowGraphConnection.js";
3
- import { RichType } from "./flowGraphRichTypes.js";
3
+ import { Observable } from "../Misc/observable.js";
4
+ import { defaultValueSerializationFunction } from "./serialization.js";
4
5
  /**
5
- * @experimental
6
6
  * Represents a connection point for data.
7
7
  * An unconnected input point can have a default value.
8
8
  * An output point will only have a value if it is connected to an input point. Furthermore,
@@ -11,18 +11,63 @@ import { RichType } from "./flowGraphRichTypes.js";
11
11
  export class FlowGraphDataConnection extends FlowGraphConnection {
12
12
  /**
13
13
  * Create a new data connection point.
14
- * @param name
15
- * @param connectionType
16
- * @param ownerBlock
17
- * @param richType
14
+ * @param name the name of the connection
15
+ * @param connectionType the type of the connection
16
+ * @param ownerBlock the block that owns this connection
17
+ * @param richType the type of the data in this block
18
+ * @param _defaultValue the default value of the connection
19
+ * @param _optional if the connection is optional
18
20
  */
19
21
  constructor(name, connectionType, ownerBlock,
20
22
  /**
21
23
  * the type of the data in this block
22
24
  */
23
- richType) {
25
+ richType,
26
+ /**
27
+ * [any] the default value of the connection
28
+ */
29
+ _defaultValue = richType.defaultValue,
30
+ /**
31
+ * [false] if the connection is optional
32
+ */
33
+ _optional = false) {
24
34
  super(name, connectionType, ownerBlock);
25
35
  this.richType = richType;
36
+ this._defaultValue = _defaultValue;
37
+ this._optional = _optional;
38
+ this._isDiabled = false;
39
+ /**
40
+ * a data transformer function, if needed.
41
+ * This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.
42
+ */
43
+ this.dataTransformer = null;
44
+ /**
45
+ * An observable that is triggered when the value of the connection changes.
46
+ */
47
+ this.onValueChangedObservable = new Observable();
48
+ }
49
+ /**
50
+ * Whether or not the connection is optional.
51
+ * Currently only used for UI control.
52
+ */
53
+ get optional() {
54
+ return this._optional;
55
+ }
56
+ /**
57
+ * is this connection disabled
58
+ * If the connection is disabled you will not be able to connect anything to it.
59
+ */
60
+ get isDisabled() {
61
+ return this._isDiabled;
62
+ }
63
+ set isDisabled(value) {
64
+ if (this._isDiabled === value) {
65
+ return;
66
+ }
67
+ this._isDiabled = value;
68
+ if (this._isDiabled) {
69
+ this.disconnectFromAll();
70
+ }
26
71
  }
27
72
  /**
28
73
  * An output data block can connect to multiple input data blocks,
@@ -38,22 +83,33 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
38
83
  * @param context the context to which the value is set
39
84
  */
40
85
  setValue(value, context) {
86
+ // check if the value is different
87
+ if (context._getConnectionValue(this) === value) {
88
+ return;
89
+ }
41
90
  context._setConnectionValue(this, value);
91
+ this.onValueChangedObservable.notifyObservers(value);
92
+ }
93
+ /**
94
+ * Reset the value of the connection to the default value.
95
+ * @param context the context in which the value is reset
96
+ */
97
+ resetToDefaultValue(context) {
98
+ context._setConnectionValue(this, this._defaultValue);
42
99
  }
43
100
  /**
44
101
  * Connect this point to another point.
45
102
  * @param point the point to connect to.
46
103
  */
47
104
  connectTo(point) {
105
+ if (this._isDiabled) {
106
+ return;
107
+ }
48
108
  super.connectTo(point);
49
109
  }
50
110
  _getValueOrDefault(context) {
51
- if (context._hasConnectionValue(this)) {
52
- return context._getConnectionValue(this);
53
- }
54
- else {
55
- return this.richType.defaultValue;
56
- }
111
+ const val = context._getConnectionValue(this) ?? this._defaultValue;
112
+ return this.dataTransformer ? this.dataTransformer(val) : val;
57
113
  }
58
114
  /**
59
115
  * Gets the value of the connection in a specific context.
@@ -77,7 +133,7 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
77
133
  * @returns class name of the object.
78
134
  */
79
135
  getClassName() {
80
- return "FGDataConnection";
136
+ return "FlowGraphDataConnection";
81
137
  }
82
138
  /**
83
139
  * Serializes this object.
@@ -87,18 +143,9 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
87
143
  super.serialize(serializationObject);
88
144
  serializationObject.richType = {};
89
145
  this.richType.serialize(serializationObject.richType);
90
- }
91
- /**
92
- * Parses a data connection from a serialized object.
93
- * @param serializationObject the object to parse from
94
- * @param ownerBlock the block that owns the connection
95
- * @returns the parsed connection
96
- */
97
- static Parse(serializationObject, ownerBlock) {
98
- const obj = FlowGraphConnection.Parse(serializationObject, ownerBlock);
99
- obj.richType = RichType.Parse(serializationObject.richType);
100
- return obj;
146
+ serializationObject.optional = this._optional;
147
+ defaultValueSerializationFunction("defaultValue", this._defaultValue, serializationObject);
101
148
  }
102
149
  }
103
- RegisterClass("FGDataConnection", FlowGraphDataConnection);
150
+ RegisterClass("FlowGraphDataConnection", FlowGraphDataConnection);
104
151
  //# sourceMappingURL=flowGraphDataConnection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD;;;;;;GAMG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAC3G;;;;;;OAMG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B;IAC1B;;OAEG;IACI,QAAqB;QAE5B,KA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IAC9B,CAAC;IAED;;;OAGG;IACa,SAAS,CAAC,sBAA2B,EAAE;QACnD,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAU,KAAK,CAAC,mBAAwB,EAAE,UAA0B;QAC7E,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QACvE,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { RichType } from \"./flowGraphRichTypes\";\r\n/**\r\n * @experimental\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n /**\r\n * Create a new data connection point.\r\n * @param name\r\n * @param connectionType\r\n * @param ownerBlock\r\n * @param richType\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n /**\r\n * the type of the data in this block\r\n */\r\n public richType: RichType<T>\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n context._setConnectionValue(this, value);\r\n }\r\n\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n public override connectTo(point: FlowGraphDataConnection<T>): void {\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n if (context._hasConnectionValue(this)) {\r\n return context._getConnectionValue(this);\r\n } else {\r\n return this.richType.defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n return this._getValueOrDefault(context);\r\n }\r\n\r\n if (!this.isConnected()) {\r\n return this._getValueOrDefault(context);\r\n } else {\r\n return this._connectedPoint[0].getValue(context);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the object.\r\n */\r\n public override getClassName(): string {\r\n return \"FGDataConnection\";\r\n }\r\n\r\n /**\r\n * Serializes this object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n }\r\n\r\n /**\r\n * Parses a data connection from a serialized object.\r\n * @param serializationObject the object to parse from\r\n * @param ownerBlock the block that owns the connection\r\n * @returns the parsed connection\r\n */\r\n public static override Parse(serializationObject: any, ownerBlock: FlowGraphBlock): FlowGraphDataConnection<any> {\r\n const obj = FlowGraphConnection.Parse(serializationObject, ownerBlock);\r\n obj.richType = RichType.Parse(serializationObject.richType);\r\n return obj;\r\n }\r\n}\r\n\r\nRegisterClass(\"FGDataConnection\", FlowGraphDataConnection);\r\n"]}
1
+ {"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE;;;;;GAKG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAa3G;;;;;;;;OAQG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B;IAC1B;;OAEG;IACI,QAAqB;IAC5B;;OAEG;IACK,gBAAmB,QAAQ,CAAC,YAAY;IAChD;;OAEG;IACK,YAAqB,KAAK;QAElC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAVjC,aAAQ,GAAR,QAAQ,CAAa;QAIpB,kBAAa,GAAb,aAAa,CAA2B;QAIxC,cAAS,GAAT,SAAS,CAAiB;QApC9B,eAAU,GAAY,KAAK,CAAC;QAEpC;;;WAGG;QACI,oBAAe,GAA8B,IAAI,CAAC;QAEzD;;WAEG;QACI,6BAAwB,GAAG,IAAI,UAAU,EAAK,CAAC;IA4BtD,CAAC;IAED;;;OAGG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAW,UAAU,CAAC,KAAc;QAChC,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;YAC5B,OAAO;QACX,C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C,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,yBAAyB,CAAC;IACrC,CAAC;IAED;;;OAGG;IACa,SAAS,CAAC,sBAA2B,EAAE;QACnD,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACtD,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAC9C,iCAAiC,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAC/F,CAAC;CACJ;AAED,aAAa,CAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\n/**\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n private _isDiabled: boolean = false;\r\n\r\n /**\r\n * a data transformer function, if needed.\r\n * This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.\r\n */\r\n public dataTransformer: Nullable<(value: T) => T> = null;\r\n\r\n /**\r\n * An observable that is triggered when the value of the connection changes.\r\n */\r\n public onValueChangedObservable = new Observable<T>();\r\n /**\r\n * Create a new data connection point.\r\n * @param name the name of the connection\r\n * @param connectionType the type of the connection\r\n * @param ownerBlock the block that owns this connection\r\n * @param richType the type of the data in this block\r\n * @param _defaultValue the default value of the connection\r\n * @param _optional if the connection is optional\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n /**\r\n * the type of the data in this block\r\n */\r\n public richType: RichType<T>,\r\n /**\r\n * [any] the default value of the connection\r\n */\r\n private _defaultValue: T = richType.defaultValue,\r\n /**\r\n * [false] if the connection is optional\r\n */\r\n private _optional: boolean = false\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * Whether or not the connection is optional.\r\n * Currently only used for UI control.\r\n */\r\n public get optional(): boolean {\r\n return this._optional;\r\n }\r\n\r\n /**\r\n * is this connection disabled\r\n * If the connection is disabled you will not be able to connect anything to it.\r\n */\r\n public get isDisabled(): boolean {\r\n return this._isDiabled;\r\n }\r\n\r\n public set isDisabled(value: boolean) {\r\n if (this._isDiabled === value) {\r\n return;\r\n }\r\n this._isDiabled = value;\r\n if (this._isDiabled) {\r\n this.disconnectFromAll();\r\n }\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n // check if the value is different\r\n if (context._getConnectionValue(this) === value) {\r\n return;\r\n }\r\n context._setConnectionValue(this, value);\r\n this.onValueChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Reset the value of the connection to the default value.\r\n * @param context the context in which the value is reset\r\n */\r\n public resetToDefaultValue(context: FlowGraphContext): void {\r\n context._setConnectionValue(this, this._defaultValue);\r\n }\r\n\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n public override connectTo(point: FlowGraphDataConnection<T>): void {\r\n if (this._isDiabled) {\r\n return;\r\n }\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n const val = context._getConnectionValue(this) ?? this._defaultValue;\r\n return this.dataTransformer ? this.dataTransformer(val) : val;\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n return this._getValueOrDefault(context);\r\n }\r\n\r\n if (!this.isConnected()) {\r\n return this._getValueOrDefault(context);\r\n } else {\r\n return this._connectedPoint[0].getValue(context);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the object.\r\n */\r\n public override getClassName(): string {\r\n return \"FlowGraphDataConnection\";\r\n }\r\n\r\n /**\r\n * Serializes this object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n serializationObject.optional = this._optional;\r\n defaultValueSerializationFunction(\"defaultValue\", this._defaultValue, serializationObject);\r\n }\r\n}\r\n\r\nRegisterClass(\"FlowGraphDataConnection\", FlowGraphDataConnection);\r\n"]}
@@ -1,13 +1,29 @@
1
1
  import { FlowGraphAsyncExecutionBlock } from "./flowGraphAsyncExecutionBlock";
2
2
  import type { FlowGraphContext } from "./flowGraphContext";
3
+ import { FlowGraphEventType } from "./flowGraphEventType";
3
4
  /**
4
- * @experimental
5
5
  * A type of block that listens to an event observable and activates
6
6
  * its output signal when the event is triggered.
7
7
  */
8
8
  export declare abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {
9
+ /**
10
+ * the priority of initialization of this block.
11
+ * For example, scene start should have a negative priority because it should be initialized last.
12
+ */
13
+ initPriority: number;
14
+ /**
15
+ * The type of the event
16
+ */
17
+ readonly type: FlowGraphEventType;
9
18
  /**
10
19
  * @internal
11
20
  */
12
21
  _execute(context: FlowGraphContext): void;
22
+ /**
23
+ * Execute the event. This function should be called by the flow graph when the event is triggered.
24
+ * @param context the context in which the event is executed
25
+ * @param payload the payload of the event
26
+ * @returns a boolean indicating if the event should stop propagation. if false, the event will stop propagating.
27
+ */
28
+ abstract _executeEvent(context: FlowGraphContext, payload: any): boolean;
13
29
  }
@@ -1,16 +1,27 @@
1
1
  import { FlowGraphAsyncExecutionBlock } from "./flowGraphAsyncExecutionBlock.js";
2
2
  /**
3
- * @experimental
4
3
  * A type of block that listens to an event observable and activates
5
4
  * its output signal when the event is triggered.
6
5
  */
7
6
  export class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {
7
+ constructor() {
8
+ super(...arguments);
9
+ /**
10
+ * the priority of initialization of this block.
11
+ * For example, scene start should have a negative priority because it should be initialized last.
12
+ */
13
+ this.initPriority = 0;
14
+ /**
15
+ * The type of the event
16
+ */
17
+ this.type = "NoTrigger" /* FlowGraphEventType.NoTrigger */;
18
+ }
8
19
  /**
9
20
  * @internal
10
21
  */
11
22
  _execute(context) {
12
23
  context._notifyExecuteNode(this);
13
- this.out._activateSignal(context);
24
+ this.done._activateSignal(context);
14
25
  }
15
26
  }
16
27
  //# sourceMappingURL=flowGraphEventBlock.js.map
@@ -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;AAG9E;;;;GAIG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAC1E;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\n\r\n/**\r\n * @experimental\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 * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n context._notifyExecuteNode(this);\r\n this.out._activateSignal(context);\r\n }\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;AAI9E;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAA9E;;QACI;;;WAGG;QACI,iBAAY,GAAW,CAAC,CAAC;QAEhC;;WAEG;QACa,SAAI,kDAAoD;IAgB5E,CAAC;IAfG;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CASJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\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 * 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 this.done._activateSignal(context);\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"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Event types supported by the FlowGraph.
3
+ */
4
+ export declare enum FlowGraphEventType {
5
+ SceneReady = "SceneReady",
6
+ SceneDispose = "SceneDispose",
7
+ SceneBeforeRender = "SceneBeforeRender",
8
+ SceneAfterRender = "SceneAfterRender",
9
+ MeshPick = "MeshPick",
10
+ PointerDown = "PointerDown",
11
+ PointerUp = "PointerUp",
12
+ PointerMove = "PointerMove",
13
+ PointerOver = "PointerOver",
14
+ PointerOut = "PointerOut",
15
+ NoTrigger = "NoTrigger"
16
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Event types supported by the FlowGraph.
3
+ */
4
+ export var FlowGraphEventType;
5
+ (function (FlowGraphEventType) {
6
+ FlowGraphEventType["SceneReady"] = "SceneReady";
7
+ FlowGraphEventType["SceneDispose"] = "SceneDispose";
8
+ FlowGraphEventType["SceneBeforeRender"] = "SceneBeforeRender";
9
+ FlowGraphEventType["SceneAfterRender"] = "SceneAfterRender";
10
+ FlowGraphEventType["MeshPick"] = "MeshPick";
11
+ FlowGraphEventType["PointerDown"] = "PointerDown";
12
+ FlowGraphEventType["PointerUp"] = "PointerUp";
13
+ FlowGraphEventType["PointerMove"] = "PointerMove";
14
+ FlowGraphEventType["PointerOver"] = "PointerOver";
15
+ FlowGraphEventType["PointerOut"] = "PointerOut";
16
+ FlowGraphEventType["NoTrigger"] = "NoTrigger";
17
+ })(FlowGraphEventType || (FlowGraphEventType = {}));
18
+ //# sourceMappingURL=flowGraphEventType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphEventType.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAkB,kBAYjB;AAZD,WAAkB,kBAAkB;IAChC,+CAAyB,CAAA;IACzB,mDAA6B,CAAA;IAC7B,6DAAuC,CAAA;IACvC,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,iDAA2B,CAAA;IAC3B,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,iDAA2B,CAAA;IAC3B,+CAAyB,CAAA;IACzB,6CAAuB,CAAA;AAC3B,CAAC,EAZiB,kBAAkB,KAAlB,kBAAkB,QAYnC","sourcesContent":["/**\n * Event types supported by the FlowGraph.\n */\nexport const enum FlowGraphEventType {\n SceneReady = \"SceneReady\",\n SceneDispose = \"SceneDispose\",\n SceneBeforeRender = \"SceneBeforeRender\",\n SceneAfterRender = \"SceneAfterRender\",\n MeshPick = \"MeshPick\",\n PointerDown = \"PointerDown\",\n PointerUp = \"PointerUp\",\n PointerMove = \"PointerMove\",\n PointerOver = \"PointerOver\",\n PointerOut = \"PointerOut\",\n NoTrigger = \"NoTrigger\",\n}\n"]}
@@ -3,7 +3,6 @@ import { FlowGraphBlock } from "./flowGraphBlock";
3
3
  import type { FlowGraphContext } from "./flowGraphContext";
4
4
  import { FlowGraphSignalConnection } from "./flowGraphSignalConnection";
5
5
  /**
6
- * @experimental
7
6
  * A block that executes some action. Always has an input signal (which is not used by event blocks).
8
7
  * Can have one or more output signals.
9
8
  */
@@ -12,6 +11,10 @@ export declare abstract class FlowGraphExecutionBlock extends FlowGraphBlock {
12
11
  * Input connection: The input signal of the block.
13
12
  */
14
13
  readonly in: FlowGraphSignalConnection;
14
+ /**
15
+ * An output connection that can be used to signal an error, if the block defines it.
16
+ */
17
+ readonly error: FlowGraphSignalConnection;
15
18
  /**
16
19
  * Input connections that activate the block.
17
20
  */
@@ -20,6 +23,11 @@ export declare abstract class FlowGraphExecutionBlock extends FlowGraphBlock {
20
23
  * Output connections that can activate downstream blocks.
21
24
  */
22
25
  signalOutputs: FlowGraphSignalConnection[];
26
+ /**
27
+ * The priority of the block. Higher priority blocks will be executed first.
28
+ * Note that priority cannot be change AFTER the block was added as sorting happens when the block is added to the execution queue.
29
+ */
30
+ readonly priority: number;
23
31
  protected constructor(config?: IFlowGraphBlockConfiguration);
24
32
  /**
25
33
  * @internal
@@ -28,6 +36,8 @@ export declare abstract class FlowGraphExecutionBlock extends FlowGraphBlock {
28
36
  abstract _execute(context: FlowGraphContext, callingSignal: FlowGraphSignalConnection): void;
29
37
  protected _registerSignalInput(name: string): FlowGraphSignalConnection;
30
38
  protected _registerSignalOutput(name: string): FlowGraphSignalConnection;
39
+ protected _unregisterSignalInput(name: string): void;
40
+ protected _unregisterSignalOutput(name: string): void;
31
41
  /**
32
42
  * Given a name of a signal input, return that input if it exists
33
43
  * @param name the name of the input
@@ -1,16 +1,21 @@
1
1
  import { FlowGraphBlock } from "./flowGraphBlock.js";
2
2
  import { FlowGraphSignalConnection } from "./flowGraphSignalConnection.js";
3
3
  /**
4
- * @experimental
5
4
  * A block that executes some action. Always has an input signal (which is not used by event blocks).
6
5
  * Can have one or more output signals.
7
6
  */
8
7
  export class FlowGraphExecutionBlock extends FlowGraphBlock {
9
8
  constructor(config) {
10
9
  super(config);
10
+ /**
11
+ * The priority of the block. Higher priority blocks will be executed first.
12
+ * Note that priority cannot be change AFTER the block was added as sorting happens when the block is added to the execution queue.
13
+ */
14
+ this.priority = 0;
11
15
  this.signalInputs = [];
12
16
  this.signalOutputs = [];
13
17
  this.in = this._registerSignalInput("in");
18
+ this.error = this._registerSignalOutput("error");
14
19
  }
15
20
  _registerSignalInput(name) {
16
21
  const input = new FlowGraphSignalConnection(name, 0 /* FlowGraphConnectionType.Input */, this);
@@ -22,6 +27,20 @@ export class FlowGraphExecutionBlock extends FlowGraphBlock {
22
27
  this.signalOutputs.push(output);
23
28
  return output;
24
29
  }
30
+ _unregisterSignalInput(name) {
31
+ const index = this.signalInputs.findIndex((input) => input.name === name);
32
+ if (index !== -1) {
33
+ this.signalInputs[index].dispose();
34
+ this.signalInputs.splice(index, 1);
35
+ }
36
+ }
37
+ _unregisterSignalOutput(name) {
38
+ const index = this.signalOutputs.findIndex((output) => output.name === name);
39
+ if (index !== -1) {
40
+ this.signalOutputs[index].dispose();
41
+ this.signalOutputs.splice(index, 1);
42
+ }
43
+ }
25
44
  /**
26
45
  * Given a name of a signal input, return that input if it exists
27
46
  * @param name the name of the input
@@ -85,7 +104,7 @@ export class FlowGraphExecutionBlock extends FlowGraphBlock {
85
104
  * @returns the class name
86
105
  */
87
106
  getClassName() {
88
- return "FGExecutionBlock";
107
+ return "FlowGraphExecutionBlock";
89
108
  }
90
109
  }
91
110
  //# sourceMappingURL=flowGraphExecutionBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphExecutionBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;GAIG;AACH,MAAM,OAAgB,uBAAwB,SAAQ,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C,WAAW,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACnE,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAC1J,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,kBAAkB,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * @experimental\r\n * A block that executes some action. Always has an input signal (which is not used by event blocks).\r\n * Can have one or more output signals.\r\n */\r\nexport abstract class FlowGraphExecutionBlock extends FlowGraphBlock {\r\n /**\r\n * Input connection: The input signal of the block.\r\n */\r\n public readonly in: FlowGraphSignalConnection;\r\n /**\r\n * Input connections that activate the block.\r\n */\r\n public signalInputs: FlowGraphSignalConnection[];\r\n /**\r\n * Output connections that can activate downstream blocks.\r\n */\r\n public signalOutputs: FlowGraphSignalConnection[];\r\n\r\n protected constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.signalInputs = [];\r\n this.signalOutputs = [];\r\n this.in = this._registerSignalInput(\"in\");\r\n }\r\n\r\n /**\r\n * @internal\r\n * Executes the flow graph execution block.\r\n */\r\n public abstract _execute(context: FlowGraphContext, callingSignal: FlowGraphSignalConnection): void;\r\n\r\n protected _registerSignalInput(name: string): FlowGraphSignalConnection {\r\n const input = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Input, this);\r\n this.signalInputs.push(input);\r\n return input;\r\n }\r\n\r\n protected _registerSignalOutput(name: string): FlowGraphSignalConnection {\r\n const output = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Output, this);\r\n this.signalOutputs.push(output);\r\n return output;\r\n }\r\n\r\n /**\r\n * Given a name of a signal input, return that input if it exists\r\n * @param name the name of the input\r\n * @returns if the input exists, the input. Otherwise, undefined.\r\n */\r\n public getSignalInput(name: string): FlowGraphSignalConnection | undefined {\r\n return this.signalInputs.find((input) => input.name === name);\r\n }\r\n\r\n /**\r\n * Given a name of a signal output, return that input if it exists\r\n * @param name the name of the input\r\n * @returns if the input exists, the input. Otherwise, undefined.\r\n */\r\n public getSignalOutput(name: string): FlowGraphSignalConnection | undefined {\r\n return this.signalOutputs.find((output) => output.name === name);\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @param serializationObject the object to serialize in\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.signalInputs = [];\r\n serializationObject.signalOutputs = [];\r\n for (const input of this.signalInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.signalInputs.push(serializedInput);\r\n }\r\n for (const output of this.signalOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.signalOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n /**\r\n * Deserializes from an object\r\n * @param serializationObject the object to deserialize from\r\n */\r\n public deserialize(serializationObject: any) {\r\n for (let i = 0; i < serializationObject.signalInputs.length; i++) {\r\n const signalInput = this.getSignalInput(serializationObject.signalInputs[i].name);\r\n if (signalInput) {\r\n signalInput.deserialize(serializationObject.signalInputs[i]);\r\n } else {\r\n throw new Error(\"Could not find signal input with name \" + serializationObject.signalInputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n for (let i = 0; i < serializationObject.signalOutputs.length; i++) {\r\n const signalOutput = this.getSignalOutput(serializationObject.signalOutputs[i].name);\r\n if (signalOutput) {\r\n signalOutput.deserialize(serializationObject.signalOutputs[i]);\r\n } else {\r\n throw new Error(\"Could not find signal output with name \" + serializationObject.signalOutputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"FGExecutionBlock\";\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphExecutionBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;GAGG;AACH,MAAM,OAAgB,uBAAwB,SAAQ,cAAc;IAyBhE,YAAsB,MAAqC;QACvD,KAAK,CAAC,MAAM,CAAC,CAAC;QAPlB;;;WAGG;QACa,aAAQ,GAAW,CAAC,CAAC;QAIjC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IAQS,oBAAoB,CAAC,IAAY;QACvC,MAAM,KAAK,GAAG,IAAI,yBAAyB,CAAC,IAAI,yCAAiC,IAAI,CAAC,CAAC;QACvF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,qBAAqB,CAAC,IAAY;QACxC,MAAM,MAAM,GAAG,IAAI,yBAAyB,CAAC,IAAI,0CAAkC,IAAI,CAAC,CAAC;QACzF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC;IAClB,CAAC;IAES,sBAAsB,CAAC,IAAY;QACzC,MAAM,KA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AAI,CAAC,CAAC;YACrF,IAAI,YAAY,EAAE,CAAC;gBACf,YAAY,CAAC,WAAW,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACnE,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAC1J,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,yBAAyB,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * A block that executes some action. Always has an input signal (which is not used by event blocks).\r\n * Can have one or more output signals.\r\n */\r\nexport abstract class FlowGraphExecutionBlock extends FlowGraphBlock {\r\n /**\r\n * Input connection: The input signal of the block.\r\n */\r\n public readonly in: FlowGraphSignalConnection;\r\n\r\n /**\r\n * An output connection that can be used to signal an error, if the block defines it.\r\n */\r\n public readonly error: FlowGraphSignalConnection;\r\n /**\r\n * Input connections that activate the block.\r\n */\r\n public signalInputs: FlowGraphSignalConnection[];\r\n /**\r\n * Output connections that can activate downstream blocks.\r\n */\r\n public signalOutputs: FlowGraphSignalConnection[];\r\n\r\n /**\r\n * The priority of the block. Higher priority blocks will be executed first.\r\n * Note that priority cannot be change AFTER the block was added as sorting happens when the block is added to the execution queue.\r\n */\r\n public readonly priority: number = 0;\r\n\r\n protected constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.signalInputs = [];\r\n this.signalOutputs = [];\r\n this.in = this._registerSignalInput(\"in\");\r\n this.error = this._registerSignalOutput(\"error\");\r\n }\r\n\r\n /**\r\n * @internal\r\n * Executes the flow graph execution block.\r\n */\r\n public abstract _execute(context: FlowGraphContext, callingSignal: FlowGraphSignalConnection): void;\r\n\r\n protected _registerSignalInput(name: string): FlowGraphSignalConnection {\r\n const input = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Input, this);\r\n this.signalInputs.push(input);\r\n return input;\r\n }\r\n\r\n protected _registerSignalOutput(name: string): FlowGraphSignalConnection {\r\n const output = new FlowGraphSignalConnection(name, FlowGraphConnectionType.Output, this);\r\n this.signalOutputs.push(output);\r\n return output;\r\n }\r\n\r\n protected _unregisterSignalInput(name: string): void {\r\n const index = this.signalInputs.findIndex((input) => input.name === name);\r\n if (index !== -1) {\r\n this.signalInputs[index].dispose();\r\n this.signalInputs.splice(index, 1);\r\n }\r\n }\r\n\r\n protected _unregisterSignalOutput(name: string): void {\r\n const index = this.signalOutputs.findIndex((output) => output.name === name);\r\n if (index !== -1) {\r\n this.signalOutputs[index].dispose();\r\n this.signalOutputs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Given a name of a signal input, return that input if it exists\r\n * @param name the name of the input\r\n * @returns if the input exists, the input. Otherwise, undefined.\r\n */\r\n public getSignalInput(name: string): FlowGraphSignalConnection | undefined {\r\n return this.signalInputs.find((input) => input.name === name);\r\n }\r\n\r\n /**\r\n * Given a name of a signal output, return that input if it exists\r\n * @param name the name of the input\r\n * @returns if the input exists, the input. Otherwise, undefined.\r\n */\r\n public getSignalOutput(name: string): FlowGraphSignalConnection | undefined {\r\n return this.signalOutputs.find((output) => output.name === name);\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @param serializationObject the object to serialize in\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.signalInputs = [];\r\n serializationObject.signalOutputs = [];\r\n for (const input of this.signalInputs) {\r\n const serializedInput: any = {};\r\n input.serialize(serializedInput);\r\n serializationObject.signalInputs.push(serializedInput);\r\n }\r\n for (const output of this.signalOutputs) {\r\n const serializedOutput: any = {};\r\n output.serialize(serializedOutput);\r\n serializationObject.signalOutputs.push(serializedOutput);\r\n }\r\n }\r\n\r\n /**\r\n * Deserializes from an object\r\n * @param serializationObject the object to deserialize from\r\n */\r\n public override deserialize(serializationObject: any) {\r\n for (let i = 0; i < serializationObject.signalInputs.length; i++) {\r\n const signalInput = this.getSignalInput(serializationObject.signalInputs[i].name);\r\n if (signalInput) {\r\n signalInput.deserialize(serializationObject.signalInputs[i]);\r\n } else {\r\n throw new Error(\"Could not find signal input with name \" + serializationObject.signalInputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n for (let i = 0; i < serializationObject.signalOutputs.length; i++) {\r\n const signalOutput = this.getSignalOutput(serializationObject.signalOutputs[i].name);\r\n if (signalOutput) {\r\n signalOutput.deserialize(serializationObject.signalOutputs[i]);\r\n } else {\r\n throw new Error(\"Could not find signal output with name \" + serializationObject.signalOutputs[i].name + \" in block \" + serializationObject.className);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"FlowGraphExecutionBlock\";\r\n }\r\n}\r\n"]}