@babylonjs/core 7.51.1 → 7.51.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/Animations/animation.js +2 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/Buffers/bufferUtils.d.ts +7 -5
  4. package/Buffers/bufferUtils.js +13 -9
  5. package/Buffers/bufferUtils.js.map +1 -1
  6. package/Engines/abstractEngine.js +2 -2
  7. package/Engines/abstractEngine.js.map +1 -1
  8. package/Engines/constants.d.ts +32 -0
  9. package/Engines/constants.js +33 -0
  10. package/Engines/constants.js.map +1 -1
  11. package/Engines/webgpuEngine.js +6 -3
  12. package/Engines/webgpuEngine.js.map +1 -1
  13. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +148 -465
  14. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +394 -691
  15. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  16. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.d.ts +142 -0
  17. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js +342 -0
  18. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js.map +1 -0
  19. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +107 -0
  20. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +130 -0
  21. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -0
  22. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +77 -0
  23. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +139 -0
  24. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -0
  25. package/FlowGraph/Blocks/Data/Math/index.d.ts +3 -0
  26. package/FlowGraph/Blocks/Data/Math/index.js +3 -0
  27. package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
  28. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +85 -0
  29. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +133 -0
  30. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -0
  31. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.d.ts +49 -0
  32. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js +71 -0
  33. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js.map +1 -0
  34. package/FlowGraph/Blocks/Data/Transformers/index.d.ts +2 -0
  35. package/FlowGraph/Blocks/Data/Transformers/index.js +3 -0
  36. package/FlowGraph/Blocks/Data/Transformers/index.js.map +1 -0
  37. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.d.ts +39 -0
  38. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js +46 -0
  39. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js.map +1 -0
  40. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.d.ts +35 -0
  41. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +34 -0
  42. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -0
  43. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.d.ts +20 -0
  44. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js +25 -0
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js.map +1 -0
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.d.ts +34 -0
  47. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js +35 -0
  48. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js.map +1 -0
  49. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.d.ts +39 -0
  50. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js +42 -0
  51. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js.map +1 -0
  52. package/FlowGraph/Blocks/Data/Utils/index.d.ts +5 -0
  53. package/FlowGraph/Blocks/Data/Utils/index.js +6 -0
  54. package/FlowGraph/Blocks/Data/Utils/index.js.map +1 -0
  55. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +0 -1
  56. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -2
  57. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  58. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
  59. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +4 -4
  60. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  61. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +6 -3
  62. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +12 -6
  63. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  64. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +0 -2
  65. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +2 -3
  66. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +5 -4
  68. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -4
  69. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.d.ts +62 -0
  71. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js +41 -0
  72. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js.map +1 -0
  73. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +38 -33
  74. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +42 -25
  75. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -16
  77. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +9 -17
  78. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  79. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +1 -1
  80. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +1 -1
  81. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.d.ts → flowGraphTransformCoordinatesSystemBlock.d.ts} +1 -2
  83. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.js → flowGraphTransformCoordinatesSystemBlock.js} +4 -5
  84. package/FlowGraph/Blocks/Data/flowGraphTransformCoordinatesSystemBlock.js.map +1 -0
  85. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
  86. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
  87. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  88. package/FlowGraph/Blocks/Data/index.d.ts +7 -3
  89. package/FlowGraph/Blocks/Data/index.js +9 -4
  90. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  91. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +45 -24
  92. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +45 -51
  93. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  94. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.d.ts +61 -0
  95. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js +39 -0
  96. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js.map +1 -0
  97. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.d.ts +61 -0
  98. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js +40 -0
  99. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js.map +1 -0
  100. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +12 -14
  101. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +19 -26
  102. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  103. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -12
  104. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +13 -24
  105. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  106. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +31 -7
  107. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +22 -20
  108. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  109. package/FlowGraph/Blocks/{Execution → Event}/flowGraphSendCustomEventBlock.d.ts +12 -7
  110. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +39 -0
  111. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -0
  112. package/FlowGraph/Blocks/Event/index.d.ts +3 -0
  113. package/FlowGraph/Blocks/Event/index.js +3 -0
  114. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  115. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.d.ts +44 -0
  116. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js +46 -0
  117. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js.map +1 -0
  118. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.d.ts +60 -0
  119. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js +93 -0
  120. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js.map +1 -0
  121. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.d.ts +82 -0
  122. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +105 -0
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -0
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +2 -2
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +40 -42
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +116 -50
  129. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  130. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +12 -4
  131. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +86 -8
  132. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  133. package/FlowGraph/Blocks/Execution/Animation/index.d.ts +3 -0
  134. package/FlowGraph/Blocks/Execution/Animation/index.js +3 -0
  135. package/FlowGraph/Blocks/Execution/Animation/index.js.map +1 -1
  136. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +1 -2
  137. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -4
  138. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  139. package/FlowGraph/Blocks/Execution/{Audio/flowGraphStopAudioBlock.d.ts → ControlFlow/flowGraphCancelDelayBlock.d.ts} +6 -8
  140. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +31 -0
  141. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -0
  142. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
  143. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +5 -5
  144. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  145. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +0 -1
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -3
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +5 -10
  149. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -15
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +11 -3
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +5 -6
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +27 -7
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +28 -30
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +13 -16
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +50 -52
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +8 -9
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -13
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +32 -0
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +84 -0
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -0
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +20 -6
  167. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +55 -16
  168. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -4
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +36 -13
  171. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  172. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +13 -5
  173. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +22 -17
  174. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  175. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +12 -16
  176. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +21 -21
  177. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  178. package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +2 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/index.js +2 -1
  180. package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
  181. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -5
  182. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +13 -8
  183. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  184. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +33 -36
  185. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +42 -26
  186. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  187. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +10 -25
  188. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +38 -24
  189. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  190. package/FlowGraph/Blocks/Execution/index.d.ts +0 -3
  191. package/FlowGraph/Blocks/Execution/index.js +0 -3
  192. package/FlowGraph/Blocks/Execution/index.js.map +1 -1
  193. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +16 -0
  194. package/FlowGraph/Blocks/flowGraphBlockFactory.js +292 -0
  195. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -0
  196. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +145 -0
  197. package/FlowGraph/Blocks/flowGraphBlockNames.js +147 -0
  198. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -0
  199. package/FlowGraph/Blocks/index.d.ts +2 -0
  200. package/FlowGraph/Blocks/index.js +2 -0
  201. package/FlowGraph/Blocks/index.js.map +1 -1
  202. package/FlowGraph/{flowGraphInteger.d.ts → CustomTypes/flowGraphInteger.d.ts} +2 -3
  203. package/FlowGraph/{flowGraphInteger.js → CustomTypes/flowGraphInteger.js} +4 -5
  204. package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -0
  205. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +196 -0
  206. package/FlowGraph/CustomTypes/flowGraphMatrix.js +272 -0
  207. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -0
  208. package/FlowGraph/CustomTypes/index.d.ts +2 -0
  209. package/FlowGraph/CustomTypes/index.js +3 -0
  210. package/FlowGraph/CustomTypes/index.js.map +1 -0
  211. package/FlowGraph/flowGraph.d.ts +29 -34
  212. package/FlowGraph/flowGraph.js +120 -104
  213. package/FlowGraph/flowGraph.js.map +1 -1
  214. package/FlowGraph/flowGraphAssetsContext.d.ts +29 -0
  215. package/FlowGraph/flowGraphAssetsContext.js +52 -0
  216. package/FlowGraph/flowGraphAssetsContext.js.map +1 -0
  217. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +15 -8
  218. package/FlowGraph/flowGraphAsyncExecutionBlock.js +25 -5
  219. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  220. package/FlowGraph/flowGraphBlock.d.ts +22 -15
  221. package/FlowGraph/flowGraphBlock.js +31 -52
  222. package/FlowGraph/flowGraphBlock.js.map +1 -1
  223. package/FlowGraph/flowGraphConnection.d.ts +13 -12
  224. package/FlowGraph/flowGraphConnection.js +31 -16
  225. package/FlowGraph/flowGraphConnection.js.map +1 -1
  226. package/FlowGraph/flowGraphContext.d.ts +89 -13
  227. package/FlowGraph/flowGraphContext.js +210 -23
  228. package/FlowGraph/flowGraphContext.js.map +1 -1
  229. package/FlowGraph/flowGraphCoordinator.d.ts +4 -10
  230. package/FlowGraph/flowGraphCoordinator.js +4 -16
  231. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  232. package/FlowGraph/flowGraphDataConnection.d.ts +52 -14
  233. package/FlowGraph/flowGraphDataConnection.js +73 -26
  234. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  235. package/FlowGraph/flowGraphEventBlock.d.ts +17 -1
  236. package/FlowGraph/flowGraphEventBlock.js +13 -2
  237. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  238. package/FlowGraph/flowGraphEventType.d.ts +16 -0
  239. package/FlowGraph/flowGraphEventType.js +18 -0
  240. package/FlowGraph/flowGraphEventType.js.map +1 -0
  241. package/FlowGraph/flowGraphExecutionBlock.d.ts +11 -1
  242. package/FlowGraph/flowGraphExecutionBlock.js +21 -2
  243. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  244. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.d.ts +2 -2
  245. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js +0 -1
  246. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -1
  247. package/FlowGraph/flowGraphLogger.d.ts +60 -0
  248. package/FlowGraph/flowGraphLogger.js +53 -0
  249. package/FlowGraph/flowGraphLogger.js.map +1 -0
  250. package/FlowGraph/flowGraphParser.d.ts +85 -0
  251. package/FlowGraph/flowGraphParser.js +271 -0
  252. package/FlowGraph/flowGraphParser.js.map +1 -0
  253. package/FlowGraph/flowGraphPathConverter.d.ts +1 -1
  254. package/FlowGraph/flowGraphPathConverter.js +3 -2
  255. package/FlowGraph/flowGraphPathConverter.js.map +1 -1
  256. package/FlowGraph/flowGraphPathConverterComponent.d.ts +8 -1
  257. package/FlowGraph/flowGraphPathConverterComponent.js +18 -2
  258. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  259. package/FlowGraph/flowGraphRichTypes.d.ts +51 -9
  260. package/FlowGraph/flowGraphRichTypes.js +160 -50
  261. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  262. package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +45 -0
  263. package/FlowGraph/flowGraphSceneEventCoordinator.js +77 -0
  264. package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -0
  265. package/FlowGraph/flowGraphSignalConnection.d.ts +8 -5
  266. package/FlowGraph/flowGraphSignalConnection.js +26 -9
  267. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  268. package/FlowGraph/index.d.ts +6 -1
  269. package/FlowGraph/index.js +7 -1
  270. package/FlowGraph/index.js.map +1 -1
  271. package/FlowGraph/serialization.d.ts +5 -2
  272. package/FlowGraph/serialization.js +94 -22
  273. package/FlowGraph/serialization.js.map +1 -1
  274. package/FlowGraph/typeDefinitions.d.ts +74 -12
  275. package/FlowGraph/typeDefinitions.js.map +1 -1
  276. package/FlowGraph/utils.d.ts +47 -0
  277. package/FlowGraph/utils.js +55 -0
  278. package/FlowGraph/utils.js.map +1 -1
  279. package/Maths/math.path.js +3 -0
  280. package/Maths/math.path.js.map +1 -1
  281. package/Meshes/geometry.d.ts +2 -1
  282. package/Meshes/geometry.js +8 -2
  283. package/Meshes/geometry.js.map +1 -1
  284. package/Meshes/mesh.d.ts +2 -1
  285. package/Meshes/mesh.js +3 -2
  286. package/Meshes/mesh.js.map +1 -1
  287. package/ObjectModel/objectModelInterfaces.d.ts +2 -2
  288. package/ObjectModel/objectModelInterfaces.js.map +1 -1
  289. package/package.json +1 -1
  290. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +0 -24
  291. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +0 -39
  292. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +0 -1
  293. package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
  294. package/FlowGraph/Blocks/Data/Logic/index.js +0 -2
  295. package/FlowGraph/Blocks/Data/Logic/index.js.map +0 -1
  296. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +0 -1
  297. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +0 -19
  298. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +0 -26
  299. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +0 -1
  300. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +0 -25
  301. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +0 -1
  302. package/FlowGraph/Blocks/Execution/Audio/index.d.ts +0 -2
  303. package/FlowGraph/Blocks/Execution/Audio/index.js +0 -3
  304. package/FlowGraph/Blocks/Execution/Audio/index.js.map +0 -1
  305. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +0 -31
  306. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +0 -69
  307. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +0 -1
  308. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +0 -38
  309. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +0 -1
  310. package/FlowGraph/flowGraphContextLogger.d.ts +0 -9
  311. package/FlowGraph/flowGraphContextLogger.js +0 -14
  312. package/FlowGraph/flowGraphContextLogger.js.map +0 -1
  313. package/FlowGraph/flowGraphInteger.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphInterpolationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,yCAA+B;AACnD,OAAO,EAAE,cAAc,EAAqC,mCAAsC;AAIlG,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,WAAW,EAAE,cAAc,EAAE,uCAA0C;AACxI,OAAO,EAAE,SAAS,EAAE,4CAAkC;AACtD,OAAO,EAAE,aAAa,EAAE,sCAA4B;AA+BpD;;;;;;;;;GASG;AACH,MAAM,OAAO,2BAA+B,SAAQ,cAAc;IA8C9D,YAAY,SAAoD,EAAE;QAC9D,KAAK,CAAC,MAAM,CAAC,CAAC;QAVlB;;;WAGG;QACa,cAAS,GAGnB,EAAE,CAAC;QAIL,MAAM,IAAI,GACN,OAAO,MAAM,EAAE,aAAa,KAAK,QAAQ;YACrC,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC,aAAa,CAAC;YAClD,CAAC,CAAC,0BAA0B,CAAC,MAAM,EAAE,aAAa,IAAI,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAE7F,MAAM,iBAAiB,GAAG,MAAM,EAAE,cAAc,IAAI,CAAC,CAAC;QACtD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AC;YACxB,OAAO,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACJ,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACzC,MAAM,SAAS,GAAG,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;gBAC1F,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACxB,OAAO,SAAS,CAAC;YACrB,CAAC,CAAC,CAAC;YACH,OAAO,UAAU,CAAC;QACtB,CAAC;IACL,CAAC;IAEe,YAAY;QACxB,kFAA8C;IAClD,CAAC;CACJ;AAED,aAAa,6EAAyC,2BAA2B,CAAC,CAAC;AAEnF,UAAU","sourcesContent":["import type { EasingFunction } from \"core/Animations/easing\";\nimport { Constants } from \"core/Engines/constants\";\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport type { FlowGraphTypes } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { getRichTypeByAnimationType, getRichTypeByFlowGraphType, RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { Animation } from \"core/Animations/animation\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\n\n/**\n * Configuration for the interpolation block.\n */\nexport interface IFlowGraphInterpolationBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The number of keyframes to interpolate between.\n * Will default to 1 if not provided (i.e. from currentValue to a provided value in the time provided)\n */\n keyFramesCount?: number;\n\n /**\n * The duration of the interpolation.\n */\n duration?: number;\n\n /**\n * The name of the property that will be interpolated.\n */\n propertyName?: string | string[];\n\n /**\n * The type of the animation to create.\n * Default is ANIMATIONTYPE_FLOAT\n * This cannot be changed after construction, so make sure to pass the right value.\n */\n animationType?: number | FlowGraphTypes;\n}\n\n/**\n * This block is responsible for interpolating between two values.\n * The babylon concept used is Animation, and it is the output of this block.\n *\n * Note that values will be parsed when the in connection is triggered. until then changing the value will not trigger a new interpolation.\n *\n * Internally this block uses the Animation class.\n *\n * Note that if the interpolation is already running a signal will be sent to stop the animation group running it.\n */\nexport class FlowGraphInterpolationBlock<T> extends FlowGraphBlock {\n /**\n * Input connection: The value to interpolate from.\n * Optional. If not provided, the current value will be used.\n * Note that if provided, every time the animation is created this value will be used!\n */\n public readonly initialValue: FlowGraphDataConnection<T>;\n\n /**\n * Input connection: The value to interpolate to.\n * Optional. This can also be set using the KeyFrames input!\n * If provided it will be set to the last keyframe value.\n */\n public readonly endValue: FlowGraphDataConnection<T>;\n\n /**\n * output connection: The animation that will be created when in is triggered.\n */\n public readonly animation: FlowGraphDataConnection<Animation | Animation[]>;\n\n /**\n * Input connection: An optional easing function to use for the interpolation.\n */\n public readonly easingFunction: FlowGraphDataConnection<EasingFunction>;\n\n /**\n * Input connection: The name of the property that will be set\n */\n public readonly propertyName: FlowGraphDataConnection<string | string[]>;\n\n /**\n * If provided, this function will be used to create the animation object(s).\n */\n public readonly customBuildAnimation: FlowGraphDataConnection<\n () => (keys: any[], fps: number, animationType: number, easingFunction?: EasingFunction) => Animation | Animation[]\n >;\n\n /**\n * The keyframes to interpolate between.\n * Each keyframe has a duration input and a value input.\n */\n public readonly keyFrames: {\n duration: FlowGraphDataConnection<number>;\n value: FlowGraphDataConnection<T>;\n }[] = [];\n\n constructor(config: IFlowGraphInterpolationBlockConfiguration = {}) {\n super(config);\n const type =\n typeof config?.animationType === \"string\"\n ? getRichTypeByFlowGraphType(config.animationType)\n : getRichTypeByAnimationType(config?.animationType ?? Constants.ANIMATIONTYPE_FLOAT);\n\n const numberOfKeyFrames = config?.keyFramesCount ?? 1;\n const duration = this.registerDataInput(`duration_0`, RichTypeNumber, 0);\n const value = this.registerDataInput(`value_0`, type);\n this.keyFrames.push({ duration, value });\n for (let i = 1; i < numberOfKeyFrames + 1; i++) {\n const duration = this.registerDataInput(`duration_${i}`, RichTypeNumber, i === numberOfKeyFrames ? config.duration : undefined);\n const value = this.registerDataInput(`value_${i}`, type);\n this.keyFrames.push({ duration, value });\n }\n this.initialValue = this.keyFrames[0].value;\n this.endValue = this.keyFrames[numberOfKeyFrames].value;\n this.easingFunction = this.registerDataInput(\"easingFunction\", RichTypeAny);\n this.animation = this.registerDataOutput(\"animation\", RichTypeAny);\n this.propertyName = this.registerDataInput(\"propertyName\", RichTypeAny, config?.propertyName);\n this.customBuildAnimation = this.registerDataInput(\"customBuildAnimation\", RichTypeAny);\n }\n\n public override _updateOutputs(context: FlowGraphContext): void {\n const interpolationAnimations = context._getGlobalContextVariable(\"interpolationAnimations\", []) as number[];\n const propertyName = this.propertyName.getValue(context);\n const easingFunction = this.easingFunction.getValue(context);\n const animation = this._createAnimation(context, propertyName, easingFunction);\n // If an old animation exists, it will be ignored here.\n // This is because if the animation is running and they both have the same target, the old will be stopped.\n // This doesn't happen here, it happens in the play animation block.\n this.animation.setValue(animation, context);\n // to make sure no 2 interpolations are running on the same target, we will mark the animation in the context\n if (Array.isArray(animation)) {\n for (const anim of animation) {\n interpolationAnimations.push(anim.uniqueId);\n }\n } else {\n interpolationAnimations.push(animation.uniqueId);\n }\n context._setGlobalContextVariable(\"interpolationAnimations\", interpolationAnimations);\n }\n\n private _createAnimation(context: FlowGraphContext, propertyName: string | string[], easingFunction: EasingFunction): Animation | Animation[] {\n const type = this.initialValue.richType;\n const keys: { frame: number; value: T }[] = [];\n // add initial value\n const currentValue = this.initialValue.getValue(context) || type.defaultValue;\n keys.push({ frame: 0, value: currentValue });\n const numberOfKeyFrames = this.config?.numberOfKeyFrames ?? 1;\n for (let i = 1; i < numberOfKeyFrames + 1; i++) {\n const duration = this.keyFrames[i].duration?.getValue(context);\n let value = this.keyFrames[i].value?.getValue(context);\n if (i === numberOfKeyFrames - 1) {\n value = value || type.defaultValue;\n }\n if (duration !== undefined && value) {\n // convert duration to frames, based on 60 fps\n keys.push({ frame: duration * 60, value });\n }\n }\n const customBuildAnimation = this.customBuildAnimation.getValue(context);\n if (customBuildAnimation) {\n return customBuildAnimation()(keys, 60, type.animationType, easingFunction);\n }\n if (typeof propertyName === \"string\") {\n const animation = Animation.CreateAnimation(propertyName, type.animationType, 60, easingFunction);\n animation.setKeys(keys);\n return [animation];\n } else {\n const animations = propertyName.map((name) => {\n const animation = Animation.CreateAnimation(name, type.animationType, 60, easingFunction);\n animation.setKeys(keys);\n return animation;\n });\n return animations;\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ValueInterpolation;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.ValueInterpolation, FlowGraphInterpolationBlock);\n\n// #L54P2C\n"]}
@@ -1,8 +1,8 @@
1
1
  import type { FlowGraphContext } from "../../../flowGraphContext";
2
2
  import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
3
3
  import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal";
4
- import type { Animatable } from "../../../../Animations/animatable.core";
5
4
  import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
5
+ import type { AnimationGroup } from "../../../../Animations/animationGroup.js";
6
6
  /**
7
7
  * @experimental
8
8
  * Block that pauses a running animation
@@ -11,7 +11,7 @@ export declare class FlowGraphPauseAnimationBlock extends FlowGraphExecutionBloc
11
11
  /**
12
12
  * Input connection: The animation to pause.
13
13
  */
14
- readonly animationToPause: FlowGraphDataConnection<Animatable>;
14
+ readonly animationToPause: FlowGraphDataConnection<AnimationGroup>;
15
15
  constructor(config?: IFlowGraphBlockConfiguration);
16
16
  _execute(context: FlowGraphContext): void;
17
17
  /**
@@ -19,8 +19,8 @@ export class FlowGraphPauseAnimationBlock extends FlowGraphExecutionBlockWithOut
19
19
  * @returns class name of the block.
20
20
  */
21
21
  getClassName() {
22
- return "FGPauseAnimationBlock";
22
+ return "FlowGraphPauseAnimationBlock" /* FlowGraphBlockNames.PauseAnimation */;
23
23
  }
24
24
  }
25
- RegisterClass("FGPauseAnimationBlock", FlowGraphPauseAnimationBlock);
25
+ RegisterClass("FlowGraphPauseAnimationBlock" /* FlowGraphBlockNames.PauseAnimation */, FlowGraphPauseAnimationBlock);
26
26
  //# sourceMappingURL=flowGraphPauseAnimationBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphPauseAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.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,4BAA6B,SAAQ,oCAAoC;IAMlF,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACpF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtE,qBAAqB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,uBAAuB,CAAC;IACnC,CAAC;CACJ;AACD,aAAa,CAAC,uBAAuB,EAAE,4BAA4B,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 pauses a running animation\r\n */\r\nexport class FlowGraphPauseAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The animation to pause.\r\n */\r\n public readonly animationToPause: FlowGraphDataConnection<Animatable>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.animationToPause = this.registerDataInput(\"animationToPause\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToPauseValue = this.animationToPause.getValue(context);\r\n animationToPauseValue.pause();\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 \"FGPauseAnimationBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGPauseAnimationBlock\", FlowGraphPauseAnimationBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphPauseAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,oCAAoC;IAMlF,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACpF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtE,qBAAqB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,+EAA0C;IAC9C,CAAC;CACJ;AACD,aAAa,0EAAqC,4BAA4B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal\";\r\nimport { RichTypeAny } 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\n/**\r\n * @experimental\r\n * Block that pauses a running animation\r\n */\r\nexport class FlowGraphPauseAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The animation to pause.\r\n */\r\n public readonly animationToPause: FlowGraphDataConnection<AnimationGroup>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.animationToPause = this.registerDataInput(\"animationToPause\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToPauseValue = this.animationToPause.getValue(context);\r\n animationToPauseValue.pause();\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 FlowGraphBlockNames.PauseAnimation;\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.PauseAnimation, FlowGraphPauseAnimationBlock);\r\n"]}
@@ -1,28 +1,9 @@
1
1
  import type { FlowGraphContext } from "../../../flowGraphContext";
2
- import type { Animatable } from "../../../../Animations/animatable.core";
3
2
  import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
4
3
  import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock";
5
4
  import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
6
- import type { IPathToObjectConverter } from "../../../../ObjectModel/objectModelInterfaces";
7
- import { FlowGraphPathConverterComponent } from "../../../flowGraphPathConverterComponent";
8
- import type { IObjectAccessor } from "../../../typeDefinitions";
9
- /**
10
- * @experimental
11
- */
12
- export interface IFlowGraphPlayAnimationBlockConfiguration extends IFlowGraphBlockConfiguration {
13
- /**
14
- * The path to the target object that will be animated.
15
- */
16
- targetPath: string;
17
- /**
18
- * The path to the animation that will be played.
19
- */
20
- animationPath: string;
21
- /**
22
- * The path converter to use to convert the path to an object accessor.
23
- */
24
- pathConverter: IPathToObjectConverter<IObjectAccessor>;
25
- }
5
+ import { AnimationGroup } from "../../../../Animations/animationGroup.js";
6
+ import type { Animation } from "../../../../Animations/animation.js";
26
7
  /**
27
8
  * @experimental
28
9
  * A block that plays an animation on an animatable object.
@@ -31,21 +12,14 @@ export declare class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecution
31
12
  /**
32
13
  * the configuration of the block
33
14
  */
34
- config: IFlowGraphPlayAnimationBlockConfiguration;
35
- /**
36
- * The substitution inputs for template strings in the target
37
- */
38
- readonly templateTargetComponent: FlowGraphPathConverterComponent;
39
- /**
40
- * The substitution inputs for template strings in the animation
41
- */
42
- readonly templateAnimationComponent: FlowGraphPathConverterComponent;
15
+ config?: IFlowGraphBlockConfiguration | undefined;
43
16
  /**
44
17
  * Input connection: The speed of the animation.
45
18
  */
46
19
  readonly speed: FlowGraphDataConnection<number>;
47
20
  /**
48
21
  * Input connection: Should the animation loop?
22
+ * Not in glTF specs, but useful for the engine.
49
23
  */
50
24
  readonly loop: FlowGraphDataConnection<boolean>;
51
25
  /**
@@ -56,22 +30,55 @@ export declare class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecution
56
30
  * Input connection: The ending frame of the animation.
57
31
  */
58
32
  readonly to: FlowGraphDataConnection<number>;
33
+ /**
34
+ * Output connection: The current frame of the animation.
35
+ */
36
+ readonly currentFrame: FlowGraphDataConnection<number>;
37
+ /**
38
+ * Output connection: The current time of the animation.
39
+ */
40
+ readonly currentTime: FlowGraphDataConnection<number>;
59
41
  /**
60
42
  * Output connection: The animatable that is currently running.
61
43
  */
62
- readonly runningAnimatable: FlowGraphDataConnection<Animatable>;
44
+ readonly currentAnimationGroup: FlowGraphDataConnection<AnimationGroup>;
45
+ /**
46
+ * Input: Will be initialized if no animation group was provided in the configuration.
47
+ */
48
+ readonly animationGroup: FlowGraphDataConnection<AnimationGroup>;
49
+ /**
50
+ * Input: If provided this animation will be used. Priority will be given to the animation group input.
51
+ */
52
+ readonly animation: FlowGraphDataConnection<Animation | Animation[]>;
53
+ /**
54
+ * Input connection: The target object that will be animated. If animation group is provided this input will be ignored.
55
+ */
56
+ readonly object: FlowGraphDataConnection<any>;
63
57
  constructor(
64
58
  /**
65
59
  * the configuration of the block
66
60
  */
67
- config: IFlowGraphPlayAnimationBlockConfiguration);
61
+ config?: IFlowGraphBlockConfiguration | undefined);
68
62
  /**
69
63
  * @internal
70
64
  * @param context
71
65
  */
72
66
  _preparePendingTasks(context: FlowGraphContext): void;
67
+ /**
68
+ * @internal
69
+ */
70
+ _executeOnTick(_context: FlowGraphContext): void;
73
71
  _execute(context: FlowGraphContext): void;
74
- private _onAnimationEnd;
72
+ private _onAnimationGroupEnd;
73
+ /**
74
+ * The idea behind this function is to check every running animation group and check if the targeted animations it uses are interpolation animations.
75
+ * If they are, we want to see that they don't collide with the current interpolation animations that are starting to play.
76
+ * If they do, we want to stop the already-running animation group.
77
+ * @internal
78
+ */
79
+ private _checkInterpolationDuplications;
80
+ private _stopAnimationGroup;
81
+ private _removeFromCurrentlyRunning;
75
82
  /**
76
83
  * @internal
77
84
  * Stop any currently running animations.
@@ -81,13 +88,4 @@ export declare class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecution
81
88
  * @returns class name of the block.
82
89
  */
83
90
  getClassName(): string;
84
- /**
85
- * Serializes the block to a JSON object.
86
- * @param serializationObject the object to serialize to.
87
- */
88
- serialize(serializationObject?: any): void;
89
- /**
90
- * Class name of the block.
91
- */
92
- static ClassName: string;
93
91
  }
@@ -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/FlowGra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,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QAC/D,mBAAmB,CAAC,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,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/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,iDAAuC;AAIhE;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,4BAA4B;IAiDzE;IACI;;OAEG;IACa,MAAqC;QAErD,KAAK,CAAC,MAAM,EAAE,CAAC,eAAe,EAAE,cAAc,EAAE,oBAAoB,CAAC,CAAC,CAAC;QAFvD,WAAM,GAAN,MAAM,CAA+B;QAIrD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QAC9D,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAEvD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC5E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QA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;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