@babylonjs/core 7.51.1 → 7.51.3

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 (343) hide show
  1. package/Animations/animation.js +2 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/Buffers/bufferUtils.d.ts +7 -5
  4. package/Buffers/bufferUtils.js +13 -9
  5. package/Buffers/bufferUtils.js.map +1 -1
  6. package/Engines/ICanvas.d.ts +96 -1
  7. package/Engines/ICanvas.js.map +1 -1
  8. package/Engines/Native/nativeInterfaces.d.ts +7 -1
  9. package/Engines/Native/nativeInterfaces.js.map +1 -1
  10. package/Engines/WebGPU/webgpuTextureManager.js +3 -3
  11. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  12. package/Engines/abstractEngine.d.ts +7 -1
  13. package/Engines/abstractEngine.js +10 -2
  14. package/Engines/abstractEngine.js.map +1 -1
  15. package/Engines/constants.d.ts +32 -0
  16. package/Engines/constants.js +33 -0
  17. package/Engines/constants.js.map +1 -1
  18. package/Engines/nativeEngine.d.ts +7 -1
  19. package/Engines/nativeEngine.js +12 -0
  20. package/Engines/nativeEngine.js.map +1 -1
  21. package/Engines/webgpuEngine.js +6 -3
  22. package/Engines/webgpuEngine.js.map +1 -1
  23. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +148 -465
  24. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +394 -691
  25. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  26. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.d.ts +142 -0
  27. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js +342 -0
  28. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js.map +1 -0
  29. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +111 -0
  30. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +141 -0
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -0
  32. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +77 -0
  33. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +139 -0
  34. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -0
  35. package/FlowGraph/Blocks/Data/Math/index.d.ts +3 -0
  36. package/FlowGraph/Blocks/Data/Math/index.js +3 -0
  37. package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
  38. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +85 -0
  39. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +133 -0
  40. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -0
  41. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.d.ts +49 -0
  42. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js +71 -0
  43. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js.map +1 -0
  44. package/FlowGraph/Blocks/Data/Transformers/index.d.ts +2 -0
  45. package/FlowGraph/Blocks/Data/Transformers/index.js +3 -0
  46. package/FlowGraph/Blocks/Data/Transformers/index.js.map +1 -0
  47. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.d.ts +39 -0
  48. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js +46 -0
  49. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js.map +1 -0
  50. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.d.ts +35 -0
  51. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +34 -0
  52. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -0
  53. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.d.ts +20 -0
  54. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js +25 -0
  55. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js.map +1 -0
  56. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.d.ts +34 -0
  57. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js +35 -0
  58. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js.map +1 -0
  59. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.d.ts +39 -0
  60. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js +42 -0
  61. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js.map +1 -0
  62. package/FlowGraph/Blocks/Data/Utils/index.d.ts +5 -0
  63. package/FlowGraph/Blocks/Data/Utils/index.js +6 -0
  64. package/FlowGraph/Blocks/Data/Utils/index.js.map +1 -0
  65. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +0 -1
  66. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -2
  67. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
  69. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +4 -4
  70. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  71. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +6 -3
  72. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +12 -6
  73. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  74. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +0 -2
  75. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +2 -3
  76. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  77. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +5 -4
  78. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -4
  79. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  80. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.d.ts +62 -0
  81. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js +41 -0
  82. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js.map +1 -0
  83. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +38 -33
  84. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +42 -25
  85. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -16
  87. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +9 -17
  88. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  89. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +1 -1
  90. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +1 -1
  91. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.d.ts → flowGraphTransformCoordinatesSystemBlock.d.ts} +1 -2
  93. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.js → flowGraphTransformCoordinatesSystemBlock.js} +4 -5
  94. package/FlowGraph/Blocks/Data/flowGraphTransformCoordinatesSystemBlock.js.map +1 -0
  95. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
  96. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
  97. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  98. package/FlowGraph/Blocks/Data/index.d.ts +7 -3
  99. package/FlowGraph/Blocks/Data/index.js +9 -4
  100. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  101. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +45 -24
  102. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +45 -51
  103. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  104. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.d.ts +61 -0
  105. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js +39 -0
  106. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js.map +1 -0
  107. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.d.ts +61 -0
  108. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js +40 -0
  109. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js.map +1 -0
  110. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +12 -14
  111. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +19 -26
  112. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  113. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -12
  114. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +13 -24
  115. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  116. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +31 -7
  117. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +22 -20
  118. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  119. package/FlowGraph/Blocks/{Execution → Event}/flowGraphSendCustomEventBlock.d.ts +12 -7
  120. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +39 -0
  121. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -0
  122. package/FlowGraph/Blocks/Event/index.d.ts +3 -0
  123. package/FlowGraph/Blocks/Event/index.js +3 -0
  124. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.d.ts +44 -0
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js +46 -0
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js.map +1 -0
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.d.ts +60 -0
  129. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js +93 -0
  130. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js.map +1 -0
  131. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.d.ts +82 -0
  132. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +105 -0
  133. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -0
  134. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
  135. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +2 -2
  136. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  137. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +40 -42
  138. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +116 -50
  139. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  140. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +12 -4
  141. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +86 -8
  142. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  143. package/FlowGraph/Blocks/Execution/Animation/index.d.ts +3 -0
  144. package/FlowGraph/Blocks/Execution/Animation/index.js +3 -0
  145. package/FlowGraph/Blocks/Execution/Animation/index.js.map +1 -1
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +1 -2
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -4
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  149. package/FlowGraph/Blocks/Execution/{Audio/flowGraphStopAudioBlock.d.ts → ControlFlow/flowGraphCancelDelayBlock.d.ts} +6 -8
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +31 -0
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -0
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +5 -5
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +0 -1
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -3
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +5 -10
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -15
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +11 -3
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +5 -6
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +27 -7
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +28 -30
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  167. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +13 -16
  168. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +50 -52
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +8 -9
  171. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -13
  172. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  173. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +32 -0
  174. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +84 -0
  175. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -0
  176. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +20 -6
  177. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +55 -16
  178. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -4
  180. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +36 -13
  181. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  182. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +13 -5
  183. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +22 -17
  184. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  185. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +12 -16
  186. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +21 -21
  187. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  188. package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +2 -1
  189. package/FlowGraph/Blocks/Execution/ControlFlow/index.js +2 -1
  190. package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
  191. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -5
  192. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +13 -8
  193. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  194. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +33 -36
  195. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +42 -26
  196. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  197. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +10 -25
  198. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +38 -24
  199. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  200. package/FlowGraph/Blocks/Execution/index.d.ts +0 -3
  201. package/FlowGraph/Blocks/Execution/index.js +0 -3
  202. package/FlowGraph/Blocks/Execution/index.js.map +1 -1
  203. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +16 -0
  204. package/FlowGraph/Blocks/flowGraphBlockFactory.js +292 -0
  205. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -0
  206. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +145 -0
  207. package/FlowGraph/Blocks/flowGraphBlockNames.js +147 -0
  208. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -0
  209. package/FlowGraph/Blocks/index.d.ts +2 -0
  210. package/FlowGraph/Blocks/index.js +2 -0
  211. package/FlowGraph/Blocks/index.js.map +1 -1
  212. package/FlowGraph/{flowGraphInteger.d.ts → CustomTypes/flowGraphInteger.d.ts} +2 -3
  213. package/FlowGraph/{flowGraphInteger.js → CustomTypes/flowGraphInteger.js} +4 -5
  214. package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -0
  215. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +196 -0
  216. package/FlowGraph/CustomTypes/flowGraphMatrix.js +272 -0
  217. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -0
  218. package/FlowGraph/CustomTypes/index.d.ts +2 -0
  219. package/FlowGraph/CustomTypes/index.js +3 -0
  220. package/FlowGraph/CustomTypes/index.js.map +1 -0
  221. package/FlowGraph/flowGraph.d.ts +29 -34
  222. package/FlowGraph/flowGraph.js +120 -104
  223. package/FlowGraph/flowGraph.js.map +1 -1
  224. package/FlowGraph/flowGraphAssetsContext.d.ts +29 -0
  225. package/FlowGraph/flowGraphAssetsContext.js +52 -0
  226. package/FlowGraph/flowGraphAssetsContext.js.map +1 -0
  227. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +15 -8
  228. package/FlowGraph/flowGraphAsyncExecutionBlock.js +25 -5
  229. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  230. package/FlowGraph/flowGraphBlock.d.ts +22 -15
  231. package/FlowGraph/flowGraphBlock.js +31 -52
  232. package/FlowGraph/flowGraphBlock.js.map +1 -1
  233. package/FlowGraph/flowGraphConnection.d.ts +13 -12
  234. package/FlowGraph/flowGraphConnection.js +31 -16
  235. package/FlowGraph/flowGraphConnection.js.map +1 -1
  236. package/FlowGraph/flowGraphContext.d.ts +89 -13
  237. package/FlowGraph/flowGraphContext.js +210 -23
  238. package/FlowGraph/flowGraphContext.js.map +1 -1
  239. package/FlowGraph/flowGraphCoordinator.d.ts +4 -10
  240. package/FlowGraph/flowGraphCoordinator.js +4 -16
  241. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  242. package/FlowGraph/flowGraphDataConnection.d.ts +52 -14
  243. package/FlowGraph/flowGraphDataConnection.js +73 -26
  244. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  245. package/FlowGraph/flowGraphEventBlock.d.ts +17 -1
  246. package/FlowGraph/flowGraphEventBlock.js +13 -2
  247. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  248. package/FlowGraph/flowGraphEventType.d.ts +16 -0
  249. package/FlowGraph/flowGraphEventType.js +18 -0
  250. package/FlowGraph/flowGraphEventType.js.map +1 -0
  251. package/FlowGraph/flowGraphExecutionBlock.d.ts +11 -1
  252. package/FlowGraph/flowGraphExecutionBlock.js +21 -2
  253. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  254. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.d.ts +2 -2
  255. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js +0 -1
  256. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -1
  257. package/FlowGraph/flowGraphLogger.d.ts +60 -0
  258. package/FlowGraph/flowGraphLogger.js +53 -0
  259. package/FlowGraph/flowGraphLogger.js.map +1 -0
  260. package/FlowGraph/flowGraphParser.d.ts +85 -0
  261. package/FlowGraph/flowGraphParser.js +271 -0
  262. package/FlowGraph/flowGraphParser.js.map +1 -0
  263. package/FlowGraph/flowGraphPathConverter.d.ts +1 -1
  264. package/FlowGraph/flowGraphPathConverter.js +3 -2
  265. package/FlowGraph/flowGraphPathConverter.js.map +1 -1
  266. package/FlowGraph/flowGraphPathConverterComponent.d.ts +8 -1
  267. package/FlowGraph/flowGraphPathConverterComponent.js +18 -2
  268. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  269. package/FlowGraph/flowGraphRichTypes.d.ts +51 -9
  270. package/FlowGraph/flowGraphRichTypes.js +160 -50
  271. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  272. package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +45 -0
  273. package/FlowGraph/flowGraphSceneEventCoordinator.js +77 -0
  274. package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -0
  275. package/FlowGraph/flowGraphSignalConnection.d.ts +8 -5
  276. package/FlowGraph/flowGraphSignalConnection.js +26 -9
  277. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  278. package/FlowGraph/index.d.ts +6 -1
  279. package/FlowGraph/index.js +7 -1
  280. package/FlowGraph/index.js.map +1 -1
  281. package/FlowGraph/serialization.d.ts +5 -2
  282. package/FlowGraph/serialization.js +94 -22
  283. package/FlowGraph/serialization.js.map +1 -1
  284. package/FlowGraph/typeDefinitions.d.ts +74 -12
  285. package/FlowGraph/typeDefinitions.js.map +1 -1
  286. package/FlowGraph/utils.d.ts +47 -0
  287. package/FlowGraph/utils.js +55 -0
  288. package/FlowGraph/utils.js.map +1 -1
  289. package/Layers/effectLayer.d.ts +5 -0
  290. package/Layers/effectLayer.js +7 -0
  291. package/Layers/effectLayer.js.map +1 -1
  292. package/Loading/sceneLoader.d.ts +25 -11
  293. package/Loading/sceneLoader.js +28 -11
  294. package/Loading/sceneLoader.js.map +1 -1
  295. package/Materials/material.js +1 -0
  296. package/Materials/material.js.map +1 -1
  297. package/Maths/math.path.js +3 -0
  298. package/Maths/math.path.js.map +1 -1
  299. package/Meshes/csg2.d.ts +2 -2
  300. package/Meshes/csg2.js +2 -2
  301. package/Meshes/csg2.js.map +1 -1
  302. package/Meshes/geometry.d.ts +2 -1
  303. package/Meshes/geometry.js +8 -2
  304. package/Meshes/geometry.js.map +1 -1
  305. package/Meshes/instancedMesh.d.ts +5 -0
  306. package/Meshes/instancedMesh.js +6 -0
  307. package/Meshes/instancedMesh.js.map +1 -1
  308. package/Meshes/mesh.d.ts +2 -1
  309. package/Meshes/mesh.js +3 -2
  310. package/Meshes/mesh.js.map +1 -1
  311. package/Misc/environmentTextureTools.js +2 -2
  312. package/Misc/environmentTextureTools.js.map +1 -1
  313. package/ObjectModel/objectModelInterfaces.d.ts +2 -2
  314. package/ObjectModel/objectModelInterfaces.js.map +1 -1
  315. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +26 -18
  316. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
  317. package/package.json +1 -1
  318. package/scene.js +8 -0
  319. package/scene.js.map +1 -1
  320. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +0 -24
  321. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +0 -39
  322. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +0 -1
  323. package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
  324. package/FlowGraph/Blocks/Data/Logic/index.js +0 -2
  325. package/FlowGraph/Blocks/Data/Logic/index.js.map +0 -1
  326. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +0 -1
  327. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +0 -19
  328. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +0 -26
  329. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +0 -1
  330. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +0 -25
  331. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +0 -1
  332. package/FlowGraph/Blocks/Execution/Audio/index.d.ts +0 -2
  333. package/FlowGraph/Blocks/Execution/Audio/index.js +0 -3
  334. package/FlowGraph/Blocks/Execution/Audio/index.js.map +0 -1
  335. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +0 -31
  336. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +0 -69
  337. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +0 -1
  338. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +0 -38
  339. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +0 -1
  340. package/FlowGraph/flowGraphContextLogger.d.ts +0 -9
  341. package/FlowGraph/flowGraphContextLogger.js +0 -14
  342. package/FlowGraph/flowGraphContextLogger.js.map +0 -1
  343. package/FlowGraph/flowGraphInteger.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock.js";
2
2
  import { RichTypeAny, RichTypeNumber, RichTypeBoolean } from "../../../flowGraphRichTypes.js";
3
3
  import { RegisterClass } from "../../../../Misc/typeStore.js";
4
- import { FlowGraphPathConverterComponent } from "../../../flowGraphPathConverterComponent.js";
4
+ import { AnimationGroup } from "../../../../Animations/animationGroup.js";
5
5
  /**
6
6
  * @experimental
7
7
  * A block that plays an animation on an animatable object.
@@ -12,85 +12,151 @@ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
12
12
  * the configuration of the block
13
13
  */
14
14
  config) {
15
- super(config);
15
+ super(config, ["animationLoop", "animationEnd", "animationGroupLoop"]);
16
16
  this.config = config;
17
- this.templateTargetComponent = new FlowGraphPathConverterComponent(config.targetPath, this);
18
- this.templateAnimationComponent = new FlowGraphPathConverterComponent(config.animationPath, this);
19
17
  this.speed = this.registerDataInput("speed", RichTypeNumber);
20
18
  this.loop = this.registerDataInput("loop", RichTypeBoolean);
21
- this.from = this.registerDataInput("from", RichTypeNumber);
19
+ this.from = this.registerDataInput("from", RichTypeNumber, 0);
22
20
  this.to = this.registerDataInput("to", RichTypeNumber);
23
- this.runningAnimatable = this.registerDataOutput("runningAnimatable", RichTypeAny);
21
+ this.currentFrame = this.registerDataOutput("currentFrame", RichTypeNumber);
22
+ this.currentTime = this.registerDataOutput("currentTime", RichTypeNumber);
23
+ this.currentAnimationGroup = this.registerDataOutput("currentAnimationGroup", RichTypeAny);
24
+ this.animationGroup = this.registerDataInput("animationGroup", RichTypeAny, config?.animationGroup);
25
+ this.animation = this.registerDataInput("animation", RichTypeAny);
26
+ this.object = this.registerDataInput("object", RichTypeAny);
24
27
  }
25
28
  /**
26
29
  * @internal
27
30
  * @param context
28
31
  */
29
32
  _preparePendingTasks(context) {
30
- const targetAccessor = this.templateTargetComponent.getAccessor(this.config.pathConverter, context);
31
- const targetValue = targetAccessor.info.getObject(targetAccessor.object);
32
- const animationAccessor = this.templateAnimationComponent.getAccessor(this.config.pathConverter, context);
33
- const animationValue = animationAccessor.info.get(animationAccessor.object);
34
- if (!targetValue || !animationValue) {
35
- throw new Error("Cannot play animation without target or animation");
36
- }
37
- const contextAnimatables = context._getExecutionVariable(this, "runningAnimatables") ?? [];
38
- // was an animation started on this target already and was just paused? if so, we can unpause it.
39
- const existingAnimatable = this.runningAnimatable.getValue(context);
40
- if (existingAnimatable && existingAnimatable.paused) {
41
- existingAnimatable.restart();
33
+ const ag = this.animationGroup.getValue(context);
34
+ const animation = this.animation.getValue(context);
35
+ if (!ag && !animation) {
36
+ this.error.payload = { message: "No animation group or animation provided" };
37
+ this.error._activateSignal(context);
38
+ return;
42
39
  }
43
40
  else {
44
- const scene = context.configuration.scene;
45
- 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));
46
- this.runningAnimatable.setValue(animatable, context);
47
- contextAnimatables.push(animatable);
41
+ // if an animation group was already created, dispose it and create a new one
42
+ const currentAnimationGroup = this.currentAnimationGroup.getValue(context);
43
+ if (currentAnimationGroup && currentAnimationGroup !== ag) {
44
+ currentAnimationGroup.dispose();
45
+ }
46
+ let animationGroupToUse = ag;
47
+ // check which animation to use. If no animationGroup was defined and an animation was provided, use the animation
48
+ if (animation && !animationGroupToUse) {
49
+ const target = this.object.getValue(context);
50
+ if (!target) {
51
+ this.error.payload = { message: "No target object provided" };
52
+ this.error._activateSignal(context);
53
+ return;
54
+ }
55
+ const animationsArray = Array.isArray(animation) ? animation : [animation];
56
+ const name = animationsArray[0].name;
57
+ animationGroupToUse = new AnimationGroup("flowGraphAnimationGroup-" + name + "-" + target.name, context.configuration.scene);
58
+ let isInterpolation = false;
59
+ const interpolationAnimations = context._getGlobalContextVariable("interpolationAnimations", []);
60
+ for (const anim of animationsArray) {
61
+ animationGroupToUse.addTargetedAnimation(anim, target);
62
+ if (interpolationAnimations.indexOf(anim.uniqueId) !== -1) {
63
+ isInterpolation = true;
64
+ }
65
+ }
66
+ if (isInterpolation) {
67
+ this._checkInterpolationDuplications(context, animationsArray, target);
68
+ }
69
+ }
70
+ // not accepting 0
71
+ const speed = this.speed.getValue(context) || 1;
72
+ const from = this.from.getValue(context) ?? 0;
73
+ // not accepting 0
74
+ const to = this.to.getValue(context) || animationGroupToUse.to;
75
+ const loop = this.loop.getValue(context);
76
+ this.currentAnimationGroup.setValue(animationGroupToUse, context);
77
+ const currentlyRunningAnimationGroups = context._getGlobalContextVariable("currentlyRunningAnimationGroups", []);
78
+ // check if it already running
79
+ if (currentlyRunningAnimationGroups.indexOf(animationGroupToUse.uniqueId) !== -1) {
80
+ animationGroupToUse.stop();
81
+ }
82
+ animationGroupToUse.start(loop, speed, from, to);
83
+ animationGroupToUse.onAnimationGroupEndObservable.add(() => this._onAnimationGroupEnd(context));
84
+ animationGroupToUse.onAnimationEndObservable.add(() => this._eventsSignalOutputs["animationEnd"]._activateSignal(context));
85
+ animationGroupToUse.onAnimationLoopObservable.add(() => this._eventsSignalOutputs["animationLoop"]._activateSignal(context));
86
+ animationGroupToUse.onAnimationGroupLoopObservable.add(() => this._eventsSignalOutputs["animationGroupLoop"]._activateSignal(context));
87
+ currentlyRunningAnimationGroups.push(animationGroupToUse.uniqueId);
88
+ context._setGlobalContextVariable("currentlyRunningAnimationGroups", currentlyRunningAnimationGroups);
89
+ }
90
+ }
91
+ /**
92
+ * @internal
93
+ */
94
+ _executeOnTick(_context) {
95
+ const ag = this.currentAnimationGroup.getValue(_context);
96
+ if (ag) {
97
+ this.currentFrame.setValue(ag.getCurrentFrame(), _context);
98
+ this.currentTime.setValue(ag.animatables[0]?.elapsedTime ?? 0, _context);
48
99
  }
49
- context._setExecutionVariable(this, "runningAnimatables", contextAnimatables);
50
100
  }
51
101
  _execute(context) {
52
102
  this._startPendingTasks(context);
53
- this.out._activateSignal(context);
54
103
  }
55
- _onAnimationEnd(animatable, context) {
56
- const contextAnims = context._getExecutionVariable(this, "runningAnimatables") ?? [];
57
- const index = contextAnims.indexOf(animatable);
58
- if (index !== -1) {
59
- contextAnims.splice(index, 1);
60
- }
61
- context._removePendingBlock(this);
104
+ _onAnimationGroupEnd(context) {
105
+ this._removeFromCurrentlyRunning(context, this.currentAnimationGroup.getValue(context));
106
+ this._resetAfterCanceled(context);
62
107
  this.done._activateSignal(context);
63
108
  }
109
+ /**
110
+ * The idea behind this function is to check every running animation group and check if the targeted animations it uses are interpolation animations.
111
+ * If they are, we want to see that they don't collide with the current interpolation animations that are starting to play.
112
+ * If they do, we want to stop the already-running animation group.
113
+ * @internal
114
+ */
115
+ _checkInterpolationDuplications(context, animation, target) {
116
+ const currentlyRunningAnimationGroups = context._getGlobalContextVariable("currentlyRunningAnimationGroups", []);
117
+ for (const uniqueId of currentlyRunningAnimationGroups) {
118
+ const ag = context.assetsContext.animationGroups.find((ag) => ag.uniqueId === uniqueId);
119
+ if (ag) {
120
+ for (const anim of ag.targetedAnimations) {
121
+ for (const animToCheck of animation) {
122
+ if (anim.animation.targetProperty === animToCheck.targetProperty && anim.target === target) {
123
+ this._stopAnimationGroup(context, ag);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ _stopAnimationGroup(context, animationGroup) {
131
+ // stop, while skipping the on AnimationEndObservable to avoid the "done" signal
132
+ animationGroup.stop(true);
133
+ animationGroup.dispose();
134
+ this._removeFromCurrentlyRunning(context, animationGroup);
135
+ }
136
+ _removeFromCurrentlyRunning(context, animationGroup) {
137
+ const currentlyRunningAnimationGroups = context._getGlobalContextVariable("currentlyRunningAnimationGroups", []);
138
+ const idx = currentlyRunningAnimationGroups.indexOf(animationGroup.uniqueId);
139
+ if (idx !== -1) {
140
+ currentlyRunningAnimationGroups.splice(idx, 1);
141
+ context._setGlobalContextVariable("currentlyRunningAnimationGroups", currentlyRunningAnimationGroups);
142
+ }
143
+ }
64
144
  /**
65
145
  * @internal
66
146
  * Stop any currently running animations.
67
147
  */
68
148
  _cancelPendingTasks(context) {
69
- const contextAnims = context._getExecutionVariable(this, "runningAnimatables") ?? [];
70
- for (const anim of contextAnims) {
71
- anim.stop();
149
+ const ag = this.currentAnimationGroup.getValue(context);
150
+ if (ag) {
151
+ this._stopAnimationGroup(context, ag);
72
152
  }
73
- context._deleteExecutionVariable(this, "runningAnimatables");
74
153
  }
75
154
  /**
76
155
  * @returns class name of the block.
77
156
  */
78
157
  getClassName() {
79
- return FlowGraphPlayAnimationBlock.ClassName;
80
- }
81
- /**
82
- * Serializes the block to a JSON object.
83
- * @param serializationObject the object to serialize to.
84
- */
85
- serialize(serializationObject = {}) {
86
- super.serialize(serializationObject);
87
- serializationObject.config.targetPath = this.config.targetPath;
88
- serializationObject.config.animationPath = this.config.animationPath;
158
+ return "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */;
89
159
  }
90
160
  }
91
- /**
92
- * Class name of the block.
93
- */
94
- FlowGraphPlayAnimationBlock.ClassName = "FGPlayAnimationBlock";
95
- RegisterClass(FlowGraphPlayAnimationBlock.ClassName, FlowGraphPlayAnimationBlock);
161
+ RegisterClass("FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */, FlowGraphPlayAnimationBlock);
96
162
  //# sourceMappingURL=flowGraphPlayAnimationBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphPlayAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,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CAAC;IACzE,CAAC;;AAED;;GAEG;AACW,qCAAS,GAAG,sBAAsB,CAAC;AAGrD,aAAa,CAAC,2BAA2B,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { Animatable } from \"../../../../Animations/animatable.core\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"../../../flowGraphAsyncExecutionBlock\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeBoolean } from \"../../../flowGraphRichTypes\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport type { IPathToObjectConverter } from \"../../../../ObjectModel/objectModelInterfaces\";\r\nimport { FlowGraphPathConverterComponent } from \"../../../flowGraphPathConverterComponent\";\r\nimport type { IObjectAccessor } from \"../../../typeDefinitions\";\r\n\r\n/**\r\n * @experimental\r\n */\r\nexport interface IFlowGraphPlayAnimationBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The path to the target object that will be animated.\r\n */\r\n targetPath: string;\r\n /**\r\n * The path to the animation that will be played.\r\n */\r\n animationPath: string;\r\n /**\r\n * The path converter to use to convert the path to an object accessor.\r\n */\r\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n/**\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 * The substitution inputs for template strings in the target\r\n */\r\n public readonly templateTargetComponent: FlowGraphPathConverterComponent;\r\n /**\r\n * The substitution inputs for template strings in the animation\r\n */\r\n public readonly templateAnimationComponent: FlowGraphPathConverterComponent;\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 animatable that is currently running.\r\n */\r\n public readonly runningAnimatable: FlowGraphDataConnection<Animatable>;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config: IFlowGraphPlayAnimationBlockConfiguration\r\n ) {\r\n super(config);\r\n\r\n this.templateTargetComponent = new FlowGraphPathConverterComponent(config.targetPath, this);\r\n this.templateAnimationComponent = new FlowGraphPathConverterComponent(config.animationPath, this);\r\n\r\n this.speed = this.registerDataInput(\"speed\", RichTypeNumber);\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\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 targetAccessor = this.templateTargetComponent.getAccessor(this.config.pathConverter, context);\r\n const targetValue = targetAccessor.info.getObject(targetAccessor.object);\r\n const animationAccessor = this.templateAnimationComponent.getAccessor(this.config.pathConverter, context);\r\n const animationValue = animationAccessor.info.get(animationAccessor.object);\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 contextAnimatables = (context._getExecutionVariable(this, \"runningAnimatables\") as Animatable[]) ?? [];\r\n\r\n // was an animation started on this target already and was just paused? if so, we can unpause it.\r\n const existingAnimatable = this.runningAnimatable.getValue(context);\r\n if (existingAnimatable && existingAnimatable.paused) {\r\n existingAnimatable.restart();\r\n } else {\r\n const scene = context.configuration.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.setValue(animatable, context);\r\n contextAnimatables.push(animatable);\r\n }\r\n\r\n context._setExecutionVariable(this, \"runningAnimatables\", contextAnimatables);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n this._startPendingTasks(context);\r\n\r\n this.out._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.done._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 /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphPlayAnimationBlock.ClassName;\r\n }\r\n\r\n /**\r\n * Serializes the block to a JSON object.\r\n * @param serializationObject the object to serialize to.\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.config.targetPath = this.config.targetPath;\r\n serializationObject.config.animationPath = this.config.animationPath;\r\n }\r\n\r\n /**\r\n * Class name of the block.\r\n */\r\n public static ClassName = \"FGPlayAnimationBlock\";\r\n}\r\n\r\nRegisterClass(FlowGraphPlayAnimationBlock.ClassName, FlowGraphPlayAnimationBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphPlayAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/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AAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;4BACzF,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;wBAC1C,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAEO,mBAAmB,CAAC,OAAyB,EAAE,cAA8B;QACjF,gFAAgF;QAChF,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,cAAc,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9D,CAAC;IAEO,2BAA2B,CAAC,OAAyB,EAAE,cAA8B;QACzF,MAAM,+BAA+B,GAAG,OAAO,CAAC,yBAAyB,CAAC,iCAAiC,EAAE,EAAE,CAAa,CAAC;QAC7H,MAAM,GAAG,GAAG,+BAA+B,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC7E,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;YACb,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAC/C,OAAO,CAAC,yBAAyB,CAAC,iCAAiC,EAAE,+BAA+B,CAAC,CAAC;QAC1G,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,mBAAmB,CAAC,OAAyB;QAChD,MAAM,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,EAAE,EAAE,CAAC;YACL,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,6EAAyC;IAC7C,CAAC;CACJ;AAED,aAAa,wEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"../../../flowGraphAsyncExecutionBlock\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeBoolean } from \"../../../flowGraphRichTypes\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport type { Animation } from \"core/Animations/animation\";\r\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\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 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 * Not in glTF specs, but useful for the engine.\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 current frame of the animation.\r\n */\r\n public readonly currentFrame: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output connection: The current time of the animation.\r\n */\r\n public readonly currentTime: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output connection: The animatable that is currently running.\r\n */\r\n public readonly currentAnimationGroup: FlowGraphDataConnection<AnimationGroup>;\r\n\r\n /**\r\n * Input: Will be initialized if no animation group was provided in the configuration.\r\n */\r\n public readonly animationGroup: FlowGraphDataConnection<AnimationGroup>;\r\n\r\n /**\r\n * Input: If provided this animation will be used. Priority will be given to the animation group input.\r\n */\r\n public readonly animation: FlowGraphDataConnection<Animation | Animation[]>;\r\n\r\n /**\r\n * Input connection: The target object that will be animated. If animation group is provided this input will be ignored.\r\n */\r\n public readonly object: FlowGraphDataConnection<any>;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config?: IFlowGraphBlockConfiguration\r\n ) {\r\n super(config, [\"animationLoop\", \"animationEnd\", \"animationGroupLoop\"]);\r\n\r\n this.speed = this.registerDataInput(\"speed\", RichTypeNumber);\r\n this.loop = this.registerDataInput(\"loop\", RichTypeBoolean);\r\n this.from = this.registerDataInput(\"from\", RichTypeNumber, 0);\r\n this.to = this.registerDataInput(\"to\", RichTypeNumber);\r\n\r\n this.currentFrame = this.registerDataOutput(\"currentFrame\", RichTypeNumber);\r\n this.currentTime = this.registerDataOutput(\"currentTime\", RichTypeNumber);\r\n\r\n this.currentAnimationGroup = this.registerDataOutput(\"currentAnimationGroup\", RichTypeAny);\r\n this.animationGroup = this.registerDataInput(\"animationGroup\", RichTypeAny, config?.animationGroup);\r\n this.animation = this.registerDataInput(\"animation\", RichTypeAny);\r\n this.object = this.registerDataInput(\"object\", 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 ag = this.animationGroup.getValue(context);\r\n const animation = this.animation.getValue(context);\r\n if (!ag && !animation) {\r\n this.error.payload = { message: \"No animation group or animation provided\" };\r\n this.error._activateSignal(context);\r\n return;\r\n } else {\r\n // if an animation group was already created, dispose it and create a new one\r\n const currentAnimationGroup = this.currentAnimationGroup.getValue(context);\r\n if (currentAnimationGroup && currentAnimationGroup !== ag) {\r\n currentAnimationGroup.dispose();\r\n }\r\n let animationGroupToUse = ag;\r\n // check which animation to use. If no animationGroup was defined and an animation was provided, use the animation\r\n if (animation && !animationGroupToUse) {\r\n const target = this.object.getValue(context);\r\n if (!target) {\r\n this.error.payload = { message: \"No target object provided\" };\r\n this.error._activateSignal(context);\r\n return;\r\n }\r\n const animationsArray = Array.isArray(animation) ? animation : [animation];\r\n const name = animationsArray[0].name;\r\n animationGroupToUse = new AnimationGroup(\"flowGraphAnimationGroup-\" + name + \"-\" + target.name, context.configuration.scene);\r\n let isInterpolation = false;\r\n const interpolationAnimations = context._getGlobalContextVariable(\"interpolationAnimations\", []) as number[];\r\n for (const anim of animationsArray) {\r\n animationGroupToUse.addTargetedAnimation(anim, target);\r\n if (interpolationAnimations.indexOf(anim.uniqueId) !== -1) {\r\n isInterpolation = true;\r\n }\r\n }\r\n\r\n if (isInterpolation) {\r\n this._checkInterpolationDuplications(context, animationsArray, target);\r\n }\r\n }\r\n // not accepting 0\r\n const speed = this.speed.getValue(context) || 1;\r\n const from = this.from.getValue(context) ?? 0;\r\n // not accepting 0\r\n const to = this.to.getValue(context) || animationGroupToUse.to;\r\n const loop = this.loop.getValue(context);\r\n this.currentAnimationGroup.setValue(animationGroupToUse, context);\r\n\r\n const currentlyRunningAnimationGroups = context._getGlobalContextVariable(\"currentlyRunningAnimationGroups\", []) as number[];\r\n // check if it already running\r\n if (currentlyRunningAnimationGroups.indexOf(animationGroupToUse.uniqueId) !== -1) {\r\n animationGroupToUse.stop();\r\n }\r\n animationGroupToUse.start(loop, speed, from, to);\r\n animationGroupToUse.onAnimationGroupEndObservable.add(() => this._onAnimationGroupEnd(context));\r\n animationGroupToUse.onAnimationEndObservable.add(() => this._eventsSignalOutputs[\"animationEnd\"]._activateSignal(context));\r\n animationGroupToUse.onAnimationLoopObservable.add(() => this._eventsSignalOutputs[\"animationLoop\"]._activateSignal(context));\r\n animationGroupToUse.onAnimationGroupLoopObservable.add(() => this._eventsSignalOutputs[\"animationGroupLoop\"]._activateSignal(context));\r\n currentlyRunningAnimationGroups.push(animationGroupToUse.uniqueId);\r\n context._setGlobalContextVariable(\"currentlyRunningAnimationGroups\", currentlyRunningAnimationGroups);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _executeOnTick(_context: FlowGraphContext): void {\r\n const ag = this.currentAnimationGroup.getValue(_context);\r\n if (ag) {\r\n this.currentFrame.setValue(ag.getCurrentFrame(), _context);\r\n this.currentTime.setValue(ag.animatables[0]?.elapsedTime ?? 0, _context);\r\n }\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n this._startPendingTasks(context);\r\n }\r\n\r\n private _onAnimationGroupEnd(context: FlowGraphContext) {\r\n this._removeFromCurrentlyRunning(context, this.currentAnimationGroup.getValue(context));\r\n this._resetAfterCanceled(context);\r\n this.done._activateSignal(context);\r\n }\r\n\r\n /**\r\n * The idea behind this function is to check every running animation group and check if the targeted animations it uses are interpolation animations.\r\n * If they are, we want to see that they don't collide with the current interpolation animations that are starting to play.\r\n * If they do, we want to stop the already-running animation group.\r\n * @internal\r\n */\r\n private _checkInterpolationDuplications(context: FlowGraphContext, animation: Animation[], target: any) {\r\n const currentlyRunningAnimationGroups = context._getGlobalContextVariable(\"currentlyRunningAnimationGroups\", []) as number[];\r\n for (const uniqueId of currentlyRunningAnimationGroups) {\r\n const ag = context.assetsContext.animationGroups.find((ag) => ag.uniqueId === uniqueId);\r\n if (ag) {\r\n for (const anim of ag.targetedAnimations) {\r\n for (const animToCheck of animation) {\r\n if (anim.animation.targetProperty === animToCheck.targetProperty && anim.target === target) {\r\n this._stopAnimationGroup(context, ag);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _stopAnimationGroup(context: FlowGraphContext, animationGroup: AnimationGroup) {\r\n // stop, while skipping the on AnimationEndObservable to avoid the \"done\" signal\r\n animationGroup.stop(true);\r\n animationGroup.dispose();\r\n this._removeFromCurrentlyRunning(context, animationGroup);\r\n }\r\n\r\n private _removeFromCurrentlyRunning(context: FlowGraphContext, animationGroup: AnimationGroup) {\r\n const currentlyRunningAnimationGroups = context._getGlobalContextVariable(\"currentlyRunningAnimationGroups\", []) as number[];\r\n const idx = currentlyRunningAnimationGroups.indexOf(animationGroup.uniqueId);\r\n if (idx !== -1) {\r\n currentlyRunningAnimationGroups.splice(idx, 1);\r\n context._setGlobalContextVariable(\"currentlyRunningAnimationGroups\", currentlyRunningAnimationGroups);\r\n }\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 ag = this.currentAnimationGroup.getValue(context);\r\n if (ag) {\r\n this._stopAnimationGroup(context, ag);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.PlayAnimation;\r\n }\r\n}\r\n\r\nRegisterClass(FlowGraphBlockNames.PlayAnimation, FlowGraphPlayAnimationBlock);\r\n"]}
@@ -1,21 +1,29 @@
1
1
  import type { FlowGraphContext } from "../../../flowGraphContext";
2
2
  import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
3
- import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal";
4
- import type { Animatable } from "../../../../Animations/animatable.core";
5
3
  import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
4
+ import type { AnimationGroup } from "../../../../Animations/animationGroup.js";
5
+ import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock.js";
6
6
  /**
7
7
  * @experimental
8
8
  * Block that stops a running animation
9
9
  */
10
- export declare class FlowGraphStopAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {
10
+ export declare class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
11
11
  /**
12
12
  * Input connection: The animation to stop.
13
13
  */
14
- readonly animationToStop: FlowGraphDataConnection<Animatable>;
14
+ readonly animationGroup: FlowGraphDataConnection<AnimationGroup>;
15
+ /**
16
+ * Input connection - if defined (positive integer) the animation will stop at this frame.
17
+ */
18
+ readonly stopAtFrame: FlowGraphDataConnection<number>;
15
19
  constructor(config?: IFlowGraphBlockConfiguration);
20
+ _preparePendingTasks(context: FlowGraphContext): void;
21
+ _cancelPendingTasks(context: FlowGraphContext): void;
16
22
  _execute(context: FlowGraphContext): void;
23
+ _executeOnTick(context: FlowGraphContext): void;
17
24
  /**
18
25
  * @returns class name of the block.
19
26
  */
20
27
  getClassName(): string;
28
+ private _stopAnimation;
21
29
  }
@@ -1,26 +1,104 @@
1
- import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal.js";
2
- import { RichTypeAny } from "../../../flowGraphRichTypes.js";
1
+ import { RichTypeAny, RichTypeNumber } from "../../../flowGraphRichTypes.js";
3
2
  import { RegisterClass } from "../../../../Misc/typeStore.js";
3
+ import { Logger } from "../../../../Misc/logger.js";
4
+ import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock.js";
4
5
  /**
5
6
  * @experimental
6
7
  * Block that stops a running animation
7
8
  */
8
- export class FlowGraphStopAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {
9
+ export class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
9
10
  constructor(config) {
10
11
  super(config);
11
- this.animationToStop = this.registerDataInput("animationToStop", RichTypeAny);
12
+ this.animationGroup = this.registerDataInput("animationGroup", RichTypeAny);
13
+ this.stopAtFrame = this.registerDataInput("stopAtFrame", RichTypeNumber, -1);
14
+ }
15
+ _preparePendingTasks(context) {
16
+ const animationToStopValue = this.animationGroup.getValue(context);
17
+ const stopAtFrame = this.stopAtFrame.getValue(context) ?? -1;
18
+ // get the context variable
19
+ const pendingStopAnimations = context._getGlobalContextVariable("pendingStopAnimations", []);
20
+ // add the animation to the list
21
+ pendingStopAnimations.push({ uniqueId: animationToStopValue.uniqueId, stopAtFrame });
22
+ // set the global context variable
23
+ context._setGlobalContextVariable("pendingStopAnimations", pendingStopAnimations);
24
+ }
25
+ _cancelPendingTasks(context) {
26
+ // remove the animation from the list
27
+ const animationToStopValue = this.animationGroup.getValue(context);
28
+ const pendingStopAnimations = context._getGlobalContextVariable("pendingStopAnimations", []);
29
+ for (let i = 0; i < pendingStopAnimations.length; i++) {
30
+ if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId) {
31
+ pendingStopAnimations.splice(i, 1);
32
+ // set the global context variable
33
+ context._setGlobalContextVariable("pendingStopAnimations", pendingStopAnimations);
34
+ break;
35
+ }
36
+ }
12
37
  }
13
38
  _execute(context) {
14
- const animationToStopValue = this.animationToStop.getValue(context);
15
- animationToStopValue.stop();
39
+ const animationToStopValue = this.animationGroup.getValue(context);
40
+ const stopTime = this.stopAtFrame.getValue(context) ?? -1;
41
+ // check the values
42
+ if (!animationToStopValue) {
43
+ Logger.Warn("No animation group provided to stop.");
44
+ this.error.payload = { message: "No animation group provided to stop." };
45
+ this.error._activateSignal(context);
46
+ }
47
+ if (isNaN(stopTime)) {
48
+ Logger.Warn("Invalid stop time provided.");
49
+ this.error.payload = { message: "Invalid stop time provided." };
50
+ this.error._activateSignal(context);
51
+ }
52
+ if (stopTime > 0) {
53
+ this._startPendingTasks(context);
54
+ }
55
+ else {
56
+ this._stopAnimation(animationToStopValue, context);
57
+ }
16
58
  this.out._activateSignal(context);
17
59
  }
60
+ _executeOnTick(context) {
61
+ const animationToStopValue = this.animationGroup.getValue(context);
62
+ // check each frame if any animation should be stopped
63
+ const pendingStopAnimations = context._getGlobalContextVariable("pendingStopAnimations", []);
64
+ for (let i = 0; i < pendingStopAnimations.length; i++) {
65
+ // compare the uniqueId to the animation to stop
66
+ if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId) {
67
+ // check if the current frame is AFTER the stopAtFrame
68
+ if (animationToStopValue.getCurrentFrame() >= pendingStopAnimations[i].stopAtFrame) {
69
+ // stop the animation
70
+ this._stopAnimation(animationToStopValue, context);
71
+ // remove the animation from the list
72
+ pendingStopAnimations.splice(i, 1);
73
+ // set the global context variable
74
+ context._setGlobalContextVariable("pendingStopAnimations", pendingStopAnimations);
75
+ this.done._activateSignal(context);
76
+ context._removePendingBlock(this);
77
+ break;
78
+ }
79
+ }
80
+ }
81
+ }
18
82
  /**
19
83
  * @returns class name of the block.
20
84
  */
21
85
  getClassName() {
22
- return "FGStopAnimationBlock";
86
+ return "FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */;
87
+ }
88
+ _stopAnimation(animationGroup, context) {
89
+ const currentlyRunning = context._getGlobalContextVariable("currentlyRunningAnimationGroups", []);
90
+ const index = currentlyRunning.indexOf(animationGroup.uniqueId);
91
+ if (index !== -1) {
92
+ animationGroup.stop();
93
+ currentlyRunning.splice(index, 1);
94
+ // update the global context variable
95
+ context._setGlobalContextVariable("currentlyRunningAnimationGroups", currentlyRunning);
96
+ }
97
+ else {
98
+ // Logger.Warn("Trying to stop an animation that is not running.");
99
+ // no-op for now. Probably no need to log anything here.
100
+ }
23
101
  }
24
102
  }
25
- RegisterClass("FGStopAnimationBlock", FlowGraphStopAnimationBlock);
103
+ RegisterClass("FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */, FlowGraphStopAnimationBlock);
26
104
  //# sourceMappingURL=flowGraphStopAnimationBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphStopAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,oCAAoC;IAMjF,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAClF,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,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,sBAAsB,CAAC;IAClC,CAAC;CACJ;AACD,aAAa,CAAC,sBAAsB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal\";\r\nimport type { Animatable } from \"../../../../Animations/animatable.core\";\r\nimport { RichTypeAny } from \"../../../flowGraphRichTypes\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n/**\r\n * @experimental\r\n * Block that stops a running animation\r\n */\r\nexport class FlowGraphStopAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The animation to stop.\r\n */\r\n public readonly animationToStop: FlowGraphDataConnection<Animatable>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\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.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return \"FGStopAnimationBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGStopAnimationBlock\", FlowGraphStopAnimationBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphStopAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,MAAM,EAAE,mCAAy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AAC,EAAE,CAAC;YACf,cAAc,CAAC,IAAI,EAAE,CAAC;YACtB,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAClC,qCAAqC;YACrC,OAAO,CAAC,yBAAyB,CAAC,iCAAiC,EAAE,gBAAgB,CAAC,CAAC;QAC3F,CAAC;aAAM,CAAC;YACJ,mEAAmE;YACnE,wDAAwD;QAC5D,CAAC;IACL,CAAC;CACJ;AACD,aAAa,wEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { RichTypeAny, RichTypeNumber } from \"../../../flowGraphRichTypes\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"core/FlowGraph/flowGraphAsyncExecutionBlock\";\r\n/**\r\n * @experimental\r\n * Block that stops a running animation\r\n */\r\nexport class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * Input connection: The animation to stop.\r\n */\r\n public readonly animationGroup: FlowGraphDataConnection<AnimationGroup>;\r\n\r\n /**\r\n * Input connection - if defined (positive integer) the animation will stop at this frame.\r\n */\r\n public readonly stopAtFrame: FlowGraphDataConnection<number>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.animationGroup = this.registerDataInput(\"animationGroup\", RichTypeAny);\r\n this.stopAtFrame = this.registerDataInput(\"stopAtFrame\", RichTypeNumber, -1);\r\n }\r\n\r\n public override _preparePendingTasks(context: FlowGraphContext): void {\r\n const animationToStopValue = this.animationGroup.getValue(context);\r\n const stopAtFrame = this.stopAtFrame.getValue(context) ?? -1;\r\n // get the context variable\r\n const pendingStopAnimations = context._getGlobalContextVariable(\r\n \"pendingStopAnimations\",\r\n [] as {\r\n uniqueId: number;\r\n stopAtFrame: number;\r\n }[]\r\n );\r\n // add the animation to the list\r\n pendingStopAnimations.push({ uniqueId: animationToStopValue.uniqueId, stopAtFrame });\r\n // set the global context variable\r\n context._setGlobalContextVariable(\"pendingStopAnimations\", pendingStopAnimations);\r\n }\r\n public override _cancelPendingTasks(context: FlowGraphContext): void {\r\n // remove the animation from the list\r\n const animationToStopValue = this.animationGroup.getValue(context);\r\n const pendingStopAnimations = context._getGlobalContextVariable(\r\n \"pendingStopAnimations\",\r\n [] as {\r\n uniqueId: number;\r\n stopAtFrame: number;\r\n }[]\r\n );\r\n for (let i = 0; i < pendingStopAnimations.length; i++) {\r\n if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId) {\r\n pendingStopAnimations.splice(i, 1);\r\n // set the global context variable\r\n context._setGlobalContextVariable(\"pendingStopAnimations\", pendingStopAnimations);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToStopValue = this.animationGroup.getValue(context);\r\n const stopTime = this.stopAtFrame.getValue(context) ?? -1;\r\n // check the values\r\n if (!animationToStopValue) {\r\n Logger.Warn(\"No animation group provided to stop.\");\r\n this.error.payload = { message: \"No animation group provided to stop.\" };\r\n this.error._activateSignal(context);\r\n }\r\n if (isNaN(stopTime)) {\r\n Logger.Warn(\"Invalid stop time provided.\");\r\n this.error.payload = { message: \"Invalid stop time provided.\" };\r\n this.error._activateSignal(context);\r\n }\r\n if (stopTime > 0) {\r\n this._startPendingTasks(context);\r\n } else {\r\n this._stopAnimation(animationToStopValue, context);\r\n }\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public override _executeOnTick(context: FlowGraphContext): void {\r\n const animationToStopValue = this.animationGroup.getValue(context);\r\n // check each frame if any animation should be stopped\r\n const pendingStopAnimations = context._getGlobalContextVariable(\"pendingStopAnimations\", [] as { uniqueId: number; stopAtFrame: number }[]);\r\n for (let i = 0; i < pendingStopAnimations.length; i++) {\r\n // compare the uniqueId to the animation to stop\r\n if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId) {\r\n // check if the current frame is AFTER the stopAtFrame\r\n if (animationToStopValue.getCurrentFrame() >= pendingStopAnimations[i].stopAtFrame) {\r\n // stop the animation\r\n this._stopAnimation(animationToStopValue, context);\r\n // remove the animation from the list\r\n pendingStopAnimations.splice(i, 1);\r\n // set the global context variable\r\n context._setGlobalContextVariable(\"pendingStopAnimations\", pendingStopAnimations);\r\n this.done._activateSignal(context);\r\n context._removePendingBlock(this);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.StopAnimation;\r\n }\r\n\r\n private _stopAnimation(animationGroup: AnimationGroup, context: FlowGraphContext): void {\r\n const currentlyRunning = context._getGlobalContextVariable(\"currentlyRunningAnimationGroups\", []) as number[];\r\n const index = currentlyRunning.indexOf(animationGroup.uniqueId);\r\n if (index !== -1) {\r\n animationGroup.stop();\r\n currentlyRunning.splice(index, 1);\r\n // update the global context variable\r\n context._setGlobalContextVariable(\"currentlyRunningAnimationGroups\", currentlyRunning);\r\n } else {\r\n // Logger.Warn(\"Trying to stop an animation that is not running.\");\r\n // no-op for now. Probably no need to log anything here.\r\n }\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.StopAnimation, FlowGraphStopAnimationBlock);\r\n"]}
@@ -1,3 +1,6 @@
1
1
  export * from "./flowGraphPlayAnimationBlock";
2
2
  export * from "./flowGraphStopAnimationBlock";
3
3
  export * from "./flowGraphPauseAnimationBlock";
4
+ export * from "./flowGraphInterpolationBlock";
5
+ export * from "./flowGraphEasingBlock";
6
+ export * from "./flowGraphBezierCurveEasingBlock";
@@ -1,4 +1,7 @@
1
1
  export * from "./flowGraphPlayAnimationBlock.js";
2
2
  export * from "./flowGraphStopAnimationBlock.js";
3
3
  export * from "./flowGraphPauseAnimationBlock.js";
4
+ export * from "./flowGraphInterpolationBlock.js";
5
+ export * from "./flowGraphEasingBlock.js";
6
+ export * from "./flowGraphBezierCurveEasingBlock.js";
4
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./flowGraphPlayAnimationBlock\";\r\nexport * from \"./flowGraphStopAnimationBlock\";\r\nexport * from \"./flowGraphPauseAnimationBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC","sourcesContent":["export * from \"./flowGraphPlayAnimationBlock\";\r\nexport * from \"./flowGraphStopAnimationBlock\";\r\nexport * from \"./flowGraphPauseAnimationBlock\";\r\nexport * from \"./flowGraphInterpolationBlock\";\r\nexport * from \"./flowGraphEasingBlock\";\r\nexport * from \"./flowGraphBezierCurveEasingBlock\";\r\n"]}
@@ -4,8 +4,7 @@ import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock";
4
4
  import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnection";
5
5
  import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
6
6
  /**
7
- * @experimental
8
- * A block that evaluates a condition and executes one of two branches.
7
+ * A block that evaluates a condition and activates one of two branches.
9
8
  */
10
9
  export declare class FlowGraphBranchBlock extends FlowGraphExecutionBlock {
11
10
  /**
@@ -2,8 +2,7 @@ import { RichTypeBoolean } from "../../../flowGraphRichTypes.js";
2
2
  import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock.js";
3
3
  import { RegisterClass } from "../../../../Misc/typeStore.js";
4
4
  /**
5
- * @experimental
6
- * A block that evaluates a condition and executes one of two branches.
5
+ * A block that evaluates a condition and activates one of two branches.
7
6
  */
8
7
  export class FlowGraphBranchBlock extends FlowGraphExecutionBlock {
9
8
  constructor(config) {
@@ -24,8 +23,8 @@ export class FlowGraphBranchBlock extends FlowGraphExecutionBlock {
24
23
  * @returns class name of the block.
25
24
  */
26
25
  getClassName() {
27
- return "FGBranchBlock";
26
+ return "FlowGraphBranchBlock" /* FlowGraphBlockNames.Branch */;
28
27
  }
29
28
  }
30
- RegisterClass("FGBranchBlock", FlowGraphBranchBlock);
29
+ RegisterClass("FlowGraphBranchBlock" /* FlowGraphBlockNames.Branch */, FlowGraphBranchBlock);
31
30
  //# sourceMappingURL=flowGraphBranchBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphBranchBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,uBAAuB;IAc7D,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAEtE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,eAAe,CAAC;IAC3B,CAAC;CACJ;AACD,aAAa,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { RichTypeBoolean } from \"../../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlock } from \"../../../flowGraphExecutionBlock\";\r\nimport type { FlowGraphSignalConnection } from \"../../../flowGraphSignalConnection\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n * A block that evaluates a condition and executes one of two branches.\r\n */\r\nexport class FlowGraphBranchBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * Input connection: The condition to evaluate.\r\n */\r\n public readonly condition: FlowGraphDataConnection<boolean>;\r\n /**\r\n * Output connection: The branch to execute if the condition is true.\r\n */\r\n public readonly onTrue: FlowGraphSignalConnection;\r\n /**\r\n * Output connection: The branch to execute if the condition is false.\r\n */\r\n public readonly onFalse: FlowGraphSignalConnection;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.condition = this.registerDataInput(\"condition\", RichTypeBoolean);\r\n\r\n this.onTrue = this._registerSignalOutput(\"onTrue\");\r\n this.onFalse = this._registerSignalOutput(\"onFalse\");\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n if (this.condition.getValue(context)) {\r\n this.onTrue._activateSignal(context);\r\n } else {\r\n this.onFalse._activateSignal(context);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return \"FGBranchBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGBranchBlock\", FlowGraphBranchBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphBranchBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,uBAAuB;IAc7D,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAEtE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,+DAAkC;IACtC,CAAC;CACJ;AACD,aAAa,0DAA6B,oBAAoB,CAAC,CAAC","sourcesContent":["import { RichTypeBoolean } from \"../../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlock } from \"../../../flowGraphExecutionBlock\";\r\nimport type { FlowGraphSignalConnection } from \"../../../flowGraphSignalConnection\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\r\n\r\n/**\r\n * A block that evaluates a condition and activates one of two branches.\r\n */\r\nexport class FlowGraphBranchBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * Input connection: The condition to evaluate.\r\n */\r\n public readonly condition: FlowGraphDataConnection<boolean>;\r\n /**\r\n * Output connection: The branch to execute if the condition is true.\r\n */\r\n public readonly onTrue: FlowGraphSignalConnection;\r\n /**\r\n * Output connection: The branch to execute if the condition is false.\r\n */\r\n public readonly onFalse: FlowGraphSignalConnection;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.condition = this.registerDataInput(\"condition\", RichTypeBoolean);\r\n\r\n this.onTrue = this._registerSignalOutput(\"onTrue\");\r\n this.onFalse = this._registerSignalOutput(\"onFalse\");\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n if (this.condition.getValue(context)) {\r\n this.onTrue._activateSignal(context);\r\n } else {\r\n this.onFalse._activateSignal(context);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.Branch;\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.Branch, FlowGraphBranchBlock);\r\n"]}
@@ -1,18 +1,16 @@
1
- import { Sound } from "../../../../Audio/sound";
1
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
2
2
  import type { FlowGraphContext } from "../../../flowGraphContext";
3
3
  import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
4
- import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnection";
5
4
  import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal";
6
- import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
5
+ import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnection";
7
6
  /**
8
- * Stops an audio.
9
- * @experimental
7
+ * This block cancels a delay that was previously scheduled.
10
8
  */
11
- export declare class FlowGraphStopAudioBlock extends FlowGraphExecutionBlockWithOutSignal {
9
+ export declare class FlowGraphCancelDelayBlock extends FlowGraphExecutionBlockWithOutSignal {
12
10
  /**
13
- * Input connection: The audio to stop.
11
+ * Input connection: The index value of the scheduled activation to be cancelled.
14
12
  */
15
- readonly audio: FlowGraphDataConnection<Sound>;
13
+ readonly delayIndex: FlowGraphDataConnection<number>;
16
14
  constructor(config?: IFlowGraphBlockConfiguration);
17
15
  _execute(context: FlowGraphContext, _callingSignal: FlowGraphSignalConnection): void;
18
16
  getClassName(): string;
@@ -0,0 +1,31 @@
1
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
2
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal.js";
3
+ import { RichTypeNumber } from "../../../flowGraphRichTypes.js";
4
+ /**
5
+ * This block cancels a delay that was previously scheduled.
6
+ */
7
+ export class FlowGraphCancelDelayBlock extends FlowGraphExecutionBlockWithOutSignal {
8
+ constructor(config) {
9
+ super(config);
10
+ this.delayIndex = this.registerDataInput("delayIndex", RichTypeNumber);
11
+ }
12
+ _execute(context, _callingSignal) {
13
+ const delayIndex = this.delayIndex.getValue(context);
14
+ if (delayIndex <= 0 || isNaN(delayIndex) || !isFinite(delayIndex)) {
15
+ return this.error._activateSignal(context);
16
+ }
17
+ const timers = context._getExecutionVariable(this, "pendingDelays", []);
18
+ const timer = timers[delayIndex];
19
+ if (timer) {
20
+ timer.dispose();
21
+ // not removing it from the array. Disposing it will clear all of its resources
22
+ }
23
+ // activate the out output flow
24
+ this.out._activateSignal(context);
25
+ }
26
+ getClassName() {
27
+ return "FlowGraphCancelDelayBlock" /* FlowGraphBlockNames.CancelDelay */;
28
+ }
29
+ }
30
+ RegisterClass("FlowGraphCancelDelayBlock" /* FlowGraphBlockNames.CancelDelay */, FlowGraphCancelDelayBlock);
31
+ //# sourceMappingURL=flowGraphCancelDelayBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphCancelDelayBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAKpD,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAI7D;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,oCAAoC;IAM/E,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAC3E,CAAC;IAEM,QAAQ,CAAC,OAAyB,EAAE,cAAyC;QAChF,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,UAAU,IAAI,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAChE,OAAO,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,EAAqB,CAAC,CAAC;QAC3F,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE,CAAC;YACR,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,+EAA+E;QACnF,CAAC;QACD,+BAA+B;QAC/B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEe,YAAY;QACxB,yEAAuC;IAC3C,CAAC;CACJ;AAED,aAAa,oEAAkC,yBAAyB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"core/Misc/typeStore\";\nimport type { AdvancedTimer } from \"../../../../Misc/timer\";\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal\";\nimport { RichTypeNumber } from \"../../../flowGraphRichTypes\";\nimport type { FlowGraphSignalConnection } from \"../../../flowGraphSignalConnection\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\n\n/**\n * This block cancels a delay that was previously scheduled.\n */\nexport class FlowGraphCancelDelayBlock extends FlowGraphExecutionBlockWithOutSignal {\n /**\n * Input connection: The index value of the scheduled activation to be cancelled.\n */\n public readonly delayIndex: FlowGraphDataConnection<number>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.delayIndex = this.registerDataInput(\"delayIndex\", RichTypeNumber);\n }\n\n public _execute(context: FlowGraphContext, _callingSignal: FlowGraphSignalConnection): void {\n const delayIndex = this.delayIndex.getValue(context);\n if (delayIndex <= 0 || isNaN(delayIndex) || !isFinite(delayIndex)) {\n return this.error._activateSignal(context);\n }\n const timers = context._getExecutionVariable(this, \"pendingDelays\", [] as AdvancedTimer[]);\n const timer = timers[delayIndex];\n if (timer) {\n timer.dispose();\n // not removing it from the array. Disposing it will clear all of its resources\n }\n // activate the out output flow\n this.out._activateSignal(context);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CancelDelay;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.CancelDelay, FlowGraphCancelDelayBlock);\n"]}
@@ -4,10 +4,10 @@ import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnecti
4
4
  import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal";
5
5
  import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
6
6
  /**
7
- * @experimental
8
7
  * A block that counts the number of times it has been called.
8
+ * Afterwards it activates its out signal.
9
9
  */
10
- export declare class FlowGraphCounterBlock extends FlowGraphExecutionBlockWithOutSignal {
10
+ export declare class FlowGraphCallCounterBlock extends FlowGraphExecutionBlockWithOutSignal {
11
11
  /**
12
12
  * Output connection: The number of times the block has been called.
13
13
  */