@babylonjs/core 6.19.0 → 6.20.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 (253) hide show
  1. package/Actions/actionManager.js +2 -2
  2. package/Actions/actionManager.js.map +1 -1
  3. package/Animations/runtimeAnimation.js +2 -2
  4. package/Animations/runtimeAnimation.js.map +1 -1
  5. package/Cameras/Inputs/BaseCameraPointersInput.d.ts +4 -4
  6. package/Cameras/Inputs/BaseCameraPointersInput.js +4 -6
  7. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  8. package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +3 -2
  9. package/Cameras/Inputs/arcRotateCameraPointersInput.js +3 -2
  10. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  11. package/Cameras/Inputs/flyCameraMouseInput.js +2 -7
  12. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  13. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +2 -7
  14. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  15. package/Cameras/Inputs/freeCameraMouseInput.js +4 -14
  16. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  17. package/Cameras/Inputs/freeCameraTouchInput.js +2 -1
  18. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  19. package/Cameras/arcRotateCamera.js +2 -7
  20. package/Cameras/arcRotateCamera.js.map +1 -1
  21. package/Cameras/camera.d.ts +2 -0
  22. package/Cameras/camera.js +8 -0
  23. package/Cameras/camera.js.map +1 -1
  24. package/Compute/computeShader.d.ts +15 -0
  25. package/Compute/computeShader.js +39 -0
  26. package/Compute/computeShader.js.map +1 -1
  27. package/Debug/physicsViewer.d.ts +33 -0
  28. package/Debug/physicsViewer.js +205 -0
  29. package/Debug/physicsViewer.js.map +1 -1
  30. package/Engines/Extensions/engine.computeShader.d.ts +2 -1
  31. package/Engines/Extensions/engine.computeShader.js +1 -0
  32. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  33. package/Engines/WebGPU/webgpuComputeContext.js +15 -0
  34. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  35. package/Engines/thinEngine.js +2 -2
  36. package/Engines/thinEngine.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/flowGraphAddBlock.d.ts +23 -0
  38. package/FlowGraph/Blocks/Data/flowGraphAddBlock.js +18 -0
  39. package/FlowGraph/Blocks/Data/flowGraphAddBlock.js.map +1 -0
  40. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +30 -0
  41. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +22 -0
  42. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -0
  43. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +33 -0
  44. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +30 -0
  45. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -0
  46. package/FlowGraph/Blocks/Data/index.d.ts +3 -1
  47. package/FlowGraph/Blocks/Data/index.js +3 -1
  48. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  49. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +12 -10
  50. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +25 -29
  51. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  52. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +25 -0
  53. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +31 -0
  54. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -0
  55. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +3 -7
  56. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +11 -11
  57. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  58. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  59. package/FlowGraph/Blocks/Event/index.js +1 -0
  60. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  61. package/FlowGraph/Blocks/Execution/flowGraphConditionalBlock.d.ts +24 -0
  62. package/FlowGraph/Blocks/Execution/flowGraphConditionalBlock.js +23 -0
  63. package/FlowGraph/Blocks/Execution/flowGraphConditionalBlock.js.map +1 -0
  64. package/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.d.ts +10 -13
  65. package/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.js +28 -22
  66. package/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.js.map +1 -1
  67. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.d.ts +5 -5
  68. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +8 -6
  69. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Execution/flowGraphPlayAnimationBlock.d.ts +56 -0
  71. package/FlowGraph/Blocks/Execution/flowGraphPlayAnimationBlock.js +66 -0
  72. package/FlowGraph/Blocks/Execution/flowGraphPlayAnimationBlock.js.map +1 -0
  73. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +18 -0
  74. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +19 -0
  75. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -0
  76. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +26 -0
  77. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +36 -0
  78. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -0
  79. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +23 -0
  80. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +25 -0
  81. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -0
  82. package/FlowGraph/Blocks/Execution/flowGraphStopAnimationBlock.d.ts +16 -0
  83. package/FlowGraph/Blocks/Execution/flowGraphStopAnimationBlock.js +18 -0
  84. package/FlowGraph/Blocks/Execution/flowGraphStopAnimationBlock.js.map +1 -0
  85. package/FlowGraph/Blocks/Execution/flowGraphTimerBlock.d.ts +32 -0
  86. package/FlowGraph/Blocks/Execution/flowGraphTimerBlock.js +62 -0
  87. package/FlowGraph/Blocks/Execution/flowGraphTimerBlock.js.map +1 -0
  88. package/FlowGraph/Blocks/Execution/index.d.ts +7 -0
  89. package/FlowGraph/Blocks/Execution/index.js +7 -0
  90. package/FlowGraph/Blocks/Execution/index.js.map +1 -1
  91. package/FlowGraph/flowGraph.d.ts +42 -12
  92. package/FlowGraph/flowGraph.js +37 -23
  93. package/FlowGraph/flowGraph.js.map +1 -1
  94. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +29 -0
  95. package/FlowGraph/flowGraphAsyncExecutionBlock.js +21 -0
  96. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -0
  97. package/FlowGraph/flowGraphBlock.d.ts +9 -11
  98. package/FlowGraph/flowGraphBlock.js +12 -8
  99. package/FlowGraph/flowGraphBlock.js.map +1 -1
  100. package/FlowGraph/flowGraphConnection.d.ts +17 -7
  101. package/FlowGraph/flowGraphConnection.js +26 -9
  102. package/FlowGraph/flowGraphConnection.js.map +1 -1
  103. package/FlowGraph/flowGraphContext.d.ts +102 -0
  104. package/FlowGraph/flowGraphContext.js +111 -0
  105. package/FlowGraph/flowGraphContext.js.map +1 -0
  106. package/FlowGraph/flowGraphCustomEvent.d.ts +5 -0
  107. package/FlowGraph/flowGraphCustomEvent.js +2 -0
  108. package/FlowGraph/flowGraphCustomEvent.js.map +1 -0
  109. package/FlowGraph/flowGraphDataConnection.d.ts +10 -2
  110. package/FlowGraph/flowGraphDataConnection.js +16 -8
  111. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  112. package/FlowGraph/flowGraphEventBlock.d.ts +5 -12
  113. package/FlowGraph/flowGraphEventBlock.js +5 -5
  114. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  115. package/FlowGraph/flowGraphEventCoordinator.d.ts +23 -0
  116. package/FlowGraph/flowGraphEventCoordinator.js +37 -0
  117. package/FlowGraph/flowGraphEventCoordinator.js.map +1 -0
  118. package/FlowGraph/flowGraphExecutionBlock.d.ts +5 -5
  119. package/FlowGraph/flowGraphExecutionBlock.js +3 -3
  120. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  121. package/FlowGraph/flowGraphRichTypes.d.ts +28 -0
  122. package/FlowGraph/flowGraphRichTypes.js +43 -0
  123. package/FlowGraph/flowGraphRichTypes.js.map +1 -0
  124. package/FlowGraph/flowGraphSignalConnection.d.ts +7 -1
  125. package/FlowGraph/flowGraphSignalConnection.js +11 -4
  126. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  127. package/FlowGraph/flowGraphVariableDefinitions.d.ts +12 -0
  128. package/FlowGraph/flowGraphVariableDefinitions.js +22 -0
  129. package/FlowGraph/flowGraphVariableDefinitions.js.map +1 -0
  130. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +10 -2
  131. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +8 -2
  132. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
  133. package/FlowGraph/index.d.ts +3 -0
  134. package/FlowGraph/index.js +3 -0
  135. package/FlowGraph/index.js.map +1 -1
  136. package/Materials/Node/nodeMaterial.d.ts +2 -1
  137. package/Materials/Node/nodeMaterial.js +26 -2
  138. package/Materials/Node/nodeMaterial.js.map +1 -1
  139. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
  140. package/Materials/PBR/pbrBaseMaterial.js +1 -0
  141. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  142. package/Materials/Textures/videoTexture.d.ts +5 -0
  143. package/Materials/Textures/videoTexture.js +6 -0
  144. package/Materials/Textures/videoTexture.js.map +1 -1
  145. package/Materials/materialHelper.js +1 -0
  146. package/Materials/materialHelper.js.map +1 -1
  147. package/Materials/standardMaterial.d.ts +1 -0
  148. package/Materials/standardMaterial.js +1 -0
  149. package/Materials/standardMaterial.js.map +1 -1
  150. package/Materials/uniformBuffer.d.ts +7 -0
  151. package/Materials/uniformBuffer.js +8 -0
  152. package/Materials/uniformBuffer.js.map +1 -1
  153. package/Maths/math.vector.d.ts +5 -0
  154. package/Maths/math.vector.js +7 -0
  155. package/Maths/math.vector.js.map +1 -1
  156. package/Meshes/Node/Blocks/Instances/instantiateBlock.d.ts +11 -5
  157. package/Meshes/Node/Blocks/Instances/instantiateBlock.js +20 -10
  158. package/Meshes/Node/Blocks/Instances/instantiateBlock.js.map +1 -1
  159. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +15 -9
  160. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +20 -11
  161. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  162. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +15 -9
  163. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +20 -11
  164. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  165. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +15 -9
  166. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +20 -11
  167. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  168. package/Meshes/Node/Blocks/Set/setColorsBlock.d.ts +12 -0
  169. package/Meshes/Node/Blocks/Set/setColorsBlock.js +62 -27
  170. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  171. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.d.ts +7 -0
  172. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +19 -0
  173. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  174. package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +12 -0
  175. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +62 -27
  176. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  177. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +12 -0
  178. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +54 -19
  179. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  180. package/Meshes/Node/Blocks/Set/setTangentsBlock.d.ts +12 -0
  181. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +62 -27
  182. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  183. package/Meshes/Node/Blocks/Set/setUVsBlock.d.ts +5 -0
  184. package/Meshes/Node/Blocks/Set/setUVsBlock.js +65 -46
  185. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  186. package/Meshes/Node/Blocks/debugBlock.js +5 -1
  187. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  188. package/Meshes/Node/Blocks/geometryInputBlock.js +1 -0
  189. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  190. package/Meshes/Node/Blocks/intFloatConverterBlock.js +2 -2
  191. package/Meshes/Node/Blocks/intFloatConverterBlock.js.map +1 -1
  192. package/Meshes/Node/Blocks/mapRangeBlock.js +8 -1
  193. package/Meshes/Node/Blocks/mapRangeBlock.js.map +1 -1
  194. package/Meshes/Node/Blocks/mathBlock.js +1 -0
  195. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  196. package/Meshes/Node/Blocks/matrixComposeBlock.d.ts +30 -0
  197. package/Meshes/Node/Blocks/matrixComposeBlock.js +55 -0
  198. package/Meshes/Node/Blocks/matrixComposeBlock.js.map +1 -0
  199. package/Meshes/Node/Enums/nodeGeometryContextualSources.d.ts +3 -1
  200. package/Meshes/Node/Enums/nodeGeometryContextualSources.js +2 -0
  201. package/Meshes/Node/Enums/nodeGeometryContextualSources.js.map +1 -1
  202. package/Meshes/Node/Interfaces/nodeGeometryInstancingContext.d.ts +10 -0
  203. package/Meshes/Node/Interfaces/nodeGeometryInstancingContext.js +2 -0
  204. package/Meshes/Node/Interfaces/nodeGeometryInstancingContext.js.map +1 -0
  205. package/Meshes/Node/index.d.ts +1 -0
  206. package/Meshes/Node/index.js +1 -0
  207. package/Meshes/Node/index.js.map +1 -1
  208. package/Meshes/Node/nodeGeometry.js +2 -2
  209. package/Meshes/Node/nodeGeometry.js.map +1 -1
  210. package/Meshes/Node/nodeGeometryBuildState.d.ts +5 -0
  211. package/Meshes/Node/nodeGeometryBuildState.js +20 -0
  212. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  213. package/Meshes/abstractMesh.js +4 -1
  214. package/Meshes/abstractMesh.js.map +1 -1
  215. package/Meshes/geometry.js +10 -10
  216. package/Meshes/geometry.js.map +1 -1
  217. package/Meshes/mesh.js +7 -5
  218. package/Meshes/mesh.js.map +1 -1
  219. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +2 -1
  220. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
  221. package/Misc/dumpTools.js +3 -2
  222. package/Misc/dumpTools.js.map +1 -1
  223. package/Misc/equirectangularCapture.d.ts +39 -0
  224. package/Misc/equirectangularCapture.js +56 -0
  225. package/Misc/equirectangularCapture.js.map +1 -0
  226. package/Misc/index.d.ts +1 -0
  227. package/Misc/index.js +1 -0
  228. package/Misc/index.js.map +1 -1
  229. package/Particles/solidParticleSystem.d.ts +4 -0
  230. package/Particles/solidParticleSystem.js +16 -1
  231. package/Particles/solidParticleSystem.js.map +1 -1
  232. package/Physics/v2/IPhysicsEnginePlugin.d.ts +10 -0
  233. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  234. package/Physics/v2/Plugins/havokPlugin.d.ts +8 -1
  235. package/Physics/v2/Plugins/havokPlugin.js +34 -0
  236. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  237. package/Physics/v2/physicsConstraint.d.ts +11 -1
  238. package/Physics/v2/physicsConstraint.js +7 -0
  239. package/Physics/v2/physicsConstraint.js.map +1 -1
  240. package/Rendering/prePassRenderer.d.ts +6 -0
  241. package/Rendering/prePassRenderer.js +14 -0
  242. package/Rendering/prePassRenderer.js.map +1 -1
  243. package/Shaders/default.fragment.js +4 -0
  244. package/Shaders/default.fragment.js.map +1 -1
  245. package/Shaders/equirectangularPanorama.fragment.d.ts +5 -0
  246. package/Shaders/equirectangularPanorama.fragment.js +17 -0
  247. package/Shaders/equirectangularPanorama.fragment.js.map +1 -0
  248. package/Shaders/pbr.fragment.js +4 -0
  249. package/Shaders/pbr.fragment.js.map +1 -1
  250. package/package.json +1 -1
  251. package/FlowGraph/Blocks/Data/flowGraphBinaryOpBlocks.d.ts +0 -34
  252. package/FlowGraph/Blocks/Data/flowGraphBinaryOpBlocks.js +0 -29
  253. package/FlowGraph/Blocks/Data/flowGraphBinaryOpBlocks.js.map +0 -1
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @experimental
3
+ * The context represents the current state and execution of the flow graph.
4
+ * It contains both user-defined variables, which are derived from
5
+ * a more general variable definition, and execution variables that
6
+ * are set by the blocks.
7
+ */
8
+ export class FlowGraphContext {
9
+ constructor(params) {
10
+ /**
11
+ * These are the variables defined by a user.
12
+ */
13
+ this._userVariables = new Map();
14
+ /**
15
+ * These are the variables set by the blocks.
16
+ */
17
+ this._executionVariables = new Map();
18
+ /**
19
+ * These are blocks that have currently pending tasks/listeners that need to be cleaned up.
20
+ */
21
+ this._pendingBlocks = [];
22
+ this._graphVariables = params;
23
+ }
24
+ /**
25
+ * Check if a user-defined variable is defined.
26
+ * @param name
27
+ * @returns
28
+ */
29
+ hasVariable(name) {
30
+ return this._userVariables.has(name);
31
+ }
32
+ /**
33
+ * Set a user-defined variable.
34
+ * @param name
35
+ * @param value
36
+ */
37
+ setVariable(name, value) {
38
+ this._userVariables.set(name, value);
39
+ }
40
+ /**
41
+ * Get a user-defined variable.
42
+ * @param name
43
+ * @returns
44
+ */
45
+ getVariable(name) {
46
+ return this._userVariables.get(name);
47
+ }
48
+ _getBlockPrefixedName(block, name) {
49
+ return `${block.uniqueId}_${name}`;
50
+ }
51
+ /**
52
+ * Set an internal execution variable
53
+ * @internal
54
+ * @param name
55
+ * @param value
56
+ */
57
+ _setExecutionVariable(block, name, value) {
58
+ this._executionVariables.set(this._getBlockPrefixedName(block, name), value);
59
+ }
60
+ /**
61
+ * Get an internal execution variable
62
+ * @internal
63
+ * @param name
64
+ * @returns
65
+ */
66
+ _getExecutionVariable(block, name) {
67
+ return this._executionVariables.get(this._getBlockPrefixedName(block, name));
68
+ }
69
+ _deleteExecutionVariable(block, name) {
70
+ this._executionVariables.delete(this._getBlockPrefixedName(block, name));
71
+ }
72
+ /**
73
+ * Get the graph set variables
74
+ * @internal
75
+ * @param name
76
+ * @param value
77
+ */
78
+ get graphVariables() {
79
+ return this._graphVariables;
80
+ }
81
+ /**
82
+ * Add a block to the list of blocks that have pending tasks.
83
+ * @internal
84
+ * @param block
85
+ */
86
+ _addPendingBlock(block) {
87
+ this._pendingBlocks.push(block);
88
+ }
89
+ /**
90
+ * Remove a block from the list of blocks that have pending tasks.
91
+ * @internal
92
+ * @param block
93
+ */
94
+ _removePendingBlock(block) {
95
+ const index = this._pendingBlocks.indexOf(block);
96
+ if (index !== -1) {
97
+ this._pendingBlocks.splice(index, 1);
98
+ }
99
+ }
100
+ /**
101
+ * Clear all pending blocks.
102
+ * @internal
103
+ */
104
+ _clearPendingBlocks() {
105
+ for (const block of this._pendingBlocks) {
106
+ block._cancelPendingTasks(this);
107
+ }
108
+ this._pendingBlocks.length = 0;
109
+ }
110
+ }
111
+ //# sourceMappingURL=flowGraphContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAkBzB,YAAY,MAAgC;QAjB5C;;WAEG;QACK,mBAAc,GAAqB,IAAI,GAAG,EAAE,CAAC;QACrD;;WAEG;QACK,wBAAmB,GAAqB,IAAI,GAAG,EAAE,CAAC;QAK1D;;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,qBAAqB,CAAC,KAAqB,EAAE,IAAY;QAC7D,OAAO,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,KAAqB,EAAE,IAAY,EAAE,KAAU;QACxE,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACjF,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,KAAqB,EAAE,IAAY;QAC5D,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACjF,CAAC;IAEM,wBAAwB,CAAC,KAAqB,EAAE,IAAY;QAC/D,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;OAKG;IACH,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 { 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 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 _getBlockPrefixedName(block: FlowGraphBlock, name: string): string {\r\n return `${block.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._getBlockPrefixedName(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): any {\r\n return this._executionVariables.get(this._getBlockPrefixedName(block, name));\r\n }\r\n\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n this._executionVariables.delete(this._getBlockPrefixedName(block, name));\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"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @experimental
3
+ * Represents a custom event
4
+ */
5
+ export type FlowGraphCustomEvent = any;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=flowGraphCustomEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphCustomEvent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCustomEvent.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * @experimental\r\n * Represents a custom event\r\n */\r\nexport type FlowGraphCustomEvent = any;\r\n"]}
@@ -1,5 +1,7 @@
1
1
  import type { FlowGraphBlock } from "./flowGraphBlock";
2
2
  import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnection";
3
+ import type { FlowGraphContext } from "./flowGraphContext";
4
+ import type { RichType } from "./flowGraphRichTypes";
3
5
  /**
4
6
  * @experimental
5
7
  * Represents a connection point for data.
@@ -8,8 +10,14 @@ import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnect
8
10
  * if the point belongs to a "function" node, the node will run its function to update the value.
9
11
  */
10
12
  export declare class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {
13
+ private _valueType;
11
14
  private _value;
12
- constructor(name: string, type: FlowGraphConnectionType, ownerBlock: FlowGraphBlock, _value: T);
15
+ constructor(name: string, connectionType: FlowGraphConnectionType, ownerBlock: FlowGraphBlock, _valueType: RichType<T>);
16
+ /**
17
+ * An output data block can connect to multiple input data blocks,
18
+ * but an input data block can only connect to one output data block.
19
+ */
20
+ _isSingularConnection(): boolean;
13
21
  set value(value: T);
14
- get value(): T;
22
+ getValue(context: FlowGraphContext): T;
15
23
  }
@@ -7,23 +7,31 @@ import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnect
7
7
  * if the point belongs to a "function" node, the node will run its function to update the value.
8
8
  */
9
9
  export class FlowGraphDataConnection extends FlowGraphConnection {
10
- constructor(name, type, ownerBlock, _value) {
11
- super(name, type, ownerBlock);
12
- this._value = _value;
10
+ constructor(name, connectionType, ownerBlock, _valueType) {
11
+ super(name, connectionType, ownerBlock);
12
+ this._valueType = _valueType;
13
+ this._value = this._valueType.defaultValueBuilder();
14
+ }
15
+ /**
16
+ * An output data block can connect to multiple input data blocks,
17
+ * but an input data block can only connect to one output data block.
18
+ */
19
+ _isSingularConnection() {
20
+ return this.connectionType === FlowGraphConnectionType.Input;
13
21
  }
14
22
  set value(value) {
15
23
  this._value = value;
16
24
  }
17
- get value() {
18
- if (this.type === FlowGraphConnectionType.Output) {
19
- this._ownerBlock._updateOutputs();
25
+ getValue(context) {
26
+ if (this.connectionType === FlowGraphConnectionType.Output) {
27
+ this._ownerBlock._updateOutputs(context);
20
28
  return this._value;
21
29
  }
22
- if (!this._connectedPoint) {
30
+ if (!this.isConnected()) {
23
31
  return this._value;
24
32
  }
25
33
  else {
26
- return this._connectedPoint.value;
34
+ return this._connectedPoint[0].getValue(context);
27
35
  }
28
36
  }
29
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAC3G,YAAmB,IAAY,EAAE,IAA6B,EAAE,UAA0B,EAAU,MAAS;QACzG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QADkE,WAAM,GAAN,MAAM,CAAG;IAE7G,CAAC;IAED,IAAW,KAAK,CAAC,KAAQ;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,IAAW,KAAK;QACZ,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAuB,CAAC,MAAM,EAAE;YAC9C,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;QAED,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;aAAM;YACH,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;SACrC;IACL,CAAC;CACJ","sourcesContent":["import type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\n\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 public constructor(name: string, type: FlowGraphConnectionType, ownerBlock: FlowGraphBlock, private _value: T) {\r\n super(name, type, ownerBlock);\r\n }\r\n\r\n public set value(value: T) {\r\n this._value = value;\r\n }\r\n\r\n public get value(): T {\r\n if (this.type === FlowGraphConnectionType.Output) {\r\n this._ownerBlock._updateOutputs();\r\n return this._value;\r\n }\r\n\r\n if (!this._connectedPoint) {\r\n return this._value;\r\n } else {\r\n return this._connectedPoint.value;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAIrF;;;;;;GAMG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAG3G,YAAmB,IAAY,EAAE,cAAuC,EAAE,UAA0B,EAAU,UAAuB;QACjI,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QADkE,eAAU,GAAV,UAAU,CAAa;QAEjI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,KAAK,CAAC;IACjE,CAAC;IAED,IAAW,KAAK,CAAC,KAAQ;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,IAAI,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,MAAM,EAAE;YACxD,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YACrB,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;aAAM;YACH,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SACpD;IACL,CAAC;CACJ","sourcesContent":["import type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\n\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 private _value: T;\r\n\r\n public constructor(name: string, connectionType: FlowGraphConnectionType, ownerBlock: FlowGraphBlock, private _valueType: RichType<T>) {\r\n super(name, connectionType, ownerBlock);\r\n this._value = this._valueType.defaultValueBuilder();\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 */\r\n public _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n public set value(value: T) {\r\n this._value = value;\r\n }\r\n\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n this._ownerBlock._updateOutputs(context);\r\n return this._value;\r\n }\r\n\r\n if (!this.isConnected()) {\r\n return this._value;\r\n } else {\r\n return this._connectedPoint[0].getValue(context);\r\n }\r\n }\r\n}\r\n"]}
@@ -1,20 +1,13 @@
1
- import { FlowGraphWithOnDoneExecutionBlock } from "./flowGraphWithOnDoneExecutionBlock";
1
+ import { FlowGraphAsyncExecutionBlock } from "./flowGraphAsyncExecutionBlock";
2
+ import type { FlowGraphContext } from "./flowGraphContext";
2
3
  /**
3
4
  * @experimental
4
5
  * A type of block that listens to an event observable and activates
5
- * its output signal ("onTriggered"), when the event is triggered.
6
+ * its output signal when the event is triggered.
6
7
  */
7
- export declare abstract class FlowGraphEventBlock extends FlowGraphWithOnDoneExecutionBlock {
8
+ export declare abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {
8
9
  /**
9
10
  * @internal
10
11
  */
11
- abstract _startListening(): void;
12
- /**
13
- * @internal
14
- */
15
- abstract _stopListening(): void;
16
- /**
17
- * @internal
18
- */
19
- _execute(): void;
12
+ _execute(context: FlowGraphContext): void;
20
13
  }
@@ -1,15 +1,15 @@
1
- import { FlowGraphWithOnDoneExecutionBlock } from "./flowGraphWithOnDoneExecutionBlock.js";
1
+ import { FlowGraphAsyncExecutionBlock } from "./flowGraphAsyncExecutionBlock.js";
2
2
  /**
3
3
  * @experimental
4
4
  * A type of block that listens to an event observable and activates
5
- * its output signal ("onTriggered"), when the event is triggered.
5
+ * its output signal when the event is triggered.
6
6
  */
7
- export class FlowGraphEventBlock extends FlowGraphWithOnDoneExecutionBlock {
7
+ export class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {
8
8
  /**
9
9
  * @internal
10
10
  */
11
- _execute() {
12
- this.onDone._activateSignal();
11
+ _execute(context) {
12
+ this.onDone._activateSignal(context);
13
13
  }
14
14
  }
15
15
  //# 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,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAExF;;;;GAIG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,iCAAiC;IAU/E;;OAEG;IACI,QAAQ;QACX,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;IAClC,CAAC;CACJ","sourcesContent":["import { FlowGraphWithOnDoneExecutionBlock } from \"./flowGraphWithOnDoneExecutionBlock\";\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 (\"onTriggered\"), when the event is triggered.\r\n */\r\nexport abstract class FlowGraphEventBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * @internal\r\n */\r\n public abstract _startListening(): void;\r\n /**\r\n * @internal\r\n */\r\n public abstract _stopListening(): void;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _execute(): void {\r\n this.onDone._activateSignal();\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;AAG9E;;;;GAIG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAC1E;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,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 this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,23 @@
1
+ import { Observable } from "../Misc/observable";
2
+ import type { FlowGraphCustomEvent } from "./flowGraphCustomEvent";
3
+ /**
4
+ * This class centralizes the handling of events in the flow graph.
5
+ * If a block fires an event, it will be handled by this class.
6
+ * It will also notify any blocks that are listening to that event.
7
+ * @experimental
8
+ */
9
+ export declare class FlowGraphEventCoordinator {
10
+ private _customEventsMap;
11
+ /**
12
+ * Get an observable that will be notified when the event with the given id is fired.
13
+ * @param id the id of the event
14
+ * @returns the observable for the event
15
+ */
16
+ getCustomEventObservable(id: string): Observable<FlowGraphCustomEvent>;
17
+ /**
18
+ * Notifies the observable for the given event id with the given data.
19
+ * @param id the id of the event
20
+ * @param data the data to send with the event
21
+ */
22
+ notifyCustomEvent(id: string, data: any): void;
23
+ }
@@ -0,0 +1,37 @@
1
+ import { Observable } from "../Misc/observable.js";
2
+ /**
3
+ * This class centralizes the handling of events in the flow graph.
4
+ * If a block fires an event, it will be handled by this class.
5
+ * It will also notify any blocks that are listening to that event.
6
+ * @experimental
7
+ */
8
+ export class FlowGraphEventCoordinator {
9
+ constructor() {
10
+ this._customEventsMap = new Map();
11
+ }
12
+ /**
13
+ * Get an observable that will be notified when the event with the given id is fired.
14
+ * @param id the id of the event
15
+ * @returns the observable for the event
16
+ */
17
+ getCustomEventObservable(id) {
18
+ let observable = this._customEventsMap.get(id);
19
+ if (!observable) {
20
+ observable = new Observable();
21
+ this._customEventsMap.set(id, observable);
22
+ }
23
+ return observable;
24
+ }
25
+ /**
26
+ * Notifies the observable for the given event id with the given data.
27
+ * @param id the id of the event
28
+ * @param data the data to send with the event
29
+ */
30
+ notifyCustomEvent(id, data) {
31
+ const observable = this._customEventsMap.get(id);
32
+ if (observable) {
33
+ observable.notifyObservers(data);
34
+ }
35
+ }
36
+ }
37
+ //# sourceMappingURL=flowGraphEventCoordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphEventCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IAAtC;QACY,qBAAgB,GAAkD,IAAI,GAAG,EAAE,CAAC;IA2BxF,CAAC;IAzBG;;;;OAIG;IACH,wBAAwB,CAAC,EAAU;QAC/B,IAAI,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,EAAE;YACb,UAAU,GAAG,IAAI,UAAU,EAAwB,CAAC;YACpD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;SAC7C;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,EAAU,EAAE,IAAS;QACnC,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE;YACZ,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACpC;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { FlowGraphCustomEvent } from \"./flowGraphCustomEvent\";\r\n\r\n/**\r\n * This class centralizes the handling of events in the flow graph.\r\n * If a block fires an event, it will be handled by this class.\r\n * It will also notify any blocks that are listening to that event.\r\n * @experimental\r\n */\r\nexport class FlowGraphEventCoordinator {\r\n private _customEventsMap: Map<string, Observable<FlowGraphCustomEvent>> = new Map();\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 getCustomEventObservable(id: string): Observable<FlowGraphCustomEvent> {\r\n let observable = this._customEventsMap.get(id);\r\n if (!observable) {\r\n observable = new Observable<FlowGraphCustomEvent>();\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 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,24 +1,24 @@
1
- import type { FlowGraph } from "./flowGraph";
2
1
  import { FlowGraphBlock } from "./flowGraphBlock";
2
+ import type { FlowGraphContext } from "./flowGraphContext";
3
3
  import { FlowGraphSignalConnection } from "./flowGraphSignalConnection";
4
4
  /**
5
5
  * @experimental
6
- * A block that executes some action. Always has an input signal.
6
+ * A block that executes some action. Always has an input signal (which is not used by event blocks).
7
7
  * Can have one or more output signals.
8
8
  */
9
9
  export declare abstract class FlowGraphExecutionBlock extends FlowGraphBlock {
10
10
  /**
11
- * The input signal of the block.
11
+ * Input connection: The input signal of the block.
12
12
  */
13
13
  readonly onStart: FlowGraphSignalConnection;
14
14
  private readonly _signalInputs;
15
15
  private readonly _signalOutputs;
16
- protected constructor(graph: FlowGraph);
16
+ protected constructor();
17
17
  /**
18
18
  * @internal
19
19
  * Executes the flow graph execution block.
20
20
  */
21
- abstract _execute(): void;
21
+ abstract _execute(context: FlowGraphContext): void;
22
22
  protected _registerSignalInput(name: string): FlowGraphSignalConnection;
23
23
  protected _registerSignalOutput(name: string): FlowGraphSignalConnection;
24
24
  }
@@ -3,12 +3,12 @@ import { FlowGraphConnectionType } from "./flowGraphConnection.js";
3
3
  import { FlowGraphSignalConnection } from "./flowGraphSignalConnection.js";
4
4
  /**
5
5
  * @experimental
6
- * A block that executes some action. Always has an input signal.
6
+ * A block that executes some action. Always has an input signal (which is not used by event blocks).
7
7
  * Can have one or more output signals.
8
8
  */
9
9
  export class FlowGraphExecutionBlock extends FlowGraphBlock {
10
- constructor(graph) {
11
- super(graph);
10
+ constructor() {
11
+ super();
12
12
  this._signalInputs = [];
13
13
  this._signalOutputs = [];
14
14
  this.onStart = this._registerSignalInput("onStart");
@@ -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;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;GAIG;AACH,MAAM,OAAgB,uBAAwB,SAAQ,cAAc;IAShE,YAAsB,KAAgB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QAJA,kBAAa,GAAgC,EAAE,CAAC;QAChD,mBAAc,GAAgC,EAAE,CAAC;QAK9D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;IAOS,oBAAoB,CAAC,IAAY;QACvC,MAAM,KAAK,GAAG,IAAI,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,qBAAqB,CAAC,IAAY;QACxC,MAAM,MAAM,GAAG,IAAI,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACzF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import type { FlowGraph } from \"./flowGraph\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnectionType } from \"./flowGraphConnection\";\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.\r\n * Can have one or more output signals.\r\n */\r\nexport abstract class FlowGraphExecutionBlock extends FlowGraphBlock {\r\n /**\r\n * The input signal of the block.\r\n */\r\n public readonly onStart: FlowGraphSignalConnection;\r\n\r\n private readonly _signalInputs: FlowGraphSignalConnection[] = [];\r\n private readonly _signalOutputs: FlowGraphSignalConnection[] = [];\r\n\r\n protected constructor(graph: FlowGraph) {\r\n super(graph);\r\n\r\n this.onStart = this._registerSignalInput(\"onStart\");\r\n }\r\n /**\r\n * @internal\r\n * Executes the flow graph execution block.\r\n */\r\n public abstract _execute(): 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"]}
1
+ {"version":3,"file":"flowGraphExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphExecutionBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;GAIG;AACH,MAAM,OAAgB,uBAAwB,SAAQ,cAAc;IAShE;QACI,KAAK,EAAE,CAAC;QAJK,kBAAa,GAAgC,EAAE,CAAC;QAChD,mBAAc,GAAgC,EAAE,CAAC;QAI9D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;IAOS,oBAAoB,CAAC,IAAY;QACvC,MAAM,KAAK,GAAG,IAAI,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,qBAAqB,CAAC,IAAY;QACxC,MAAM,MAAM,GAAG,IAAI,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACzF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import { 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 onStart: FlowGraphSignalConnection;\r\n\r\n private readonly _signalInputs: FlowGraphSignalConnection[] = [];\r\n private readonly _signalOutputs: FlowGraphSignalConnection[] = [];\r\n\r\n protected constructor() {\r\n super();\r\n this.onStart = this._registerSignalInput(\"onStart\");\r\n }\r\n /**\r\n * @internal\r\n * Executes the flow graph execution block.\r\n */\r\n public abstract _execute(context: FlowGraphContext): 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"]}
@@ -0,0 +1,28 @@
1
+ import { Vector2, Vector3, Vector4, Matrix } from "../Maths/math.vector";
2
+ import { Color3, Color4 } from "../Maths/math.color";
3
+ /**
4
+ * A rich type represents extra information about a type,
5
+ * such as its name and a default value constructor.
6
+ * @experimental
7
+ */
8
+ export interface RichType<T> {
9
+ /**
10
+ * Name of the type
11
+ */
12
+ typeName: string;
13
+ /**
14
+ * Constructor for the default value
15
+ * @returns the default value
16
+ */
17
+ defaultValueBuilder: () => T;
18
+ }
19
+ export declare const RichTypeAny: RichType<any>;
20
+ export declare const RichTypeString: RichType<string>;
21
+ export declare const RichTypeNumber: RichType<number>;
22
+ export declare const RichTypeBoolean: RichType<boolean>;
23
+ export declare const RichTypeVector2: RichType<Vector2>;
24
+ export declare const RichTypeVector3: RichType<Vector3>;
25
+ export declare const RichTypeVector4: RichType<Vector4>;
26
+ export declare const RichTypeMatrix: RichType<Matrix>;
27
+ export declare const RichTypeColor3: RichType<Color3>;
28
+ export declare const RichTypeColor4: RichType<Color4>;
@@ -0,0 +1,43 @@
1
+ import { Vector2, Vector3, Vector4, Matrix } from "../Maths/math.vector.js";
2
+ import { Color3, Color4 } from "../Maths/math.color.js";
3
+ export const RichTypeAny = {
4
+ typeName: "any",
5
+ defaultValueBuilder: () => undefined,
6
+ };
7
+ export const RichTypeString = {
8
+ typeName: "string",
9
+ defaultValueBuilder: () => "",
10
+ };
11
+ export const RichTypeNumber = {
12
+ typeName: "number",
13
+ defaultValueBuilder: () => 0,
14
+ };
15
+ export const RichTypeBoolean = {
16
+ typeName: "boolean",
17
+ defaultValueBuilder: () => false,
18
+ };
19
+ export const RichTypeVector2 = {
20
+ typeName: "Vector2",
21
+ defaultValueBuilder: () => Vector2.Zero(),
22
+ };
23
+ export const RichTypeVector3 = {
24
+ typeName: "Vector3",
25
+ defaultValueBuilder: () => Vector3.Zero(),
26
+ };
27
+ export const RichTypeVector4 = {
28
+ typeName: "Vector4",
29
+ defaultValueBuilder: () => Vector4.Zero(),
30
+ };
31
+ export const RichTypeMatrix = {
32
+ typeName: "Matrix",
33
+ defaultValueBuilder: () => Matrix.Identity(),
34
+ };
35
+ export const RichTypeColor3 = {
36
+ typeName: "Color3",
37
+ defaultValueBuilder: () => Color3.Black(),
38
+ };
39
+ export const RichTypeColor4 = {
40
+ typeName: "Color4",
41
+ defaultValueBuilder: () => new Color4(0, 0, 0, 0),
42
+ };
43
+ //# sourceMappingURL=flowGraphRichTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphRichTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphRichTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAmBrD,MAAM,CAAC,MAAM,WAAW,GAAkB;IACtC,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,GAAG,EAAE,CAAC,SAAS;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAqB;IAC5C,QAAQ,EAAE,QAAQ;IAClB,mBAAmB,EAAE,GAAG,EAAE,CAAC,EAAE;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAqB;IAC5C,QAAQ,EAAE,QAAQ;IAClB,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAsB;IAC9C,QAAQ,EAAE,SAAS;IACnB,mBAAmB,EAAE,GAAG,EAAE,CAAC,KAAK;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAsB;IAC9C,QAAQ,EAAE,SAAS;IACnB,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAsB;IAC9C,QAAQ,EAAE,SAAS;IACnB,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAsB;IAC9C,QAAQ,EAAE,SAAS;IACnB,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAqB;IAC5C,QAAQ,EAAE,QAAQ;IAClB,mBAAmB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAqB;IAC5C,QAAQ,EAAE,QAAQ;IAClB,mBAAmB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAqB;IAC5C,QAAQ,EAAE,QAAQ;IAClB,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CACpD,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4, Matrix } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\n\r\n/**\r\n * A rich type represents extra information about a type,\r\n * such as its name and a default value constructor.\r\n * @experimental\r\n */\r\nexport interface RichType<T> {\r\n /**\r\n * Name of the type\r\n */\r\n typeName: string;\r\n /**\r\n * Constructor for the default value\r\n * @returns the default value\r\n */\r\n defaultValueBuilder: () => T;\r\n}\r\n\r\nexport const RichTypeAny: RichType<any> = {\r\n typeName: \"any\",\r\n defaultValueBuilder: () => undefined,\r\n};\r\n\r\nexport const RichTypeString: RichType<string> = {\r\n typeName: \"string\",\r\n defaultValueBuilder: () => \"\",\r\n};\r\n\r\nexport const RichTypeNumber: RichType<number> = {\r\n typeName: \"number\",\r\n defaultValueBuilder: () => 0,\r\n};\r\n\r\nexport const RichTypeBoolean: RichType<boolean> = {\r\n typeName: \"boolean\",\r\n defaultValueBuilder: () => false,\r\n};\r\n\r\nexport const RichTypeVector2: RichType<Vector2> = {\r\n typeName: \"Vector2\",\r\n defaultValueBuilder: () => Vector2.Zero(),\r\n};\r\n\r\nexport const RichTypeVector3: RichType<Vector3> = {\r\n typeName: \"Vector3\",\r\n defaultValueBuilder: () => Vector3.Zero(),\r\n};\r\n\r\nexport const RichTypeVector4: RichType<Vector4> = {\r\n typeName: \"Vector4\",\r\n defaultValueBuilder: () => Vector4.Zero(),\r\n};\r\n\r\nexport const RichTypeMatrix: RichType<Matrix> = {\r\n typeName: \"Matrix\",\r\n defaultValueBuilder: () => Matrix.Identity(),\r\n};\r\n\r\nexport const RichTypeColor3: RichType<Color3> = {\r\n typeName: \"Color3\",\r\n defaultValueBuilder: () => Color3.Black(),\r\n};\r\n\r\nexport const RichTypeColor4: RichType<Color4> = {\r\n typeName: \"Color4\",\r\n defaultValueBuilder: () => new Color4(0, 0, 0, 0),\r\n};\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock";
2
2
  import { FlowGraphConnection } from "./flowGraphConnection";
3
+ import type { FlowGraphContext } from "./flowGraphContext";
3
4
  /**
4
5
  * @experimental
5
6
  * Represents a connection point for a signal.
@@ -7,8 +8,13 @@ import { FlowGraphConnection } from "./flowGraphConnection";
7
8
  * When an input point is activated, it will execute the block it belongs to.
8
9
  */
9
10
  export declare class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {
11
+ /**
12
+ * A signal input can be connected to more than one signal output,
13
+ * but a signal output can only connect to one signal input
14
+ */
15
+ _isSingularConnection(): boolean;
10
16
  /**
11
17
  * @internal
12
18
  */
13
- _activateSignal(): void;
19
+ _activateSignal(context: FlowGraphContext): void;
14
20
  }
@@ -6,16 +6,23 @@ import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnect
6
6
  * When an input point is activated, it will execute the block it belongs to.
7
7
  */
8
8
  export class FlowGraphSignalConnection extends FlowGraphConnection {
9
+ /**
10
+ * A signal input can be connected to more than one signal output,
11
+ * but a signal output can only connect to one signal input
12
+ */
13
+ _isSingularConnection() {
14
+ return this.connectionType === FlowGraphConnectionType.Output;
15
+ }
9
16
  /**
10
17
  * @internal
11
18
  */
12
- _activateSignal() {
19
+ _activateSignal(context) {
13
20
  var _a;
14
- if (this.type === FlowGraphConnectionType.Input) {
15
- this._ownerBlock._execute();
21
+ if (this.connectionType === FlowGraphConnectionType.Input) {
22
+ this._ownerBlock._execute(context);
16
23
  }
17
24
  else {
18
- (_a = this._connectedPoint) === null || _a === void 0 ? void 0 : _a._activateSignal();
25
+ (_a = this._connectedPoint[0]) === null || _a === void 0 ? void 0 : _a._activateSignal(context);
19
26
  }
20
27
  }
21
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphSignalConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErF;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAuE;IAClH;;OAEG;IACI,eAAe;;QAClB,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAuB,CAAC,KAAK,EAAE;YAC7C,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;SAC/B;aAAM;YACH,MAAA,IAAI,CAAC,eAAe,0CAAE,eAAe,EAAE,CAAC;SAC3C;IACL,CAAC;CACJ","sourcesContent":["import type { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\n\r\n/**\r\n * @experimental\r\n * Represents a connection point for a signal.\r\n * When an output point is activated, it will activate the connected input point.\r\n * When an input point is activated, it will execute the block it belongs to.\r\n */\r\nexport class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {\r\n /**\r\n * @internal\r\n */\r\n public _activateSignal(): void {\r\n if (this.type === FlowGraphConnectionType.Input) {\r\n this._ownerBlock._execute();\r\n } else {\r\n this._connectedPoint?._activateSignal();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphSignalConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGrF;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAuE;IAClH;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,MAAM,CAAC;IAClE,CAAC;IAED;;OAEG;IACI,eAAe,CAAC,OAAyB;;QAC5C,IAAI,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,KAAK,EAAE;YACvD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SACtC;aAAM;YACH,MAAA,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,0CAAE,eAAe,CAAC,OAAO,CAAC,CAAC;SACrD;IACL,CAAC;CACJ","sourcesContent":["import type { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\n\r\n/**\r\n * @experimental\r\n * Represents a connection point for a signal.\r\n * When an output point is activated, it will activate the connected input point.\r\n * When an input point is activated, it will execute the block it belongs to.\r\n */\r\nexport class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {\r\n /**\r\n * A signal input can be connected to more than one signal output,\r\n * but a signal output can only connect to one signal input\r\n */\r\n public _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Output;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _activateSignal(context: FlowGraphContext): void {\r\n if (this.connectionType === FlowGraphConnectionType.Input) {\r\n this._ownerBlock._execute(context);\r\n } else {\r\n this._connectedPoint[0]?._activateSignal(context);\r\n }\r\n }\r\n}\r\n"]}
@@ -0,0 +1,12 @@
1
+ import type { IFlowGraphGraphVariables } from "./flowGraphContext";
2
+ import { FlowGraphContext } from "./flowGraphContext";
3
+ /**
4
+ * @experimental
5
+ * This class represents the definition of a variable, with a name and
6
+ * a default value. It can be used to create a context.
7
+ */
8
+ export declare class FlowGraphVariableDefinitions {
9
+ private _definitions;
10
+ defineVariable(name: string, defaultValue: any): void;
11
+ generateContext(params: IFlowGraphGraphVariables): FlowGraphContext;
12
+ }
@@ -0,0 +1,22 @@
1
+ import { FlowGraphContext } from "./flowGraphContext.js";
2
+ /**
3
+ * @experimental
4
+ * This class represents the definition of a variable, with a name and
5
+ * a default value. It can be used to create a context.
6
+ */
7
+ export class FlowGraphVariableDefinitions {
8
+ constructor() {
9
+ this._definitions = new Map();
10
+ }
11
+ defineVariable(name, defaultValue) {
12
+ this._definitions.set(name, defaultValue);
13
+ }
14
+ generateContext(params) {
15
+ const context = new FlowGraphContext(params);
16
+ this._definitions.forEach((value, key) => {
17
+ context.setVariable(key, value);
18
+ });
19
+ return context;
20
+ }
21
+ }
22
+ //# sourceMappingURL=flowGraphVariableDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphVariableDefinitions.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphVariableDefinitions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;IAAzC;QACY,iBAAY,GAAqB,IAAI,GAAG,EAAe,CAAC;IAapE,CAAC;IAXU,cAAc,CAAC,IAAY,EAAE,YAAiB;QACjD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC9C,CAAC;IAEM,eAAe,CAAC,MAAgC;QACnD,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACrC,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","sourcesContent":["import type { IFlowGraphGraphVariables } from \"./flowGraphContext\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\n\r\n/**\r\n * @experimental\r\n * This class represents the definition of a variable, with a name and\r\n * a default value. It can be used to create a context.\r\n */\r\nexport class FlowGraphVariableDefinitions {\r\n private _definitions: Map<string, any> = new Map<string, any>();\r\n\r\n public defineVariable(name: string, defaultValue: any) {\r\n this._definitions.set(name, defaultValue);\r\n }\r\n\r\n public generateContext(params: IFlowGraphGraphVariables): FlowGraphContext {\r\n const context = new FlowGraphContext(params);\r\n this._definitions.forEach((value, key) => {\r\n context.setVariable(key, value);\r\n });\r\n return context;\r\n }\r\n}\r\n"]}
@@ -1,7 +1,15 @@
1
- import type { FlowGraph } from "./flowGraph";
2
1
  import { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock";
3
2
  import type { FlowGraphSignalConnection } from "./flowGraphSignalConnection";
3
+ /**
4
+ * @experimental
5
+ * An execution block that has an onDone signal. This signal is triggered when the execution of this block is done.
6
+ * Most execution blocks will inherit from this, except for the ones that have multiple signals to be triggered.
7
+ * (such as if blocks)
8
+ */
4
9
  export declare abstract class FlowGraphWithOnDoneExecutionBlock extends FlowGraphExecutionBlock {
10
+ /**
11
+ * Output connection: The signal that is triggered when the execution of this block is done.
12
+ */
5
13
  readonly onDone: FlowGraphSignalConnection;
6
- protected constructor(graph: FlowGraph);
14
+ protected constructor();
7
15
  }
@@ -1,7 +1,13 @@
1
1
  import { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock.js";
2
+ /**
3
+ * @experimental
4
+ * An execution block that has an onDone signal. This signal is triggered when the execution of this block is done.
5
+ * Most execution blocks will inherit from this, except for the ones that have multiple signals to be triggered.
6
+ * (such as if blocks)
7
+ */
2
8
  export class FlowGraphWithOnDoneExecutionBlock extends FlowGraphExecutionBlock {
3
- constructor(graph) {
4
- super(graph);
9
+ constructor() {
10
+ super();
5
11
  this.onDone = this._registerSignalOutput("onDone");
6
12
  }
7
13
  }