@nice2dev/game-engine 1.3.15 → 1.3.16

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 (434) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/accessibility/Accessibility.js +152 -165
  3. package/dist/cjs/ai/AI.js +292 -294
  4. package/dist/cjs/ai/BehaviorTree.js +1029 -1113
  5. package/dist/cjs/ai/StateMachine.js +694 -756
  6. package/dist/cjs/animation/Animation.js +232 -241
  7. package/dist/cjs/audio/AudioAdvanced.js +221 -236
  8. package/dist/cjs/audio/AudioBridge.js +441 -435
  9. package/dist/cjs/audio/AudioManager.js +242 -259
  10. package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
  11. package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
  12. package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
  13. package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
  14. package/dist/cjs/core/EventBus.js +51 -56
  15. package/dist/cjs/core/GameClock.js +62 -66
  16. package/dist/cjs/core/GameConfig.js +72 -79
  17. package/dist/cjs/core/GameLoop.js +80 -89
  18. package/dist/cjs/core/ServiceLocator.js +61 -65
  19. package/dist/cjs/core/Validation.js +72 -82
  20. package/dist/cjs/core/math.js +108 -112
  21. package/dist/cjs/devtools/DevTools.js +542 -563
  22. package/dist/cjs/devtools/DeveloperExperience.js +521 -559
  23. package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
  24. package/dist/cjs/dialogue/DialogueSystem.js +984 -986
  25. package/dist/cjs/docs/DocGenerator.js +339 -364
  26. package/dist/cjs/ecs/World.js +355 -371
  27. package/dist/cjs/editor/AchievementEditor.js +580 -636
  28. package/dist/cjs/editor/AdvancedEditor.js +184 -191
  29. package/dist/cjs/editor/AnimationRetargeting.js +696 -741
  30. package/dist/cjs/editor/AssetBrowser.js +1072 -1160
  31. package/dist/cjs/editor/AssetManager.js +187 -192
  32. package/dist/cjs/editor/ConsolePro.js +971 -1061
  33. package/dist/cjs/editor/CraftingEditor.js +680 -730
  34. package/dist/cjs/editor/DebugTools.js +187 -185
  35. package/dist/cjs/editor/DialogueSystem.js +844 -901
  36. package/dist/cjs/editor/LeaderboardSystem.js +429 -483
  37. package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
  38. package/dist/cjs/editor/PrefabSystem.js +772 -838
  39. package/dist/cjs/editor/ProfilerPanel.js +649 -700
  40. package/dist/cjs/editor/QuestEditor.js +792 -839
  41. package/dist/cjs/editor/ReplaySystem.js +585 -634
  42. package/dist/cjs/editor/SceneEditor.js +176 -200
  43. package/dist/cjs/editor/ScreenshotMode.js +621 -688
  44. package/dist/cjs/editor/ShaderGraph.js +1556 -1582
  45. package/dist/cjs/editor/TimelineEditor.js +715 -778
  46. package/dist/cjs/editor/UndoRedoPro.js +830 -904
  47. package/dist/cjs/editor/VRARMode.js +582 -645
  48. package/dist/cjs/engine/NiceGameEngine.js +141 -164
  49. package/dist/cjs/engine/SaveSystem.js +441 -495
  50. package/dist/cjs/enterprise/Enterprise.js +254 -261
  51. package/dist/cjs/export/BevyExporter.js +927 -967
  52. package/dist/cjs/export/CocosExporter.js +644 -673
  53. package/dist/cjs/export/Construct3Exporter.js +783 -794
  54. package/dist/cjs/export/DefoldExporter.js +1028 -1069
  55. package/dist/cjs/export/GDevelopExporter.js +674 -708
  56. package/dist/cjs/export/GameMakerExporter.js +791 -805
  57. package/dist/cjs/export/GodotExporter.js +1003 -1045
  58. package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
  59. package/dist/cjs/export/MonoGameExporter.js +1265 -1293
  60. package/dist/cjs/export/Pico8Exporter.js +766 -812
  61. package/dist/cjs/export/PlatformExporter.js +188 -206
  62. package/dist/cjs/export/RPGMakerExporter.js +860 -879
  63. package/dist/cjs/export/RobloxExporter.js +883 -919
  64. package/dist/cjs/export/Solar2DExporter.js +1218 -1256
  65. package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
  66. package/dist/cjs/export/Tic80Exporter.js +1210 -1267
  67. package/dist/cjs/export/UnityExporter.js +1116 -1131
  68. package/dist/cjs/export/UnrealExporter.js +889 -919
  69. package/dist/cjs/export/WebExporter.js +931 -970
  70. package/dist/cjs/export/index.js +42 -65
  71. package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
  72. package/dist/cjs/godot-integration/GodotImport.js +929 -1027
  73. package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
  74. package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
  75. package/dist/cjs/i18n/I18n.js +860 -900
  76. package/dist/cjs/i18n/useTranslation.js +84 -89
  77. package/dist/cjs/import/AsepriteImporter.js +658 -716
  78. package/dist/cjs/import/DragonBonesImporter.js +437 -461
  79. package/dist/cjs/import/GameMakerImporter.js +511 -521
  80. package/dist/cjs/import/GodotSceneImporter.js +788 -822
  81. package/dist/cjs/import/LDtkImporter.js +436 -454
  82. package/dist/cjs/import/Live2DImporter.js +497 -518
  83. package/dist/cjs/import/NdgFormat.js +424 -457
  84. package/dist/cjs/import/OgmoImporter.js +466 -493
  85. package/dist/cjs/import/RPGMakerImporter.js +451 -477
  86. package/dist/cjs/import/SceneImporter.js +378 -423
  87. package/dist/cjs/import/SpineImporter.js +511 -546
  88. package/dist/cjs/import/SpriterImporter.js +590 -613
  89. package/dist/cjs/import/TiledMapImporter.js +811 -846
  90. package/dist/cjs/import/UnitySceneImporter.js +687 -703
  91. package/dist/cjs/import/index.js +206 -251
  92. package/dist/cjs/index.js +275 -278
  93. package/dist/cjs/input/GamepadNavigation.js +185 -205
  94. package/dist/cjs/input/InputManager.js +397 -421
  95. package/dist/cjs/input/useGamepads.js +70 -81
  96. package/dist/cjs/integration/IconSprite.js +129 -256
  97. package/dist/cjs/inventory/InventorySystem.js +920 -995
  98. package/dist/cjs/kids/KidMode.js +997 -1022
  99. package/dist/cjs/kids/KidTools.js +570 -594
  100. package/dist/cjs/monetization/Monetization.js +170 -177
  101. package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
  102. package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
  103. package/dist/cjs/native-engine/AnimationSystem.js +731 -806
  104. package/dist/cjs/native-engine/AssetPipeline.js +454 -515
  105. package/dist/cjs/native-engine/AudioEngine.js +763 -804
  106. package/dist/cjs/native-engine/InputSystem.js +1075 -1145
  107. package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
  108. package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
  109. package/dist/cjs/native-engine/RenderingEngine.js +302 -350
  110. package/dist/cjs/native-engine/SceneGraph.js +769 -808
  111. package/dist/cjs/network/MultiplayerTransport.js +97 -132
  112. package/dist/cjs/network/Networking.js +549 -564
  113. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
  114. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
  115. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
  116. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
  117. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
  118. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
  119. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
  120. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
  121. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
  122. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
  123. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
  124. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
  125. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
  126. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
  127. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
  128. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
  129. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
  130. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
  131. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
  132. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
  133. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
  134. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
  135. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
  136. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
  137. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
  138. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
  139. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
  140. package/dist/cjs/pathfinding/Pathfinding.js +245 -263
  141. package/dist/cjs/performance/AssetStreaming.js +561 -635
  142. package/dist/cjs/performance/BenchmarkSuite.js +283 -311
  143. package/dist/cjs/performance/DeltaCompression.js +467 -526
  144. package/dist/cjs/performance/DeterministicPhysics.js +450 -498
  145. package/dist/cjs/performance/ECSOptimization.js +644 -695
  146. package/dist/cjs/performance/GameSaveSystem.js +509 -556
  147. package/dist/cjs/performance/HotReload.js +447 -500
  148. package/dist/cjs/performance/InputRecording.js +511 -561
  149. package/dist/cjs/performance/InterestManagement.js +453 -500
  150. package/dist/cjs/performance/LocalizationRuntime.js +376 -423
  151. package/dist/cjs/performance/MemoryManagement.js +410 -470
  152. package/dist/cjs/performance/ModSupport.js +445 -496
  153. package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
  154. package/dist/cjs/performance/NetworkPrediction.js +424 -482
  155. package/dist/cjs/performance/ObjectPooling.js +569 -617
  156. package/dist/cjs/performance/Performance.js +174 -190
  157. package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
  158. package/dist/cjs/performance/WebGPURenderer.js +656 -683
  159. package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
  160. package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
  161. package/dist/cjs/plugins/PluginSDK.js +432 -466
  162. package/dist/cjs/plugins/PluginTestKit.js +307 -330
  163. package/dist/cjs/procedural/Procedural.js +243 -254
  164. package/dist/cjs/procedural/WorldBuilding.js +297 -314
  165. package/dist/cjs/quest/QuestSystem.js +975 -932
  166. package/dist/cjs/release/MobileExport.js +157 -163
  167. package/dist/cjs/release/Release.js +225 -238
  168. package/dist/cjs/rendering/Camera2D.js +121 -124
  169. package/dist/cjs/rendering/Renderer2D.js +321 -335
  170. package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
  171. package/dist/cjs/runtime3d/Runtime3D.js +359 -378
  172. package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
  173. package/dist/cjs/scene/SceneManager.js +177 -193
  174. package/dist/cjs/scripting/GraphToAST.js +574 -547
  175. package/dist/cjs/scripting/LanguageExporter.js +254 -279
  176. package/dist/cjs/scripting/NodeGraph.js +546 -570
  177. package/dist/cjs/scripting/ScriptAST.js +31 -39
  178. package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
  179. package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
  180. package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
  181. package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
  182. package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
  183. package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
  184. package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
  185. package/dist/cjs/social/Social.js +72 -80
  186. package/dist/cjs/systems/LightingSystem.js +844 -931
  187. package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
  188. package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
  189. package/dist/cjs/systems/TerrainSystem.js +985 -1098
  190. package/dist/cjs/templates/ActionTemplates.js +296 -309
  191. package/dist/cjs/templates/FightingTemplate.js +417 -463
  192. package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
  193. package/dist/cjs/templates/PartyTemplates.js +190 -202
  194. package/dist/cjs/templates/PuzzleTemplates.js +245 -261
  195. package/dist/cjs/templates/RPGTemplates.js +160 -178
  196. package/dist/cjs/templates/SportsTemplates.js +237 -250
  197. package/dist/cjs/templates/StrategyTemplates.js +143 -153
  198. package/dist/cjs/templates/SurvivalTemplate.js +336 -380
  199. package/dist/cjs/templates/WaveDefense.js +499 -526
  200. package/dist/cjs/tilemap/Tilemap.js +207 -214
  201. package/dist/cjs/tutorials/TutorialBranching.js +396 -417
  202. package/dist/cjs/tutorials/TutorialEngine.js +888 -931
  203. package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
  204. package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
  205. package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
  206. package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
  207. package/dist/cjs/ui/GameUI.js +295 -312
  208. package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
  209. package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
  210. package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
  211. package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
  212. package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
  213. package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
  214. package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
  215. package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
  216. package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
  217. package/dist/cjs/xr/ARVR.js +167 -175
  218. package/dist/esm/accessibility/Accessibility.js +160 -164
  219. package/dist/esm/ai/AI.js +310 -293
  220. package/dist/esm/ai/BehaviorTree.js +1057 -1112
  221. package/dist/esm/ai/StateMachine.js +709 -755
  222. package/dist/esm/animation/Animation.js +237 -240
  223. package/dist/esm/audio/AudioAdvanced.js +239 -235
  224. package/dist/esm/audio/AudioBridge.js +448 -434
  225. package/dist/esm/audio/AudioManager.js +243 -258
  226. package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
  227. package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
  228. package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
  229. package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
  230. package/dist/esm/core/EventBus.js +52 -55
  231. package/dist/esm/core/GameClock.js +63 -65
  232. package/dist/esm/core/GameConfig.js +77 -78
  233. package/dist/esm/core/GameLoop.js +81 -88
  234. package/dist/esm/core/ServiceLocator.js +63 -64
  235. package/dist/esm/core/Validation.js +82 -81
  236. package/dist/esm/core/math.js +109 -111
  237. package/dist/esm/devtools/DevTools.js +546 -562
  238. package/dist/esm/devtools/DeveloperExperience.js +535 -558
  239. package/dist/esm/devtools/GameplayAnalytics.js +647 -645
  240. package/dist/esm/dialogue/DialogueSystem.js +998 -985
  241. package/dist/esm/docs/DocGenerator.js +342 -363
  242. package/dist/esm/ecs/World.js +358 -370
  243. package/dist/esm/editor/AchievementEditor.js +584 -635
  244. package/dist/esm/editor/AdvancedEditor.js +191 -190
  245. package/dist/esm/editor/AnimationRetargeting.js +700 -740
  246. package/dist/esm/editor/AssetBrowser.js +1078 -1159
  247. package/dist/esm/editor/AssetManager.js +188 -191
  248. package/dist/esm/editor/ConsolePro.js +977 -1060
  249. package/dist/esm/editor/CraftingEditor.js +684 -729
  250. package/dist/esm/editor/DebugTools.js +194 -184
  251. package/dist/esm/editor/DialogueSystem.js +849 -900
  252. package/dist/esm/editor/LeaderboardSystem.js +433 -482
  253. package/dist/esm/editor/NiceGameEditor.js +1908 -1200
  254. package/dist/esm/editor/PrefabSystem.js +777 -837
  255. package/dist/esm/editor/ProfilerPanel.js +654 -699
  256. package/dist/esm/editor/QuestEditor.js +795 -838
  257. package/dist/esm/editor/ReplaySystem.js +591 -633
  258. package/dist/esm/editor/SceneEditor.js +189 -199
  259. package/dist/esm/editor/ScreenshotMode.js +628 -687
  260. package/dist/esm/editor/ShaderGraph.js +1565 -1581
  261. package/dist/esm/editor/TimelineEditor.js +733 -777
  262. package/dist/esm/editor/UndoRedoPro.js +835 -903
  263. package/dist/esm/editor/VRARMode.js +586 -644
  264. package/dist/esm/engine/NiceGameEngine.js +142 -163
  265. package/dist/esm/engine/SaveSystem.js +447 -494
  266. package/dist/esm/enterprise/Enterprise.js +265 -260
  267. package/dist/esm/export/BevyExporter.js +929 -966
  268. package/dist/esm/export/CocosExporter.js +646 -672
  269. package/dist/esm/export/Construct3Exporter.js +785 -793
  270. package/dist/esm/export/DefoldExporter.js +1030 -1068
  271. package/dist/esm/export/GDevelopExporter.js +676 -707
  272. package/dist/esm/export/GameMakerExporter.js +793 -804
  273. package/dist/esm/export/GodotExporter.js +1004 -1044
  274. package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
  275. package/dist/esm/export/MonoGameExporter.js +1267 -1292
  276. package/dist/esm/export/Pico8Exporter.js +768 -811
  277. package/dist/esm/export/PlatformExporter.js +193 -205
  278. package/dist/esm/export/RPGMakerExporter.js +862 -878
  279. package/dist/esm/export/RobloxExporter.js +885 -918
  280. package/dist/esm/export/Solar2DExporter.js +1220 -1255
  281. package/dist/esm/export/ThreeJSExporter.js +1007 -1072
  282. package/dist/esm/export/Tic80Exporter.js +1212 -1266
  283. package/dist/esm/export/UnityExporter.js +1117 -1130
  284. package/dist/esm/export/UnrealExporter.js +891 -918
  285. package/dist/esm/export/WebExporter.js +933 -969
  286. package/dist/esm/export/index.js +86 -71
  287. package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
  288. package/dist/esm/godot-integration/GodotImport.js +935 -1026
  289. package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
  290. package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
  291. package/dist/esm/i18n/I18n.js +871 -899
  292. package/dist/esm/i18n/useTranslation.js +88 -88
  293. package/dist/esm/import/AsepriteImporter.js +637 -715
  294. package/dist/esm/import/DragonBonesImporter.js +417 -460
  295. package/dist/esm/import/GameMakerImporter.js +491 -520
  296. package/dist/esm/import/GodotSceneImporter.js +767 -821
  297. package/dist/esm/import/LDtkImporter.js +415 -453
  298. package/dist/esm/import/Live2DImporter.js +477 -517
  299. package/dist/esm/import/NdgFormat.js +410 -456
  300. package/dist/esm/import/OgmoImporter.js +446 -492
  301. package/dist/esm/import/RPGMakerImporter.js +431 -476
  302. package/dist/esm/import/SceneImporter.js +385 -422
  303. package/dist/esm/import/SpineImporter.js +491 -545
  304. package/dist/esm/import/SpriterImporter.js +570 -612
  305. package/dist/esm/import/TiledMapImporter.js +790 -845
  306. package/dist/esm/import/UnitySceneImporter.js +666 -702
  307. package/dist/esm/import/index.js +247 -258
  308. package/dist/esm/index.js +1332 -188
  309. package/dist/esm/input/GamepadNavigation.js +187 -204
  310. package/dist/esm/input/InputManager.js +401 -420
  311. package/dist/esm/input/useGamepads.js +72 -80
  312. package/dist/esm/integration/IconSprite.js +143 -255
  313. package/dist/esm/inventory/InventorySystem.js +925 -994
  314. package/dist/esm/kids/KidMode.js +1003 -1021
  315. package/dist/esm/kids/KidTools.js +573 -593
  316. package/dist/esm/monetization/Monetization.js +180 -176
  317. package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
  318. package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
  319. package/dist/esm/native-engine/AnimationSystem.js +735 -805
  320. package/dist/esm/native-engine/AssetPipeline.js +456 -514
  321. package/dist/esm/native-engine/AudioEngine.js +765 -803
  322. package/dist/esm/native-engine/InputSystem.js +1079 -1144
  323. package/dist/esm/native-engine/NetworkingSystem.js +740 -792
  324. package/dist/esm/native-engine/PhysicsEngine.js +585 -606
  325. package/dist/esm/native-engine/RenderingEngine.js +304 -349
  326. package/dist/esm/native-engine/SceneGraph.js +773 -807
  327. package/dist/esm/network/MultiplayerTransport.js +99 -131
  328. package/dist/esm/network/Networking.js +556 -563
  329. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
  330. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
  331. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
  332. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
  333. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
  334. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
  335. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
  336. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
  337. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
  338. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
  339. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
  340. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
  341. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
  342. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
  343. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
  344. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
  345. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
  346. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
  347. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
  348. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
  349. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
  350. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
  351. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
  352. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
  353. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
  354. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
  355. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
  356. package/dist/esm/pathfinding/Pathfinding.js +249 -262
  357. package/dist/esm/performance/AssetStreaming.js +567 -634
  358. package/dist/esm/performance/BenchmarkSuite.js +285 -310
  359. package/dist/esm/performance/DeltaCompression.js +478 -525
  360. package/dist/esm/performance/DeterministicPhysics.js +479 -497
  361. package/dist/esm/performance/ECSOptimization.js +653 -694
  362. package/dist/esm/performance/GameSaveSystem.js +515 -555
  363. package/dist/esm/performance/HotReload.js +454 -499
  364. package/dist/esm/performance/InputRecording.js +520 -560
  365. package/dist/esm/performance/InterestManagement.js +460 -499
  366. package/dist/esm/performance/LocalizationRuntime.js +382 -422
  367. package/dist/esm/performance/MemoryManagement.js +415 -469
  368. package/dist/esm/performance/ModSupport.js +455 -495
  369. package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
  370. package/dist/esm/performance/NetworkPrediction.js +436 -481
  371. package/dist/esm/performance/ObjectPooling.js +582 -616
  372. package/dist/esm/performance/Performance.js +182 -189
  373. package/dist/esm/performance/PerformanceAdvanced.js +621 -636
  374. package/dist/esm/performance/WebGPURenderer.js +660 -682
  375. package/dist/esm/physics/PhysicsAdvanced.js +359 -378
  376. package/dist/esm/physics/PhysicsEngine2D.js +393 -426
  377. package/dist/esm/plugins/PluginSDK.js +435 -465
  378. package/dist/esm/plugins/PluginTestKit.js +315 -329
  379. package/dist/esm/procedural/Procedural.js +248 -253
  380. package/dist/esm/procedural/WorldBuilding.js +316 -313
  381. package/dist/esm/quest/QuestSystem.js +982 -931
  382. package/dist/esm/release/MobileExport.js +163 -162
  383. package/dist/esm/release/Release.js +234 -237
  384. package/dist/esm/rendering/Camera2D.js +122 -123
  385. package/dist/esm/rendering/Renderer2D.js +323 -334
  386. package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
  387. package/dist/esm/runtime3d/Runtime3D.js +368 -377
  388. package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
  389. package/dist/esm/scene/SceneManager.js +178 -192
  390. package/dist/esm/scripting/GraphToAST.js +576 -546
  391. package/dist/esm/scripting/LanguageExporter.js +263 -278
  392. package/dist/esm/scripting/NodeGraph.js +550 -569
  393. package/dist/esm/scripting/ScriptAST.js +45 -38
  394. package/dist/esm/scripting/VisualScripting2.js +1025 -1064
  395. package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
  396. package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
  397. package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
  398. package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
  399. package/dist/esm/scripting/exporters/RustExporter.js +460 -511
  400. package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
  401. package/dist/esm/social/Social.js +77 -79
  402. package/dist/esm/systems/LightingSystem.js +855 -930
  403. package/dist/esm/systems/ParticleSystem2.js +1453 -1450
  404. package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
  405. package/dist/esm/systems/TerrainSystem.js +996 -1097
  406. package/dist/esm/templates/ActionTemplates.js +307 -308
  407. package/dist/esm/templates/FightingTemplate.js +439 -462
  408. package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
  409. package/dist/esm/templates/PartyTemplates.js +206 -201
  410. package/dist/esm/templates/PuzzleTemplates.js +260 -260
  411. package/dist/esm/templates/RPGTemplates.js +172 -177
  412. package/dist/esm/templates/SportsTemplates.js +251 -249
  413. package/dist/esm/templates/StrategyTemplates.js +158 -152
  414. package/dist/esm/templates/SurvivalTemplate.js +367 -379
  415. package/dist/esm/templates/WaveDefense.js +501 -525
  416. package/dist/esm/tilemap/Tilemap.js +209 -213
  417. package/dist/esm/tutorials/TutorialBranching.js +399 -416
  418. package/dist/esm/tutorials/TutorialEngine.js +893 -930
  419. package/dist/esm/tutorials/TutorialOverlay.js +603 -639
  420. package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
  421. package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
  422. package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
  423. package/dist/esm/ui/GameUI.js +296 -311
  424. package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
  425. package/dist/esm/unity-integration/UnityImport.js +1071 -1175
  426. package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
  427. package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
  428. package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
  429. package/dist/esm/unreal-integration/UnrealImport.js +395 -411
  430. package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
  431. package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
  432. package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
  433. package/dist/esm/xr/ARVR.js +181 -174
  434. package/package.json +7 -12
@@ -1,643 +1,620 @@
1
- 'use strict';
2
-
3
- var SceneImporter = require('./SceneImporter.js');
4
-
5
- /**
6
- * @file SpriterImporter.ts
7
- * @description Spriter Pro Animation Importer
8
- * PRO-1.3: Scene Format Interoperability
9
- *
10
- * Spriter is a 2D animation tool for games.
11
- * Supports SCML (XML) and SCON (JSON) formats.
12
- *
13
- * File Types:
14
- * - *.scml - Spriter Character Map Lxml (XML format)
15
- * - *.scon - Spriter Character Object Notation (JSON format)
16
- */
17
- // ============================================================
18
- // Spriter Importer
19
- // ============================================================
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
+ const SceneImporter = require("./SceneImporter.js");
20
26
  class SpriterImporter extends SceneImporter.SceneImporter {
21
- constructor() {
22
- super('spriter');
23
- this.project = null;
24
- this.fileMap = new Map();
25
- this.folderMap = new Map();
26
- }
27
- canHandle(filePath) {
28
- const ext = filePath.toLowerCase();
29
- return ext.endsWith('.scml') || ext.endsWith('.scon');
30
- }
31
- async import(options) {
32
- const startTime = Date.now();
33
- this.options = options;
34
- this.clearMessages();
35
- const scenes = [];
36
- const assets = [];
37
- try {
38
- const content = await this.readFile(options.sourcePath);
39
- const isXml = options.sourcePath.toLowerCase().endsWith('.scml');
40
- if (isXml) {
41
- this.project = this.parseScml(content);
42
- }
43
- else {
44
- const parsed = JSON.parse(content);
45
- this.project = parsed.spriter_data;
46
- }
47
- if (!this.project) {
48
- throw new Error('Failed to parse Spriter project');
49
- }
50
- // Build folder/file maps
51
- this.buildMaps();
52
- // Add file assets
53
- for (const folder of this.project.folder) {
54
- for (const file of folder.file) {
55
- assets.push({
56
- id: this.generateId(),
57
- name: this.extractFileName(file.name),
58
- type: file.name.match(/\.(wav|ogg|mp3)$/i) ? 'audio' : 'texture',
59
- path: file.name,
60
- data: {
61
- folder: folder.name || `folder_${folder.id}`,
62
- width: file.width,
63
- height: file.height,
64
- pivotX: file.pivot_x,
65
- pivotY: file.pivot_y,
66
- },
67
- });
68
- }
69
- }
70
- // Convert each entity to a scene
71
- for (const entity of this.project.entity) {
72
- const scene = this.convertEntityToScene(entity);
73
- scenes.push(scene);
27
+ constructor() {
28
+ super("spriter");
29
+ this.project = null;
30
+ this.fileMap = /* @__PURE__ */ new Map();
31
+ this.folderMap = /* @__PURE__ */ new Map();
32
+ }
33
+ canHandle(filePath) {
34
+ const ext = filePath.toLowerCase();
35
+ return ext.endsWith(".scml") || ext.endsWith(".scon");
36
+ }
37
+ async import(options) {
38
+ const startTime = Date.now();
39
+ this.options = options;
40
+ this.clearMessages();
41
+ const scenes = [];
42
+ const assets = [];
43
+ try {
44
+ const content = await this.readFile(options.sourcePath);
45
+ const isXml = options.sourcePath.toLowerCase().endsWith(".scml");
46
+ if (isXml) {
47
+ this.project = this.parseScml(content);
48
+ } else {
49
+ const parsed = JSON.parse(content);
50
+ this.project = parsed.spriter_data;
51
+ }
52
+ if (!this.project) {
53
+ throw new Error("Failed to parse Spriter project");
54
+ }
55
+ this.buildMaps();
56
+ for (const folder of this.project.folder) {
57
+ for (const file of folder.file) {
58
+ assets.push({
59
+ id: this.generateId(),
60
+ name: this.extractFileName(file.name),
61
+ type: file.name.match(/\.(wav|ogg|mp3)$/i) ? "audio" : "texture",
62
+ path: file.name,
63
+ data: {
64
+ folder: folder.name || `folder_${folder.id}`,
65
+ width: file.width,
66
+ height: file.height,
67
+ pivotX: file.pivot_x,
68
+ pivotY: file.pivot_y
74
69
  }
70
+ });
75
71
  }
76
- catch (error) {
77
- this.addError('IMPORT_ERROR', `Failed to import: ${error}`, options.sourcePath, undefined, true);
78
- }
79
- return this.createResult(scenes, assets, startTime);
72
+ }
73
+ for (const entity of this.project.entity) {
74
+ const scene = this.convertEntityToScene(entity);
75
+ scenes.push(scene);
76
+ }
77
+ } catch (error) {
78
+ this.addError(
79
+ "IMPORT_ERROR",
80
+ `Failed to import: ${error}`,
81
+ options.sourcePath,
82
+ void 0,
83
+ true
84
+ );
80
85
  }
81
- async parseFile(content, filePath) {
82
- const stringContent = typeof content === 'string' ? content : new TextDecoder().decode(content);
83
- try {
84
- const isXml = filePath.toLowerCase().endsWith('.scml');
85
- if (isXml) {
86
- this.project = this.parseScml(stringContent);
87
- }
88
- else {
89
- const parsed = JSON.parse(stringContent);
90
- this.project = parsed.spriter_data;
91
- }
92
- if (this.project && this.project.entity.length > 0) {
93
- this.buildMaps();
94
- return this.convertEntityToParsed(this.project.entity[0]);
95
- }
96
- }
97
- catch {
98
- return null;
99
- }
100
- return null;
86
+ return this.createResult(scenes, assets, startTime);
87
+ }
88
+ async parseFile(content, filePath) {
89
+ const stringContent = typeof content === "string" ? content : new TextDecoder().decode(content);
90
+ try {
91
+ const isXml = filePath.toLowerCase().endsWith(".scml");
92
+ if (isXml) {
93
+ this.project = this.parseScml(stringContent);
94
+ } else {
95
+ const parsed = JSON.parse(stringContent);
96
+ this.project = parsed.spriter_data;
97
+ }
98
+ if (this.project && this.project.entity.length > 0) {
99
+ this.buildMaps();
100
+ return this.convertEntityToParsed(this.project.entity[0]);
101
+ }
102
+ } catch {
103
+ return null;
101
104
  }
102
- async validate(sourcePath) {
103
- const errors = [];
104
- if (!this.canHandle(sourcePath)) {
105
- errors.push({
106
- code: 'INVALID_FORMAT',
107
- message: `File ${sourcePath} is not a valid Spriter file`,
108
- file: sourcePath,
109
- fatal: true,
110
- });
111
- }
112
- return errors;
105
+ return null;
106
+ }
107
+ async validate(sourcePath) {
108
+ const errors = [];
109
+ if (!this.canHandle(sourcePath)) {
110
+ errors.push({
111
+ code: "INVALID_FORMAT",
112
+ message: `File ${sourcePath} is not a valid Spriter file`,
113
+ file: sourcePath,
114
+ fatal: true
115
+ });
116
+ }
117
+ return errors;
118
+ }
119
+ // ----------------------------------------
120
+ // SCML (XML) Parser
121
+ // ----------------------------------------
122
+ parseScml(xml) {
123
+ const getAttrs = (tag) => {
124
+ const attrs = {};
125
+ const attrRegex = /(\w+)="([^"]*)"/g;
126
+ let match;
127
+ while ((match = attrRegex.exec(tag)) !== null) {
128
+ attrs[match[1]] = match[2];
129
+ }
130
+ return attrs;
131
+ };
132
+ const folders = [];
133
+ const folderRegex = /<folder\s+([^>]*)>([\s\S]*?)<\/folder>/g;
134
+ let folderMatch;
135
+ while ((folderMatch = folderRegex.exec(xml)) !== null) {
136
+ const folderAttrs = getAttrs(folderMatch[1]);
137
+ const files = [];
138
+ const fileRegex = /<file\s+([^/]*?)\/>/g;
139
+ let fileMatch;
140
+ const folderContent = folderMatch[2];
141
+ while ((fileMatch = fileRegex.exec(folderContent)) !== null) {
142
+ const fileAttrs = getAttrs(fileMatch[1]);
143
+ files.push({
144
+ id: parseInt(fileAttrs.id) || 0,
145
+ name: fileAttrs.name || "",
146
+ width: parseInt(fileAttrs.width) || 0,
147
+ height: parseInt(fileAttrs.height) || 0,
148
+ pivot_x: fileAttrs.pivot_x !== void 0 ? parseFloat(fileAttrs.pivot_x) : void 0,
149
+ pivot_y: fileAttrs.pivot_y !== void 0 ? parseFloat(fileAttrs.pivot_y) : void 0
150
+ });
151
+ }
152
+ folders.push({
153
+ id: parseInt(folderAttrs.id) || 0,
154
+ name: folderAttrs.name,
155
+ file: files
156
+ });
113
157
  }
114
- // ----------------------------------------
115
- // SCML (XML) Parser
116
- // ----------------------------------------
117
- parseScml(xml) {
118
- // Simple XML attribute parser
119
- const getAttrs = (tag) => {
120
- const attrs = {};
121
- const attrRegex = /(\w+)="([^"]*)"/g;
122
- let match;
123
- while ((match = attrRegex.exec(tag)) !== null) {
124
- attrs[match[1]] = match[2];
158
+ const entities = [];
159
+ const entityRegex = /<entity\s+([^>]*)>([\s\S]*?)<\/entity>/g;
160
+ let entityMatch;
161
+ while ((entityMatch = entityRegex.exec(xml)) !== null) {
162
+ const entityAttrs = getAttrs(entityMatch[1]);
163
+ const entityContent = entityMatch[2];
164
+ const animations = [];
165
+ const animRegex = /<animation\s+([^>]*)>([\s\S]*?)<\/animation>/g;
166
+ let animMatch;
167
+ while ((animMatch = animRegex.exec(entityContent)) !== null) {
168
+ const animAttrs = getAttrs(animMatch[1]);
169
+ const animContent = animMatch[2];
170
+ const mainlineMatch = /<mainline>([\s\S]*?)<\/mainline>/.exec(animContent);
171
+ const mainlineKeys = [];
172
+ if (mainlineMatch) {
173
+ const keyRegex = /<key\s+([^>]*)>([\s\S]*?)<\/key>/g;
174
+ let keyMatch;
175
+ while ((keyMatch = keyRegex.exec(mainlineMatch[1])) !== null) {
176
+ const keyAttrs = getAttrs(keyMatch[1]);
177
+ const keyContent = keyMatch[2];
178
+ const boneRefs = [];
179
+ const objRefs = [];
180
+ const boneRefRegex = /<bone_ref\s+([^/]*?)\/>/g;
181
+ let boneRefMatch;
182
+ while ((boneRefMatch = boneRefRegex.exec(keyContent)) !== null) {
183
+ const refAttrs = getAttrs(boneRefMatch[1]);
184
+ boneRefs.push({
185
+ id: parseInt(refAttrs.id) || 0,
186
+ parent: refAttrs.parent !== void 0 ? parseInt(refAttrs.parent) : void 0,
187
+ timeline: parseInt(refAttrs.timeline) || 0,
188
+ key: parseInt(refAttrs.key) || 0
189
+ });
125
190
  }
126
- return attrs;
127
- };
128
- // Parse folders
129
- const folders = [];
130
- const folderRegex = /<folder\s+([^>]*)>([\s\S]*?)<\/folder>/g;
131
- let folderMatch;
132
- while ((folderMatch = folderRegex.exec(xml)) !== null) {
133
- const folderAttrs = getAttrs(folderMatch[1]);
134
- const files = [];
135
- const fileRegex = /<file\s+([^/]*?)\/>/g;
136
- let fileMatch;
137
- const folderContent = folderMatch[2];
138
- while ((fileMatch = fileRegex.exec(folderContent)) !== null) {
139
- const fileAttrs = getAttrs(fileMatch[1]);
140
- files.push({
141
- id: parseInt(fileAttrs.id) || 0,
142
- name: fileAttrs.name || '',
143
- width: parseInt(fileAttrs.width) || 0,
144
- height: parseInt(fileAttrs.height) || 0,
145
- pivot_x: fileAttrs.pivot_x !== undefined ? parseFloat(fileAttrs.pivot_x) : undefined,
146
- pivot_y: fileAttrs.pivot_y !== undefined ? parseFloat(fileAttrs.pivot_y) : undefined,
147
- });
191
+ const objRefRegex = /<object_ref\s+([^/]*?)\/>/g;
192
+ let objRefMatch;
193
+ while ((objRefMatch = objRefRegex.exec(keyContent)) !== null) {
194
+ const refAttrs = getAttrs(objRefMatch[1]);
195
+ objRefs.push({
196
+ id: parseInt(refAttrs.id) || 0,
197
+ parent: refAttrs.parent !== void 0 ? parseInt(refAttrs.parent) : void 0,
198
+ timeline: parseInt(refAttrs.timeline) || 0,
199
+ key: parseInt(refAttrs.key) || 0,
200
+ z_index: refAttrs.z_index !== void 0 ? parseInt(refAttrs.z_index) : void 0
201
+ });
148
202
  }
149
- folders.push({
150
- id: parseInt(folderAttrs.id) || 0,
151
- name: folderAttrs.name,
152
- file: files,
203
+ mainlineKeys.push({
204
+ id: parseInt(keyAttrs.id) || 0,
205
+ time: keyAttrs.time !== void 0 ? parseInt(keyAttrs.time) : void 0,
206
+ bone_ref: boneRefs.length > 0 ? boneRefs : void 0,
207
+ object_ref: objRefs.length > 0 ? objRefs : void 0
153
208
  });
209
+ }
154
210
  }
155
- // Parse entities
156
- const entities = [];
157
- const entityRegex = /<entity\s+([^>]*)>([\s\S]*?)<\/entity>/g;
158
- let entityMatch;
159
- while ((entityMatch = entityRegex.exec(xml)) !== null) {
160
- const entityAttrs = getAttrs(entityMatch[1]);
161
- const entityContent = entityMatch[2];
162
- // Parse animations
163
- const animations = [];
164
- const animRegex = /<animation\s+([^>]*)>([\s\S]*?)<\/animation>/g;
165
- let animMatch;
166
- while ((animMatch = animRegex.exec(entityContent)) !== null) {
167
- const animAttrs = getAttrs(animMatch[1]);
168
- const animContent = animMatch[2];
169
- // Parse mainline
170
- const mainlineMatch = /<mainline>([\s\S]*?)<\/mainline>/.exec(animContent);
171
- const mainlineKeys = [];
172
- if (mainlineMatch) {
173
- const keyRegex = /<key\s+([^>]*)>([\s\S]*?)<\/key>/g;
174
- let keyMatch;
175
- while ((keyMatch = keyRegex.exec(mainlineMatch[1])) !== null) {
176
- const keyAttrs = getAttrs(keyMatch[1]);
177
- const keyContent = keyMatch[2];
178
- // Parse bone_ref and object_ref
179
- const boneRefs = [];
180
- const objRefs = [];
181
- const boneRefRegex = /<bone_ref\s+([^/]*?)\/>/g;
182
- let boneRefMatch;
183
- while ((boneRefMatch = boneRefRegex.exec(keyContent)) !== null) {
184
- const refAttrs = getAttrs(boneRefMatch[1]);
185
- boneRefs.push({
186
- id: parseInt(refAttrs.id) || 0,
187
- parent: refAttrs.parent !== undefined ? parseInt(refAttrs.parent) : undefined,
188
- timeline: parseInt(refAttrs.timeline) || 0,
189
- key: parseInt(refAttrs.key) || 0,
190
- });
191
- }
192
- const objRefRegex = /<object_ref\s+([^/]*?)\/>/g;
193
- let objRefMatch;
194
- while ((objRefMatch = objRefRegex.exec(keyContent)) !== null) {
195
- const refAttrs = getAttrs(objRefMatch[1]);
196
- objRefs.push({
197
- id: parseInt(refAttrs.id) || 0,
198
- parent: refAttrs.parent !== undefined ? parseInt(refAttrs.parent) : undefined,
199
- timeline: parseInt(refAttrs.timeline) || 0,
200
- key: parseInt(refAttrs.key) || 0,
201
- z_index: refAttrs.z_index !== undefined ? parseInt(refAttrs.z_index) : undefined,
202
- });
203
- }
204
- mainlineKeys.push({
205
- id: parseInt(keyAttrs.id) || 0,
206
- time: keyAttrs.time !== undefined ? parseInt(keyAttrs.time) : undefined,
207
- bone_ref: boneRefs.length > 0 ? boneRefs : undefined,
208
- object_ref: objRefs.length > 0 ? objRefs : undefined,
209
- });
210
- }
211
- }
212
- // Parse timelines
213
- const timelines = [];
214
- const timelineRegex = /<timeline\s+([^>]*)>([\s\S]*?)<\/timeline>/g;
215
- let timelineMatch;
216
- while ((timelineMatch = timelineRegex.exec(animContent)) !== null) {
217
- const tlAttrs = getAttrs(timelineMatch[1]);
218
- const tlContent = timelineMatch[2];
219
- const tlKeys = [];
220
- const tlKeyRegex = /<key\s+([^>]*)>([\s\S]*?)<\/key>/g;
221
- let tlKeyMatch;
222
- while ((tlKeyMatch = tlKeyRegex.exec(tlContent)) !== null) {
223
- const tlKeyAttrs = getAttrs(tlKeyMatch[1]);
224
- const tlKeyContent = tlKeyMatch[2];
225
- const key = {
226
- id: parseInt(tlKeyAttrs.id) || 0,
227
- time: tlKeyAttrs.time !== undefined ? parseInt(tlKeyAttrs.time) : undefined,
228
- spin: tlKeyAttrs.spin !== undefined ? parseInt(tlKeyAttrs.spin) : undefined,
229
- curve_type: tlKeyAttrs.curve_type,
230
- };
231
- // Parse bone
232
- const boneMatch = /<bone\s+([^/]*?)\/?>/.exec(tlKeyContent);
233
- if (boneMatch) {
234
- const boneAttrs = getAttrs(boneMatch[1]);
235
- key.bone = {
236
- x: boneAttrs.x !== undefined ? parseFloat(boneAttrs.x) : undefined,
237
- y: boneAttrs.y !== undefined ? parseFloat(boneAttrs.y) : undefined,
238
- angle: boneAttrs.angle !== undefined ? parseFloat(boneAttrs.angle) : undefined,
239
- scale_x: boneAttrs.scale_x !== undefined ? parseFloat(boneAttrs.scale_x) : undefined,
240
- scale_y: boneAttrs.scale_y !== undefined ? parseFloat(boneAttrs.scale_y) : undefined,
241
- a: boneAttrs.a !== undefined ? parseFloat(boneAttrs.a) : undefined,
242
- };
243
- }
244
- // Parse object
245
- const objectMatch = /<object\s+([^/]*?)\/?>/.exec(tlKeyContent);
246
- if (objectMatch) {
247
- const objAttrs = getAttrs(objectMatch[1]);
248
- key.object = {
249
- folder: objAttrs.folder !== undefined ? parseInt(objAttrs.folder) : undefined,
250
- file: objAttrs.file !== undefined ? parseInt(objAttrs.file) : undefined,
251
- x: objAttrs.x !== undefined ? parseFloat(objAttrs.x) : undefined,
252
- y: objAttrs.y !== undefined ? parseFloat(objAttrs.y) : undefined,
253
- angle: objAttrs.angle !== undefined ? parseFloat(objAttrs.angle) : undefined,
254
- scale_x: objAttrs.scale_x !== undefined ? parseFloat(objAttrs.scale_x) : undefined,
255
- scale_y: objAttrs.scale_y !== undefined ? parseFloat(objAttrs.scale_y) : undefined,
256
- pivot_x: objAttrs.pivot_x !== undefined ? parseFloat(objAttrs.pivot_x) : undefined,
257
- pivot_y: objAttrs.pivot_y !== undefined ? parseFloat(objAttrs.pivot_y) : undefined,
258
- a: objAttrs.a !== undefined ? parseFloat(objAttrs.a) : undefined,
259
- };
260
- }
261
- tlKeys.push(key);
262
- }
263
- timelines.push({
264
- id: parseInt(tlAttrs.id) || 0,
265
- name: tlAttrs.name || '',
266
- object_type: tlAttrs.object_type,
267
- obj: tlAttrs.obj !== undefined ? parseInt(tlAttrs.obj) : undefined,
268
- key: tlKeys,
269
- });
270
- }
271
- animations.push({
272
- id: parseInt(animAttrs.id) || 0,
273
- name: animAttrs.name || '',
274
- length: parseInt(animAttrs.length) || 0,
275
- interval: animAttrs.interval !== undefined ? parseInt(animAttrs.interval) : undefined,
276
- looping: animAttrs.looping !== 'false',
277
- mainline: { key: mainlineKeys },
278
- timeline: timelines.length > 0 ? timelines : undefined,
279
- });
211
+ const timelines = [];
212
+ const timelineRegex = /<timeline\s+([^>]*)>([\s\S]*?)<\/timeline>/g;
213
+ let timelineMatch;
214
+ while ((timelineMatch = timelineRegex.exec(animContent)) !== null) {
215
+ const tlAttrs = getAttrs(timelineMatch[1]);
216
+ const tlContent = timelineMatch[2];
217
+ const tlKeys = [];
218
+ const tlKeyRegex = /<key\s+([^>]*)>([\s\S]*?)<\/key>/g;
219
+ let tlKeyMatch;
220
+ while ((tlKeyMatch = tlKeyRegex.exec(tlContent)) !== null) {
221
+ const tlKeyAttrs = getAttrs(tlKeyMatch[1]);
222
+ const tlKeyContent = tlKeyMatch[2];
223
+ const key = {
224
+ id: parseInt(tlKeyAttrs.id) || 0,
225
+ time: tlKeyAttrs.time !== void 0 ? parseInt(tlKeyAttrs.time) : void 0,
226
+ spin: tlKeyAttrs.spin !== void 0 ? parseInt(tlKeyAttrs.spin) : void 0,
227
+ curve_type: tlKeyAttrs.curve_type
228
+ };
229
+ const boneMatch = /<bone\s+([^/]*?)\/?>/.exec(tlKeyContent);
230
+ if (boneMatch) {
231
+ const boneAttrs = getAttrs(boneMatch[1]);
232
+ key.bone = {
233
+ x: boneAttrs.x !== void 0 ? parseFloat(boneAttrs.x) : void 0,
234
+ y: boneAttrs.y !== void 0 ? parseFloat(boneAttrs.y) : void 0,
235
+ angle: boneAttrs.angle !== void 0 ? parseFloat(boneAttrs.angle) : void 0,
236
+ scale_x: boneAttrs.scale_x !== void 0 ? parseFloat(boneAttrs.scale_x) : void 0,
237
+ scale_y: boneAttrs.scale_y !== void 0 ? parseFloat(boneAttrs.scale_y) : void 0,
238
+ a: boneAttrs.a !== void 0 ? parseFloat(boneAttrs.a) : void 0
239
+ };
280
240
  }
281
- // Parse character maps
282
- const characterMaps = [];
283
- const cmRegex = /<character_map\s+([^>]*)>([\s\S]*?)<\/character_map>/g;
284
- let cmMatch;
285
- while ((cmMatch = cmRegex.exec(entityContent)) !== null) {
286
- const cmAttrs = getAttrs(cmMatch[1]);
287
- const cmContent = cmMatch[2];
288
- const maps = [];
289
- const mapRegex = /<map\s+([^/]*?)\/>/g;
290
- let mapMatch;
291
- while ((mapMatch = mapRegex.exec(cmContent)) !== null) {
292
- const mapAttrs = getAttrs(mapMatch[1]);
293
- maps.push({
294
- folder: parseInt(mapAttrs.folder),
295
- file: parseInt(mapAttrs.file),
296
- target_folder: mapAttrs.target_folder !== undefined ? parseInt(mapAttrs.target_folder) : undefined,
297
- target_file: mapAttrs.target_file !== undefined ? parseInt(mapAttrs.target_file) : undefined,
298
- });
299
- }
300
- characterMaps.push({
301
- id: parseInt(cmAttrs.id) || 0,
302
- name: cmAttrs.name || '',
303
- map: maps.length > 0 ? maps : undefined,
304
- });
241
+ const objectMatch = /<object\s+([^/]*?)\/?>/.exec(tlKeyContent);
242
+ if (objectMatch) {
243
+ const objAttrs = getAttrs(objectMatch[1]);
244
+ key.object = {
245
+ folder: objAttrs.folder !== void 0 ? parseInt(objAttrs.folder) : void 0,
246
+ file: objAttrs.file !== void 0 ? parseInt(objAttrs.file) : void 0,
247
+ x: objAttrs.x !== void 0 ? parseFloat(objAttrs.x) : void 0,
248
+ y: objAttrs.y !== void 0 ? parseFloat(objAttrs.y) : void 0,
249
+ angle: objAttrs.angle !== void 0 ? parseFloat(objAttrs.angle) : void 0,
250
+ scale_x: objAttrs.scale_x !== void 0 ? parseFloat(objAttrs.scale_x) : void 0,
251
+ scale_y: objAttrs.scale_y !== void 0 ? parseFloat(objAttrs.scale_y) : void 0,
252
+ pivot_x: objAttrs.pivot_x !== void 0 ? parseFloat(objAttrs.pivot_x) : void 0,
253
+ pivot_y: objAttrs.pivot_y !== void 0 ? parseFloat(objAttrs.pivot_y) : void 0,
254
+ a: objAttrs.a !== void 0 ? parseFloat(objAttrs.a) : void 0
255
+ };
305
256
  }
306
- entities.push({
307
- id: parseInt(entityAttrs.id) || 0,
308
- name: entityAttrs.name || '',
309
- animation: animations,
310
- character_map: characterMaps.length > 0 ? characterMaps : undefined,
311
- });
312
- }
313
- // Get version info
314
- const spriterDataMatch = /<spriter_data\s+([^>]*)>/;
315
- const dataMatch = spriterDataMatch.exec(xml);
316
- const dataAttrs = dataMatch ? getAttrs(dataMatch[1]) : {};
317
- return {
318
- scml_version: dataAttrs.scml_version,
319
- generator: dataAttrs.generator,
320
- generator_version: dataAttrs.generator_version,
321
- folder: folders,
322
- entity: entities,
323
- };
324
- }
325
- // ----------------------------------------
326
- // Build Maps
327
- // ----------------------------------------
328
- buildMaps() {
329
- this.fileMap.clear();
330
- this.folderMap.clear();
331
- if (!this.project) {
332
- return;
257
+ tlKeys.push(key);
258
+ }
259
+ timelines.push({
260
+ id: parseInt(tlAttrs.id) || 0,
261
+ name: tlAttrs.name || "",
262
+ object_type: tlAttrs.object_type,
263
+ obj: tlAttrs.obj !== void 0 ? parseInt(tlAttrs.obj) : void 0,
264
+ key: tlKeys
265
+ });
333
266
  }
334
- for (const folder of this.project.folder) {
335
- this.folderMap.set(folder.id, folder);
336
- for (const file of folder.file) {
337
- this.fileMap.set(`${folder.id}_${file.id}`, file);
338
- }
267
+ animations.push({
268
+ id: parseInt(animAttrs.id) || 0,
269
+ name: animAttrs.name || "",
270
+ length: parseInt(animAttrs.length) || 0,
271
+ interval: animAttrs.interval !== void 0 ? parseInt(animAttrs.interval) : void 0,
272
+ looping: animAttrs.looping !== "false",
273
+ mainline: { key: mainlineKeys },
274
+ timeline: timelines.length > 0 ? timelines : void 0
275
+ });
276
+ }
277
+ const characterMaps = [];
278
+ const cmRegex = /<character_map\s+([^>]*)>([\s\S]*?)<\/character_map>/g;
279
+ let cmMatch;
280
+ while ((cmMatch = cmRegex.exec(entityContent)) !== null) {
281
+ const cmAttrs = getAttrs(cmMatch[1]);
282
+ const cmContent = cmMatch[2];
283
+ const maps = [];
284
+ const mapRegex = /<map\s+([^/]*?)\/>/g;
285
+ let mapMatch;
286
+ while ((mapMatch = mapRegex.exec(cmContent)) !== null) {
287
+ const mapAttrs = getAttrs(mapMatch[1]);
288
+ maps.push({
289
+ folder: parseInt(mapAttrs.folder),
290
+ file: parseInt(mapAttrs.file),
291
+ target_folder: mapAttrs.target_folder !== void 0 ? parseInt(mapAttrs.target_folder) : void 0,
292
+ target_file: mapAttrs.target_file !== void 0 ? parseInt(mapAttrs.target_file) : void 0
293
+ });
339
294
  }
295
+ characterMaps.push({
296
+ id: parseInt(cmAttrs.id) || 0,
297
+ name: cmAttrs.name || "",
298
+ map: maps.length > 0 ? maps : void 0
299
+ });
300
+ }
301
+ entities.push({
302
+ id: parseInt(entityAttrs.id) || 0,
303
+ name: entityAttrs.name || "",
304
+ animation: animations,
305
+ character_map: characterMaps.length > 0 ? characterMaps : void 0
306
+ });
340
307
  }
341
- // ----------------------------------------
342
- // Entity Conversion
343
- // ----------------------------------------
344
- convertEntityToScene(entity) {
345
- const entities = [];
346
- // Create root entity
347
- const rootEntity = {
348
- id: this.generateId(),
349
- name: entity.name,
350
- components: [
351
- {
352
- type: 'Transform',
353
- data: {
354
- position: { x: 0, y: 0 },
355
- rotation: 0,
356
- scale: { x: 1, y: 1 },
357
- },
358
- },
359
- {
360
- type: 'SpriterEntity',
361
- data: {
362
- animationCount: entity.animation.length,
363
- characterMapCount: entity.character_map?.length || 0,
364
- hasVariables: !!entity.var_defs && entity.var_defs.length > 0,
365
- },
366
- },
367
- ],
368
- children: [],
369
- tags: ['spriter', 'entity'],
370
- active: true,
371
- };
372
- // Add object info components
373
- if (entity.obj_info) {
374
- for (const objInfo of entity.obj_info) {
375
- rootEntity.components.push({
376
- type: objInfo.type === 'bone' ? 'Bone' : 'SpriteObject',
377
- data: {
378
- name: objInfo.name,
379
- type: objInfo.type,
380
- width: objInfo.w,
381
- height: objInfo.h,
382
- pivotX: objInfo.pivot_x,
383
- pivotY: objInfo.pivot_y,
384
- },
385
- });
386
- }
387
- }
388
- // Add character maps
389
- if (entity.character_map) {
390
- for (const charMap of entity.character_map) {
391
- rootEntity.components.push({
392
- type: 'CharacterMap',
393
- data: {
394
- name: charMap.name,
395
- mappingCount: charMap.map?.length || 0,
396
- mappings: charMap.map?.map((m) => ({
397
- sourceFolder: m.folder,
398
- sourceFile: m.file,
399
- targetFolder: m.target_folder,
400
- targetFile: m.target_file,
401
- })),
402
- },
403
- });
404
- }
405
- }
406
- // Add variables
407
- if (entity.var_defs) {
408
- for (const varDef of entity.var_defs) {
409
- rootEntity.components.push({
410
- type: 'Variable',
411
- data: {
412
- name: varDef.name,
413
- type: varDef.type,
414
- defaultValue: varDef.default_value,
415
- },
416
- });
417
- }
418
- }
419
- // Add animations
420
- for (const anim of entity.animation) {
421
- const animComponent = this.convertAnimation(anim);
422
- rootEntity.components.push(animComponent);
423
- }
424
- entities.push(rootEntity);
425
- return {
426
- id: this.generateId(),
427
- name: entity.name,
428
- entities,
429
- settings: {
430
- width: 800,
431
- height: 600,
432
- backgroundColor: '#1a1a2e',
433
- },
434
- };
308
+ const spriterDataMatch = /<spriter_data\s+([^>]*)>/;
309
+ const dataMatch = spriterDataMatch.exec(xml);
310
+ const dataAttrs = dataMatch ? getAttrs(dataMatch[1]) : {};
311
+ return {
312
+ scml_version: dataAttrs.scml_version,
313
+ generator: dataAttrs.generator,
314
+ generator_version: dataAttrs.generator_version,
315
+ folder: folders,
316
+ entity: entities
317
+ };
318
+ }
319
+ // ----------------------------------------
320
+ // Build Maps
321
+ // ----------------------------------------
322
+ buildMaps() {
323
+ this.fileMap.clear();
324
+ this.folderMap.clear();
325
+ if (!this.project) {
326
+ return;
435
327
  }
436
- convertAnimation(anim) {
437
- const bones = [];
438
- const sprites = [];
439
- // Extract bones and sprites from timelines
440
- if (anim.timeline) {
441
- for (const timeline of anim.timeline) {
442
- if (timeline.object_type === 'bone' || timeline.key[0]?.bone) {
443
- bones.push({
444
- name: timeline.name,
445
- keyframeCount: timeline.key.length,
446
- keys: timeline.key.map((k) => ({
447
- time: k.time || 0,
448
- x: k.bone?.x || 0,
449
- y: k.bone?.y || 0,
450
- angle: k.bone?.angle || 0,
451
- scaleX: k.bone?.scale_x ?? 1,
452
- scaleY: k.bone?.scale_y ?? 1,
453
- alpha: k.bone?.a ?? 1,
454
- spin: k.spin ?? 1,
455
- curveType: k.curve_type || 'linear',
456
- })),
457
- });
458
- }
459
- else if (timeline.key[0]?.object) {
460
- sprites.push({
461
- name: timeline.name,
462
- keyframeCount: timeline.key.length,
463
- keys: timeline.key.map((k) => {
464
- const file = k.object?.folder !== undefined && k.object?.file !== undefined
465
- ? this.fileMap.get(`${k.object.folder}_${k.object.file}`)
466
- : null;
467
- return {
468
- time: k.time || 0,
469
- x: k.object?.x || 0,
470
- y: k.object?.y || 0,
471
- angle: k.object?.angle || 0,
472
- scaleX: k.object?.scale_x ?? 1,
473
- scaleY: k.object?.scale_y ?? 1,
474
- pivotX: k.object?.pivot_x ?? file?.pivot_x ?? 0,
475
- pivotY: k.object?.pivot_y ?? file?.pivot_y ?? 1,
476
- alpha: k.object?.a ?? 1,
477
- spin: k.spin ?? 1,
478
- curveType: k.curve_type || 'linear',
479
- file: file?.name,
480
- };
481
- }),
482
- });
483
- }
484
- }
328
+ for (const folder of this.project.folder) {
329
+ this.folderMap.set(folder.id, folder);
330
+ for (const file of folder.file) {
331
+ this.fileMap.set(`${folder.id}_${file.id}`, file);
332
+ }
333
+ }
334
+ }
335
+ // ----------------------------------------
336
+ // Entity Conversion
337
+ // ----------------------------------------
338
+ convertEntityToScene(entity) {
339
+ const entities = [];
340
+ const rootEntity = {
341
+ id: this.generateId(),
342
+ name: entity.name,
343
+ components: [
344
+ {
345
+ type: "Transform",
346
+ data: {
347
+ position: { x: 0, y: 0 },
348
+ rotation: 0,
349
+ scale: { x: 1, y: 1 }
350
+ }
351
+ },
352
+ {
353
+ type: "SpriterEntity",
354
+ data: {
355
+ animationCount: entity.animation.length,
356
+ characterMapCount: entity.character_map?.length || 0,
357
+ hasVariables: !!entity.var_defs && entity.var_defs.length > 0
358
+ }
485
359
  }
486
- // Extract hierarchy from mainline
487
- const hierarchy = [];
488
- if (anim.mainline.key.length > 0) {
489
- const firstKey = anim.mainline.key[0];
490
- if (firstKey.bone_ref) {
491
- for (const boneRef of firstKey.bone_ref) {
492
- hierarchy.push({
493
- type: 'bone',
494
- id: boneRef.id,
495
- parent: boneRef.parent,
496
- timeline: boneRef.timeline,
497
- });
498
- }
499
- }
500
- if (firstKey.object_ref) {
501
- for (const objRef of firstKey.object_ref) {
502
- hierarchy.push({
503
- type: 'sprite',
504
- id: objRef.id,
505
- parent: objRef.parent,
506
- timeline: objRef.timeline,
507
- zIndex: objRef.z_index,
508
- });
509
- }
510
- }
360
+ ],
361
+ children: [],
362
+ tags: ["spriter", "entity"],
363
+ active: true
364
+ };
365
+ if (entity.obj_info) {
366
+ for (const objInfo of entity.obj_info) {
367
+ rootEntity.components.push({
368
+ type: objInfo.type === "bone" ? "Bone" : "SpriteObject",
369
+ data: {
370
+ name: objInfo.name,
371
+ type: objInfo.type,
372
+ width: objInfo.w,
373
+ height: objInfo.h,
374
+ pivotX: objInfo.pivot_x,
375
+ pivotY: objInfo.pivot_y
376
+ }
377
+ });
378
+ }
379
+ }
380
+ if (entity.character_map) {
381
+ for (const charMap of entity.character_map) {
382
+ rootEntity.components.push({
383
+ type: "CharacterMap",
384
+ data: {
385
+ name: charMap.name,
386
+ mappingCount: charMap.map?.length || 0,
387
+ mappings: charMap.map?.map((m) => ({
388
+ sourceFolder: m.folder,
389
+ sourceFile: m.file,
390
+ targetFolder: m.target_folder,
391
+ targetFile: m.target_file
392
+ }))
393
+ }
394
+ });
395
+ }
396
+ }
397
+ if (entity.var_defs) {
398
+ for (const varDef of entity.var_defs) {
399
+ rootEntity.components.push({
400
+ type: "Variable",
401
+ data: {
402
+ name: varDef.name,
403
+ type: varDef.type,
404
+ defaultValue: varDef.default_value
405
+ }
406
+ });
407
+ }
408
+ }
409
+ for (const anim of entity.animation) {
410
+ const animComponent = this.convertAnimation(anim);
411
+ rootEntity.components.push(animComponent);
412
+ }
413
+ entities.push(rootEntity);
414
+ return {
415
+ id: this.generateId(),
416
+ name: entity.name,
417
+ entities,
418
+ settings: {
419
+ width: 800,
420
+ height: 600,
421
+ backgroundColor: "#1a1a2e"
422
+ }
423
+ };
424
+ }
425
+ convertAnimation(anim) {
426
+ const bones = [];
427
+ const sprites = [];
428
+ if (anim.timeline) {
429
+ for (const timeline of anim.timeline) {
430
+ if (timeline.object_type === "bone" || timeline.key[0]?.bone) {
431
+ bones.push({
432
+ name: timeline.name,
433
+ keyframeCount: timeline.key.length,
434
+ keys: timeline.key.map((k) => ({
435
+ time: k.time || 0,
436
+ x: k.bone?.x || 0,
437
+ y: k.bone?.y || 0,
438
+ angle: k.bone?.angle || 0,
439
+ scaleX: k.bone?.scale_x ?? 1,
440
+ scaleY: k.bone?.scale_y ?? 1,
441
+ alpha: k.bone?.a ?? 1,
442
+ spin: k.spin ?? 1,
443
+ curveType: k.curve_type || "linear"
444
+ }))
445
+ });
446
+ } else if (timeline.key[0]?.object) {
447
+ sprites.push({
448
+ name: timeline.name,
449
+ keyframeCount: timeline.key.length,
450
+ keys: timeline.key.map((k) => {
451
+ const file = k.object?.folder !== void 0 && k.object?.file !== void 0 ? this.fileMap.get(`${k.object.folder}_${k.object.file}`) : null;
452
+ return {
453
+ time: k.time || 0,
454
+ x: k.object?.x || 0,
455
+ y: k.object?.y || 0,
456
+ angle: k.object?.angle || 0,
457
+ scaleX: k.object?.scale_x ?? 1,
458
+ scaleY: k.object?.scale_y ?? 1,
459
+ pivotX: k.object?.pivot_x ?? file?.pivot_x ?? 0,
460
+ pivotY: k.object?.pivot_y ?? file?.pivot_y ?? 1,
461
+ alpha: k.object?.a ?? 1,
462
+ spin: k.spin ?? 1,
463
+ curveType: k.curve_type || "linear",
464
+ file: file?.name
465
+ };
466
+ })
467
+ });
511
468
  }
512
- // Events
513
- const events = [];
514
- if (anim.eventline) {
515
- for (const eventline of anim.eventline) {
516
- events.push({
517
- name: eventline.name,
518
- times: eventline.key.map((k) => k.time || 0),
519
- });
520
- }
469
+ }
470
+ }
471
+ const hierarchy = [];
472
+ if (anim.mainline.key.length > 0) {
473
+ const firstKey = anim.mainline.key[0];
474
+ if (firstKey.bone_ref) {
475
+ for (const boneRef of firstKey.bone_ref) {
476
+ hierarchy.push({
477
+ type: "bone",
478
+ id: boneRef.id,
479
+ parent: boneRef.parent,
480
+ timeline: boneRef.timeline
481
+ });
521
482
  }
522
- // Sounds
523
- const sounds = [];
524
- if (anim.soundline) {
525
- for (const soundline of anim.soundline) {
526
- sounds.push({
527
- name: soundline.name,
528
- keys: soundline.key.map((k) => {
529
- const file = this.fileMap.get(`${k.object.folder}_${k.object.file}`);
530
- return {
531
- time: k.time || 0,
532
- file: file?.name,
533
- volume: k.object.volume ?? 1,
534
- panning: k.object.panning ?? 0,
535
- };
536
- }),
537
- });
538
- }
483
+ }
484
+ if (firstKey.object_ref) {
485
+ for (const objRef of firstKey.object_ref) {
486
+ hierarchy.push({
487
+ type: "sprite",
488
+ id: objRef.id,
489
+ parent: objRef.parent,
490
+ timeline: objRef.timeline,
491
+ zIndex: objRef.z_index
492
+ });
539
493
  }
540
- return {
541
- type: 'Animation',
542
- data: {
543
- name: anim.name,
544
- duration: anim.length,
545
- interval: anim.interval,
546
- looping: anim.looping !== false,
547
- fps: 1000 / (anim.interval || 33), // Convert interval to FPS
548
- boneCount: bones.length,
549
- spriteCount: sprites.length,
550
- bones,
551
- sprites,
552
- hierarchy,
553
- events,
554
- sounds,
555
- mainlineKeyCount: anim.mainline.key.length,
556
- },
557
- };
494
+ }
558
495
  }
559
- convertEntityToParsed(entity) {
560
- const entities = [];
561
- // Create model entity
562
- entities.push({
563
- id: String(entity.id),
564
- name: entity.name,
565
- type: 'SpriterEntity',
566
- x: 0,
567
- y: 0,
568
- width: 800,
569
- height: 600,
570
- rotation: 0,
571
- scaleX: 1,
572
- scaleY: 1,
573
- visible: true,
574
- components: [],
575
- children: [],
576
- properties: {
577
- animationCount: entity.animation.length,
578
- animations: entity.animation.map((a) => ({
579
- name: a.name,
580
- duration: a.length,
581
- looping: a.looping !== false,
582
- })),
583
- characterMaps: entity.character_map?.map((cm) => cm.name),
584
- variables: entity.var_defs?.map((v) => ({
585
- name: v.name,
586
- type: v.type,
587
- defaultValue: v.default_value,
588
- })),
589
- },
496
+ const events = [];
497
+ if (anim.eventline) {
498
+ for (const eventline of anim.eventline) {
499
+ events.push({
500
+ name: eventline.name,
501
+ times: eventline.key.map((k) => k.time || 0)
590
502
  });
591
- return {
592
- name: entity.name,
593
- width: 800,
594
- height: 600,
595
- backgroundColor: '#1a1a2e',
596
- layers: [
597
- {
598
- name: 'Animation',
599
- type: 'object',
600
- visible: true,
601
- opacity: 1,
602
- offsetX: 0,
603
- offsetY: 0,
604
- zIndex: 0,
605
- properties: {},
606
- },
607
- ],
608
- entities,
609
- properties: {
610
- generator: this.project?.generator,
611
- generatorVersion: this.project?.generator_version,
612
- },
613
- };
503
+ }
614
504
  }
615
- // ----------------------------------------
616
- // Utilities
617
- // ----------------------------------------
618
- async readFile(path) {
619
- if (typeof globalThis.process !== 'undefined' && globalThis.process.versions?.node) {
620
- const fs = await import('fs');
621
- return fs.readFileSync(path, 'utf-8');
622
- }
623
- else if (typeof fetch !== 'undefined') {
624
- const response = await fetch(path);
625
- return response.text();
626
- }
627
- throw new Error('Unable to read file in current environment');
505
+ const sounds = [];
506
+ if (anim.soundline) {
507
+ for (const soundline of anim.soundline) {
508
+ sounds.push({
509
+ name: soundline.name,
510
+ keys: soundline.key.map((k) => {
511
+ const file = this.fileMap.get(`${k.object.folder}_${k.object.file}`);
512
+ return {
513
+ time: k.time || 0,
514
+ file: file?.name,
515
+ volume: k.object.volume ?? 1,
516
+ panning: k.object.panning ?? 0
517
+ };
518
+ })
519
+ });
520
+ }
628
521
  }
629
- extractFileName(path) {
630
- const name = path.substring(Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\')) + 1);
631
- const dotIndex = name.lastIndexOf('.');
632
- return dotIndex > 0 ? name.substring(0, dotIndex) : name;
522
+ return {
523
+ type: "Animation",
524
+ data: {
525
+ name: anim.name,
526
+ duration: anim.length,
527
+ interval: anim.interval,
528
+ looping: anim.looping !== false,
529
+ fps: 1e3 / (anim.interval || 33),
530
+ // Convert interval to FPS
531
+ boneCount: bones.length,
532
+ spriteCount: sprites.length,
533
+ bones,
534
+ sprites,
535
+ hierarchy,
536
+ events,
537
+ sounds,
538
+ mainlineKeyCount: anim.mainline.key.length
539
+ }
540
+ };
541
+ }
542
+ convertEntityToParsed(entity) {
543
+ const entities = [];
544
+ entities.push({
545
+ id: String(entity.id),
546
+ name: entity.name,
547
+ type: "SpriterEntity",
548
+ x: 0,
549
+ y: 0,
550
+ width: 800,
551
+ height: 600,
552
+ rotation: 0,
553
+ scaleX: 1,
554
+ scaleY: 1,
555
+ visible: true,
556
+ components: [],
557
+ children: [],
558
+ properties: {
559
+ animationCount: entity.animation.length,
560
+ animations: entity.animation.map((a) => ({
561
+ name: a.name,
562
+ duration: a.length,
563
+ looping: a.looping !== false
564
+ })),
565
+ characterMaps: entity.character_map?.map((cm) => cm.name),
566
+ variables: entity.var_defs?.map((v) => ({
567
+ name: v.name,
568
+ type: v.type,
569
+ defaultValue: v.default_value
570
+ }))
571
+ }
572
+ });
573
+ return {
574
+ name: entity.name,
575
+ width: 800,
576
+ height: 600,
577
+ backgroundColor: "#1a1a2e",
578
+ layers: [
579
+ {
580
+ name: "Animation",
581
+ type: "object",
582
+ visible: true,
583
+ opacity: 1,
584
+ offsetX: 0,
585
+ offsetY: 0,
586
+ zIndex: 0,
587
+ properties: {}
588
+ }
589
+ ],
590
+ entities,
591
+ properties: {
592
+ generator: this.project?.generator,
593
+ generatorVersion: this.project?.generator_version
594
+ }
595
+ };
596
+ }
597
+ // ----------------------------------------
598
+ // Utilities
599
+ // ----------------------------------------
600
+ async readFile(path) {
601
+ if (typeof globalThis.process !== "undefined" && globalThis.process.versions?.node) {
602
+ const fs = await import("fs");
603
+ return fs.readFileSync(path, "utf-8");
604
+ } else if (typeof fetch !== "undefined") {
605
+ const response = await fetch(path);
606
+ return response.text();
633
607
  }
608
+ throw new Error("Unable to read file in current environment");
609
+ }
610
+ extractFileName(path) {
611
+ const name = path.substring(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1);
612
+ const dotIndex = name.lastIndexOf(".");
613
+ return dotIndex > 0 ? name.substring(0, dotIndex) : name;
614
+ }
634
615
  }
635
- // ============================================================
636
- // Factory Function
637
- // ============================================================
638
616
  function createSpriterImporter() {
639
- return new SpriterImporter();
617
+ return new SpriterImporter();
640
618
  }
641
-
642
619
  exports.SpriterImporter = SpriterImporter;
643
620
  exports.createSpriterImporter = createSpriterImporter;