@onerjs/core 8.56.3 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. package/Animations/animatable.core.js +36 -0
  2. package/Animations/animatable.core.js.map +1 -1
  3. package/Animations/animationGroup.pure.d.ts +61 -1
  4. package/Animations/animationGroup.pure.js +191 -2
  5. package/Animations/animationGroup.pure.js.map +1 -1
  6. package/Animations/index.d.ts +1 -0
  7. package/Animations/index.js +1 -0
  8. package/Animations/index.js.map +1 -1
  9. package/Animations/pure.d.ts +1 -0
  10. package/Animations/pure.js +1 -0
  11. package/Animations/pure.js.map +1 -1
  12. package/Animations/rootMotion.d.ts +560 -0
  13. package/Animations/rootMotion.js +1709 -0
  14. package/Animations/rootMotion.js.map +1 -0
  15. package/Animations/runtimeAnimation.d.ts +57 -0
  16. package/Animations/runtimeAnimation.js +127 -3
  17. package/Animations/runtimeAnimation.js.map +1 -1
  18. package/Cameras/arcRotateCamera.pure.d.ts +2 -0
  19. package/Cameras/arcRotateCamera.pure.js +2 -0
  20. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  21. package/Cameras/camera.pure.js +4 -0
  22. package/Cameras/camera.pure.js.map +1 -1
  23. package/Cameras/targetCamera.pure.d.ts +2 -0
  24. package/Cameras/targetCamera.pure.js +7 -1
  25. package/Cameras/targetCamera.pure.js.map +1 -1
  26. package/Collisions/gpuPicker.js +5 -5
  27. package/Collisions/gpuPicker.js.map +1 -1
  28. package/Engines/AbstractEngine/abstractEngine.query.pure.js +4 -2
  29. package/Engines/AbstractEngine/abstractEngine.query.pure.js.map +1 -1
  30. package/Engines/AbstractEngine/abstractEngine.query.types.d.ts +11 -2
  31. package/Engines/AbstractEngine/abstractEngine.query.types.js.map +1 -1
  32. package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js +1 -0
  33. package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js.map +1 -1
  34. package/Engines/Extensions/engine.multiRender.pure.js +63 -0
  35. package/Engines/Extensions/engine.multiRender.pure.js.map +1 -1
  36. package/Engines/Extensions/engine.multiRender.types.d.ts +13 -0
  37. package/Engines/Extensions/engine.multiRender.types.js.map +1 -1
  38. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +2 -2
  39. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
  40. package/Engines/Extensions/engine.prefilteredCubeTexture.types.d.ts +2 -1
  41. package/Engines/Extensions/engine.prefilteredCubeTexture.types.js.map +1 -1
  42. package/Engines/Extensions/index.d.ts +1 -0
  43. package/Engines/Extensions/index.js +1 -0
  44. package/Engines/Extensions/index.js.map +1 -1
  45. package/Engines/Extensions/pure.d.ts +1 -1
  46. package/Engines/Extensions/pure.js +1 -1
  47. package/Engines/Extensions/pure.js.map +1 -1
  48. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +88 -39
  49. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
  50. package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.d.ts +20 -2
  51. package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.js.map +1 -1
  52. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +4 -0
  53. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
  54. package/Engines/WebGPU/Extensions/engine.multiRender.types.d.ts +13 -0
  55. package/Engines/WebGPU/Extensions/engine.multiRender.types.js.map +1 -1
  56. package/Engines/WebGPU/Extensions/engine.query.pure.js +11 -3
  57. package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
  58. package/Engines/WebGPU/Extensions/index.d.ts +1 -0
  59. package/Engines/WebGPU/Extensions/index.js +1 -0
  60. package/Engines/WebGPU/Extensions/index.js.map +1 -1
  61. package/Engines/WebGPU/Extensions/pure.d.ts +1 -1
  62. package/Engines/WebGPU/Extensions/pure.js +1 -1
  63. package/Engines/WebGPU/Extensions/pure.js.map +1 -1
  64. package/Engines/WebGPU/webgpuBundleList.d.ts +2 -0
  65. package/Engines/WebGPU/webgpuBundleList.js +4 -0
  66. package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
  67. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +5 -2
  68. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  69. package/Engines/WebGPU/webgpuHardwareTexture.js +3 -1
  70. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  71. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -1
  72. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  73. package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +4 -0
  74. package/Engines/WebGPU/webgpuSnapshotRendering.js +40 -7
  75. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  76. package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -1
  77. package/Engines/WebGPU/webgpuTextureHelper.js +2 -2
  78. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  79. package/Engines/WebGPU/webgpuTextureManager.d.ts +2 -0
  80. package/Engines/WebGPU/webgpuTextureManager.js +286 -13
  81. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  82. package/Engines/abstractEngine.pure.d.ts +2 -0
  83. package/Engines/abstractEngine.pure.js +7 -3
  84. package/Engines/abstractEngine.pure.js.map +1 -1
  85. package/Engines/constants.d.ts +4 -0
  86. package/Engines/constants.js +4 -0
  87. package/Engines/constants.js.map +1 -1
  88. package/Engines/thinEngine.pure.d.ts +14 -0
  89. package/Engines/thinEngine.pure.js +48 -12
  90. package/Engines/thinEngine.pure.js.map +1 -1
  91. package/Engines/thinNativeEngine.pure.d.ts +1 -0
  92. package/Engines/thinNativeEngine.pure.js +7 -1
  93. package/Engines/thinNativeEngine.pure.js.map +1 -1
  94. package/Engines/thinWebGPUEngine.d.ts +4 -0
  95. package/Engines/thinWebGPUEngine.js +10 -1
  96. package/Engines/thinWebGPUEngine.js.map +1 -1
  97. package/Engines/webgpuEngine.pure.d.ts +5 -2
  98. package/Engines/webgpuEngine.pure.js +48 -13
  99. package/Engines/webgpuEngine.pure.js.map +1 -1
  100. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +2 -2
  101. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  102. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.d.ts +11 -2
  103. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +1 -1
  104. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  105. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.d.ts +9 -1
  106. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js +6 -8
  107. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js.map +1 -1
  108. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.d.ts +2 -0
  109. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js +5 -1
  110. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js.map +1 -1
  111. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.d.ts +2 -0
  112. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js +5 -1
  113. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js.map +1 -1
  114. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +9 -0
  115. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +34 -9
  116. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  117. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +2 -0
  118. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +4 -0
  119. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  120. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +2 -0
  121. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +4 -0
  122. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  123. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js +19 -7
  124. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js.map +1 -1
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +20 -2
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +53 -10
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.d.ts +16 -1
  129. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +64 -14
  130. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  131. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js +64 -16
  132. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js.map +1 -1
  133. package/FlowGraph/flowGraph.d.ts +4 -0
  134. package/FlowGraph/flowGraph.js +38 -7
  135. package/FlowGraph/flowGraph.js.map +1 -1
  136. package/FlowGraph/flowGraphBlock.js +3 -0
  137. package/FlowGraph/flowGraphBlock.js.map +1 -1
  138. package/FlowGraph/flowGraphConnection.d.ts +7 -0
  139. package/FlowGraph/flowGraphConnection.js +7 -0
  140. package/FlowGraph/flowGraphConnection.js.map +1 -1
  141. package/FlowGraph/flowGraphContext.d.ts +2 -1
  142. package/FlowGraph/flowGraphContext.js +4 -3
  143. package/FlowGraph/flowGraphContext.js.map +1 -1
  144. package/FlowGraph/flowGraphCoordinator.d.ts +15 -1
  145. package/FlowGraph/flowGraphCoordinator.js +47 -16
  146. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  147. package/FlowGraph/flowGraphEventBlock.d.ts +5 -0
  148. package/FlowGraph/flowGraphEventBlock.js +7 -0
  149. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  150. package/FlowGraph/flowGraphHostResolver.d.ts +2 -1
  151. package/FlowGraph/flowGraphHostResolver.js.map +1 -1
  152. package/FlowGraph/flowGraphParser.js +60 -2
  153. package/FlowGraph/flowGraphParser.js.map +1 -1
  154. package/FlowGraph/serialization.d.ts +2 -0
  155. package/FlowGraph/serialization.js +10 -22
  156. package/FlowGraph/serialization.js.map +1 -1
  157. package/FlowGraph/typeDefinitions.d.ts +8 -0
  158. package/FlowGraph/typeDefinitions.js.map +1 -1
  159. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.d.ts +5 -0
  160. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js +8 -0
  161. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js.map +1 -0
  162. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.d.ts +87 -0
  163. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js +295 -0
  164. package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js.map +1 -0
  165. package/FrameGraph/Node/Blocks/PostProcesses/pure.d.ts +1 -0
  166. package/FrameGraph/Node/Blocks/PostProcesses/pure.js +1 -0
  167. package/FrameGraph/Node/Blocks/PostProcesses/pure.js.map +1 -1
  168. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +4 -4
  169. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  170. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.d.ts +5 -1
  171. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +13 -1
  172. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
  173. package/FrameGraph/Node/Blocks/allBlocks.pure.js +2 -0
  174. package/FrameGraph/Node/Blocks/allBlocks.pure.js.map +1 -1
  175. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  176. package/FrameGraph/Node/Blocks/index.js +1 -0
  177. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  178. package/FrameGraph/Node/Blocks/inputBlock.pure.js +20 -1
  179. package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
  180. package/FrameGraph/Node/Blocks/pure.d.ts +1 -0
  181. package/FrameGraph/Node/Blocks/pure.js +1 -0
  182. package/FrameGraph/Node/Blocks/pure.js.map +1 -1
  183. package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
  184. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +4 -2
  185. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
  186. package/FrameGraph/Node/nodeRenderGraph.js +1 -1
  187. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  188. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +1 -0
  189. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
  190. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +5 -1
  191. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  192. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +1 -0
  193. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -1
  194. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.d.ts +69 -0
  195. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js +223 -0
  196. package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js.map +1 -0
  197. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +25 -3
  198. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +69 -33
  199. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  200. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -1
  201. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  202. package/FrameGraph/frameGraphObjectList.d.ts +6 -1
  203. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  204. package/FrameGraph/frameGraphRenderContext.d.ts +3 -1
  205. package/FrameGraph/frameGraphRenderContext.js +5 -5
  206. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  207. package/FrameGraph/index.d.ts +1 -0
  208. package/FrameGraph/index.js +1 -0
  209. package/FrameGraph/index.js.map +1 -1
  210. package/FrameGraph/pure.d.ts +1 -0
  211. package/FrameGraph/pure.js +1 -0
  212. package/FrameGraph/pure.js.map +1 -1
  213. package/Inputs/scene.inputManager.d.ts +4 -0
  214. package/Inputs/scene.inputManager.js +50 -8
  215. package/Inputs/scene.inputManager.js.map +1 -1
  216. package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js +5 -5
  217. package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js.map +1 -1
  218. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +5 -5
  219. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
  220. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +26 -1
  221. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +151 -47
  222. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  223. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +5 -5
  224. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
  225. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +11 -1
  226. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
  227. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js +17 -2
  228. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js.map +1 -1
  229. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +2 -2
  230. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
  231. package/Materials/Node/nodeMaterial.pure.d.ts +4 -0
  232. package/Materials/Node/nodeMaterial.pure.js +4 -0
  233. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  234. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
  235. package/Materials/Node/nodeMaterialBuildState.js +25 -3
  236. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  237. package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -0
  238. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -0
  239. package/Materials/Textures/Procedurals/proceduralTexture.pure.d.ts +13 -14
  240. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +6 -6
  241. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  242. package/Materials/Textures/baseTexture.pure.js +3 -0
  243. package/Materials/Textures/baseTexture.pure.js.map +1 -1
  244. package/Materials/Textures/cubeTexture.pure.js +1 -1
  245. package/Materials/Textures/cubeTexture.pure.js.map +1 -1
  246. package/Materials/Textures/internalTexture.d.ts +8 -1
  247. package/Materials/Textures/internalTexture.js +9 -2
  248. package/Materials/Textures/internalTexture.js.map +1 -1
  249. package/Materials/Textures/rawTexture2DArray.functions.d.ts +3 -3
  250. package/Materials/Textures/rawTexture2DArray.functions.js.map +1 -1
  251. package/Materials/Textures/rawTexture3D.d.ts +1 -1
  252. package/Materials/Textures/rawTexture3D.js +1 -1
  253. package/Materials/Textures/rawTexture3D.js.map +1 -1
  254. package/Materials/Textures/textureHelper.functions.d.ts +14 -0
  255. package/Materials/Textures/textureHelper.functions.js +24 -0
  256. package/Materials/Textures/textureHelper.functions.js.map +1 -1
  257. package/Materials/ditheredTileFadeMaterialPlugin.d.ts +210 -0
  258. package/Materials/ditheredTileFadeMaterialPlugin.js +509 -0
  259. package/Materials/ditheredTileFadeMaterialPlugin.js.map +1 -0
  260. package/Materials/index.d.ts +1 -0
  261. package/Materials/index.js +1 -0
  262. package/Materials/index.js.map +1 -1
  263. package/Materials/materialHelper.geometryrendering.d.ts +46 -1
  264. package/Materials/materialHelper.geometryrendering.js +105 -8
  265. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  266. package/Materials/prepass.defines.d.ts +2 -0
  267. package/Materials/prepass.defines.js +2 -0
  268. package/Materials/prepass.defines.js.map +1 -1
  269. package/Materials/pure.d.ts +1 -0
  270. package/Materials/pure.js +1 -0
  271. package/Materials/pure.js.map +1 -1
  272. package/Materials/standardMaterial.pure.d.ts +2 -0
  273. package/Materials/standardMaterial.pure.js +6 -3
  274. package/Materials/standardMaterial.pure.js.map +1 -1
  275. package/Meshes/Builders/polygonBuilder.pure.d.ts +4 -0
  276. package/Meshes/Builders/polygonBuilder.pure.js +4 -1
  277. package/Meshes/Builders/polygonBuilder.pure.js.map +1 -1
  278. package/Meshes/GaussianSplatting/gaussianSplatting.functions.d.ts +19 -0
  279. package/Meshes/GaussianSplatting/gaussianSplatting.functions.js +23 -0
  280. package/Meshes/GaussianSplatting/gaussianSplatting.functions.js.map +1 -0
  281. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -14
  282. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +20 -24
  283. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  284. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -0
  285. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +11 -4
  286. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  287. package/Meshes/abstractMesh.pure.d.ts +18 -0
  288. package/Meshes/abstractMesh.pure.js +22 -0
  289. package/Meshes/abstractMesh.pure.js.map +1 -1
  290. package/Meshes/index.d.ts +1 -0
  291. package/Meshes/index.js +1 -0
  292. package/Meshes/index.js.map +1 -1
  293. package/Meshes/instancedMesh.pure.d.ts +5 -0
  294. package/Meshes/instancedMesh.pure.js +12 -0
  295. package/Meshes/instancedMesh.pure.js.map +1 -1
  296. package/Meshes/mesh.pure.js +23 -8
  297. package/Meshes/mesh.pure.js.map +1 -1
  298. package/Meshes/meshBlendingTag.d.ts +47 -0
  299. package/Meshes/meshBlendingTag.js +64 -0
  300. package/Meshes/meshBlendingTag.js.map +1 -0
  301. package/Meshes/polygonMesh.js +2 -2
  302. package/Meshes/polygonMesh.js.map +1 -1
  303. package/Meshes/pure.d.ts +1 -0
  304. package/Meshes/pure.js +1 -0
  305. package/Meshes/pure.js.map +1 -1
  306. package/Misc/fileTools.pure.js +21 -0
  307. package/Misc/fileTools.pure.js.map +1 -1
  308. package/Misc/snapshotRenderingHelper.js +2 -2
  309. package/Misc/snapshotRenderingHelper.js.map +1 -1
  310. package/Misc/tools.pure.js +1 -1
  311. package/Misc/tools.pure.js.map +1 -1
  312. package/Particles/gpuParticleSystem.pure.d.ts +2 -0
  313. package/Particles/gpuParticleSystem.pure.js +89 -28
  314. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  315. package/Particles/thinParticleSystem.pure.d.ts +2 -0
  316. package/Particles/thinParticleSystem.pure.js +84 -19
  317. package/Particles/thinParticleSystem.pure.js.map +1 -1
  318. package/Particles/webgl2ParticleSystem.pure.d.ts +1 -0
  319. package/Particles/webgl2ParticleSystem.pure.js +12 -4
  320. package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
  321. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js +7 -0
  322. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js.map +1 -1
  323. package/PostProcesses/index.d.ts +2 -0
  324. package/PostProcesses/index.js +2 -0
  325. package/PostProcesses/index.js.map +1 -1
  326. package/PostProcesses/meshBlendingBlueNoise.d.ts +15 -0
  327. package/PostProcesses/meshBlendingBlueNoise.js +77 -0
  328. package/PostProcesses/meshBlendingBlueNoise.js.map +1 -0
  329. package/PostProcesses/meshBlendingPostProcess.d.ts +131 -0
  330. package/PostProcesses/meshBlendingPostProcess.js +315 -0
  331. package/PostProcesses/meshBlendingPostProcess.js.map +1 -0
  332. package/PostProcesses/pure.d.ts +2 -0
  333. package/PostProcesses/pure.js +2 -0
  334. package/PostProcesses/pure.js.map +1 -1
  335. package/PostProcesses/thinMeshBlendingPostProcess.d.ts +339 -0
  336. package/PostProcesses/thinMeshBlendingPostProcess.js +771 -0
  337. package/PostProcesses/thinMeshBlendingPostProcess.js.map +1 -0
  338. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +6 -6
  339. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  340. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +8 -8
  341. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  342. package/Rendering/boundingBoxRenderer.pure.js +2 -1
  343. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  344. package/Rendering/depthRenderer.pure.js +3 -4
  345. package/Rendering/depthRenderer.pure.js.map +1 -1
  346. package/Rendering/edgesRenderer.pure.d.ts +4 -2
  347. package/Rendering/edgesRenderer.pure.js +11 -2
  348. package/Rendering/edgesRenderer.pure.js.map +1 -1
  349. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +10 -0
  350. package/Rendering/fluidRenderer/fluidRenderingObject.js +20 -0
  351. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  352. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +9 -3
  353. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +14 -9
  354. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  355. package/Rendering/geometryBufferRenderer.pure.d.ts +38 -4
  356. package/Rendering/geometryBufferRenderer.pure.js +126 -17
  357. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  358. package/Rendering/objectRenderer.d.ts +7 -1
  359. package/Rendering/objectRenderer.js +45 -7
  360. package/Rendering/objectRenderer.js.map +1 -1
  361. package/Rendering/outlineRenderer.pure.js +6 -2
  362. package/Rendering/outlineRenderer.pure.js.map +1 -1
  363. package/Rendering/renderingManager.d.ts +1 -1
  364. package/Rendering/renderingManager.js +5 -4
  365. package/Rendering/renderingManager.js.map +1 -1
  366. package/Shaders/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
  367. package/Shaders/ShadersInclude/defaultFragmentAlpha.js +34 -0
  368. package/Shaders/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
  369. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +5 -1
  370. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  371. package/Shaders/ShadersInclude/geometryRenderingFragment.d.ts +5 -0
  372. package/Shaders/ShadersInclude/geometryRenderingFragment.js +74 -0
  373. package/Shaders/ShadersInclude/geometryRenderingFragment.js.map +1 -0
  374. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js +89 -0
  375. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js.map +1 -1
  376. package/Shaders/ShadersInclude/openpbrBlockPrePass.js +24 -17
  377. package/Shaders/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
  378. package/Shaders/ShadersInclude/pbrBlockPrePass.js +27 -20
  379. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  380. package/Shaders/ShadersInclude/pbrDebug.js +6 -2
  381. package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
  382. package/Shaders/ShadersInclude/prePassDeclaration.js +95 -2
  383. package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
  384. package/Shaders/default.fragment.js +31 -40
  385. package/Shaders/default.fragment.js.map +1 -1
  386. package/Shaders/depthOfField.fragment.js +13 -9
  387. package/Shaders/depthOfField.fragment.js.map +1 -1
  388. package/Shaders/fluidRenderingParticleDepth.vertex.js +16 -1
  389. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
  390. package/Shaders/fluidRenderingParticleThickness.vertex.js +16 -1
  391. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
  392. package/Shaders/gaussianSplatting.fragment.js +63 -3
  393. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  394. package/Shaders/gaussianSplatting.vertex.js +80 -0
  395. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  396. package/Shaders/geometry.fragment.js +17 -11
  397. package/Shaders/geometry.fragment.js.map +1 -1
  398. package/Shaders/gpuRenderParticles.fragment.js +43 -1
  399. package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
  400. package/Shaders/gpuRenderParticles.vertex.js +96 -16
  401. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  402. package/Shaders/meshBlending.fragment.d.ts +5 -0
  403. package/Shaders/meshBlending.fragment.js +519 -0
  404. package/Shaders/meshBlending.fragment.js.map +1 -0
  405. package/Shaders/particles.fragment.js +43 -1
  406. package/Shaders/particles.fragment.js.map +1 -1
  407. package/Shaders/particles.vertex.js +84 -3
  408. package/Shaders/particles.vertex.js.map +1 -1
  409. package/Shaders/sprites.fragment.js +52 -2
  410. package/Shaders/sprites.fragment.js.map +1 -1
  411. package/Shaders/sprites.vertex.js +62 -1
  412. package/Shaders/sprites.vertex.js.map +1 -1
  413. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
  414. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js +33 -0
  415. package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
  416. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.d.ts +6 -0
  417. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js +76 -0
  418. package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js.map +1 -0
  419. package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
  420. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  421. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.d.ts +5 -0
  422. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js +18 -0
  423. package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js.map +1 -0
  424. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.d.ts +1 -0
  425. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js +11 -25
  426. package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
  427. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +1 -0
  428. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +11 -25
  429. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  430. package/ShadersWGSL/ShadersInclude/pbrDebug.js +5 -1
  431. package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
  432. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +6 -1
  433. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
  434. package/ShadersWGSL/default.fragment.js +17 -48
  435. package/ShadersWGSL/default.fragment.js.map +1 -1
  436. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +15 -2
  437. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
  438. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -2
  439. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
  440. package/ShadersWGSL/gaussianSplatting.fragment.js +63 -2
  441. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  442. package/ShadersWGSL/gaussianSplatting.vertex.js +80 -0
  443. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  444. package/ShadersWGSL/geometry.fragment.js +37 -2
  445. package/ShadersWGSL/geometry.fragment.js.map +1 -1
  446. package/ShadersWGSL/gpuRenderParticles.fragment.js +47 -2
  447. package/ShadersWGSL/gpuRenderParticles.fragment.js.map +1 -1
  448. package/ShadersWGSL/gpuRenderParticles.vertex.js +110 -7
  449. package/ShadersWGSL/gpuRenderParticles.vertex.js.map +1 -1
  450. package/ShadersWGSL/meshBlending.fragment.d.ts +5 -0
  451. package/ShadersWGSL/meshBlending.fragment.js +576 -0
  452. package/ShadersWGSL/meshBlending.fragment.js.map +1 -0
  453. package/ShadersWGSL/openpbr.fragment.js +2 -1
  454. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  455. package/ShadersWGSL/particles.fragment.js +45 -1
  456. package/ShadersWGSL/particles.fragment.js.map +1 -1
  457. package/ShadersWGSL/particles.vertex.js +86 -4
  458. package/ShadersWGSL/particles.vertex.js.map +1 -1
  459. package/ShadersWGSL/pbr.fragment.js +2 -1
  460. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  461. package/ShadersWGSL/sprites.fragment.js +56 -2
  462. package/ShadersWGSL/sprites.fragment.js.map +1 -1
  463. package/ShadersWGSL/sprites.vertex.js +62 -1
  464. package/ShadersWGSL/sprites.vertex.js.map +1 -1
  465. package/Sprites/spriteManager.d.ts +13 -0
  466. package/Sprites/spriteManager.js +15 -0
  467. package/Sprites/spriteManager.js.map +1 -1
  468. package/Sprites/spriteRenderer.d.ts +24 -1
  469. package/Sprites/spriteRenderer.js +368 -50
  470. package/Sprites/spriteRenderer.js.map +1 -1
  471. package/Sprites/thinSprite.d.ts +4 -0
  472. package/Sprites/thinSprite.js +4 -0
  473. package/Sprites/thinSprite.js.map +1 -1
  474. package/States/alphaCullingState.d.ts +3 -1
  475. package/States/alphaCullingState.js +18 -3
  476. package/States/alphaCullingState.js.map +1 -1
  477. package/XR/webXRDefaultExperience.d.ts +5 -1
  478. package/XR/webXRDefaultExperience.js.map +1 -1
  479. package/XR/webXREnterExitUI.d.ts +2 -1
  480. package/XR/webXREnterExitUI.js.map +1 -1
  481. package/package.json +1 -1
  482. package/scene.pure.d.ts +23 -0
  483. package/scene.pure.js +35 -0
  484. package/scene.pure.js.map +1 -1
@@ -2,6 +2,7 @@
2
2
  import { getRichTypeByFlowGraphType } from "../../flowGraphRichTypes.pure.js";
3
3
  import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphExecutionBlockWithOutSignal.js";
4
4
  import { RegisterClass } from "../../../Misc/typeStore.js";
5
+ import { defaultValueSerializationFunction } from "../../serialization.js";
5
6
  /**
6
7
  * A block that sends a custom event.
7
8
  * To receive this event you need to use the ReceiveCustomEvent block.
@@ -16,7 +17,7 @@ export class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOu
16
17
  config) {
17
18
  super(config);
18
19
  this.config = config;
19
- for (const key in this.config.eventData) {
20
+ for (const key of Object.keys(this.config.eventData ?? {})) {
20
21
  const entry = this.config.eventData[key];
21
22
  // Handle deserialized config where type may be a string typeName, a plain object
22
23
  // with a typeName property (from old JSON serialization), or a proper RichType instance.
@@ -29,9 +30,14 @@ export class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOu
29
30
  _execute(context) {
30
31
  const eventId = this.config.eventId;
31
32
  // eventData is a map with the key being the data input's name, and value being the data input's value
32
- const eventData = {};
33
+ const eventData = Object.create(null);
33
34
  for (const port of this.dataInputs) {
34
- eventData[port.name] = port.getValue(context);
35
+ Object.defineProperty(eventData, port.name, {
36
+ configurable: true,
37
+ enumerable: true,
38
+ value: port.getValue(context),
39
+ writable: true,
40
+ });
35
41
  }
36
42
  context.configuration.coordinator.notifyCustomEvent(eventId, eventData);
37
43
  this.out._activateSignal(context);
@@ -39,13 +45,19 @@ export class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOu
39
45
  serialize(serializationObject = {}) {
40
46
  super.serialize(serializationObject);
41
47
  // Override the eventData in config to store typeName strings instead of RichType instances
42
- const serializedEventData = {};
43
- for (const key in this.config.eventData) {
48
+ const serializedEventData = Object.create(null);
49
+ for (const key of Object.keys(this.config.eventData ?? {})) {
44
50
  const entry = this.config.eventData[key];
45
- serializedEventData[key] = { type: entry.type.typeName };
51
+ const serializedEntry = { type: entry.type.typeName };
46
52
  if (entry.value !== undefined) {
47
- serializedEventData[key].value = entry.value;
53
+ defaultValueSerializationFunction("value", entry.value, serializedEntry);
48
54
  }
55
+ Object.defineProperty(serializedEventData, key, {
56
+ configurable: true,
57
+ enumerable: true,
58
+ value: serializedEntry,
59
+ writable: true,
60
+ });
49
61
  }
50
62
  serializationObject.config.eventData = serializedEventData;
51
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphSendCustomEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAiB,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAIlG,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAgBxD;;;;;GAKG;AACH,MAAM,OAAO,6BAA8B,SAAQ,oCAAoC;IACnF;IACI;;OAEG;IACa,MAAmD;QAEnE,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAA6C;QAGnE,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACzC,iFAAiF;YACjF,yFAAyF;YACzF,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC;YACnF,MAAM,QAAQ,GAAG,OAAO,KAAK,CAAC,IAAI,EAAE,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,OAA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C/D,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,iFAA2C;IAC/C,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,qCAAqC;IACjD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type RichType, getRichTypeByFlowGraphType } from \"core/FlowGraph/flowGraphRichTypes.pure\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphExecutionBlockWithOutSignal\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n\r\n/**\r\n * Parameters used to create a FlowGraphSendCustomEventBlock.\r\n */\r\nexport interface IFlowGraphSendCustomEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The id of the event to send.\r\n * Note - in the glTF specs this is an index to the event array (i.e. - a number)\r\n */\r\n eventId: string;\r\n /**\r\n * The names of the data inputs for that event.\r\n */\r\n eventData: { [key: string]: { type: RichType<any>; value?: any } };\r\n}\r\n/**\r\n * A block that sends a custom event.\r\n * To receive this event you need to use the ReceiveCustomEvent block.\r\n * This block has no output, but does have inputs based on the eventData from the configuration.\r\n * @see FlowGraphReceiveCustomEventBlock\r\n */\r\nexport class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config: IFlowGraphSendCustomEventBlockConfiguration\r\n ) {\r\n super(config);\r\n for (const key in this.config.eventData) {\r\n const entry = this.config.eventData[key];\r\n // Handle deserialized config where type may be a string typeName, a plain object\r\n // with a typeName property (from old JSON serialization), or a proper RichType instance.\r\n const typeKey = typeof entry.type === \"string\" ? entry.type : entry.type?.typeName;\r\n const richType = typeof entry.type?.serialize === \"function\" ? entry.type : getRichTypeByFlowGraphType(typeKey);\r\n entry.type = richType;\r\n this.registerDataInput(key, richType, entry.value);\r\n }\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const eventId = this.config.eventId;\r\n // eventData is a map with the key being the data input's name, and value being the data input's value\r\n const eventData: any = {};\r\n for (const port of this.dataInputs) {\r\n eventData[port.name] = port.getValue(context);\r\n }\r\n\r\n context.configuration.coordinator.notifyCustomEvent(eventId, eventData);\r\n\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n // Override the eventData in config to store typeName strings instead of RichType instances\r\n const serializedEventData: any = {};\r\n for (const key in this.config.eventData) {\r\n const entry = this.config.eventData[key];\r\n serializedEventData[key] = { type: entry.type.typeName };\r\n if (entry.value !== undefined) {\r\n serializedEventData[key].value = entry.value;\r\n }\r\n }\r\n serializationObject.config.eventData = serializedEventData;\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.SendCustomEvent;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphSendCustomEventBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphSendCustomEventBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.SendCustomEvent, FlowGraphSendCustomEventBlock);\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphSendCustomEventBlock.pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAiB,0BAA0B,EAAE,MAAM,w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mB,CAAC;IAC/D,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,iFAA2C;IAC/C,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,qCAAqC;IACjD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type RichType, getRichTypeByFlowGraphType } from \"core/FlowGraph/flowGraphRichTypes.pure\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphExecutionBlockWithOutSignal\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { defaultValueSerializationFunction } from \"../../serialization\";\r\n\r\n/**\r\n * Parameters used to create a FlowGraphSendCustomEventBlock.\r\n */\r\nexport interface IFlowGraphSendCustomEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The id of the event to send.\r\n * Note - in the glTF specs this is an index to the event array (i.e. - a number)\r\n */\r\n eventId: string;\r\n /**\r\n * The names of the data inputs for that event.\r\n */\r\n eventData: { [key: string]: { type: RichType<any>; value?: any } };\r\n}\r\n/**\r\n * A block that sends a custom event.\r\n * To receive this event you need to use the ReceiveCustomEvent block.\r\n * This block has no output, but does have inputs based on the eventData from the configuration.\r\n * @see FlowGraphReceiveCustomEventBlock\r\n */\r\nexport class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config: IFlowGraphSendCustomEventBlockConfiguration\r\n ) {\r\n super(config);\r\n for (const key of Object.keys(this.config.eventData ?? {})) {\r\n const entry = this.config.eventData[key];\r\n // Handle deserialized config where type may be a string typeName, a plain object\r\n // with a typeName property (from old JSON serialization), or a proper RichType instance.\r\n const typeKey = typeof entry.type === \"string\" ? entry.type : entry.type?.typeName;\r\n const richType = typeof entry.type?.serialize === \"function\" ? entry.type : getRichTypeByFlowGraphType(typeKey);\r\n entry.type = richType;\r\n this.registerDataInput(key, richType, entry.value);\r\n }\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const eventId = this.config.eventId;\r\n // eventData is a map with the key being the data input's name, and value being the data input's value\r\n const eventData: any = Object.create(null);\r\n for (const port of this.dataInputs) {\r\n Object.defineProperty(eventData, port.name, {\r\n configurable: true,\r\n enumerable: true,\r\n value: port.getValue(context),\r\n writable: true,\r\n });\r\n }\r\n\r\n context.configuration.coordinator.notifyCustomEvent(eventId, eventData);\r\n\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n // Override the eventData in config to store typeName strings instead of RichType instances\r\n const serializedEventData: any = Object.create(null);\r\n for (const key of Object.keys(this.config.eventData ?? {})) {\r\n const entry = this.config.eventData[key];\r\n const serializedEntry: { type: string; value?: unknown } = { type: entry.type.typeName };\r\n if (entry.value !== undefined) {\r\n defaultValueSerializationFunction(\"value\", entry.value, serializedEntry);\r\n }\r\n Object.defineProperty(serializedEventData, key, {\r\n configurable: true,\r\n enumerable: true,\r\n value: serializedEntry,\r\n writable: true,\r\n });\r\n }\r\n serializationObject.config.eventData = serializedEventData;\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.SendCustomEvent;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphSendCustomEventBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphSendCustomEventBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.SendCustomEvent, FlowGraphSendCustomEventBlock);\r\n}\r\n"]}
@@ -5,6 +5,22 @@ import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBl
5
5
  import { type IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
6
6
  import { AnimationGroup } from "../../../../Animations/animationGroup.pure.js";
7
7
  import { type Animation } from "../../../../Animations/animation.pure.js";
8
+ /**
9
+ * Configuration for playing an animation.
10
+ */
11
+ export interface IFlowGraphPlayAnimationBlockConfiguration extends IFlowGraphBlockConfiguration {
12
+ /**
13
+ * Whether animation-group playback uses the unbounded KHR_interactivity timeline.
14
+ */
15
+ useVirtualTimeline?: boolean;
16
+ }
17
+ /**
18
+ * Removes observers owned by the play block that started an animation group.
19
+ * @param context active FlowGraph context
20
+ * @param animationGroup animation group being replaced or stopped
21
+ * @returns the owning play block, when one was registered
22
+ */
23
+ export declare function RemoveFlowGraphAnimationGroupObservers(context: FlowGraphContext, animationGroup: AnimationGroup): FlowGraphPlayAnimationBlock | undefined;
8
24
  /**
9
25
  * @experimental
10
26
  * A block that plays an animation on an animatable object.
@@ -13,7 +29,7 @@ export declare class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecution
13
29
  /**
14
30
  * the configuration of the block
15
31
  */
16
- config?: IFlowGraphBlockConfiguration | undefined;
32
+ config?: IFlowGraphPlayAnimationBlockConfiguration | undefined;
17
33
  /**
18
34
  * Input connection: The speed of the animation.
19
35
  */
@@ -59,7 +75,7 @@ export declare class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecution
59
75
  /**
60
76
  * the configuration of the block
61
77
  */
62
- config?: IFlowGraphBlockConfiguration | undefined);
78
+ config?: IFlowGraphPlayAnimationBlockConfiguration | undefined);
63
79
  /**
64
80
  * @internal
65
81
  * @param context
@@ -93,6 +109,8 @@ export declare class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecution
93
109
  */
94
110
  private _checkInterpolationDuplications;
95
111
  private _stopAnimationGroup;
112
+ /** @internal */
113
+ _cleanupAfterExternalStop(context: FlowGraphContext, animationGroup: AnimationGroup): void;
96
114
  private _removeFromCurrentlyRunning;
97
115
  /**
98
116
  * @internal
@@ -3,6 +3,26 @@ import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBl
3
3
  import { RichTypeAny, RichTypeNumber, RichTypeBoolean } from "../../../flowGraphRichTypes.pure.js";
4
4
  import { AnimationGroup } from "../../../../Animations/animationGroup.pure.js";
5
5
  import { RegisterClass } from "../../../../Misc/typeStore.js";
6
+ /**
7
+ * Removes observers owned by the play block that started an animation group.
8
+ * @param context active FlowGraph context
9
+ * @param animationGroup animation group being replaced or stopped
10
+ * @returns the owning play block, when one was registered
11
+ */
12
+ export function RemoveFlowGraphAnimationGroupObservers(context, animationGroup) {
13
+ const observerSets = context._getGlobalContextVariable("animationGroupObserverSets", new Map());
14
+ const observers = observerSets.get(animationGroup.uniqueId);
15
+ if (!observers) {
16
+ return undefined;
17
+ }
18
+ animationGroup.onAnimationGroupEndObservable.remove(observers.groupEnd);
19
+ animationGroup.onAnimationEndObservable.remove(observers.animationEnd);
20
+ animationGroup.onAnimationLoopObservable.remove(observers.animationLoop);
21
+ animationGroup.onAnimationGroupLoopObservable.remove(observers.groupLoop);
22
+ observerSets.delete(animationGroup.uniqueId);
23
+ context._setGlobalContextVariable("animationGroupObserverSets", observerSets);
24
+ return observers.block;
25
+ }
6
26
  /**
7
27
  * @experimental
8
28
  * A block that plays an animation on an animatable object.
@@ -63,6 +83,10 @@ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
63
83
  this._reportError(context, "No animation or animation group provided");
64
84
  return false;
65
85
  }
86
+ else if (ag && ag.targetedAnimations.length === 0) {
87
+ this._reportError(context, "Animation group has no targeted animations");
88
+ return false;
89
+ }
66
90
  else {
67
91
  // if an animation group was already created, dispose it and create a new one
68
92
  const currentAnimationGroup = this.currentAnimationGroup.getValue(context);
@@ -99,8 +123,8 @@ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
99
123
  // Read the raw end time before it is defaulted to the animation group's natural end, so that an
100
124
  // explicitly provided NaN end time can still be detected by the animation/start validation below.
101
125
  const rawTo = this.to.getValue(context);
102
- // not accepting 0
103
- const to = rawTo || animationGroupToUse.to;
126
+ const hasTo = this.to.isConnected() || context._hasConnectionValue(this.to);
127
+ const to = hasTo ? rawTo : animationGroupToUse.to;
104
128
  // Input validation. Only applies to animation-group playback
105
129
  // (animation/start); interpolation uses the `animation` input and has its own validation below.
106
130
  // The operation activates its `err` flow when the speed is NaN, infinite, or <= 0, or
@@ -167,14 +191,25 @@ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
167
191
  const currentlyRunningAnimationGroups = context._getGlobalContextVariable("currentlyRunningAnimationGroups", []);
168
192
  // check if it already running
169
193
  if (currentlyRunningAnimationGroups.indexOf(animationGroupToUse.uniqueId) !== -1) {
170
- animationGroupToUse.stop();
194
+ this._stopAnimationGroup(context, animationGroupToUse);
171
195
  }
172
196
  try {
173
- animationGroupToUse.start(loop, speed, from, to);
174
- animationGroupToUse.onAnimationGroupEndObservable.add(() => this._onAnimationGroupEnd(context));
175
- animationGroupToUse.onAnimationEndObservable.add(() => this._eventsSignalOutputs["animationEnd"]._activateSignal(context));
176
- animationGroupToUse.onAnimationLoopObservable.add(() => this._eventsSignalOutputs["animationLoop"]._activateSignal(context));
177
- animationGroupToUse.onAnimationGroupLoopObservable.add(() => this._eventsSignalOutputs["animationGroupLoop"]._activateSignal(context));
197
+ if (this.config?.useVirtualTimeline) {
198
+ animationGroupToUse.startWithVirtualTimeline(loop, speed, from, to);
199
+ }
200
+ else {
201
+ animationGroupToUse.start(loop, speed, from, to);
202
+ }
203
+ const observers = {
204
+ block: this,
205
+ groupEnd: animationGroupToUse.onAnimationGroupEndObservable.add(() => this._onAnimationGroupEnd(context, animationGroupToUse)),
206
+ animationEnd: animationGroupToUse.onAnimationEndObservable.add(() => this._eventsSignalOutputs["animationEnd"]._activateSignal(context)),
207
+ animationLoop: animationGroupToUse.onAnimationLoopObservable.add(() => this._eventsSignalOutputs["animationLoop"]._activateSignal(context)),
208
+ groupLoop: animationGroupToUse.onAnimationGroupLoopObservable.add(() => this._eventsSignalOutputs["animationGroupLoop"]._activateSignal(context)),
209
+ };
210
+ const observerSets = context._getGlobalContextVariable("animationGroupObserverSets", new Map());
211
+ observerSets.set(animationGroupToUse.uniqueId, observers);
212
+ context._setGlobalContextVariable("animationGroupObserverSets", observerSets);
178
213
  currentlyRunningAnimationGroups.push(animationGroupToUse.uniqueId);
179
214
  context._setGlobalContextVariable("currentlyRunningAnimationGroups", currentlyRunningAnimationGroups);
180
215
  }
@@ -203,8 +238,9 @@ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
203
238
  _execute(context) {
204
239
  this._startPendingTasks(context);
205
240
  }
206
- _onAnimationGroupEnd(context) {
207
- this._removeFromCurrentlyRunning(context, this.currentAnimationGroup.getValue(context));
241
+ _onAnimationGroupEnd(context, animationGroup) {
242
+ RemoveFlowGraphAnimationGroupObservers(context, animationGroup);
243
+ this._removeFromCurrentlyRunning(context, animationGroup);
208
244
  this._resetAfterCanceled(context);
209
245
  this.done._activateSignal(context);
210
246
  }
@@ -230,6 +266,8 @@ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
230
266
  }
231
267
  }
232
268
  _stopAnimationGroup(context, animationGroup) {
269
+ const owner = RemoveFlowGraphAnimationGroupObservers(context, animationGroup);
270
+ owner?._cleanupAfterExternalStop(context, animationGroup);
233
271
  // stop, while skipping the on AnimationEndObservable to avoid the "done" signal
234
272
  animationGroup.stop(true);
235
273
  // Only dispose animation groups that were internally created by this block
@@ -241,6 +279,11 @@ export class FlowGraphPlayAnimationBlock extends FlowGraphAsyncExecutionBlock {
241
279
  }
242
280
  this._removeFromCurrentlyRunning(context, animationGroup);
243
281
  }
282
+ /** @internal */
283
+ _cleanupAfterExternalStop(context, animationGroup) {
284
+ this._removeFromCurrentlyRunning(context, animationGroup);
285
+ this._resetAfterCanceled(context);
286
+ }
244
287
  _removeFromCurrentlyRunning(context, animationGroup) {
245
288
  const currentlyRunningAnimationGroups = context._getGlobalContextVariable("currentlyRunningAnimationGroups", []);
246
289
  const idx = currentlyRunningAnimationGroups.indexOf(animationGroup.uniqueId);
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphPlayAnimationBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;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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xB,6EAAyC;IAC7C,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,mCAAmC;IAC/C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,wEAAoC,2BAA2B,CAAC,CAAC;AAClF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport { type FlowGraphDataConnection } from \"../../../flowGraphDataConnection.pure\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"../../../flowGraphAsyncExecutionBlock\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeBoolean } from \"../../../flowGraphRichTypes.pure\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { AnimationGroup } from \"core/Animations/animationGroup.pure\";\r\nimport { type Animation } from \"core/Animations/animation.pure\";\r\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\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 override _startPendingTasks(context: FlowGraphContext): void {\r\n if (context._getExecutionVariable(this, \"_initialized\", false)) {\r\n this._cancelPendingTasks(context);\r\n this._resetAfterCanceled(context);\r\n }\r\n\r\n if (!this._tryPreparePendingTasks(context)) {\r\n return;\r\n }\r\n context._addPendingBlock(this);\r\n this.out._activateSignal(context);\r\n context._setExecutionVariable(this, \"_initialized\", true);\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param context the graph context\r\n */\r\n public override _preparePendingTasks(context: FlowGraphContext): void {\r\n this._tryPreparePendingTasks(context);\r\n }\r\n\r\n /**\r\n * Prepares and starts the animation, reporting whether it could be started. Invalid inputs\r\n * activate `err` and return false, so the caller neither activates `out` nor registers the\r\n * block as pending.\r\n * @param context the graph context\r\n * @returns whether the animation was prepared and started successfully\r\n */\r\n private _tryPreparePendingTasks(context: FlowGraphContext): boolean {\r\n const ag = this.animationGroup.getValue(context);\r\n const animation = this.animation.getValue(context);\r\n if (!ag && !animation) {\r\n this._reportError(context, \"No animation or animation group provided\");\r\n return false;\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 let isInterpolation = false;\r\n let interpolationAnimationsArray: Animation[] | undefined;\r\n let interpolationTarget: any;\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._reportError(context, \"No target object provided\");\r\n return false;\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 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 interpolationAnimationsArray = animationsArray;\r\n interpolationTarget = target;\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 // Read the raw end time before it is defaulted to the animation group's natural end, so that an\r\n // explicitly provided NaN end time can still be detected by the animation/start validation below.\r\n const rawTo = this.to.getValue(context);\r\n // not accepting 0\r\n const to = rawTo || animationGroupToUse.to;\r\n\r\n // Input validation. Only applies to animation-group playback\r\n // (animation/start); interpolation uses the `animation` input and has its own validation below.\r\n // The operation activates its `err` flow when the speed is NaN, infinite, or <= 0, or\r\n // when the end time is NaN. A NaN or infinite start time is caught by the finite check on `from`.\r\n if (!animation) {\r\n if (isNaN(rawTo)) {\r\n this._reportError(context, \"Invalid animation end time\");\r\n return false;\r\n }\r\n // Only validate a speed that was explicitly provided; an unconnected speed keeps the engine\r\n // default of 1 (matching the historical Babylon behavior for animation/start without a speed).\r\n if (this.speed.isConnected() || context._hasConnectionValue(this.speed)) {\r\n const providedSpeed = this.speed.getValue(context);\r\n if (!isFinite(providedSpeed) || providedSpeed <= 0) {\r\n this._reportError(context, \"Invalid animation speed\");\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // The start value (interpolation start frame / animation start time) must always be finite. For\r\n // animation/start this also satisfies the spec requirement that a NaN or infinite start time\r\n // activates the err flow.\r\n if (!isFinite(from)) {\r\n this._reportError(context, \"Invalid animation duration\");\r\n return false;\r\n }\r\n // For interpolation the end value is the animation duration and must be a finite, non-negative number.\r\n // Animation-group playback (animation/start) instead allows an infinite end time — it means \"play to\r\n // the natural end / loop\" (see the `loop` computation below) — and its NaN end time was already\r\n // rejected above, so the end value is only range-checked here for the interpolation case.\r\n if (animation && (!isFinite(to) || to < 0)) {\r\n this._reportError(context, \"Invalid animation duration\");\r\n return false;\r\n }\r\n\r\n // CSS cubic-bezier control points must be finite, and the X components must be in [0, 1].\r\n if (animation) {\r\n const animationsArray = Array.isArray(animation) ? animation : [animation];\r\n for (const anim of animationsArray) {\r\n const easing = anim.getEasingFunction?.();\r\n if (easing && \"x1\" in easing) {\r\n const bezier = easing as unknown as { x1: number; y1: number; x2: number; y2: number };\r\n if (\r\n !Number.isFinite(bezier.x1) ||\r\n !Number.isFinite(bezier.y1) ||\r\n !Number.isFinite(bezier.x2) ||\r\n !Number.isFinite(bezier.y2) ||\r\n bezier.x1 < 0 ||\r\n bezier.x1 > 1 ||\r\n bezier.x2 < 0 ||\r\n bezier.x2 > 1\r\n ) {\r\n this._reportError(context, \"Invalid bezier curve control points\");\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Stop any interpolation already running on the same target/property, but only after validation has\r\n // passed. An invalid interpolation (bad duration or NaN control points) must report [err] without\r\n // disturbing an interpolation that is already running on the same target.\r\n if (isInterpolation && interpolationAnimationsArray && interpolationTarget !== undefined) {\r\n this._checkInterpolationDuplications(context, interpolationAnimationsArray, interpolationTarget);\r\n }\r\n\r\n const loop = !isFinite(to) || 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 try {\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 } catch (e) {\r\n this._reportError(context, e);\r\n return false;\r\n }\r\n return true;\r\n }\r\n }\r\n\r\n protected override _reportError(context: FlowGraphContext, error: string | Error): void {\r\n super._reportError(context, error);\r\n this.currentFrame.setValue(-1, context);\r\n this.currentTime.setValue(-1, context);\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 // Only dispose animation groups that were internally created by this block\r\n // (i.e. built from individual animations). Scene-provided animation groups\r\n // must not be disposed as that removes them from the scene catalog and\r\n // breaks the editor dropdown / re-use on replay.\r\n if (animationGroup.name.startsWith(\"flowGraphAnimationGroup-\")) {\r\n animationGroup.dispose();\r\n }\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 override _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\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphPlayAnimationBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphPlayAnimationBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.PlayAnimation, FlowGraphPlayAnimationBlock);\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphPlayAnimationBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGrE,OAAO,EAAE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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,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,mCAAmC;IAC/C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,wEAAoC,2BAA2B,CAAC,CAAC;AAClF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport { type FlowGraphDataConnection } from \"../../../flowGraphDataConnection.pure\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"../../../flowGraphAsyncExecutionBlock\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeBoolean } from \"../../../flowGraphRichTypes.pure\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { AnimationGroup } from \"core/Animations/animationGroup.pure\";\r\nimport { type Animation } from \"core/Animations/animation.pure\";\r\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { type Observer } from \"core/Misc/observable.pure\";\r\n\r\n/**\r\n * Configuration for playing an animation.\r\n */\r\nexport interface IFlowGraphPlayAnimationBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * Whether animation-group playback uses the unbounded KHR_interactivity timeline.\r\n */\r\n useVirtualTimeline?: boolean;\r\n}\r\n\r\ntype AnimationObserverSet = {\r\n block: FlowGraphPlayAnimationBlock;\r\n groupEnd: Observer<AnimationGroup>;\r\n animationEnd: Observer<any>;\r\n animationLoop: Observer<any>;\r\n groupLoop: Observer<AnimationGroup>;\r\n};\r\n\r\n/**\r\n * Removes observers owned by the play block that started an animation group.\r\n * @param context active FlowGraph context\r\n * @param animationGroup animation group being replaced or stopped\r\n * @returns the owning play block, when one was registered\r\n */\r\nexport function RemoveFlowGraphAnimationGroupObservers(context: FlowGraphContext, animationGroup: AnimationGroup): FlowGraphPlayAnimationBlock | undefined {\r\n const observerSets = context._getGlobalContextVariable(\"animationGroupObserverSets\", new Map<number, AnimationObserverSet>()) as Map<number, AnimationObserverSet>;\r\n const observers = observerSets.get(animationGroup.uniqueId);\r\n if (!observers) {\r\n return undefined;\r\n }\r\n animationGroup.onAnimationGroupEndObservable.remove(observers.groupEnd);\r\n animationGroup.onAnimationEndObservable.remove(observers.animationEnd);\r\n animationGroup.onAnimationLoopObservable.remove(observers.animationLoop);\r\n animationGroup.onAnimationGroupLoopObservable.remove(observers.groupLoop);\r\n observerSets.delete(animationGroup.uniqueId);\r\n context._setGlobalContextVariable(\"animationGroupObserverSets\", observerSets);\r\n return observers.block;\r\n}\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?: IFlowGraphPlayAnimationBlockConfiguration\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 override _startPendingTasks(context: FlowGraphContext): void {\r\n if (context._getExecutionVariable(this, \"_initialized\", false)) {\r\n this._cancelPendingTasks(context);\r\n this._resetAfterCanceled(context);\r\n }\r\n\r\n if (!this._tryPreparePendingTasks(context)) {\r\n return;\r\n }\r\n context._addPendingBlock(this);\r\n this.out._activateSignal(context);\r\n context._setExecutionVariable(this, \"_initialized\", true);\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param context the graph context\r\n */\r\n public override _preparePendingTasks(context: FlowGraphContext): void {\r\n this._tryPreparePendingTasks(context);\r\n }\r\n\r\n /**\r\n * Prepares and starts the animation, reporting whether it could be started. Invalid inputs\r\n * activate `err` and return false, so the caller neither activates `out` nor registers the\r\n * block as pending.\r\n * @param context the graph context\r\n * @returns whether the animation was prepared and started successfully\r\n */\r\n private _tryPreparePendingTasks(context: FlowGraphContext): boolean {\r\n const ag = this.animationGroup.getValue(context);\r\n const animation = this.animation.getValue(context);\r\n if (!ag && !animation) {\r\n this._reportError(context, \"No animation or animation group provided\");\r\n return false;\r\n } else if (ag && ag.targetedAnimations.length === 0) {\r\n this._reportError(context, \"Animation group has no targeted animations\");\r\n return false;\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 let isInterpolation = false;\r\n let interpolationAnimationsArray: Animation[] | undefined;\r\n let interpolationTarget: any;\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._reportError(context, \"No target object provided\");\r\n return false;\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 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 interpolationAnimationsArray = animationsArray;\r\n interpolationTarget = target;\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 // Read the raw end time before it is defaulted to the animation group's natural end, so that an\r\n // explicitly provided NaN end time can still be detected by the animation/start validation below.\r\n const rawTo = this.to.getValue(context);\r\n const hasTo = this.to.isConnected() || context._hasConnectionValue(this.to);\r\n const to = hasTo ? rawTo : animationGroupToUse.to;\r\n\r\n // Input validation. Only applies to animation-group playback\r\n // (animation/start); interpolation uses the `animation` input and has its own validation below.\r\n // The operation activates its `err` flow when the speed is NaN, infinite, or <= 0, or\r\n // when the end time is NaN. A NaN or infinite start time is caught by the finite check on `from`.\r\n if (!animation) {\r\n if (isNaN(rawTo)) {\r\n this._reportError(context, \"Invalid animation end time\");\r\n return false;\r\n }\r\n // Only validate a speed that was explicitly provided; an unconnected speed keeps the engine\r\n // default of 1 (matching the historical Babylon behavior for animation/start without a speed).\r\n if (this.speed.isConnected() || context._hasConnectionValue(this.speed)) {\r\n const providedSpeed = this.speed.getValue(context);\r\n if (!isFinite(providedSpeed) || providedSpeed <= 0) {\r\n this._reportError(context, \"Invalid animation speed\");\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // The start value (interpolation start frame / animation start time) must always be finite. For\r\n // animation/start this also satisfies the spec requirement that a NaN or infinite start time\r\n // activates the err flow.\r\n if (!isFinite(from)) {\r\n this._reportError(context, \"Invalid animation duration\");\r\n return false;\r\n }\r\n // For interpolation the end value is the animation duration and must be a finite, non-negative number.\r\n // Animation-group playback (animation/start) instead allows an infinite end time — it means \"play to\r\n // the natural end / loop\" (see the `loop` computation below) — and its NaN end time was already\r\n // rejected above, so the end value is only range-checked here for the interpolation case.\r\n if (animation && (!isFinite(to) || to < 0)) {\r\n this._reportError(context, \"Invalid animation duration\");\r\n return false;\r\n }\r\n\r\n // CSS cubic-bezier control points must be finite, and the X components must be in [0, 1].\r\n if (animation) {\r\n const animationsArray = Array.isArray(animation) ? animation : [animation];\r\n for (const anim of animationsArray) {\r\n const easing = anim.getEasingFunction?.();\r\n if (easing && \"x1\" in easing) {\r\n const bezier = easing as unknown as { x1: number; y1: number; x2: number; y2: number };\r\n if (\r\n !Number.isFinite(bezier.x1) ||\r\n !Number.isFinite(bezier.y1) ||\r\n !Number.isFinite(bezier.x2) ||\r\n !Number.isFinite(bezier.y2) ||\r\n bezier.x1 < 0 ||\r\n bezier.x1 > 1 ||\r\n bezier.x2 < 0 ||\r\n bezier.x2 > 1\r\n ) {\r\n this._reportError(context, \"Invalid bezier curve control points\");\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Stop any interpolation already running on the same target/property, but only after validation has\r\n // passed. An invalid interpolation (bad duration or NaN control points) must report [err] without\r\n // disturbing an interpolation that is already running on the same target.\r\n if (isInterpolation && interpolationAnimationsArray && interpolationTarget !== undefined) {\r\n this._checkInterpolationDuplications(context, interpolationAnimationsArray, interpolationTarget);\r\n }\r\n\r\n const loop = !isFinite(to) || 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 this._stopAnimationGroup(context, animationGroupToUse);\r\n }\r\n try {\r\n if (this.config?.useVirtualTimeline) {\r\n animationGroupToUse.startWithVirtualTimeline(loop, speed, from, to);\r\n } else {\r\n animationGroupToUse.start(loop, speed, from, to);\r\n }\r\n const observers: AnimationObserverSet = {\r\n block: this,\r\n groupEnd: animationGroupToUse.onAnimationGroupEndObservable.add(() => this._onAnimationGroupEnd(context, animationGroupToUse)),\r\n animationEnd: animationGroupToUse.onAnimationEndObservable.add(() => this._eventsSignalOutputs[\"animationEnd\"]._activateSignal(context)),\r\n animationLoop: animationGroupToUse.onAnimationLoopObservable.add(() => this._eventsSignalOutputs[\"animationLoop\"]._activateSignal(context)),\r\n groupLoop: animationGroupToUse.onAnimationGroupLoopObservable.add(() => this._eventsSignalOutputs[\"animationGroupLoop\"]._activateSignal(context)),\r\n };\r\n const observerSets = context._getGlobalContextVariable(\"animationGroupObserverSets\", new Map<number, AnimationObserverSet>()) as Map<number, AnimationObserverSet>;\r\n observerSets.set(animationGroupToUse.uniqueId, observers);\r\n context._setGlobalContextVariable(\"animationGroupObserverSets\", observerSets);\r\n currentlyRunningAnimationGroups.push(animationGroupToUse.uniqueId);\r\n context._setGlobalContextVariable(\"currentlyRunningAnimationGroups\", currentlyRunningAnimationGroups);\r\n } catch (e) {\r\n this._reportError(context, e);\r\n return false;\r\n }\r\n return true;\r\n }\r\n }\r\n\r\n protected override _reportError(context: FlowGraphContext, error: string | Error): void {\r\n super._reportError(context, error);\r\n this.currentFrame.setValue(-1, context);\r\n this.currentTime.setValue(-1, context);\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, animationGroup: AnimationGroup) {\r\n RemoveFlowGraphAnimationGroupObservers(context, animationGroup);\r\n this._removeFromCurrentlyRunning(context, animationGroup);\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 const owner = RemoveFlowGraphAnimationGroupObservers(context, animationGroup);\r\n owner?._cleanupAfterExternalStop(context, animationGroup);\r\n // stop, while skipping the on AnimationEndObservable to avoid the \"done\" signal\r\n animationGroup.stop(true);\r\n // Only dispose animation groups that were internally created by this block\r\n // (i.e. built from individual animations). Scene-provided animation groups\r\n // must not be disposed as that removes them from the scene catalog and\r\n // breaks the editor dropdown / re-use on replay.\r\n if (animationGroup.name.startsWith(\"flowGraphAnimationGroup-\")) {\r\n animationGroup.dispose();\r\n }\r\n this._removeFromCurrentlyRunning(context, animationGroup);\r\n }\r\n\r\n /** @internal */\r\n public _cleanupAfterExternalStop(context: FlowGraphContext, animationGroup: AnimationGroup): void {\r\n this._removeFromCurrentlyRunning(context, animationGroup);\r\n this._resetAfterCanceled(context);\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 override _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\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphPlayAnimationBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphPlayAnimationBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(FlowGraphBlockNames.PlayAnimation, FlowGraphPlayAnimationBlock);\r\n}\r\n"]}
@@ -4,6 +4,21 @@ import { type FlowGraphDataConnection } from "../../../flowGraphDataConnection.p
4
4
  import { type IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
5
5
  import { type AnimationGroup } from "../../../../Animations/animationGroup.pure.js";
6
6
  import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock.js";
7
+ /**
8
+ * Configuration for stopping an animation.
9
+ */
10
+ export interface IFlowGraphStopAnimationBlockConfiguration extends IFlowGraphBlockConfiguration {
11
+ /**
12
+ * Whether stopAtFrame uses the unbounded KHR_interactivity timeline.
13
+ * When false, the block retains its legacy positive-frame scheduling behavior.
14
+ */
15
+ useVirtualStopAt?: boolean;
16
+ /**
17
+ * Whether stopping suppresses the animation-group end notification.
18
+ * Defaults to true to preserve the historical StopAnimation behavior.
19
+ */
20
+ skipOnAnimationEnd?: boolean;
21
+ }
7
22
  /**
8
23
  * @experimental
9
24
  * Block that stops a running animation
@@ -17,7 +32,7 @@ export declare class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecution
17
32
  * Input connection - if defined (positive integer) the animation will stop at this frame.
18
33
  */
19
34
  readonly stopAtFrame: FlowGraphDataConnection<number>;
20
- constructor(config?: IFlowGraphBlockConfiguration);
35
+ constructor(config?: IFlowGraphStopAnimationBlockConfiguration);
21
36
  _preparePendingTasks(context: FlowGraphContext): void;
22
37
  _cancelPendingTasks(context: FlowGraphContext): void;
23
38
  _execute(context: FlowGraphContext): void;
@@ -3,6 +3,7 @@ import { RichTypeAny, RichTypeNumber } from "../../../flowGraphRichTypes.pure.js
3
3
  import { Logger } from "../../../../Misc/logger.js";
4
4
  import { FlowGraphAsyncExecutionBlock } from "../../../flowGraphAsyncExecutionBlock.js";
5
5
  import { RegisterClass } from "../../../../Misc/typeStore.js";
6
+ import { RemoveFlowGraphAnimationGroupObservers } from "./flowGraphPlayAnimationBlock.pure.js";
6
7
  /**
7
8
  * @experimental
8
9
  * Block that stops a running animation
@@ -18,8 +19,22 @@ export class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
18
19
  const stopAtFrame = this.stopAtFrame.getValue(context) ?? -1;
19
20
  // get the context variable
20
21
  const pendingStopAnimations = context._getGlobalContextVariable("pendingStopAnimations", []);
21
- // add the animation to the list
22
- pendingStopAnimations.push({ uniqueId: animationToStopValue.uniqueId, stopAtFrame });
22
+ if (this.config?.useVirtualStopAt) {
23
+ const existing = pendingStopAnimations.find((entry) => entry.uniqueId === animationToStopValue.uniqueId && entry.useVirtualStopAt);
24
+ if (existing) {
25
+ if (existing.block !== this) {
26
+ context._removePendingBlock(existing.block);
27
+ }
28
+ existing.stopAtFrame = stopAtFrame;
29
+ existing.block = this;
30
+ }
31
+ else {
32
+ pendingStopAnimations.push({ uniqueId: animationToStopValue.uniqueId, stopAtFrame, block: this, useVirtualStopAt: true });
33
+ }
34
+ }
35
+ else {
36
+ pendingStopAnimations.push({ uniqueId: animationToStopValue.uniqueId, stopAtFrame, block: this, useVirtualStopAt: false });
37
+ }
23
38
  // set the global context variable
24
39
  context._setGlobalContextVariable("pendingStopAnimations", pendingStopAnimations);
25
40
  }
@@ -28,7 +43,7 @@ export class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
28
43
  const animationToStopValue = this.animationGroup.getValue(context);
29
44
  const pendingStopAnimations = context._getGlobalContextVariable("pendingStopAnimations", []);
30
45
  for (let i = 0; i < pendingStopAnimations.length; i++) {
31
- if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId) {
46
+ if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId && pendingStopAnimations[i].block === this) {
32
47
  pendingStopAnimations.splice(i, 1);
33
48
  // set the global context variable
34
49
  context._setGlobalContextVariable("pendingStopAnimations", pendingStopAnimations);
@@ -47,14 +62,26 @@ export class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
47
62
  if (isNaN(stopTime)) {
48
63
  return this._reportError(context, "Invalid stop time.");
49
64
  }
50
- if (stopTime > 0) {
51
- this._startPendingTasks(context);
65
+ const useVirtualStopAt = !!this.config?.useVirtualStopAt;
66
+ const hasScheduledStop = useVirtualStopAt ? this.stopAtFrame.isConnected() || context._hasConnectionValue(this.stopAtFrame) : stopTime > 0;
67
+ let activateDone = false;
68
+ if (hasScheduledStop) {
69
+ if (useVirtualStopAt && animationToStopValue.isValidVirtualStopFrame(stopTime) && animationToStopValue.isVirtualFrameReached(stopTime)) {
70
+ this._stopAnimation(animationToStopValue, context, stopTime);
71
+ activateDone = true;
72
+ }
73
+ else {
74
+ this._startPendingTasks(context);
75
+ }
52
76
  }
53
77
  else {
54
78
  this._stopAnimation(animationToStopValue, context);
55
79
  }
56
80
  // note that out will not be triggered in case of an error
57
81
  this.out._activateSignal(context);
82
+ if (activateDone) {
83
+ this.done._activateSignal(context);
84
+ }
58
85
  }
59
86
  _executeOnTick(context) {
60
87
  const animationToStopValue = this.animationGroup.getValue(context);
@@ -62,11 +89,15 @@ export class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
62
89
  const pendingStopAnimations = context._getGlobalContextVariable("pendingStopAnimations", []);
63
90
  for (let i = 0; i < pendingStopAnimations.length; i++) {
64
91
  // compare the uniqueId to the animation to stop
65
- if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId) {
66
- // check if the current frame is AFTER the stopAtFrame
67
- if (animationToStopValue.getCurrentFrame() >= pendingStopAnimations[i].stopAtFrame) {
92
+ if (pendingStopAnimations[i].uniqueId === animationToStopValue.uniqueId && pendingStopAnimations[i].block === this) {
93
+ const useVirtualStopAt = pendingStopAnimations[i].useVirtualStopAt;
94
+ const shouldStop = useVirtualStopAt
95
+ ? animationToStopValue.isValidVirtualStopFrame(pendingStopAnimations[i].stopAtFrame) &&
96
+ animationToStopValue.isVirtualFrameReached(pendingStopAnimations[i].stopAtFrame)
97
+ : animationToStopValue.getCurrentFrame() >= pendingStopAnimations[i].stopAtFrame;
98
+ if (shouldStop) {
68
99
  // stop the animation
69
- this._stopAnimation(animationToStopValue, context);
100
+ this._stopAnimation(animationToStopValue, context, useVirtualStopAt ? pendingStopAnimations[i].stopAtFrame : undefined);
70
101
  // remove the animation from the list
71
102
  pendingStopAnimations.splice(i, 1);
72
103
  // set the global context variable
@@ -75,6 +106,12 @@ export class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
75
106
  context._removePendingBlock(this);
76
107
  break;
77
108
  }
109
+ else if (!animationToStopValue.isPlaying) {
110
+ pendingStopAnimations.splice(i, 1);
111
+ context._setGlobalContextVariable("pendingStopAnimations", pendingStopAnimations);
112
+ context._removePendingBlock(this);
113
+ break;
114
+ }
78
115
  }
79
116
  }
80
117
  }
@@ -84,18 +121,31 @@ export class FlowGraphStopAnimationBlock extends FlowGraphAsyncExecutionBlock {
84
121
  getClassName() {
85
122
  return "FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */;
86
123
  }
87
- _stopAnimation(animationGroup, context) {
124
+ _stopAnimation(animationGroup, context, virtualStopFrame) {
88
125
  const currentlyRunning = context._getGlobalContextVariable("currentlyRunningAnimationGroups", []);
89
126
  const index = currentlyRunning.indexOf(animationGroup.uniqueId);
90
127
  if (index !== -1) {
128
+ const suppressAnimationEnd = this.config?.skipOnAnimationEnd !== false;
129
+ const owner = suppressAnimationEnd ? RemoveFlowGraphAnimationGroupObservers(context, animationGroup) : undefined;
130
+ owner?._cleanupAfterExternalStop(context, animationGroup);
131
+ if (virtualStopFrame !== undefined) {
132
+ animationGroup.setVirtualCurrentFrame(virtualStopFrame);
133
+ }
91
134
  // Skip the animation-end observable so that stopping does not activate the originating
92
135
  // starting block's `done` flow. When an animation is
93
136
  // stopped (animation/stop or animation/stopAt) the previously associated `done` flows MUST NOT be
94
137
  // activated; only animation/stopAt's own `done` flow (fired from _executeOnTick) should run.
95
- animationGroup.stop(true);
96
- currentlyRunning.splice(index, 1);
97
- // update the global context variable
98
- context._setGlobalContextVariable("currentlyRunningAnimationGroups", currentlyRunning);
138
+ if (suppressAnimationEnd) {
139
+ animationGroup.stop(true);
140
+ }
141
+ else {
142
+ animationGroup.stop();
143
+ }
144
+ const remainingIndex = currentlyRunning.indexOf(animationGroup.uniqueId);
145
+ if (remainingIndex !== -1) {
146
+ currentlyRunning.splice(remainingIndex, 1);
147
+ context._setGlobalContextVariable("currentlyRunningAnimationGroups", currentlyRunning);
148
+ }
99
149
  }
100
150
  else {
101
151
  // Logger.Warn("Trying to stop an animation that is not running.");