@nice2dev/game-engine 1.3.15 → 1.3.17

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 +13 -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,1064 +1,973 @@
1
- /**
2
- * @file GodotImport.ts
3
- * @description Godot Engine Project Import for Nice2Dev Game Engine
4
- * PRO-1.9.1: Godot Project Import
5
- *
6
- * Features:
7
- * - .tscn (text scene) parsing
8
- * - .scn (binary scene) detection
9
- * - .tres resource parsing
10
- * - GDScript parser and AST extraction
11
- * - Node tree reconstruction
12
- * - Signal/connection mapping
13
- */
14
- // ============================================================
15
- // TSCN Parser
16
- // ============================================================
17
- /**
18
- * Parses Godot's text scene format (.tscn)
19
- */
20
1
  function parseGodotScene(content) {
21
- const lines = content.split('\n');
22
- const scene = {
23
- header: { loadSteps: 0, format: 3 },
24
- extResources: [],
25
- subResources: [],
26
- rootNode: null,
27
- connections: [],
28
- editable: [],
29
- };
30
- let currentSection = 'header';
31
- let currentNode = null;
32
- const nodeMap = new Map();
33
- let currentSubResource = null;
34
- let multiLineValue = '';
35
- let multiLineKey = '';
36
- let inMultiLine = false;
37
- for (let i = 0; i < lines.length; i++) {
38
- let line = lines[i];
39
- // Handle multi-line values (strings, arrays, etc.)
40
- if (inMultiLine) {
41
- multiLineValue += '\n' + line;
42
- if (line.includes(']') || (line.includes('"') && line.trim().endsWith('"'))) {
43
- if (currentNode) {
44
- currentNode.properties[multiLineKey] = parseGodotValue(multiLineValue);
45
- }
46
- else if (currentSubResource) {
47
- currentSubResource.properties[multiLineKey] = parseGodotValue(multiLineValue);
48
- }
49
- inMultiLine = false;
50
- multiLineValue = '';
51
- multiLineKey = '';
52
- }
53
- continue;
54
- }
55
- line = line.trim();
56
- if (!line || line.startsWith(';')) {
57
- continue;
58
- }
59
- // Section headers
60
- if (line.startsWith('[')) {
61
- const sectionMatch = line.match(/^\[(\w+)(?:\s+(.+))?\]$/);
62
- if (sectionMatch) {
63
- const sectionType = sectionMatch[1];
64
- const sectionParams = sectionMatch[2] || '';
65
- switch (sectionType) {
66
- case 'gd_scene':
67
- currentSection = 'header';
68
- scene.header = parseGodotSceneHeader(sectionParams);
69
- break;
70
- case 'ext_resource':
71
- currentSection = 'ext_resource';
72
- scene.extResources.push(parseExtResource(sectionParams));
73
- break;
74
- case 'sub_resource':
75
- currentSection = 'sub_resource';
76
- currentSubResource = parseSubResourceHeader(sectionParams);
77
- scene.subResources.push(currentSubResource);
78
- break;
79
- case 'node':
80
- currentSection = 'node';
81
- currentNode = parseNodeHeader(sectionParams);
82
- if (!currentNode.parent) {
83
- // Root node
84
- scene.rootNode = currentNode;
85
- nodeMap.set('.', currentNode);
86
- }
87
- else {
88
- // Find parent and add as child
89
- const parentPath = currentNode.parent;
90
- const parentNode = nodeMap.get(parentPath);
91
- if (parentNode) {
92
- parentNode.children.push(currentNode);
93
- }
94
- // Calculate this node's path
95
- const nodePath = parentPath === '.' ? currentNode.name : `${parentPath}/${currentNode.name}`;
96
- nodeMap.set(nodePath, currentNode);
97
- }
98
- break;
99
- case 'connection':
100
- currentSection = 'connection';
101
- scene.connections.push(parseConnectionHeader(sectionParams));
102
- break;
103
- case 'editable': {
104
- currentSection = 'editable';
105
- const pathMatch = sectionParams.match(/path="([^"]+)"/);
106
- if (pathMatch) {
107
- scene.editable.push(pathMatch[1]);
108
- }
109
- break;
110
- }
111
- }
112
- continue;
113
- }
114
- }
115
- // Property assignment
116
- if (line.includes('=')) {
117
- const eqIndex = line.indexOf('=');
118
- const key = line.substring(0, eqIndex).trim();
119
- const valueStr = line.substring(eqIndex + 1).trim();
120
- // Check for multi-line value start
121
- if ((valueStr.startsWith('[') && !valueStr.includes(']')) ||
122
- (valueStr.startsWith('"') && !valueStr.endsWith('"') && valueStr.length > 1)) {
123
- inMultiLine = true;
124
- multiLineKey = key;
125
- multiLineValue = valueStr;
126
- continue;
127
- }
128
- const value = parseGodotValue(valueStr);
129
- if (currentSection === 'node' && currentNode) {
130
- currentNode.properties[key] = value;
2
+ const lines = content.split("\n");
3
+ const scene = {
4
+ header: { loadSteps: 0, format: 3 },
5
+ extResources: [],
6
+ subResources: [],
7
+ rootNode: null,
8
+ connections: [],
9
+ editable: []
10
+ };
11
+ let currentSection = "header";
12
+ let currentNode = null;
13
+ const nodeMap = /* @__PURE__ */ new Map();
14
+ let currentSubResource = null;
15
+ let multiLineValue = "";
16
+ let multiLineKey = "";
17
+ let inMultiLine = false;
18
+ for (let i = 0; i < lines.length; i++) {
19
+ let line = lines[i];
20
+ if (inMultiLine) {
21
+ multiLineValue += "\n" + line;
22
+ if (line.includes("]") || line.includes('"') && line.trim().endsWith('"')) {
23
+ if (currentNode) {
24
+ currentNode.properties[multiLineKey] = parseGodotValue(multiLineValue);
25
+ } else if (currentSubResource) {
26
+ currentSubResource.properties[multiLineKey] = parseGodotValue(multiLineValue);
27
+ }
28
+ inMultiLine = false;
29
+ multiLineValue = "";
30
+ multiLineKey = "";
31
+ }
32
+ continue;
33
+ }
34
+ line = line.trim();
35
+ if (!line || line.startsWith(";")) {
36
+ continue;
37
+ }
38
+ if (line.startsWith("[")) {
39
+ const sectionMatch = line.match(/^\[(\w+)(?:\s+(.+))?\]$/);
40
+ if (sectionMatch) {
41
+ const sectionType = sectionMatch[1];
42
+ const sectionParams = sectionMatch[2] || "";
43
+ switch (sectionType) {
44
+ case "gd_scene":
45
+ currentSection = "header";
46
+ scene.header = parseGodotSceneHeader(sectionParams);
47
+ break;
48
+ case "ext_resource":
49
+ currentSection = "ext_resource";
50
+ scene.extResources.push(parseExtResource(sectionParams));
51
+ break;
52
+ case "sub_resource":
53
+ currentSection = "sub_resource";
54
+ currentSubResource = parseSubResourceHeader(sectionParams);
55
+ scene.subResources.push(currentSubResource);
56
+ break;
57
+ case "node":
58
+ currentSection = "node";
59
+ currentNode = parseNodeHeader(sectionParams);
60
+ if (!currentNode.parent) {
61
+ scene.rootNode = currentNode;
62
+ nodeMap.set(".", currentNode);
63
+ } else {
64
+ const parentPath = currentNode.parent;
65
+ const parentNode = nodeMap.get(parentPath);
66
+ if (parentNode) {
67
+ parentNode.children.push(currentNode);
68
+ }
69
+ const nodePath = parentPath === "." ? currentNode.name : `${parentPath}/${currentNode.name}`;
70
+ nodeMap.set(nodePath, currentNode);
131
71
  }
132
- else if (currentSection === 'sub_resource' && currentSubResource) {
133
- currentSubResource.properties[key] = value;
72
+ break;
73
+ case "connection":
74
+ currentSection = "connection";
75
+ scene.connections.push(parseConnectionHeader(sectionParams));
76
+ break;
77
+ case "editable": {
78
+ currentSection = "editable";
79
+ const pathMatch = sectionParams.match(/path="([^"]+)"/);
80
+ if (pathMatch) {
81
+ scene.editable.push(pathMatch[1]);
134
82
  }
135
- }
136
- }
137
- return scene;
83
+ break;
84
+ }
85
+ }
86
+ continue;
87
+ }
88
+ }
89
+ if (line.includes("=")) {
90
+ const eqIndex = line.indexOf("=");
91
+ const key = line.substring(0, eqIndex).trim();
92
+ const valueStr = line.substring(eqIndex + 1).trim();
93
+ if (valueStr.startsWith("[") && !valueStr.includes("]") || valueStr.startsWith('"') && !valueStr.endsWith('"') && valueStr.length > 1) {
94
+ inMultiLine = true;
95
+ multiLineKey = key;
96
+ multiLineValue = valueStr;
97
+ continue;
98
+ }
99
+ const value = parseGodotValue(valueStr);
100
+ if (currentSection === "node" && currentNode) {
101
+ currentNode.properties[key] = value;
102
+ } else if (currentSection === "sub_resource" && currentSubResource) {
103
+ currentSubResource.properties[key] = value;
104
+ }
105
+ }
106
+ }
107
+ return scene;
138
108
  }
139
109
  function parseGodotSceneHeader(params) {
140
- const header = { loadSteps: 0, format: 3 };
141
- const loadStepsMatch = params.match(/load_steps=(\d+)/);
142
- if (loadStepsMatch) {
143
- header.loadSteps = parseInt(loadStepsMatch[1], 10);
144
- }
145
- const formatMatch = params.match(/format=(\d+)/);
146
- if (formatMatch) {
147
- header.format = parseInt(formatMatch[1], 10);
148
- }
149
- const uidMatch = params.match(/uid="([^"]+)"/);
150
- if (uidMatch) {
151
- header.uid = uidMatch[1];
152
- }
153
- const typeMatch = params.match(/type="([^"]+)"/);
154
- if (typeMatch) {
155
- header.type = typeMatch[1];
156
- }
157
- return header;
110
+ const header = { loadSteps: 0, format: 3 };
111
+ const loadStepsMatch = params.match(/load_steps=(\d+)/);
112
+ if (loadStepsMatch) {
113
+ header.loadSteps = parseInt(loadStepsMatch[1], 10);
114
+ }
115
+ const formatMatch = params.match(/format=(\d+)/);
116
+ if (formatMatch) {
117
+ header.format = parseInt(formatMatch[1], 10);
118
+ }
119
+ const uidMatch = params.match(/uid="([^"]+)"/);
120
+ if (uidMatch) {
121
+ header.uid = uidMatch[1];
122
+ }
123
+ const typeMatch = params.match(/type="([^"]+)"/);
124
+ if (typeMatch) {
125
+ header.type = typeMatch[1];
126
+ }
127
+ return header;
158
128
  }
159
129
  function parseExtResource(params) {
160
- const resource = { id: '', type: '', path: '' };
161
- const typeMatch = params.match(/type="([^"]+)"/);
162
- if (typeMatch) {
163
- resource.type = typeMatch[1];
164
- }
165
- const pathMatch = params.match(/path="([^"]+)"/);
166
- if (pathMatch) {
167
- resource.path = pathMatch[1];
168
- }
169
- const idMatch = params.match(/id="?([^"\s]+)"?/);
170
- if (idMatch) {
171
- resource.id = idMatch[1];
172
- }
173
- const uidMatch = params.match(/uid="([^"]+)"/);
174
- if (uidMatch) {
175
- resource.uid = uidMatch[1];
176
- }
177
- return resource;
130
+ const resource = { id: "", type: "", path: "" };
131
+ const typeMatch = params.match(/type="([^"]+)"/);
132
+ if (typeMatch) {
133
+ resource.type = typeMatch[1];
134
+ }
135
+ const pathMatch = params.match(/path="([^"]+)"/);
136
+ if (pathMatch) {
137
+ resource.path = pathMatch[1];
138
+ }
139
+ const idMatch = params.match(/id="?([^"\s]+)"?/);
140
+ if (idMatch) {
141
+ resource.id = idMatch[1];
142
+ }
143
+ const uidMatch = params.match(/uid="([^"]+)"/);
144
+ if (uidMatch) {
145
+ resource.uid = uidMatch[1];
146
+ }
147
+ return resource;
178
148
  }
179
149
  function parseSubResourceHeader(params) {
180
- const resource = { id: '', type: '', properties: {} };
181
- const typeMatch = params.match(/type="([^"]+)"/);
182
- if (typeMatch) {
183
- resource.type = typeMatch[1];
184
- }
185
- const idMatch = params.match(/id="?([^"\s]+)"?/);
186
- if (idMatch) {
187
- resource.id = idMatch[1];
188
- }
189
- return resource;
150
+ const resource = { id: "", type: "", properties: {} };
151
+ const typeMatch = params.match(/type="([^"]+)"/);
152
+ if (typeMatch) {
153
+ resource.type = typeMatch[1];
154
+ }
155
+ const idMatch = params.match(/id="?([^"\s]+)"?/);
156
+ if (idMatch) {
157
+ resource.id = idMatch[1];
158
+ }
159
+ return resource;
190
160
  }
191
161
  function parseNodeHeader(params) {
192
- const node = {
193
- name: '',
194
- type: 'Node',
195
- properties: {},
196
- children: [],
197
- };
198
- const nameMatch = params.match(/name="([^"]+)"/);
199
- if (nameMatch) {
200
- node.name = nameMatch[1];
201
- }
202
- const typeMatch = params.match(/type="([^"]+)"/);
203
- if (typeMatch) {
204
- node.type = typeMatch[1];
205
- }
206
- const parentMatch = params.match(/parent="([^"]+)"/);
207
- if (parentMatch) {
208
- node.parent = parentMatch[1];
209
- }
210
- const instanceMatch = params.match(/instance=ExtResource\(\s*"?([^")]+)"?\s*\)/);
211
- if (instanceMatch) {
212
- node.instance = instanceMatch[1];
213
- }
214
- const groupsMatch = params.match(/groups=\[([^\]]+)\]/);
215
- if (groupsMatch) {
216
- node.groups = groupsMatch[1].split(',').map((g) => g.trim().replace(/"/g, ''));
217
- }
218
- const indexMatch = params.match(/index="?(\d+)"?/);
219
- if (indexMatch) {
220
- node.index = parseInt(indexMatch[1], 10);
221
- }
222
- return node;
162
+ const node = {
163
+ name: "",
164
+ type: "Node",
165
+ properties: {},
166
+ children: []
167
+ };
168
+ const nameMatch = params.match(/name="([^"]+)"/);
169
+ if (nameMatch) {
170
+ node.name = nameMatch[1];
171
+ }
172
+ const typeMatch = params.match(/type="([^"]+)"/);
173
+ if (typeMatch) {
174
+ node.type = typeMatch[1];
175
+ }
176
+ const parentMatch = params.match(/parent="([^"]+)"/);
177
+ if (parentMatch) {
178
+ node.parent = parentMatch[1];
179
+ }
180
+ const instanceMatch = params.match(/instance=ExtResource\(\s*"?([^")]+)"?\s*\)/);
181
+ if (instanceMatch) {
182
+ node.instance = instanceMatch[1];
183
+ }
184
+ const groupsMatch = params.match(/groups=\[([^\]]+)\]/);
185
+ if (groupsMatch) {
186
+ node.groups = groupsMatch[1].split(",").map((g) => g.trim().replace(/"/g, ""));
187
+ }
188
+ const indexMatch = params.match(/index="?(\d+)"?/);
189
+ if (indexMatch) {
190
+ node.index = parseInt(indexMatch[1], 10);
191
+ }
192
+ return node;
223
193
  }
224
194
  function parseConnectionHeader(params) {
225
- const connection = {
226
- signal: '',
227
- from: '',
228
- to: '',
229
- method: '',
230
- };
231
- const signalMatch = params.match(/signal="([^"]+)"/);
232
- if (signalMatch) {
233
- connection.signal = signalMatch[1];
234
- }
235
- const fromMatch = params.match(/from="([^"]+)"/);
236
- if (fromMatch) {
237
- connection.from = fromMatch[1];
238
- }
239
- const toMatch = params.match(/to="([^"]+)"/);
240
- if (toMatch) {
241
- connection.to = toMatch[1];
242
- }
243
- const methodMatch = params.match(/method="([^"]+)"/);
244
- if (methodMatch) {
245
- connection.method = methodMatch[1];
246
- }
247
- const flagsMatch = params.match(/flags=(\d+)/);
248
- if (flagsMatch) {
249
- connection.flags = parseInt(flagsMatch[1], 10);
250
- }
251
- return connection;
195
+ const connection = {
196
+ signal: "",
197
+ from: "",
198
+ to: "",
199
+ method: ""
200
+ };
201
+ const signalMatch = params.match(/signal="([^"]+)"/);
202
+ if (signalMatch) {
203
+ connection.signal = signalMatch[1];
204
+ }
205
+ const fromMatch = params.match(/from="([^"]+)"/);
206
+ if (fromMatch) {
207
+ connection.from = fromMatch[1];
208
+ }
209
+ const toMatch = params.match(/to="([^"]+)"/);
210
+ if (toMatch) {
211
+ connection.to = toMatch[1];
212
+ }
213
+ const methodMatch = params.match(/method="([^"]+)"/);
214
+ if (methodMatch) {
215
+ connection.method = methodMatch[1];
216
+ }
217
+ const flagsMatch = params.match(/flags=(\d+)/);
218
+ if (flagsMatch) {
219
+ connection.flags = parseInt(flagsMatch[1], 10);
220
+ }
221
+ return connection;
252
222
  }
253
223
  function parseGodotValue(valueStr) {
254
- valueStr = valueStr.trim();
255
- // null
256
- if (valueStr === 'null') {
257
- return null;
258
- }
259
- // Boolean
260
- if (valueStr === 'true') {
261
- return true;
262
- }
263
- if (valueStr === 'false') {
264
- return false;
265
- }
266
- // Integer
267
- if (/^-?\d+$/.test(valueStr)) {
268
- return parseInt(valueStr, 10);
269
- }
270
- // Float
271
- if (/^-?\d+\.\d+$/.test(valueStr)) {
272
- return parseFloat(valueStr);
273
- }
274
- // String
275
- if (valueStr.startsWith('"') && valueStr.endsWith('"')) {
276
- return valueStr.slice(1, -1);
277
- }
278
- // Vector2
279
- const vec2Match = valueStr.match(/^Vector2\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/);
280
- if (vec2Match) {
281
- return { x: parseFloat(vec2Match[1]), y: parseFloat(vec2Match[2]) };
282
- }
283
- // Vector2i
284
- const vec2iMatch = valueStr.match(/^Vector2i\(\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/);
285
- if (vec2iMatch) {
286
- return { x: parseInt(vec2iMatch[1], 10), y: parseInt(vec2iMatch[2], 10) };
287
- }
288
- // Vector3
289
- const vec3Match = valueStr.match(/^Vector3\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/);
290
- if (vec3Match) {
291
- return {
292
- x: parseFloat(vec3Match[1]),
293
- y: parseFloat(vec3Match[2]),
294
- z: parseFloat(vec3Match[3]),
295
- };
296
- }
297
- // Vector3i
298
- const vec3iMatch = valueStr.match(/^Vector3i\(\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/);
299
- if (vec3iMatch) {
300
- return {
301
- x: parseInt(vec3iMatch[1], 10),
302
- y: parseInt(vec3iMatch[2], 10),
303
- z: parseInt(vec3iMatch[3], 10),
304
- };
305
- }
306
- // Color
307
- const colorMatch = valueStr.match(/^Color\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/);
308
- if (colorMatch) {
309
- return {
310
- r: parseFloat(colorMatch[1]),
311
- g: parseFloat(colorMatch[2]),
312
- b: parseFloat(colorMatch[3]),
313
- a: colorMatch[4] ? parseFloat(colorMatch[4]) : 1,
314
- };
315
- }
316
- // Rect2
317
- const rect2Match = valueStr.match(/^Rect2\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);
318
- if (rect2Match) {
319
- return {
320
- x: parseFloat(rect2Match[1]),
321
- y: parseFloat(rect2Match[2]),
322
- width: parseFloat(rect2Match[3]),
323
- height: parseFloat(rect2Match[4]),
324
- };
325
- }
326
- // Transform2D
327
- const transform2dMatch = valueStr.match(/^Transform2D\(\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*\)$/);
328
- if (transform2dMatch) {
329
- return {
330
- type: 'Transform2D',
331
- x: { x: parseFloat(transform2dMatch[1]), y: parseFloat(transform2dMatch[2]) },
332
- y: { x: parseFloat(transform2dMatch[3]), y: parseFloat(transform2dMatch[4]) },
333
- origin: { x: parseFloat(transform2dMatch[5]), y: parseFloat(transform2dMatch[6]) },
334
- };
335
- }
336
- // Transform3D
337
- const transform3dMatch = valueStr.match(/^Transform3D\(([^)]+)\)$/);
338
- if (transform3dMatch) {
339
- const values = transform3dMatch[1].split(',').map((v) => parseFloat(v.trim()));
340
- if (values.length === 12) {
341
- return {
342
- type: 'Transform3D',
343
- basis: {
344
- x: { x: values[0], y: values[1], z: values[2] },
345
- y: { x: values[3], y: values[4], z: values[5] },
346
- z: { x: values[6], y: values[7], z: values[8] },
347
- },
348
- origin: { x: values[9], y: values[10], z: values[11] },
349
- };
350
- }
351
- }
352
- // NodePath
353
- const nodePathMatch = valueStr.match(/^NodePath\("([^"]*)"\)$/);
354
- if (nodePathMatch) {
355
- return { type: 'NodePath', path: nodePathMatch[1] };
356
- }
357
- // ExtResource reference
358
- const extResMatch = valueStr.match(/^ExtResource\(\s*"?([^")]+)"?\s*\)$/);
359
- if (extResMatch) {
360
- return { type: 'ExtResource', id: extResMatch[1] };
361
- }
362
- // SubResource reference
363
- const subResMatch = valueStr.match(/^SubResource\(\s*"?([^")]+)"?\s*\)$/);
364
- if (subResMatch) {
365
- return { type: 'SubResource', id: subResMatch[1] };
366
- }
367
- // Array
368
- if (valueStr.startsWith('[') && valueStr.endsWith(']')) {
369
- const inner = valueStr.slice(1, -1).trim();
370
- if (!inner) {
371
- return [];
372
- }
373
- // Simple split for basic arrays (doesn't handle nested structures well)
374
- return inner.split(/,(?![^(]*\))/).map((v) => parseGodotValue(v.trim()));
375
- }
376
- // Dictionary
377
- if (valueStr.startsWith('{') && valueStr.endsWith('}')) {
378
- // Simple dict parsing
379
- const inner = valueStr.slice(1, -1).trim();
380
- if (!inner) {
381
- return {};
382
- }
383
- const dict = {};
384
- // Match key: value pairs
385
- const pairRegex = /"([^"]+)":\s*([^,}]+)/g;
386
- let match;
387
- while ((match = pairRegex.exec(inner)) !== null) {
388
- dict[match[1]] = parseGodotValue(match[2].trim());
389
- }
390
- return dict;
391
- }
392
- // PackedStringArray
393
- const packedStrMatch = valueStr.match(/^PackedStringArray\(\s*([^)]*)\s*\)$/);
394
- if (packedStrMatch) {
395
- const inner = packedStrMatch[1].trim();
396
- if (!inner) {
397
- return [];
398
- }
399
- return inner.split(',').map((s) => s.trim().replace(/^"|"$/g, ''));
400
- }
401
- // PackedVector2Array
402
- const packedVec2Match = valueStr.match(/^PackedVector2Array\(\s*([^)]*)\s*\)$/);
403
- if (packedVec2Match) {
404
- const inner = packedVec2Match[1].trim();
405
- if (!inner) {
406
- return [];
407
- }
408
- const nums = inner.split(',').map((n) => parseFloat(n.trim()));
409
- const vectors = [];
410
- for (let i = 0; i < nums.length; i += 2) {
411
- vectors.push({ x: nums[i], y: nums[i + 1] });
412
- }
413
- return vectors;
414
- }
415
- // Return as-is for unknown types
416
- return valueStr;
224
+ valueStr = valueStr.trim();
225
+ if (valueStr === "null") {
226
+ return null;
227
+ }
228
+ if (valueStr === "true") {
229
+ return true;
230
+ }
231
+ if (valueStr === "false") {
232
+ return false;
233
+ }
234
+ if (/^-?\d+$/.test(valueStr)) {
235
+ return parseInt(valueStr, 10);
236
+ }
237
+ if (/^-?\d+\.\d+$/.test(valueStr)) {
238
+ return parseFloat(valueStr);
239
+ }
240
+ if (valueStr.startsWith('"') && valueStr.endsWith('"')) {
241
+ return valueStr.slice(1, -1);
242
+ }
243
+ const vec2Match = valueStr.match(/^Vector2\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/);
244
+ if (vec2Match) {
245
+ return { x: parseFloat(vec2Match[1]), y: parseFloat(vec2Match[2]) };
246
+ }
247
+ const vec2iMatch = valueStr.match(/^Vector2i\(\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/);
248
+ if (vec2iMatch) {
249
+ return { x: parseInt(vec2iMatch[1], 10), y: parseInt(vec2iMatch[2], 10) };
250
+ }
251
+ const vec3Match = valueStr.match(
252
+ /^Vector3\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
253
+ );
254
+ if (vec3Match) {
255
+ return {
256
+ x: parseFloat(vec3Match[1]),
257
+ y: parseFloat(vec3Match[2]),
258
+ z: parseFloat(vec3Match[3])
259
+ };
260
+ }
261
+ const vec3iMatch = valueStr.match(/^Vector3i\(\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/);
262
+ if (vec3iMatch) {
263
+ return {
264
+ x: parseInt(vec3iMatch[1], 10),
265
+ y: parseInt(vec3iMatch[2], 10),
266
+ z: parseInt(vec3iMatch[3], 10)
267
+ };
268
+ }
269
+ const colorMatch = valueStr.match(
270
+ /^Color\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/
271
+ );
272
+ if (colorMatch) {
273
+ return {
274
+ r: parseFloat(colorMatch[1]),
275
+ g: parseFloat(colorMatch[2]),
276
+ b: parseFloat(colorMatch[3]),
277
+ a: colorMatch[4] ? parseFloat(colorMatch[4]) : 1
278
+ };
279
+ }
280
+ const rect2Match = valueStr.match(
281
+ /^Rect2\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/
282
+ );
283
+ if (rect2Match) {
284
+ return {
285
+ x: parseFloat(rect2Match[1]),
286
+ y: parseFloat(rect2Match[2]),
287
+ width: parseFloat(rect2Match[3]),
288
+ height: parseFloat(rect2Match[4])
289
+ };
290
+ }
291
+ const transform2dMatch = valueStr.match(
292
+ /^Transform2D\(\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*,\s*([\d.e+-]+)\s*\)$/
293
+ );
294
+ if (transform2dMatch) {
295
+ return {
296
+ type: "Transform2D",
297
+ x: { x: parseFloat(transform2dMatch[1]), y: parseFloat(transform2dMatch[2]) },
298
+ y: { x: parseFloat(transform2dMatch[3]), y: parseFloat(transform2dMatch[4]) },
299
+ origin: { x: parseFloat(transform2dMatch[5]), y: parseFloat(transform2dMatch[6]) }
300
+ };
301
+ }
302
+ const transform3dMatch = valueStr.match(/^Transform3D\(([^)]+)\)$/);
303
+ if (transform3dMatch) {
304
+ const values = transform3dMatch[1].split(",").map((v) => parseFloat(v.trim()));
305
+ if (values.length === 12) {
306
+ return {
307
+ type: "Transform3D",
308
+ basis: {
309
+ x: { x: values[0], y: values[1], z: values[2] },
310
+ y: { x: values[3], y: values[4], z: values[5] },
311
+ z: { x: values[6], y: values[7], z: values[8] }
312
+ },
313
+ origin: { x: values[9], y: values[10], z: values[11] }
314
+ };
315
+ }
316
+ }
317
+ const nodePathMatch = valueStr.match(/^NodePath\("([^"]*)"\)$/);
318
+ if (nodePathMatch) {
319
+ return { type: "NodePath", path: nodePathMatch[1] };
320
+ }
321
+ const extResMatch = valueStr.match(/^ExtResource\(\s*"?([^")]+)"?\s*\)$/);
322
+ if (extResMatch) {
323
+ return { type: "ExtResource", id: extResMatch[1] };
324
+ }
325
+ const subResMatch = valueStr.match(/^SubResource\(\s*"?([^")]+)"?\s*\)$/);
326
+ if (subResMatch) {
327
+ return { type: "SubResource", id: subResMatch[1] };
328
+ }
329
+ if (valueStr.startsWith("[") && valueStr.endsWith("]")) {
330
+ const inner = valueStr.slice(1, -1).trim();
331
+ if (!inner) {
332
+ return [];
333
+ }
334
+ return inner.split(/,(?![^(]*\))/).map((v) => parseGodotValue(v.trim()));
335
+ }
336
+ if (valueStr.startsWith("{") && valueStr.endsWith("}")) {
337
+ const inner = valueStr.slice(1, -1).trim();
338
+ if (!inner) {
339
+ return {};
340
+ }
341
+ const dict = {};
342
+ const pairRegex = /"([^"]+)":\s*([^,}]+)/g;
343
+ let match;
344
+ while ((match = pairRegex.exec(inner)) !== null) {
345
+ dict[match[1]] = parseGodotValue(match[2].trim());
346
+ }
347
+ return dict;
348
+ }
349
+ const packedStrMatch = valueStr.match(/^PackedStringArray\(\s*([^)]*)\s*\)$/);
350
+ if (packedStrMatch) {
351
+ const inner = packedStrMatch[1].trim();
352
+ if (!inner) {
353
+ return [];
354
+ }
355
+ return inner.split(",").map((s) => s.trim().replace(/^"|"$/g, ""));
356
+ }
357
+ const packedVec2Match = valueStr.match(/^PackedVector2Array\(\s*([^)]*)\s*\)$/);
358
+ if (packedVec2Match) {
359
+ const inner = packedVec2Match[1].trim();
360
+ if (!inner) {
361
+ return [];
362
+ }
363
+ const nums = inner.split(",").map((n) => parseFloat(n.trim()));
364
+ const vectors = [];
365
+ for (let i = 0; i < nums.length; i += 2) {
366
+ vectors.push({ x: nums[i], y: nums[i + 1] });
367
+ }
368
+ return vectors;
369
+ }
370
+ return valueStr;
417
371
  }
418
- // ============================================================
419
- // TRES Resource Parser
420
- // ============================================================
421
- /**
422
- * Parses Godot's text resource format (.tres)
423
- */
424
372
  function parseGodotResource(content) {
425
- const lines = content.split('\n');
426
- const resource = {
427
- header: { type: '', format: 3 },
428
- extResources: [],
429
- subResources: [],
430
- resource: { type: '', properties: {} },
431
- };
432
- let currentSection = 'header';
433
- let currentSubResource = null;
434
- for (let line of lines) {
435
- line = line.trim();
436
- if (!line || line.startsWith(';')) {
437
- continue;
438
- }
439
- // Section headers
440
- if (line.startsWith('[')) {
441
- const sectionMatch = line.match(/^\[(\w+)(?:\s+(.+))?\]$/);
442
- if (sectionMatch) {
443
- const sectionType = sectionMatch[1];
444
- const sectionParams = sectionMatch[2] || '';
445
- switch (sectionType) {
446
- case 'gd_resource':
447
- currentSection = 'header';
448
- resource.header = parseResourceHeader(sectionParams);
449
- break;
450
- case 'ext_resource':
451
- currentSection = 'ext_resource';
452
- resource.extResources.push(parseExtResource(sectionParams));
453
- break;
454
- case 'sub_resource':
455
- currentSection = 'sub_resource';
456
- currentSubResource = parseSubResourceHeader(sectionParams);
457
- resource.subResources.push(currentSubResource);
458
- break;
459
- case 'resource':
460
- currentSection = 'resource';
461
- break;
462
- }
463
- continue;
464
- }
465
- }
466
- // Property assignment
467
- if (line.includes('=')) {
468
- const eqIndex = line.indexOf('=');
469
- const key = line.substring(0, eqIndex).trim();
470
- const valueStr = line.substring(eqIndex + 1).trim();
471
- const value = parseGodotValue(valueStr);
472
- if (currentSection === 'resource') {
473
- resource.resource.properties[key] = value;
474
- }
475
- else if (currentSection === 'sub_resource' && currentSubResource) {
476
- currentSubResource.properties[key] = value;
477
- }
478
- }
479
- }
480
- resource.resource.type = resource.header.type;
481
- return resource;
373
+ const lines = content.split("\n");
374
+ const resource = {
375
+ header: { type: "", format: 3 },
376
+ extResources: [],
377
+ subResources: [],
378
+ resource: { type: "", properties: {} }
379
+ };
380
+ let currentSection = "header";
381
+ let currentSubResource = null;
382
+ for (let line of lines) {
383
+ line = line.trim();
384
+ if (!line || line.startsWith(";")) {
385
+ continue;
386
+ }
387
+ if (line.startsWith("[")) {
388
+ const sectionMatch = line.match(/^\[(\w+)(?:\s+(.+))?\]$/);
389
+ if (sectionMatch) {
390
+ const sectionType = sectionMatch[1];
391
+ const sectionParams = sectionMatch[2] || "";
392
+ switch (sectionType) {
393
+ case "gd_resource":
394
+ currentSection = "header";
395
+ resource.header = parseResourceHeader(sectionParams);
396
+ break;
397
+ case "ext_resource":
398
+ currentSection = "ext_resource";
399
+ resource.extResources.push(parseExtResource(sectionParams));
400
+ break;
401
+ case "sub_resource":
402
+ currentSection = "sub_resource";
403
+ currentSubResource = parseSubResourceHeader(sectionParams);
404
+ resource.subResources.push(currentSubResource);
405
+ break;
406
+ case "resource":
407
+ currentSection = "resource";
408
+ break;
409
+ }
410
+ continue;
411
+ }
412
+ }
413
+ if (line.includes("=")) {
414
+ const eqIndex = line.indexOf("=");
415
+ const key = line.substring(0, eqIndex).trim();
416
+ const valueStr = line.substring(eqIndex + 1).trim();
417
+ const value = parseGodotValue(valueStr);
418
+ if (currentSection === "resource") {
419
+ resource.resource.properties[key] = value;
420
+ } else if (currentSection === "sub_resource" && currentSubResource) {
421
+ currentSubResource.properties[key] = value;
422
+ }
423
+ }
424
+ }
425
+ resource.resource.type = resource.header.type;
426
+ return resource;
482
427
  }
483
428
  function parseResourceHeader(params) {
484
- const header = { type: '', format: 3 };
485
- const typeMatch = params.match(/type="([^"]+)"/);
486
- if (typeMatch) {
487
- header.type = typeMatch[1];
488
- }
489
- const loadStepsMatch = params.match(/load_steps=(\d+)/);
490
- if (loadStepsMatch) {
491
- header.loadSteps = parseInt(loadStepsMatch[1], 10);
492
- }
493
- const formatMatch = params.match(/format=(\d+)/);
494
- if (formatMatch) {
495
- header.format = parseInt(formatMatch[1], 10);
496
- }
497
- const uidMatch = params.match(/uid="([^"]+)"/);
498
- if (uidMatch) {
499
- header.uid = uidMatch[1];
500
- }
501
- return header;
429
+ const header = { type: "", format: 3 };
430
+ const typeMatch = params.match(/type="([^"]+)"/);
431
+ if (typeMatch) {
432
+ header.type = typeMatch[1];
433
+ }
434
+ const loadStepsMatch = params.match(/load_steps=(\d+)/);
435
+ if (loadStepsMatch) {
436
+ header.loadSteps = parseInt(loadStepsMatch[1], 10);
437
+ }
438
+ const formatMatch = params.match(/format=(\d+)/);
439
+ if (formatMatch) {
440
+ header.format = parseInt(formatMatch[1], 10);
441
+ }
442
+ const uidMatch = params.match(/uid="([^"]+)"/);
443
+ if (uidMatch) {
444
+ header.uid = uidMatch[1];
445
+ }
446
+ return header;
502
447
  }
503
- // ============================================================
504
- // GDScript Parser
505
- // ============================================================
506
- /**
507
- * Parses GDScript files and extracts structure
508
- */
509
- function parseGDScript(content, filePath = '') {
510
- const script = {
511
- path: filePath,
512
- extends: 'Node',
513
- isToolScript: false,
448
+ function parseGDScript(content, filePath = "") {
449
+ const script = {
450
+ path: filePath,
451
+ extends: "Node",
452
+ isToolScript: false,
453
+ signals: [],
454
+ enums: [],
455
+ constants: [],
456
+ exportVars: [],
457
+ onreadyVars: [],
458
+ variables: [],
459
+ functions: [],
460
+ innerClasses: [],
461
+ staticFunctions: [],
462
+ annotations: []
463
+ };
464
+ const lines = content.split("\n");
465
+ let currentFunction = null;
466
+ let functionIndent = 0;
467
+ let currentEnum = null;
468
+ let enumIndent = 0;
469
+ let pendingDocComment;
470
+ let pendingAnnotations = [];
471
+ for (let i = 0; i < lines.length; i++) {
472
+ const line = lines[i];
473
+ const trimmed = line.trim();
474
+ const indent = line.length - line.trimStart().length;
475
+ if (!trimmed) {
476
+ continue;
477
+ }
478
+ if (trimmed.startsWith("##")) {
479
+ pendingDocComment = (pendingDocComment || "") + trimmed.substring(2).trim() + "\n";
480
+ continue;
481
+ }
482
+ if (trimmed.startsWith("#")) {
483
+ continue;
484
+ }
485
+ if (currentFunction && indent > functionIndent) {
486
+ currentFunction.body += line + "\n";
487
+ continue;
488
+ } else if (currentFunction && indent <= functionIndent) {
489
+ currentFunction = null;
490
+ }
491
+ if (currentEnum && indent > enumIndent) {
492
+ const enumValMatch = trimmed.match(/^(\w+)(?:\s*=\s*(-?\d+))?,?$/);
493
+ if (enumValMatch) {
494
+ const name = enumValMatch[1];
495
+ const value = enumValMatch[2] ? parseInt(enumValMatch[2], 10) : Object.keys(currentEnum.values).length;
496
+ currentEnum.values[name] = value;
497
+ }
498
+ continue;
499
+ } else if (currentEnum && indent <= enumIndent) {
500
+ currentEnum = null;
501
+ }
502
+ if (trimmed === "@tool") {
503
+ script.isToolScript = true;
504
+ continue;
505
+ }
506
+ if (trimmed.startsWith("@")) {
507
+ const annotationMatch = trimmed.match(/^@(\w+)(?:\(([^)]*)\))?/);
508
+ if (annotationMatch) {
509
+ const annotation = { name: annotationMatch[1] };
510
+ if (annotationMatch[2]) {
511
+ annotation.arguments = annotationMatch[2].split(",").map((a) => a.trim());
512
+ }
513
+ pendingAnnotations.push(annotation);
514
+ if (annotation.name === "icon" && annotation.arguments?.[0]) {
515
+ script.iconPath = annotation.arguments[0].replace(/"/g, "");
516
+ }
517
+ }
518
+ continue;
519
+ }
520
+ const classNameMatch = trimmed.match(/^class_name\s+(\w+)/);
521
+ if (classNameMatch) {
522
+ script.className = classNameMatch[1];
523
+ script.classNameToken = classNameMatch[1];
524
+ continue;
525
+ }
526
+ const extendsMatch = trimmed.match(/^extends\s+(.+)$/);
527
+ if (extendsMatch) {
528
+ script.extends = extendsMatch[1].trim();
529
+ continue;
530
+ }
531
+ const signalMatch = trimmed.match(/^signal\s+(\w+)(?:\(([^)]*)\))?/);
532
+ if (signalMatch) {
533
+ const sig = {
534
+ name: signalMatch[1],
535
+ parameters: [],
536
+ documentation: pendingDocComment?.trim()
537
+ };
538
+ if (signalMatch[2]) {
539
+ sig.parameters = parseGDScriptParameters(signalMatch[2]);
540
+ }
541
+ script.signals.push(sig);
542
+ pendingDocComment = void 0;
543
+ continue;
544
+ }
545
+ const enumMatch = trimmed.match(/^enum\s+(\w+)\s*{?/);
546
+ if (enumMatch) {
547
+ currentEnum = {
548
+ name: enumMatch[1],
549
+ values: {},
550
+ documentation: pendingDocComment?.trim()
551
+ };
552
+ enumIndent = indent;
553
+ const inlineMatch = trimmed.match(/^enum\s+\w+\s*{([^}]+)}/);
554
+ if (inlineMatch) {
555
+ const entries = inlineMatch[1].split(",");
556
+ let nextVal = 0;
557
+ for (const entry of entries) {
558
+ const valMatch = entry.trim().match(/^(\w+)(?:\s*=\s*(-?\d+))?$/);
559
+ if (valMatch) {
560
+ const val = valMatch[2] ? parseInt(valMatch[2], 10) : nextVal;
561
+ currentEnum.values[valMatch[1]] = val;
562
+ nextVal = val + 1;
563
+ }
564
+ }
565
+ script.enums.push(currentEnum);
566
+ currentEnum = null;
567
+ } else {
568
+ script.enums.push(currentEnum);
569
+ }
570
+ pendingDocComment = void 0;
571
+ continue;
572
+ }
573
+ const constMatch = trimmed.match(/^const\s+(\w+)(?:\s*:\s*(\w+))?\s*=\s*(.+)$/);
574
+ if (constMatch) {
575
+ script.constants.push({
576
+ name: constMatch[1],
577
+ type: constMatch[2],
578
+ value: constMatch[3],
579
+ documentation: pendingDocComment?.trim()
580
+ });
581
+ pendingDocComment = void 0;
582
+ continue;
583
+ }
584
+ if (trimmed.startsWith("@export")) {
585
+ const exportAnnotations = [trimmed];
586
+ let j = i + 1;
587
+ while (j < lines.length && lines[j].trim().startsWith("@export")) {
588
+ exportAnnotations.push(lines[j].trim());
589
+ j++;
590
+ }
591
+ if (j < lines.length) {
592
+ const varLine = lines[j].trim();
593
+ const varMatch2 = varLine.match(/^var\s+(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?$/);
594
+ if (varMatch2) {
595
+ script.exportVars.push({
596
+ name: varMatch2[1],
597
+ type: varMatch2[2],
598
+ default: varMatch2[3],
599
+ exportAnnotations,
600
+ documentation: pendingDocComment?.trim()
601
+ });
602
+ i = j;
603
+ pendingDocComment = void 0;
604
+ pendingAnnotations = [];
605
+ }
606
+ }
607
+ continue;
608
+ }
609
+ const onreadyMatch = trimmed.match(/^@onready\s+var\s+(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?$/);
610
+ if (onreadyMatch) {
611
+ script.onreadyVars.push({
612
+ name: onreadyMatch[1],
613
+ type: onreadyMatch[2],
614
+ default: onreadyMatch[3],
615
+ documentation: pendingDocComment?.trim()
616
+ });
617
+ pendingDocComment = void 0;
618
+ continue;
619
+ }
620
+ const varMatch = trimmed.match(
621
+ /^var\s+(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?(?:\s*:\s*(?:get\s*=\s*(\w+))?(?:\s*,?\s*set\s*=\s*(\w+))?)?$/
622
+ );
623
+ if (varMatch) {
624
+ const variable = {
625
+ name: varMatch[1],
626
+ type: varMatch[2],
627
+ default: varMatch[3],
628
+ documentation: pendingDocComment?.trim()
629
+ };
630
+ if (varMatch[4] || varMatch[5]) {
631
+ variable.setget = {
632
+ getter: varMatch[4],
633
+ setter: varMatch[5]
634
+ };
635
+ }
636
+ script.variables.push(variable);
637
+ pendingDocComment = void 0;
638
+ continue;
639
+ }
640
+ const funcMatch = trimmed.match(
641
+ /^(?:(static)\s+)?func\s+(\w+)\(([^)]*)\)(?:\s*->\s*(\w+))?(?:\s*:\s*)?$/
642
+ );
643
+ if (funcMatch) {
644
+ currentFunction = {
645
+ name: funcMatch[2],
646
+ parameters: parseGDScriptParameters(funcMatch[3]),
647
+ returnType: funcMatch[4],
648
+ isVirtual: funcMatch[2].startsWith("_"),
649
+ isStatic: !!funcMatch[1],
650
+ isCoroutine: false,
651
+ body: "",
652
+ documentation: pendingDocComment?.trim()
653
+ };
654
+ functionIndent = indent;
655
+ if (currentFunction.isStatic) {
656
+ script.staticFunctions.push(currentFunction);
657
+ } else {
658
+ script.functions.push(currentFunction);
659
+ }
660
+ pendingDocComment = void 0;
661
+ continue;
662
+ }
663
+ const classMatch = trimmed.match(/^class\s+(\w+)(?:\s+extends\s+(\w+))?(?:\s*:\s*)?$/);
664
+ if (classMatch) {
665
+ script.innerClasses.push({
666
+ name: classMatch[1],
667
+ extends: classMatch[2],
514
668
  signals: [],
515
- enums: [],
516
- constants: [],
517
- exportVars: [],
518
- onreadyVars: [],
519
669
  variables: [],
520
- functions: [],
521
- innerClasses: [],
522
- staticFunctions: [],
523
- annotations: [],
670
+ functions: []
671
+ });
672
+ pendingDocComment = void 0;
673
+ continue;
674
+ }
675
+ pendingDocComment = void 0;
676
+ pendingAnnotations = [];
677
+ }
678
+ return script;
679
+ }
680
+ function parseGDScriptParameters(paramString) {
681
+ if (!paramString.trim()) {
682
+ return [];
683
+ }
684
+ const params = [];
685
+ const parts = paramString.split(",");
686
+ for (const part of parts) {
687
+ const trimmed = part.trim();
688
+ const paramMatch = trimmed.match(/^(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?$/);
689
+ if (paramMatch) {
690
+ params.push({
691
+ name: paramMatch[1],
692
+ type: paramMatch[2],
693
+ default: paramMatch[3]
694
+ });
695
+ }
696
+ }
697
+ return params;
698
+ }
699
+ class GodotProjectImporter {
700
+ constructor(callbacks) {
701
+ this.projectPath = "";
702
+ this.config = null;
703
+ this.scenes = /* @__PURE__ */ new Map();
704
+ this.resources = /* @__PURE__ */ new Map();
705
+ this.scripts = /* @__PURE__ */ new Map();
706
+ this.callbacks = {};
707
+ if (callbacks) {
708
+ this.callbacks = callbacks;
709
+ }
710
+ }
711
+ /**
712
+ * Parses project.godot configuration file
713
+ */
714
+ parseProjectConfig(content) {
715
+ const config = {
716
+ configVersion: 5,
717
+ name: "Untitled",
718
+ features: [],
719
+ autoloads: {},
720
+ inputMap: {},
721
+ layers: { layer2d: {}, layer3d: {} }
524
722
  };
525
- const lines = content.split('\n');
526
- let currentFunction = null;
527
- let functionIndent = 0;
528
- let currentEnum = null;
529
- let enumIndent = 0;
530
- let pendingDocComment;
531
- let pendingAnnotations = [];
532
- for (let i = 0; i < lines.length; i++) {
533
- const line = lines[i];
534
- const trimmed = line.trim();
535
- const indent = line.length - line.trimStart().length;
536
- // Skip empty lines and comments (but capture doc comments)
537
- if (!trimmed) {
538
- continue;
539
- }
540
- if (trimmed.startsWith('##')) {
541
- pendingDocComment = (pendingDocComment || '') + trimmed.substring(2).trim() + '\n';
542
- continue;
543
- }
544
- if (trimmed.startsWith('#')) {
545
- continue;
546
- }
547
- // Handle being inside function body
548
- if (currentFunction && indent > functionIndent) {
549
- currentFunction.body += line + '\n';
550
- continue;
551
- }
552
- else if (currentFunction && indent <= functionIndent) {
553
- currentFunction = null;
554
- }
555
- // Handle being inside enum
556
- if (currentEnum && indent > enumIndent) {
557
- // Parse enum value
558
- const enumValMatch = trimmed.match(/^(\w+)(?:\s*=\s*(-?\d+))?,?$/);
559
- if (enumValMatch) {
560
- const name = enumValMatch[1];
561
- const value = enumValMatch[2]
562
- ? parseInt(enumValMatch[2], 10)
563
- : Object.keys(currentEnum.values).length;
564
- currentEnum.values[name] = value;
565
- }
566
- continue;
567
- }
568
- else if (currentEnum && indent <= enumIndent) {
569
- currentEnum = null;
570
- }
571
- // @tool annotation
572
- if (trimmed === '@tool') {
573
- script.isToolScript = true;
574
- continue;
575
- }
576
- // Annotations
577
- if (trimmed.startsWith('@')) {
578
- const annotationMatch = trimmed.match(/^@(\w+)(?:\(([^)]*)\))?/);
579
- if (annotationMatch) {
580
- const annotation = { name: annotationMatch[1] };
581
- if (annotationMatch[2]) {
582
- annotation.arguments = annotationMatch[2].split(',').map((a) => a.trim());
583
- }
584
- pendingAnnotations.push(annotation);
585
- // Handle @icon specifically
586
- if (annotation.name === 'icon' && annotation.arguments?.[0]) {
587
- script.iconPath = annotation.arguments[0].replace(/"/g, '');
588
- }
723
+ let currentSection = "";
724
+ const lines = content.split("\n");
725
+ for (let line of lines) {
726
+ line = line.trim();
727
+ if (!line || line.startsWith(";")) {
728
+ continue;
729
+ }
730
+ if (line.startsWith("[")) {
731
+ const match = line.match(/^\[(.+)\]$/);
732
+ if (match) {
733
+ currentSection = match[1];
734
+ }
735
+ continue;
736
+ }
737
+ if (line.includes("=")) {
738
+ const eqIndex = line.indexOf("=");
739
+ const key = line.substring(0, eqIndex).trim();
740
+ const valueStr = line.substring(eqIndex + 1).trim();
741
+ const value = parseGodotValue(valueStr);
742
+ switch (currentSection) {
743
+ case "":
744
+ if (key === "config_version") {
745
+ config.configVersion = value;
589
746
  }
590
- continue;
591
- }
592
- // class_name
593
- const classNameMatch = trimmed.match(/^class_name\s+(\w+)/);
594
- if (classNameMatch) {
595
- script.className = classNameMatch[1];
596
- script.classNameToken = classNameMatch[1];
597
- continue;
598
- }
599
- // extends
600
- const extendsMatch = trimmed.match(/^extends\s+(.+)$/);
601
- if (extendsMatch) {
602
- script.extends = extendsMatch[1].trim();
603
- continue;
604
- }
605
- // signal
606
- const signalMatch = trimmed.match(/^signal\s+(\w+)(?:\(([^)]*)\))?/);
607
- if (signalMatch) {
608
- const sig = {
609
- name: signalMatch[1],
610
- parameters: [],
611
- documentation: pendingDocComment?.trim(),
612
- };
613
- if (signalMatch[2]) {
614
- sig.parameters = parseGDScriptParameters(signalMatch[2]);
747
+ break;
748
+ case "application":
749
+ if (key === "config/name") {
750
+ config.name = value;
615
751
  }
616
- script.signals.push(sig);
617
- pendingDocComment = undefined;
618
- continue;
619
- }
620
- // enum
621
- const enumMatch = trimmed.match(/^enum\s+(\w+)\s*{?/);
622
- if (enumMatch) {
623
- currentEnum = {
624
- name: enumMatch[1],
625
- values: {},
626
- documentation: pendingDocComment?.trim(),
627
- };
628
- enumIndent = indent;
629
- // Check for single-line enum
630
- const inlineMatch = trimmed.match(/^enum\s+\w+\s*{([^}]+)}/);
631
- if (inlineMatch) {
632
- const entries = inlineMatch[1].split(',');
633
- let nextVal = 0;
634
- for (const entry of entries) {
635
- const valMatch = entry.trim().match(/^(\w+)(?:\s*=\s*(-?\d+))?$/);
636
- if (valMatch) {
637
- const val = valMatch[2] ? parseInt(valMatch[2], 10) : nextVal;
638
- currentEnum.values[valMatch[1]] = val;
639
- nextVal = val + 1;
640
- }
641
- }
642
- script.enums.push(currentEnum);
643
- currentEnum = null;
752
+ if (key === "config/features") {
753
+ config.features = value;
644
754
  }
645
- else {
646
- script.enums.push(currentEnum);
755
+ if (key === "config/icon") {
756
+ config.icon = value;
647
757
  }
648
- pendingDocComment = undefined;
649
- continue;
650
- }
651
- // const
652
- const constMatch = trimmed.match(/^const\s+(\w+)(?:\s*:\s*(\w+))?\s*=\s*(.+)$/);
653
- if (constMatch) {
654
- script.constants.push({
655
- name: constMatch[1],
656
- type: constMatch[2],
657
- value: constMatch[3],
658
- documentation: pendingDocComment?.trim(),
659
- });
660
- pendingDocComment = undefined;
661
- continue;
662
- }
663
- // @export var
664
- if (trimmed.startsWith('@export')) {
665
- // This is an export annotation, the var should follow
666
- const exportAnnotations = [trimmed];
667
- // Look for subsequent export annotations or the var line
668
- let j = i + 1;
669
- while (j < lines.length && lines[j].trim().startsWith('@export')) {
670
- exportAnnotations.push(lines[j].trim());
671
- j++;
758
+ if (key === "run/main_scene") {
759
+ config.mainScene = value;
672
760
  }
673
- if (j < lines.length) {
674
- const varLine = lines[j].trim();
675
- const varMatch = varLine.match(/^var\s+(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?$/);
676
- if (varMatch) {
677
- script.exportVars.push({
678
- name: varMatch[1],
679
- type: varMatch[2],
680
- default: varMatch[3],
681
- exportAnnotations: exportAnnotations,
682
- documentation: pendingDocComment?.trim(),
683
- });
684
- i = j; // Skip to after the var line
685
- pendingDocComment = undefined;
686
- pendingAnnotations = [];
687
- }
761
+ break;
762
+ case "autoload": {
763
+ const autoloadMatch = key.match(/^(.+)$/);
764
+ if (autoloadMatch) {
765
+ const autoloadPath = value.replace(/^\*/, "");
766
+ config.autoloads[autoloadMatch[1]] = autoloadPath;
688
767
  }
689
- continue;
690
- }
691
- // @onready var
692
- const onreadyMatch = trimmed.match(/^@onready\s+var\s+(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?$/);
693
- if (onreadyMatch) {
694
- script.onreadyVars.push({
695
- name: onreadyMatch[1],
696
- type: onreadyMatch[2],
697
- default: onreadyMatch[3],
698
- documentation: pendingDocComment?.trim(),
699
- });
700
- pendingDocComment = undefined;
701
- continue;
702
- }
703
- // Regular var
704
- const varMatch = trimmed.match(/^var\s+(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?(?:\s*:\s*(?:get\s*=\s*(\w+))?(?:\s*,?\s*set\s*=\s*(\w+))?)?$/);
705
- if (varMatch) {
706
- const variable = {
707
- name: varMatch[1],
708
- type: varMatch[2],
709
- default: varMatch[3],
710
- documentation: pendingDocComment?.trim(),
711
- };
712
- if (varMatch[4] || varMatch[5]) {
713
- variable.setget = {
714
- getter: varMatch[4],
715
- setter: varMatch[5],
716
- };
768
+ break;
769
+ }
770
+ case "input": {
771
+ const inputMatch = key.match(/^(.+)$/);
772
+ if (inputMatch) {
773
+ const inputValue = value;
774
+ config.inputMap[inputMatch[1]] = {
775
+ deadzone: inputValue.deadzone ?? 0.5,
776
+ events: inputValue.events ?? []
777
+ };
717
778
  }
718
- script.variables.push(variable);
719
- pendingDocComment = undefined;
720
- continue;
721
- }
722
- // Function
723
- const funcMatch = trimmed.match(/^(?:(static)\s+)?func\s+(\w+)\(([^)]*)\)(?:\s*->\s*(\w+))?(?:\s*:\s*)?$/);
724
- if (funcMatch) {
725
- currentFunction = {
726
- name: funcMatch[2],
727
- parameters: parseGDScriptParameters(funcMatch[3]),
728
- returnType: funcMatch[4],
729
- isVirtual: funcMatch[2].startsWith('_'),
730
- isStatic: !!funcMatch[1],
731
- isCoroutine: false,
732
- body: '',
733
- documentation: pendingDocComment?.trim(),
734
- };
735
- functionIndent = indent;
736
- if (currentFunction.isStatic) {
737
- script.staticFunctions.push(currentFunction);
779
+ break;
780
+ }
781
+ case "layer_names":
782
+ if (key.startsWith("2d_physics/layer_")) {
783
+ const layerNum = parseInt(key.split("_").pop(), 10);
784
+ config.layers.layer2d[value] = layerNum;
738
785
  }
739
- else {
740
- script.functions.push(currentFunction);
786
+ if (key.startsWith("3d_physics/layer_")) {
787
+ const layerNum = parseInt(key.split("_").pop(), 10);
788
+ config.layers.layer3d[value] = layerNum;
741
789
  }
742
- pendingDocComment = undefined;
743
- continue;
744
- }
745
- // Inner class
746
- const classMatch = trimmed.match(/^class\s+(\w+)(?:\s+extends\s+(\w+))?(?:\s*:\s*)?$/);
747
- if (classMatch) {
748
- script.innerClasses.push({
749
- name: classMatch[1],
750
- extends: classMatch[2],
751
- signals: [],
752
- variables: [],
753
- functions: [],
754
- });
755
- pendingDocComment = undefined;
756
- continue;
757
- }
758
- pendingDocComment = undefined;
759
- pendingAnnotations = [];
760
- }
790
+ break;
791
+ }
792
+ }
793
+ }
794
+ this.config = config;
795
+ return config;
796
+ }
797
+ /**
798
+ * Imports a scene file and all its dependencies
799
+ */
800
+ async importScene(content, filePath) {
801
+ const scene = parseGodotScene(content);
802
+ this.scenes.set(filePath, scene);
803
+ this.callbacks.onSceneParsed?.(scene);
804
+ return this.convertSceneToImported(scene, filePath);
805
+ }
806
+ /**
807
+ * Imports a resource file
808
+ */
809
+ async importResource(content, filePath) {
810
+ const resource = parseGodotResource(content);
811
+ this.resources.set(filePath, resource);
812
+ this.callbacks.onResourceParsed?.(resource);
813
+ return resource;
814
+ }
815
+ /**
816
+ * Imports a GDScript file
817
+ */
818
+ async importScript(content, filePath) {
819
+ const script = parseGDScript(content, filePath);
820
+ this.scripts.set(filePath, script);
821
+ this.callbacks.onScriptParsed?.(script);
761
822
  return script;
823
+ }
824
+ convertSceneToImported(scene, filePath) {
825
+ const imported = {
826
+ name: filePath.split("/").pop()?.replace(".tscn", "") ?? "Scene",
827
+ path: filePath,
828
+ nodes: [],
829
+ rootNode: null,
830
+ connections: scene.connections,
831
+ resources: /* @__PURE__ */ new Map()
832
+ };
833
+ for (const extRes of scene.extResources) {
834
+ imported.resources.set(String(extRes.id), extRes);
835
+ }
836
+ if (scene.rootNode) {
837
+ imported.rootNode = this.convertNode(scene.rootNode, imported.resources);
838
+ imported.nodes = this.flattenNodes(imported.rootNode);
839
+ }
840
+ return imported;
841
+ }
842
+ convertNode(node, resources, parentId) {
843
+ const id = parentId ? `${parentId}/${node.name}` : node.name;
844
+ const imported = {
845
+ id,
846
+ name: node.name,
847
+ type: node.type,
848
+ parentId,
849
+ properties: { ...node.properties },
850
+ children: [],
851
+ groups: node.groups ?? []
852
+ };
853
+ if (node.properties.position) {
854
+ imported.position = node.properties.position;
855
+ }
856
+ if (node.properties.global_position) {
857
+ imported.position = node.properties.global_position;
858
+ }
859
+ if (node.properties.rotation) {
860
+ imported.rotation = node.properties.rotation;
861
+ }
862
+ if (node.properties.scale) {
863
+ imported.scale = node.properties.scale;
864
+ }
865
+ if (node.properties.transform) {
866
+ const t = node.properties.transform;
867
+ imported.position = t.origin;
868
+ }
869
+ if (node.script) {
870
+ const scriptRes = resources.get(String(node.script));
871
+ if (scriptRes) {
872
+ const cachedScript = this.scripts.get(scriptRes.path);
873
+ if (cachedScript) {
874
+ imported.script = cachedScript;
875
+ }
876
+ }
877
+ }
878
+ for (const child of node.children) {
879
+ imported.children.push(this.convertNode(child, resources, id));
880
+ }
881
+ return imported;
882
+ }
883
+ flattenNodes(node) {
884
+ const nodes = [node];
885
+ for (const child of node.children) {
886
+ nodes.push(...this.flattenNodes(child));
887
+ }
888
+ return nodes;
889
+ }
890
+ /**
891
+ * Gets all imported data
892
+ */
893
+ getImportedData() {
894
+ return {
895
+ config: this.config,
896
+ scenes: this.scenes,
897
+ resources: this.resources,
898
+ scripts: this.scripts
899
+ };
900
+ }
901
+ setCallbacks(callbacks) {
902
+ this.callbacks = { ...this.callbacks, ...callbacks };
903
+ }
762
904
  }
763
- function parseGDScriptParameters(paramString) {
764
- if (!paramString.trim()) {
765
- return [];
766
- }
767
- const params = [];
768
- const parts = paramString.split(',');
769
- for (const part of parts) {
770
- const trimmed = part.trim();
771
- const paramMatch = trimmed.match(/^(\w+)(?:\s*:\s*(\w+))?(?:\s*=\s*(.+))?$/);
772
- if (paramMatch) {
773
- params.push({
774
- name: paramMatch[1],
775
- type: paramMatch[2],
776
- default: paramMatch[3],
777
- });
778
- }
779
- }
780
- return params;
781
- }
782
- class GodotProjectImporter {
783
- constructor(callbacks) {
784
- this.projectPath = '';
785
- this.config = null;
786
- this.scenes = new Map();
787
- this.resources = new Map();
788
- this.scripts = new Map();
789
- this.callbacks = {};
790
- if (callbacks) {
791
- this.callbacks = callbacks;
792
- }
793
- }
794
- /**
795
- * Parses project.godot configuration file
796
- */
797
- parseProjectConfig(content) {
798
- const config = {
799
- configVersion: 5,
800
- name: 'Untitled',
801
- features: [],
802
- autoloads: {},
803
- inputMap: {},
804
- layers: { layer2d: {}, layer3d: {} },
805
- };
806
- let currentSection = '';
807
- const lines = content.split('\n');
808
- for (let line of lines) {
809
- line = line.trim();
810
- if (!line || line.startsWith(';')) {
811
- continue;
812
- }
813
- // Section header
814
- if (line.startsWith('[')) {
815
- const match = line.match(/^\[(.+)\]$/);
816
- if (match) {
817
- currentSection = match[1];
818
- }
819
- continue;
820
- }
821
- // Key-value pair
822
- if (line.includes('=')) {
823
- const eqIndex = line.indexOf('=');
824
- const key = line.substring(0, eqIndex).trim();
825
- const valueStr = line.substring(eqIndex + 1).trim();
826
- const value = parseGodotValue(valueStr);
827
- switch (currentSection) {
828
- case '':
829
- if (key === 'config_version') {
830
- config.configVersion = value;
831
- }
832
- break;
833
- case 'application':
834
- if (key === 'config/name') {
835
- config.name = value;
836
- }
837
- if (key === 'config/features') {
838
- config.features = value;
839
- }
840
- if (key === 'config/icon') {
841
- config.icon = value;
842
- }
843
- if (key === 'run/main_scene') {
844
- config.mainScene = value;
845
- }
846
- break;
847
- case 'autoload': {
848
- const autoloadMatch = key.match(/^(.+)$/);
849
- if (autoloadMatch) {
850
- const autoloadPath = value.replace(/^\*/, '');
851
- config.autoloads[autoloadMatch[1]] = autoloadPath;
852
- }
853
- break;
854
- }
855
- case 'input': {
856
- const inputMatch = key.match(/^(.+)$/);
857
- if (inputMatch) {
858
- const inputValue = value;
859
- config.inputMap[inputMatch[1]] = {
860
- deadzone: inputValue.deadzone ?? 0.5,
861
- events: inputValue.events ?? [],
862
- };
863
- }
864
- break;
865
- }
866
- case 'layer_names':
867
- if (key.startsWith('2d_physics/layer_')) {
868
- const layerNum = parseInt(key.split('_').pop(), 10);
869
- config.layers.layer2d[value] = layerNum;
870
- }
871
- if (key.startsWith('3d_physics/layer_')) {
872
- const layerNum = parseInt(key.split('_').pop(), 10);
873
- config.layers.layer3d[value] = layerNum;
874
- }
875
- break;
876
- }
877
- }
878
- }
879
- this.config = config;
880
- return config;
881
- }
882
- /**
883
- * Imports a scene file and all its dependencies
884
- */
885
- async importScene(content, filePath) {
886
- const scene = parseGodotScene(content);
887
- this.scenes.set(filePath, scene);
888
- this.callbacks.onSceneParsed?.(scene);
889
- return this.convertSceneToImported(scene, filePath);
890
- }
891
- /**
892
- * Imports a resource file
893
- */
894
- async importResource(content, filePath) {
895
- const resource = parseGodotResource(content);
896
- this.resources.set(filePath, resource);
897
- this.callbacks.onResourceParsed?.(resource);
898
- return resource;
899
- }
900
- /**
901
- * Imports a GDScript file
902
- */
903
- async importScript(content, filePath) {
904
- const script = parseGDScript(content, filePath);
905
- this.scripts.set(filePath, script);
906
- this.callbacks.onScriptParsed?.(script);
907
- return script;
908
- }
909
- convertSceneToImported(scene, filePath) {
910
- const imported = {
911
- name: filePath.split('/').pop()?.replace('.tscn', '') ?? 'Scene',
912
- path: filePath,
913
- nodes: [],
914
- rootNode: null,
915
- connections: scene.connections,
916
- resources: new Map(),
917
- };
918
- // Build resource map
919
- for (const extRes of scene.extResources) {
920
- imported.resources.set(String(extRes.id), extRes);
921
- }
922
- // Convert nodes
923
- if (scene.rootNode) {
924
- imported.rootNode = this.convertNode(scene.rootNode, imported.resources);
925
- imported.nodes = this.flattenNodes(imported.rootNode);
926
- }
927
- return imported;
928
- }
929
- convertNode(node, resources, parentId) {
930
- const id = parentId ? `${parentId}/${node.name}` : node.name;
931
- const imported = {
932
- id,
933
- name: node.name,
934
- type: node.type,
935
- parentId,
936
- properties: { ...node.properties },
937
- children: [],
938
- groups: node.groups ?? [],
939
- };
940
- // Extract position/rotation/scale from properties
941
- if (node.properties.position) {
942
- imported.position = node.properties.position;
943
- }
944
- if (node.properties.global_position) {
945
- imported.position = node.properties.global_position;
946
- }
947
- if (node.properties.rotation) {
948
- imported.rotation = node.properties.rotation;
949
- }
950
- if (node.properties.scale) {
951
- imported.scale = node.properties.scale;
952
- }
953
- // 3D transforms
954
- if (node.properties.transform) {
955
- const t = node.properties.transform;
956
- imported.position = t.origin;
957
- }
958
- // Resolve script reference
959
- if (node.script) {
960
- const scriptRes = resources.get(String(node.script));
961
- if (scriptRes) {
962
- const cachedScript = this.scripts.get(scriptRes.path);
963
- if (cachedScript) {
964
- imported.script = cachedScript;
965
- }
966
- }
967
- }
968
- // Convert children
969
- for (const child of node.children) {
970
- imported.children.push(this.convertNode(child, resources, id));
971
- }
972
- return imported;
973
- }
974
- flattenNodes(node) {
975
- const nodes = [node];
976
- for (const child of node.children) {
977
- nodes.push(...this.flattenNodes(child));
978
- }
979
- return nodes;
980
- }
981
- /**
982
- * Gets all imported data
983
- */
984
- getImportedData() {
985
- return {
986
- config: this.config,
987
- scenes: this.scenes,
988
- resources: this.resources,
989
- scripts: this.scripts,
990
- };
991
- }
992
- setCallbacks(callbacks) {
993
- this.callbacks = { ...this.callbacks, ...callbacks };
994
- }
995
- }
996
- // ============================================================
997
- // Node Type Mapping
998
- // ============================================================
999
905
  const GODOT_NODE_MAPPING = {
1000
- // 2D Nodes
1001
- Node2D: 'Entity2D',
1002
- Sprite2D: 'Sprite',
1003
- AnimatedSprite2D: 'AnimatedSprite',
1004
- Camera2D: 'Camera2D',
1005
- CharacterBody2D: 'KinematicBody2D',
1006
- RigidBody2D: 'RigidBody2D',
1007
- StaticBody2D: 'StaticBody2D',
1008
- Area2D: 'Area2D',
1009
- CollisionShape2D: 'CollisionShape2D',
1010
- TileMap: 'TileMap',
1011
- TileMapLayer: 'TileMapLayer',
1012
- GPUParticles2D: 'ParticleEmitter2D',
1013
- CPUParticles2D: 'ParticleEmitter2D',
1014
- NavigationAgent2D: 'NavigationAgent2D',
1015
- AudioStreamPlayer2D: 'AudioSource2D',
1016
- // 3D Nodes
1017
- Node3D: 'Entity3D',
1018
- MeshInstance3D: 'MeshRenderer',
1019
- Camera3D: 'Camera3D',
1020
- CharacterBody3D: 'KinematicBody3D',
1021
- RigidBody3D: 'RigidBody3D',
1022
- StaticBody3D: 'StaticBody3D',
1023
- Area3D: 'Area3D',
1024
- CollisionShape3D: 'CollisionShape3D',
1025
- DirectionalLight3D: 'DirectionalLight',
1026
- OmniLight3D: 'PointLight',
1027
- SpotLight3D: 'SpotLight',
1028
- GPUParticles3D: 'ParticleEmitter3D',
1029
- CPUParticles3D: 'ParticleEmitter3D',
1030
- NavigationAgent3D: 'NavigationAgent3D',
1031
- AudioStreamPlayer3D: 'AudioSource3D',
1032
- WorldEnvironment: 'Environment',
1033
- // Audio
1034
- AudioStreamPlayer: 'AudioSource',
1035
- // Animation
1036
- AnimationPlayer: 'AnimationPlayer',
1037
- AnimationTree: 'AnimationTree',
1038
- // UI
1039
- Control: 'UIElement',
1040
- Button: 'UIButton',
1041
- Label: 'UILabel',
1042
- TextureRect: 'UIImage',
1043
- Panel: 'UIPanel',
1044
- VBoxContainer: 'UIVBox',
1045
- HBoxContainer: 'UIHBox',
1046
- GridContainer: 'UIGrid',
1047
- LineEdit: 'UIInput',
1048
- TextEdit: 'UITextArea',
1049
- ProgressBar: 'UIProgressBar',
1050
- Slider: 'UISlider',
1051
- TabContainer: 'UITabs',
1052
- CanvasLayer: 'UILayer',
1053
- // Other
1054
- Timer: 'Timer',
1055
- Node: 'Entity',
906
+ // 2D Nodes
907
+ Node2D: "Entity2D",
908
+ Sprite2D: "Sprite",
909
+ AnimatedSprite2D: "AnimatedSprite",
910
+ Camera2D: "Camera2D",
911
+ CharacterBody2D: "KinematicBody2D",
912
+ RigidBody2D: "RigidBody2D",
913
+ StaticBody2D: "StaticBody2D",
914
+ Area2D: "Area2D",
915
+ CollisionShape2D: "CollisionShape2D",
916
+ TileMap: "TileMap",
917
+ TileMapLayer: "TileMapLayer",
918
+ GPUParticles2D: "ParticleEmitter2D",
919
+ CPUParticles2D: "ParticleEmitter2D",
920
+ NavigationAgent2D: "NavigationAgent2D",
921
+ AudioStreamPlayer2D: "AudioSource2D",
922
+ // 3D Nodes
923
+ Node3D: "Entity3D",
924
+ MeshInstance3D: "MeshRenderer",
925
+ Camera3D: "Camera3D",
926
+ CharacterBody3D: "KinematicBody3D",
927
+ RigidBody3D: "RigidBody3D",
928
+ StaticBody3D: "StaticBody3D",
929
+ Area3D: "Area3D",
930
+ CollisionShape3D: "CollisionShape3D",
931
+ DirectionalLight3D: "DirectionalLight",
932
+ OmniLight3D: "PointLight",
933
+ SpotLight3D: "SpotLight",
934
+ GPUParticles3D: "ParticleEmitter3D",
935
+ CPUParticles3D: "ParticleEmitter3D",
936
+ NavigationAgent3D: "NavigationAgent3D",
937
+ AudioStreamPlayer3D: "AudioSource3D",
938
+ WorldEnvironment: "Environment",
939
+ // Audio
940
+ AudioStreamPlayer: "AudioSource",
941
+ // Animation
942
+ AnimationPlayer: "AnimationPlayer",
943
+ AnimationTree: "AnimationTree",
944
+ // UI
945
+ Control: "UIElement",
946
+ Button: "UIButton",
947
+ Label: "UILabel",
948
+ TextureRect: "UIImage",
949
+ Panel: "UIPanel",
950
+ VBoxContainer: "UIVBox",
951
+ HBoxContainer: "UIHBox",
952
+ GridContainer: "UIGrid",
953
+ LineEdit: "UIInput",
954
+ TextEdit: "UITextArea",
955
+ ProgressBar: "UIProgressBar",
956
+ Slider: "UISlider",
957
+ TabContainer: "UITabs",
958
+ CanvasLayer: "UILayer",
959
+ // Other
960
+ Timer: "Timer",
961
+ Node: "Entity"
1056
962
  };
1057
- // ============================================================
1058
- // Factory Functions
1059
- // ============================================================
1060
963
  function createGodotProjectImporter(callbacks) {
1061
- return new GodotProjectImporter(callbacks);
964
+ return new GodotProjectImporter(callbacks);
1062
965
  }
1063
-
1064
- export { GODOT_NODE_MAPPING, GodotProjectImporter, createGodotProjectImporter, parseGDScript, parseGodotResource, parseGodotScene };
966
+ export {
967
+ GODOT_NODE_MAPPING,
968
+ GodotProjectImporter,
969
+ createGodotProjectImporter,
970
+ parseGDScript,
971
+ parseGodotResource,
972
+ parseGodotScene
973
+ };