@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
@@ -1,40 +1,46 @@
1
1
  import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
2
+ import { RichTypeNumber } from "../../flowGraphRichTypes.js";
2
3
  /**
3
4
  * @experimental
4
- * Block that executes a loop.
5
+ * Block that executes an action in a loop.
5
6
  */
6
7
  export class FlowGraphForLoopBlock extends FlowGraphWithOnDoneExecutionBlock {
7
- constructor(graph) {
8
- super(graph);
9
- this._currentIndex = 0;
10
- this._cachedEndIndex = 0;
11
- this._cachedStep = 0;
12
- this.startIndex = this._registerDataInput("startIndex", 0);
13
- this.endIndex = this._registerDataInput("endIndex", 0);
14
- this.step = this._registerDataInput("step", 1);
15
- this.index = this._registerDataOutput("index", 0);
8
+ constructor() {
9
+ super();
10
+ this.startIndex = this._registerDataInput("startIndex", RichTypeNumber);
11
+ this.endIndex = this._registerDataInput("endIndex", RichTypeNumber);
12
+ this.step = this._registerDataInput("step", RichTypeNumber);
13
+ this.step.value = 1;
14
+ this.index = this._registerDataOutput("index", RichTypeNumber);
16
15
  this.onLoop = this._registerSignalOutput("onLoop");
17
16
  this.onDone = this._registerSignalOutput("onDone");
18
17
  }
19
- _executeLoop() {
20
- if (this._currentIndex < this._cachedEndIndex) {
21
- this.index.value = this._currentIndex;
22
- this.onLoop._activateSignal();
23
- this._currentIndex += this._cachedStep;
24
- this._executeLoop();
18
+ _executeLoop(context) {
19
+ let index = context._getExecutionVariable(this, "index");
20
+ const endIndex = context._getExecutionVariable(this, "endIndex");
21
+ if (index < endIndex) {
22
+ this.index.value = index;
23
+ this.onLoop._activateSignal(context);
24
+ const step = context._getExecutionVariable(this, "step");
25
+ index += step;
26
+ context._setExecutionVariable(this, "index", index);
27
+ this._executeLoop(context);
25
28
  }
26
29
  else {
27
- this.onDone._activateSignal();
30
+ this.onDone._activateSignal(context);
28
31
  }
29
32
  }
30
33
  /**
31
34
  * @internal
32
35
  */
33
- _execute() {
34
- this._currentIndex = this.startIndex.value;
35
- this._cachedEndIndex = this.endIndex.value;
36
- this._cachedStep = this.step.value;
37
- this._executeLoop();
36
+ _execute(context) {
37
+ const index = this.startIndex.getValue(context);
38
+ const endIndex = this.endIndex.getValue(context);
39
+ const step = this.step.getValue(context);
40
+ context._setExecutionVariable(this, "index", index);
41
+ context._setExecutionVariable(this, "endIndex", endIndex);
42
+ context._setExecutionVariable(this, "step", step);
43
+ this._executeLoop(context);
38
44
  }
39
45
  }
40
46
  //# sourceMappingURL=flowGraphForLoopBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphForLoopBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iCAAiC,EAAE,mDAAyD;AAErG;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iCAAiC;IA8BxE,YAAmB,KAAgB;QAC/B,KAAK,CAAC,KAAK,CAAC,CAAC;QALT,kBAAa,GAAW,CAAC,CAAC;QAC1B,oBAAe,GAAW,CAAC,CAAC;QAC5B,gBAAW,GAAW,CAAC,CAAC;QAK5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAE/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAEO,YAAY;QAChB,IAAI,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE;YAC3C,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YAC9B,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,CAAC;YACvC,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;SACjC;IACL,CAAC;IAED;;OAEG;IACI,QAAQ;QACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QACnC,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;CACJ","sourcesContent":["import type { FlowGraph } from \"../../flowGraph\";\r\nimport type { FlowGraphSignalConnection } from \"../../flowGraphSignalConnection\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"core/FlowGraph/flowGraphWithOnDoneExecutionBlock\";\r\n\r\n/**\r\n * @experimental\r\n * Block that executes a loop.\r\n */\r\nexport class FlowGraphForLoopBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * The start index of the loop.\r\n */\r\n public readonly startIndex: FlowGraphDataConnection<number>;\r\n /**\r\n * The end index of the loop.\r\n */\r\n public readonly endIndex: FlowGraphDataConnection<number>;\r\n /**\r\n * The step of the loop.\r\n */\r\n public readonly step: FlowGraphDataConnection<number>;\r\n /**\r\n * The current index of the loop.\r\n */\r\n public readonly index: FlowGraphDataConnection<number>;\r\n /**\r\n * The signal that is activated when the loop body is executed.\r\n */\r\n public readonly onLoop: FlowGraphSignalConnection;\r\n /**\r\n * The signal that is activated when the loop is done.\r\n */\r\n public readonly onDone: FlowGraphSignalConnection;\r\n\r\n private _currentIndex: number = 0;\r\n private _cachedEndIndex: number = 0;\r\n private _cachedStep: number = 0;\r\n\r\n public constructor(graph: FlowGraph) {\r\n super(graph);\r\n\r\n this.startIndex = this._registerDataInput(\"startIndex\", 0);\r\n this.endIndex = this._registerDataInput(\"endIndex\", 0);\r\n this.step = this._registerDataInput(\"step\", 1);\r\n\r\n this.index = this._registerDataOutput(\"index\", 0);\r\n this.onLoop = this._registerSignalOutput(\"onLoop\");\r\n this.onDone = this._registerSignalOutput(\"onDone\");\r\n }\r\n\r\n private _executeLoop() {\r\n if (this._currentIndex < this._cachedEndIndex) {\r\n this.index.value = this._currentIndex;\r\n this.onLoop._activateSignal();\r\n this._currentIndex += this._cachedStep;\r\n this._executeLoop();\r\n } else {\r\n this.onDone._activateSignal();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _execute(): void {\r\n this._currentIndex = this.startIndex.value;\r\n this._cachedEndIndex = this.endIndex.value;\r\n this._cachedStep = this.step.value;\r\n this._executeLoop();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphForLoopBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,mDAAyD;AAErG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iCAAiC;IA0BxE;QACI,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACxE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC/D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAEO,YAAY,CAAC,OAAyB;QAC1C,IAAI,KAAK,GAAG,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACjE,IAAI,KAAK,GAAG,QAAQ,EAAE;YAClB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YACrC,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACzD,KAAK,IAAI,IAAI,CAAC;YACd,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SAC9B;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SACxC;IACL,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC1D,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["import type { FlowGraphSignalConnection } from \"../../flowGraphSignalConnection\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"core/FlowGraph/flowGraphWithOnDoneExecutionBlock\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { RichTypeNumber } from \"../../flowGraphRichTypes\";\r\n\r\n/**\r\n * @experimental\r\n * Block that executes an action in a loop.\r\n */\r\nexport class FlowGraphForLoopBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The start index of the loop.\r\n */\r\n public readonly startIndex: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The end index of the loop.\r\n */\r\n public readonly endIndex: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The step of the loop.\r\n */\r\n public readonly step: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The current index of the loop.\r\n */\r\n public readonly index: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The signal that is activated when the loop body is executed.\r\n */\r\n public readonly onLoop: FlowGraphSignalConnection;\r\n /**\r\n * Output connection: The signal that is activated when the loop is done.\r\n */\r\n public readonly onDone: FlowGraphSignalConnection;\r\n\r\n public constructor() {\r\n super();\r\n\r\n this.startIndex = this._registerDataInput(\"startIndex\", RichTypeNumber);\r\n this.endIndex = this._registerDataInput(\"endIndex\", RichTypeNumber);\r\n this.step = this._registerDataInput(\"step\", RichTypeNumber);\r\n this.step.value = 1;\r\n\r\n this.index = this._registerDataOutput(\"index\", RichTypeNumber);\r\n this.onLoop = this._registerSignalOutput(\"onLoop\");\r\n this.onDone = this._registerSignalOutput(\"onDone\");\r\n }\r\n\r\n private _executeLoop(context: FlowGraphContext) {\r\n let index = context._getExecutionVariable(this, \"index\");\r\n const endIndex = context._getExecutionVariable(this, \"endIndex\");\r\n if (index < endIndex) {\r\n this.index.value = index;\r\n this.onLoop._activateSignal(context);\r\n const step = context._getExecutionVariable(this, \"step\");\r\n index += step;\r\n context._setExecutionVariable(this, \"index\", index);\r\n this._executeLoop(context);\r\n } else {\r\n this.onDone._activateSignal(context);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n const index = this.startIndex.getValue(context);\r\n const endIndex = this.endIndex.getValue(context);\r\n const step = this.step.getValue(context);\r\n context._setExecutionVariable(this, \"index\", index);\r\n context._setExecutionVariable(this, \"endIndex\", endIndex);\r\n context._setExecutionVariable(this, \"step\", step);\r\n this._executeLoop(context);\r\n }\r\n}\r\n"]}
@@ -1,18 +1,18 @@
1
- import type { FlowGraph } from "../../flowGraph";
1
+ import type { FlowGraphContext } from "../../flowGraphContext";
2
2
  import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
3
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
3
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
4
4
  /**
5
5
  * @experimental
6
6
  * Block that logs a message to the console.
7
7
  */
8
8
  export declare class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock {
9
9
  /**
10
- * The message to log.
10
+ * Input connection: The message to log.
11
11
  */
12
12
  readonly message: FlowGraphDataConnection<any>;
13
- constructor(graph: FlowGraph);
13
+ constructor();
14
14
  /**
15
15
  * @internal
16
16
  */
17
- _execute(): void;
17
+ _execute(context: FlowGraphContext): void;
18
18
  }
@@ -1,21 +1,23 @@
1
1
  import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
2
+ import { RichTypeAny } from "../../flowGraphRichTypes.js";
2
3
  /**
3
4
  * @experimental
4
5
  * Block that logs a message to the console.
5
6
  */
6
7
  export class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock {
7
- constructor(graph) {
8
- super(graph);
9
- this.message = this._registerDataInput("message", "Hello world");
8
+ constructor() {
9
+ super();
10
+ this.message = this._registerDataInput("message", RichTypeAny);
11
+ this.message.value = "Hello World!";
10
12
  }
11
13
  /**
12
14
  * @internal
13
15
  */
14
- _execute() {
15
- const messageValue = this.message.value;
16
+ _execute(context) {
17
+ const messageValue = this.message.getValue(context);
16
18
  console.log(messageValue);
17
19
  // activate the output flow block
18
- this.onDone._activateSignal();
20
+ this.onDone._activateSignal(context);
19
21
  }
20
22
  }
21
23
  //# sourceMappingURL=flowGraphLogBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphLogBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphLogBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,mDAAyD;AAErG;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,iCAAiC;IAMpE,YAAmB,KAAgB;QAC/B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACI,QAAQ;QACX,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1B,iCAAiC;QACjC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;IAClC,CAAC;CACJ","sourcesContent":["import type { FlowGraph } from \"../../flowGraph\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"core/FlowGraph/flowGraphWithOnDoneExecutionBlock\";\r\n\r\n/**\r\n * @experimental\r\n * Block that logs a message to the console.\r\n */\r\nexport class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * The message to log.\r\n */\r\n public readonly message: FlowGraphDataConnection<any>;\r\n\r\n public constructor(graph: FlowGraph) {\r\n super(graph);\r\n this.message = this._registerDataInput(\"message\", \"Hello world\");\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _execute(): void {\r\n const messageValue = this.message.value;\r\n console.log(messageValue);\r\n // activate the output flow block\r\n this.onDone._activateSignal();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphLogBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphLogBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,iCAAiC;IAMpE;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1B,iCAAiC;QACjC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport { RichTypeAny } from \"../../flowGraphRichTypes\";\r\n\r\n/**\r\n * @experimental\r\n * Block that logs a message to the console.\r\n */\r\nexport class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The message to log.\r\n */\r\n public readonly message: FlowGraphDataConnection<any>;\r\n\r\n public constructor() {\r\n super();\r\n this.message = this._registerDataInput(\"message\", RichTypeAny);\r\n this.message.value = \"Hello World!\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n const messageValue = this.message.getValue(context);\r\n console.log(messageValue);\r\n // activate the output flow block\r\n this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,56 @@
1
+ import type { FlowGraphContext } from "../../flowGraphContext";
2
+ import type { Animatable, Animation, IAnimatable } from "../../../Animations";
3
+ import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
4
+ import type { FlowGraphSignalConnection } from "../../flowGraphSignalConnection";
5
+ import { FlowGraphAsyncExecutionBlock } from "../../flowGraphAsyncExecutionBlock";
6
+ /**
7
+ * @experimental
8
+ * A block that plays an animation on an animatable object.
9
+ */
10
+ export declare class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
11
+ /**
12
+ * Input connection: The target to play the animation on.
13
+ */
14
+ readonly target: FlowGraphDataConnection<IAnimatable>;
15
+ /**
16
+ * Input connection: The animation to play.
17
+ */
18
+ readonly animation: FlowGraphDataConnection<Animation>;
19
+ /**
20
+ * Input connection: The speed of the animation.
21
+ */
22
+ readonly speed: FlowGraphDataConnection<number>;
23
+ /**
24
+ * Input connection: Should the animation loop?
25
+ */
26
+ readonly loop: FlowGraphDataConnection<boolean>;
27
+ /**
28
+ * Input connection: The starting frame of the animation.
29
+ */
30
+ readonly from: FlowGraphDataConnection<number>;
31
+ /**
32
+ * Input connection: The ending frame of the animation.
33
+ */
34
+ readonly to: FlowGraphDataConnection<number>;
35
+ /**
36
+ * Output connection: The signal that is triggered when the animation ends.
37
+ */
38
+ readonly onAnimationEnd: FlowGraphSignalConnection;
39
+ /**
40
+ * Output connection: The animatable that is currently running.
41
+ */
42
+ readonly runningAnimatable: FlowGraphDataConnection<Animatable>;
43
+ constructor();
44
+ /**
45
+ * @internal
46
+ * @param context
47
+ */
48
+ _preparePendingTasks(context: FlowGraphContext): void;
49
+ _execute(context: FlowGraphContext): void;
50
+ private _onAnimationEnd;
51
+ /**
52
+ * @internal
53
+ * Stop any currently running animations.
54
+ */
55
+ _cancelPendingTasks(context: FlowGraphContext): void;
56
+ }
@@ -0,0 +1,66 @@
1
+ import { FlowGraphAsyncExecutionBlock } from "../../flowGraphAsyncExecutionBlock.js";
2
+ import { RichTypeAny, RichTypeNumber, RichTypeBoolean } from "../../flowGraphRichTypes.js";
3
+ /**
4
+ * @experimental
5
+ * A block that plays an animation on an animatable object.
6
+ */
7
+ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
8
+ constructor() {
9
+ super();
10
+ this.target = this._registerDataInput("target", RichTypeAny);
11
+ this.animation = this._registerDataInput("animation", RichTypeAny);
12
+ this.speed = this._registerDataInput("speed", RichTypeNumber);
13
+ this.speed.value = 1;
14
+ this.loop = this._registerDataInput("loop", RichTypeBoolean);
15
+ this.from = this._registerDataInput("from", RichTypeNumber);
16
+ this.to = this._registerDataInput("to", RichTypeNumber);
17
+ this.to.value = 100;
18
+ this.onAnimationEnd = this._registerSignalOutput("onAnimationEnd");
19
+ this.runningAnimatable = this._registerDataOutput("runningAnimatable", RichTypeAny);
20
+ }
21
+ /**
22
+ * @internal
23
+ * @param context
24
+ */
25
+ _preparePendingTasks(context) {
26
+ var _a;
27
+ const targetValue = this.target.getValue(context);
28
+ const animationValue = this.animation.getValue(context);
29
+ if (!targetValue || !animationValue) {
30
+ throw new Error("Cannot play animation without target or animation");
31
+ }
32
+ const contextAnims = (_a = context._getExecutionVariable(this, "runningAnimatables")) !== null && _a !== void 0 ? _a : [];
33
+ const scene = context.graphVariables.scene;
34
+ const animatable = scene.beginDirectAnimation(targetValue, [animationValue], this.from.getValue(context), this.to.getValue(context), this.loop.getValue(context), this.speed.getValue(context), () => this._onAnimationEnd(animatable, context));
35
+ this.runningAnimatable.value = animatable;
36
+ contextAnims.push(animatable);
37
+ context._setExecutionVariable(this, "runningAnimatables", contextAnims);
38
+ }
39
+ _execute(context) {
40
+ this._startPendingTasks(context);
41
+ this.onDone._activateSignal(context);
42
+ }
43
+ _onAnimationEnd(animatable, context) {
44
+ var _a;
45
+ const contextAnims = (_a = context._getExecutionVariable(this, "runningAnimatables")) !== null && _a !== void 0 ? _a : [];
46
+ const index = contextAnims.indexOf(animatable);
47
+ if (index !== -1) {
48
+ contextAnims.splice(index, 1);
49
+ }
50
+ context._removePendingBlock(this);
51
+ this.onAnimationEnd._activateSignal(context);
52
+ }
53
+ /**
54
+ * @internal
55
+ * Stop any currently running animations.
56
+ */
57
+ _cancelPendingTasks(context) {
58
+ var _a;
59
+ const contextAnims = (_a = context._getExecutionVariable(this, "runningAnimatables")) !== null && _a !== void 0 ? _a : [];
60
+ for (const anim of contextAnims) {
61
+ anim.stop();
62
+ }
63
+ context._deleteExecutionVariable(this, "runningAnimatables");
64
+ }
65
+ }
66
+ //# sourceMappingURL=flowGraphPlayAnimationBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphPlayAnimationBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphPlayAnimationBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAExF;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,4BAA4B;IAoCzE;QACI,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACnE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAC5D,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACxD,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC;QAEpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QACnE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;IACxF,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,OAAyB;;QACjD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAc,CAAC;QAErE,IAAI,CAAC,WAAW,IAAI,CAAC,cAAc,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;SACxE;QAED,MAAM,YAAY,GAAG,MAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,CAAkB,mCAAI,EAAE,CAAC;QAEvG,MAAM,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC;QAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,oBAAoB,CACzC,WAAW,EACX,CAAC,cAAc,CAAC,EAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAC3B,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAC3B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAC5B,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAClD,CAAC;QACF,IAAI,CAAC,iBAAiB,CAAC,KAAK,GAAG,UAAU,CAAC;QAC1C,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE9B,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,EAAE,YAAY,CAAC,CAAC;IAC5E,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEjC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEO,eAAe,CAAC,UAAsB,EAAE,OAAyB;;QACrE,MAAM,YAAY,GAAG,MAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,CAAkB,mCAAI,EAAE,CAAC;QACvG,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACjC;QACD,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,mBAAmB,CAAC,OAAyB;;QAChD,MAAM,YAAY,GAAG,MAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,CAAkB,mCAAI,EAAE,CAAC;QACvG,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE;YAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;SACf;QACD,OAAO,CAAC,wBAAwB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACjE,CAAC;CACJ","sourcesContent":["import type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { Animatable, Animation, IAnimatable } from \"../../../Animations\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport type { FlowGraphSignalConnection } from \"../../flowGraphSignalConnection\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"../../flowGraphAsyncExecutionBlock\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeBoolean } from \"../../flowGraphRichTypes\";\r\n\r\n/**\r\n * @experimental\r\n * A block that plays an animation on an animatable object.\r\n */\r\nexport class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * Input connection: The target to play the animation on.\r\n */\r\n public readonly target: FlowGraphDataConnection<IAnimatable>;\r\n /**\r\n * Input connection: The animation to play.\r\n */\r\n public readonly animation: FlowGraphDataConnection<Animation>;\r\n /**\r\n * Input connection: The speed of the animation.\r\n */\r\n public readonly speed: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: Should the animation loop?\r\n */\r\n public readonly loop: FlowGraphDataConnection<boolean>;\r\n /**\r\n * Input connection: The starting frame of the animation.\r\n */\r\n public readonly from: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The ending frame of the animation.\r\n */\r\n public readonly to: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output connection: The signal that is triggered when the animation ends.\r\n */\r\n public readonly onAnimationEnd: FlowGraphSignalConnection;\r\n\r\n /**\r\n * Output connection: The animatable that is currently running.\r\n */\r\n public readonly runningAnimatable: FlowGraphDataConnection<Animatable>;\r\n\r\n public constructor() {\r\n super();\r\n\r\n this.target = this._registerDataInput(\"target\", RichTypeAny);\r\n this.animation = this._registerDataInput(\"animation\", RichTypeAny);\r\n this.speed = this._registerDataInput(\"speed\", RichTypeNumber);\r\n this.speed.value = 1;\r\n this.loop = this._registerDataInput(\"loop\", RichTypeBoolean);\r\n this.from = this._registerDataInput(\"from\", RichTypeNumber);\r\n this.to = this._registerDataInput(\"to\", RichTypeNumber);\r\n this.to.value = 100;\r\n\r\n this.onAnimationEnd = this._registerSignalOutput(\"onAnimationEnd\");\r\n this.runningAnimatable = this._registerDataOutput(\"runningAnimatable\", RichTypeAny);\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param context\r\n */\r\n public _preparePendingTasks(context: FlowGraphContext): void {\r\n const targetValue = this.target.getValue(context);\r\n const animationValue = this.animation.getValue(context) as Animation;\r\n\r\n if (!targetValue || !animationValue) {\r\n throw new Error(\"Cannot play animation without target or animation\");\r\n }\r\n\r\n const contextAnims = (context._getExecutionVariable(this, \"runningAnimatables\") as Animatable[]) ?? [];\r\n\r\n const scene = context.graphVariables.scene;\r\n const animatable = scene.beginDirectAnimation(\r\n targetValue,\r\n [animationValue],\r\n this.from.getValue(context),\r\n this.to.getValue(context),\r\n this.loop.getValue(context),\r\n this.speed.getValue(context),\r\n () => this._onAnimationEnd(animatable, context)\r\n );\r\n this.runningAnimatable.value = animatable;\r\n contextAnims.push(animatable);\r\n\r\n context._setExecutionVariable(this, \"runningAnimatables\", contextAnims);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n this._startPendingTasks(context);\r\n\r\n this.onDone._activateSignal(context);\r\n }\r\n\r\n private _onAnimationEnd(animatable: Animatable, context: FlowGraphContext) {\r\n const contextAnims = (context._getExecutionVariable(this, \"runningAnimatables\") as Animatable[]) ?? [];\r\n const index = contextAnims.indexOf(animatable);\r\n if (index !== -1) {\r\n contextAnims.splice(index, 1);\r\n }\r\n context._removePendingBlock(this);\r\n this.onAnimationEnd._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @internal\r\n * Stop any currently running animations.\r\n */\r\n public _cancelPendingTasks(context: FlowGraphContext): void {\r\n const contextAnims = (context._getExecutionVariable(this, \"runningAnimatables\") as Animatable[]) ?? [];\r\n for (const anim of contextAnims) {\r\n anim.stop();\r\n }\r\n context._deleteExecutionVariable(this, \"runningAnimatables\");\r\n }\r\n}\r\n"]}
@@ -0,0 +1,18 @@
1
+ import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
2
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
3
+ import type { FlowGraphContext } from "../../flowGraphContext";
4
+ /**
5
+ * @experimental
6
+ */
7
+ export declare class FlowGraphSendCustomEventBlock extends FlowGraphWithOnDoneExecutionBlock {
8
+ /**
9
+ * Input connection: The id of the event to send.
10
+ */
11
+ readonly eventId: FlowGraphDataConnection<string>;
12
+ /**
13
+ * Input connection: The data to send with the event.
14
+ */
15
+ readonly eventData: FlowGraphDataConnection<any>;
16
+ constructor();
17
+ _execute(context: FlowGraphContext): void;
18
+ }
@@ -0,0 +1,19 @@
1
+ import { RichTypeAny, RichTypeString } from "../../flowGraphRichTypes.js";
2
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
3
+ /**
4
+ * @experimental
5
+ */
6
+ export class FlowGraphSendCustomEventBlock extends FlowGraphWithOnDoneExecutionBlock {
7
+ constructor() {
8
+ super();
9
+ this.eventId = this._registerDataInput("eventId", RichTypeString);
10
+ this.eventData = this._registerDataInput("eventData", RichTypeAny);
11
+ }
12
+ _execute(context) {
13
+ const eventId = this.eventId.getValue(context);
14
+ const eventData = this.eventData.getValue(context);
15
+ context.graphVariables.eventCoordinator.notifyCustomEvent(eventId, eventData);
16
+ this.onDone._activateSignal(context);
17
+ }
18
+ }
19
+ //# sourceMappingURL=flowGraphSendCustomEventBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphSendCustomEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,oCAA0C;AAEhF,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAG5F;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,iCAAiC;IAUhF;QACI,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACvE,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEnD,OAAO,CAAC,cAAc,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE9E,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import { RichTypeAny, RichTypeString } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\n\r\n/**\r\n * @experimental\r\n */\r\nexport class FlowGraphSendCustomEventBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The id of the event to send.\r\n */\r\n public readonly eventId: FlowGraphDataConnection<string>;\r\n /**\r\n * Input connection: The data to send with the event.\r\n */\r\n public readonly eventData: FlowGraphDataConnection<any>;\r\n\r\n public constructor() {\r\n super();\r\n\r\n this.eventId = this._registerDataInput(\"eventId\", RichTypeString);\r\n this.eventData = this._registerDataInput(\"eventData\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const eventId = this.eventId.getValue(context);\r\n const eventData = this.eventData.getValue(context);\r\n\r\n context.graphVariables.eventCoordinator.notifyCustomEvent(eventId, eventData);\r\n\r\n this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,26 @@
1
+ import type { FlowGraphContext } from "../../flowGraphContext";
2
+ import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
3
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
4
+ /**
5
+ * @experimental
6
+ * Block that sets a property on a target object.
7
+ * TODO: Add support for animating the property.
8
+ */
9
+ export declare class FlowGraphSetPropertyBlock<TargetT, ValueT> extends FlowGraphWithOnDoneExecutionBlock {
10
+ /**
11
+ * Input connection: The target object.
12
+ */
13
+ readonly target: FlowGraphDataConnection<TargetT>;
14
+ /**
15
+ * Input connection: The property to set on the object.
16
+ * Supports dot notation.
17
+ */
18
+ readonly property: FlowGraphDataConnection<string>;
19
+ /**
20
+ * Input connection: The value to set on the property.
21
+ */
22
+ readonly value: FlowGraphDataConnection<ValueT>;
23
+ constructor();
24
+ private _setProperty;
25
+ _execute(context: FlowGraphContext): void;
26
+ }
@@ -0,0 +1,36 @@
1
+ import { RichTypeString, RichTypeAny } from "../../flowGraphRichTypes.js";
2
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
3
+ /**
4
+ * @experimental
5
+ * Block that sets a property on a target object.
6
+ * TODO: Add support for animating the property.
7
+ */
8
+ export class FlowGraphSetPropertyBlock extends FlowGraphWithOnDoneExecutionBlock {
9
+ constructor() {
10
+ super();
11
+ this.target = this._registerDataInput("target", RichTypeAny);
12
+ this.property = this._registerDataInput("property", RichTypeString);
13
+ this.value = this._registerDataInput("value", RichTypeAny);
14
+ }
15
+ _setProperty(target, property, value) {
16
+ const splitProp = property.split(".");
17
+ let currentTarget = target;
18
+ for (let i = 0; i < splitProp.length - 1; i++) {
19
+ currentTarget = currentTarget[splitProp[i]];
20
+ }
21
+ currentTarget[splitProp[splitProp.length - 1]] = value;
22
+ }
23
+ _execute(context) {
24
+ const target = this.target.getValue(context);
25
+ const property = this.property.getValue(context);
26
+ const value = this.value.getValue(context);
27
+ if (target && property && value) {
28
+ this._setProperty(target, property, value);
29
+ }
30
+ else {
31
+ throw new Error("Invalid target, property or value.");
32
+ }
33
+ this.onDone._activateSignal(context);
34
+ }
35
+ }
36
+ //# sourceMappingURL=flowGraphSetPropertyBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphSetPropertyBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAE5F;;;;GAIG;AACH,MAAM,OAAO,yBAA2C,SAAQ,iCAAiC;IAe7F;QACI,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC/D,CAAC;IAEO,YAAY,CAAC,MAAW,EAAE,QAAgB,EAAE,KAAU;QAC1D,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,aAAa,GAAG,MAAM,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC3C,aAAa,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/C;QAED,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAC3D,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAE3C,IAAI,MAAM,IAAI,QAAQ,IAAI,KAAK,EAAE;YAC7B,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;SAC9C;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;SACzD;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import { RichTypeString, RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\n\r\n/**\r\n * @experimental\r\n * Block that sets a property on a target object.\r\n * TODO: Add support for animating the property.\r\n */\r\nexport class FlowGraphSetPropertyBlock<TargetT, ValueT> extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The target object.\r\n */\r\n public readonly target: FlowGraphDataConnection<TargetT>;\r\n /**\r\n * Input connection: The property to set on the object.\r\n * Supports dot notation.\r\n */\r\n public readonly property: FlowGraphDataConnection<string>;\r\n /**\r\n * Input connection: The value to set on the property.\r\n */\r\n public readonly value: FlowGraphDataConnection<ValueT>;\r\n\r\n public constructor() {\r\n super();\r\n\r\n this.target = this._registerDataInput(\"target\", RichTypeAny);\r\n this.property = this._registerDataInput(\"property\", RichTypeString);\r\n this.value = this._registerDataInput(\"value\", RichTypeAny);\r\n }\r\n\r\n private _setProperty(target: any, property: string, value: any): void {\r\n const splitProp = property.split(\".\");\r\n\r\n let currentTarget = target;\r\n for (let i = 0; i < splitProp.length - 1; i++) {\r\n currentTarget = currentTarget[splitProp[i]];\r\n }\r\n\r\n currentTarget[splitProp[splitProp.length - 1]] = value;\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const target = this.target.getValue(context);\r\n const property = this.property.getValue(context);\r\n const value = this.value.getValue(context);\r\n\r\n if (target && property && value) {\r\n this._setProperty(target, property, value);\r\n } else {\r\n throw new Error(\"Invalid target, property or value.\");\r\n }\r\n\r\n this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,23 @@
1
+ import type { FlowGraphContext } from "../../flowGraphContext";
2
+ import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
3
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
4
+ export interface IFlowGraphSetVariableBlockParameter<T> {
5
+ variableName?: string;
6
+ input?: T;
7
+ }
8
+ /**
9
+ * Block to set a variable.
10
+ * @experimental
11
+ */
12
+ export declare class FlowGraphSetVariableBlock<T> extends FlowGraphWithOnDoneExecutionBlock {
13
+ /**
14
+ * Input connection: The name of the variable to set.
15
+ */
16
+ readonly variableName: FlowGraphDataConnection<string>;
17
+ /**
18
+ * Input connection: The value to set on the variable.
19
+ */
20
+ readonly input: FlowGraphDataConnection<T>;
21
+ constructor(params?: IFlowGraphSetVariableBlockParameter<T>);
22
+ _execute(context: FlowGraphContext): void;
23
+ }
@@ -0,0 +1,25 @@
1
+ import { RichTypeString, RichTypeAny } from "../../flowGraphRichTypes.js";
2
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
3
+ /**
4
+ * Block to set a variable.
5
+ * @experimental
6
+ */
7
+ export class FlowGraphSetVariableBlock extends FlowGraphWithOnDoneExecutionBlock {
8
+ constructor(params) {
9
+ super();
10
+ this.variableName = this._registerDataInput("variableName", RichTypeString);
11
+ if ((params === null || params === void 0 ? void 0 : params.variableName) !== undefined) {
12
+ this.variableName.value = params.variableName;
13
+ }
14
+ this.input = this._registerDataInput("input", RichTypeAny);
15
+ if ((params === null || params === void 0 ? void 0 : params.input) !== undefined) {
16
+ this.input.value = params.input;
17
+ }
18
+ }
19
+ _execute(context) {
20
+ const variableNameValue = this.variableName.getValue(context);
21
+ context.setVariable(variableNameValue, this.input.getValue(context));
22
+ this.onDone._activateSignal(context);
23
+ }
24
+ }
25
+ //# sourceMappingURL=flowGraphSetVariableBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphSetVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAM5F;;;GAGG;AACH,MAAM,OAAO,yBAA6B,SAAQ,iCAAiC;IAU/E,YAAY,MAA+C;QACvD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC5E,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,MAAK,SAAS,EAAE;YACpC,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC;SACjD;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC3D,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,MAAK,SAAS,EAAE;YAC7B,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;SACnC;IACL,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC9D,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import { RichTypeString, RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\n\r\nexport interface IFlowGraphSetVariableBlockParameter<T> {\r\n variableName?: string;\r\n input?: T;\r\n}\r\n/**\r\n * Block to set a variable.\r\n * @experimental\r\n */\r\nexport class FlowGraphSetVariableBlock<T> extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The name of the variable to set.\r\n */\r\n public readonly variableName: FlowGraphDataConnection<string>;\r\n /**\r\n * Input connection: The value to set on the variable.\r\n */\r\n public readonly input: FlowGraphDataConnection<T>;\r\n\r\n constructor(params?: IFlowGraphSetVariableBlockParameter<T>) {\r\n super();\r\n\r\n this.variableName = this._registerDataInput(\"variableName\", RichTypeString);\r\n if (params?.variableName !== undefined) {\r\n this.variableName.value = params.variableName;\r\n }\r\n this.input = this._registerDataInput(\"input\", RichTypeAny);\r\n if (params?.input !== undefined) {\r\n this.input.value = params.input;\r\n }\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const variableNameValue = this.variableName.getValue(context);\r\n context.setVariable(variableNameValue, this.input.getValue(context));\r\n this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,16 @@
1
+ import type { FlowGraphContext } from "../../flowGraphContext";
2
+ import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
3
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
4
+ import type { Animatable } from "../../../Animations";
5
+ /**
6
+ * @experimental
7
+ * Block that stops a running animation
8
+ */
9
+ export declare class FlowGraphStopAnimationBlock extends FlowGraphWithOnDoneExecutionBlock {
10
+ /**
11
+ *
12
+ */
13
+ readonly animationToStop: FlowGraphDataConnection<Animatable>;
14
+ constructor();
15
+ _execute(context: FlowGraphContext): void;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
2
+ import { RichTypeAny } from "../../flowGraphRichTypes.js";
3
+ /**
4
+ * @experimental
5
+ * Block that stops a running animation
6
+ */
7
+ export class FlowGraphStopAnimationBlock extends FlowGraphWithOnDoneExecutionBlock {
8
+ constructor() {
9
+ super();
10
+ this.animationToStop = this._registerDataInput("animationToStop", RichTypeAny);
11
+ }
12
+ _execute(context) {
13
+ const animationToStopValue = this.animationToStop.getValue(context);
14
+ animationToStopValue.stop();
15
+ this.onDone._activateSignal(context);
16
+ }
17
+ }
18
+ //# sourceMappingURL=flowGraphStopAnimationBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphStopAnimationBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphStopAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,iCAAiC;IAM9E;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IACnF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpE,oBAAoB,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport type { Animatable } from \"../../../Animations\";\r\nimport { RichTypeAny } from \"../../flowGraphRichTypes\";\r\n\r\n/**\r\n * @experimental\r\n * Block that stops a running animation\r\n */\r\nexport class FlowGraphStopAnimationBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n *\r\n */\r\n public readonly animationToStop: FlowGraphDataConnection<Animatable>;\r\n\r\n constructor() {\r\n super();\r\n this.animationToStop = this._registerDataInput(\"animationToStop\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToStopValue = this.animationToStop.getValue(context);\r\n animationToStopValue.stop();\r\n this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,32 @@
1
+ import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
2
+ import type { FlowGraphSignalConnection } from "../../flowGraphSignalConnection";
3
+ import type { FlowGraphContext } from "../../flowGraphContext";
4
+ import { FlowGraphAsyncExecutionBlock } from "../../flowGraphAsyncExecutionBlock";
5
+ export interface IFlowGraphTimerBlockParameters {
6
+ timeout?: number;
7
+ }
8
+ /**
9
+ * @experimental
10
+ * question: is this doc understandable enough? accepting suggestions
11
+ * Block that provides two different output flows. One is started immediately once the block is executed,
12
+ * and the other is executed after a set time. The timer for this block runs based on the scene's render loop.
13
+ */
14
+ export declare class FlowGraphTimerBlock extends FlowGraphAsyncExecutionBlock {
15
+ /**
16
+ * Input connection: The timeout of the timer.
17
+ */
18
+ readonly timeout: FlowGraphDataConnection<number>;
19
+ /**
20
+ * Output connection: The signal that is activated when the timer is done.
21
+ * This signal is activated asynchronically.
22
+ */
23
+ readonly onTimerDone: FlowGraphSignalConnection;
24
+ constructor(parameters?: IFlowGraphTimerBlockParameters);
25
+ _preparePendingTasks(context: FlowGraphContext): void;
26
+ /**
27
+ * @internal
28
+ */
29
+ _execute(context: FlowGraphContext): void;
30
+ private _onEnded;
31
+ _cancelPendingTasks(context: FlowGraphContext): void;
32
+ }
@@ -0,0 +1,62 @@
1
+ import { AdvancedTimer } from "../../../Misc/timer.js";
2
+ import { FlowGraphAsyncExecutionBlock } from "../../flowGraphAsyncExecutionBlock.js";
3
+ import { RichTypeNumber } from "../../flowGraphRichTypes.js";
4
+ import { Tools } from "../../../Misc/tools.js";
5
+ /**
6
+ * @experimental
7
+ * question: is this doc understandable enough? accepting suggestions
8
+ * Block that provides two different output flows. One is started immediately once the block is executed,
9
+ * and the other is executed after a set time. The timer for this block runs based on the scene's render loop.
10
+ */
11
+ export class FlowGraphTimerBlock extends FlowGraphAsyncExecutionBlock {
12
+ constructor(parameters) {
13
+ super();
14
+ this.timeout = this._registerDataInput("timeout", RichTypeNumber);
15
+ if ((parameters === null || parameters === void 0 ? void 0 : parameters.timeout) !== undefined) {
16
+ this.timeout.value = parameters.timeout;
17
+ }
18
+ this.onTimerDone = this._registerSignalOutput("onTimerDone");
19
+ }
20
+ _preparePendingTasks(context) {
21
+ const currentTimeout = this.timeout.getValue(context);
22
+ if (currentTimeout !== undefined && currentTimeout >= 0) {
23
+ const timers = context._getExecutionVariable(this, "runningTimers") || [];
24
+ const scene = context.graphVariables.scene;
25
+ const timer = new AdvancedTimer({
26
+ timeout: currentTimeout,
27
+ contextObservable: scene.onBeforeRenderObservable,
28
+ onEnded: () => this._onEnded(timer, context),
29
+ });
30
+ timer.start();
31
+ timers.push(timer);
32
+ context._setExecutionVariable(this, "runningTimers", timers);
33
+ }
34
+ }
35
+ /**
36
+ * @internal
37
+ */
38
+ _execute(context) {
39
+ this._startPendingTasks(context);
40
+ this.onDone._activateSignal(context);
41
+ }
42
+ _onEnded(timer, context) {
43
+ const timers = context._getExecutionVariable(this, "runningTimers") || [];
44
+ const index = timers.indexOf(timer);
45
+ if (index !== -1) {
46
+ timers.splice(index, 1);
47
+ }
48
+ else {
49
+ Tools.Warn("FlowGraphTimerBlock: Timer ended but was not found in the running timers list");
50
+ }
51
+ context._removePendingBlock(this);
52
+ this.onTimerDone._activateSignal(context);
53
+ }
54
+ _cancelPendingTasks(context) {
55
+ const timers = context._getExecutionVariable(this, "runningTimers") || [];
56
+ for (const timer of timers) {
57
+ timer.dispose();
58
+ }
59
+ context._deleteExecutionVariable(this, "runningTimers");
60
+ }
61
+ }
62
+ //# sourceMappingURL=flowGraphTimerBlock.js.map