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