@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.
- package/CHANGELOG.md +13 -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,841 +1,807 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
//
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
const SceneImporter = require("./SceneImporter.js");
|
|
19
26
|
const GODOT_NODE_MAPPING = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
27
|
+
// 2D Nodes
|
|
28
|
+
Node2D: { niceType: "Transform2D", category: "2d" },
|
|
29
|
+
Sprite2D: { niceType: "Sprite", category: "2d" },
|
|
30
|
+
AnimatedSprite2D: { niceType: "AnimatedSprite", category: "2d" },
|
|
31
|
+
CharacterBody2D: { niceType: "CharacterController2D", category: "2d" },
|
|
32
|
+
RigidBody2D: { niceType: "Rigidbody2D", category: "2d" },
|
|
33
|
+
StaticBody2D: { niceType: "StaticBody2D", category: "2d" },
|
|
34
|
+
Area2D: { niceType: "Trigger2D", category: "2d" },
|
|
35
|
+
CollisionShape2D: { niceType: "Collider2D", category: "2d" },
|
|
36
|
+
CollisionPolygon2D: { niceType: "PolygonCollider2D", category: "2d" },
|
|
37
|
+
TileMap: { niceType: "Tilemap", category: "2d" },
|
|
38
|
+
TileMapLayer: { niceType: "TilemapLayer", category: "2d" },
|
|
39
|
+
Camera2D: { niceType: "Camera2D", category: "2d" },
|
|
40
|
+
Light2D: { niceType: "Light2D", category: "2d" },
|
|
41
|
+
PointLight2D: { niceType: "PointLight2D", category: "2d" },
|
|
42
|
+
DirectionalLight2D: { niceType: "DirectionalLight2D", category: "2d" },
|
|
43
|
+
Line2D: { niceType: "LineRenderer", category: "2d" },
|
|
44
|
+
Path2D: { niceType: "Path2D", category: "2d" },
|
|
45
|
+
PathFollow2D: { niceType: "PathFollower2D", category: "2d" },
|
|
46
|
+
GPUParticles2D: { niceType: "ParticleSystem2D", category: "2d" },
|
|
47
|
+
CPUParticles2D: { niceType: "CPUParticles2D", category: "2d" },
|
|
48
|
+
// 3D Nodes
|
|
49
|
+
Node3D: { niceType: "Transform3D", category: "3d" },
|
|
50
|
+
MeshInstance3D: { niceType: "MeshRenderer", category: "3d" },
|
|
51
|
+
CharacterBody3D: { niceType: "CharacterController3D", category: "3d" },
|
|
52
|
+
RigidBody3D: { niceType: "Rigidbody3D", category: "3d" },
|
|
53
|
+
StaticBody3D: { niceType: "StaticBody3D", category: "3d" },
|
|
54
|
+
Area3D: { niceType: "Trigger3D", category: "3d" },
|
|
55
|
+
CollisionShape3D: { niceType: "Collider3D", category: "3d" },
|
|
56
|
+
Camera3D: { niceType: "Camera3D", category: "3d" },
|
|
57
|
+
DirectionalLight3D: { niceType: "DirectionalLight", category: "3d" },
|
|
58
|
+
OmniLight3D: { niceType: "PointLight", category: "3d" },
|
|
59
|
+
SpotLight3D: { niceType: "SpotLight", category: "3d" },
|
|
60
|
+
GPUParticles3D: { niceType: "ParticleSystem3D", category: "3d" },
|
|
61
|
+
// Audio
|
|
62
|
+
AudioStreamPlayer: { niceType: "AudioSource", category: "audio" },
|
|
63
|
+
AudioStreamPlayer2D: { niceType: "AudioSource2D", category: "audio" },
|
|
64
|
+
AudioStreamPlayer3D: { niceType: "AudioSource3D", category: "audio" },
|
|
65
|
+
// UI
|
|
66
|
+
Control: { niceType: "UIElement", category: "ui" },
|
|
67
|
+
Label: { niceType: "Text", category: "ui" },
|
|
68
|
+
Button: { niceType: "Button", category: "ui" },
|
|
69
|
+
TextureRect: { niceType: "Image", category: "ui" },
|
|
70
|
+
Panel: { niceType: "Panel", category: "ui" },
|
|
71
|
+
HBoxContainer: { niceType: "HorizontalLayout", category: "ui" },
|
|
72
|
+
VBoxContainer: { niceType: "VerticalLayout", category: "ui" },
|
|
73
|
+
GridContainer: { niceType: "GridLayout", category: "ui" },
|
|
74
|
+
ScrollContainer: { niceType: "ScrollView", category: "ui" },
|
|
75
|
+
LineEdit: { niceType: "InputField", category: "ui" },
|
|
76
|
+
TextEdit: { niceType: "TextArea", category: "ui" },
|
|
77
|
+
CheckBox: { niceType: "Checkbox", category: "ui" },
|
|
78
|
+
ProgressBar: { niceType: "ProgressBar", category: "ui" },
|
|
79
|
+
Slider: { niceType: "Slider", category: "ui" },
|
|
80
|
+
SpinBox: { niceType: "SpinBox", category: "ui" },
|
|
81
|
+
ColorRect: { niceType: "ColorPanel", category: "ui" },
|
|
82
|
+
NinePatchRect: { niceType: "NineSlice", category: "ui" },
|
|
83
|
+
CanvasLayer: { niceType: "UICanvas", category: "ui" },
|
|
84
|
+
// Animation
|
|
85
|
+
AnimationPlayer: { niceType: "Animator", category: "animation" },
|
|
86
|
+
AnimationTree: { niceType: "AnimationStateMachine", category: "animation" },
|
|
87
|
+
// Navigation
|
|
88
|
+
NavigationRegion2D: { niceType: "NavMesh2D", category: "navigation" },
|
|
89
|
+
NavigationAgent2D: { niceType: "NavAgent2D", category: "navigation" },
|
|
90
|
+
NavigationRegion3D: { niceType: "NavMesh3D", category: "navigation" },
|
|
91
|
+
NavigationAgent3D: { niceType: "NavAgent3D", category: "navigation" },
|
|
92
|
+
// Other
|
|
93
|
+
Timer: { niceType: "Timer", category: "utility" },
|
|
94
|
+
HTTPRequest: { niceType: "HTTPClient", category: "utility" }
|
|
88
95
|
};
|
|
89
|
-
// ============================================================
|
|
90
|
-
// Godot Scene Importer
|
|
91
|
-
// ============================================================
|
|
92
96
|
class GodotSceneImporter extends SceneImporter.SceneImporter {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const sectionType = sectionMatch[1];
|
|
172
|
-
const sectionParams = sectionMatch[2].trim();
|
|
173
|
-
if (sectionType === 'gd_scene' || sectionType === 'gd_resource') {
|
|
174
|
-
currentSection = 'header';
|
|
175
|
-
this.header = this.parseInlineParams(sectionParams);
|
|
176
|
-
}
|
|
177
|
-
else if (sectionType === 'ext_resource') {
|
|
178
|
-
currentSection = 'ext_resource';
|
|
179
|
-
currentItem = this.parseInlineParams(sectionParams);
|
|
180
|
-
}
|
|
181
|
-
else if (sectionType === 'sub_resource') {
|
|
182
|
-
currentSection = 'sub_resource';
|
|
183
|
-
currentItem = this.parseInlineParams(sectionParams);
|
|
184
|
-
}
|
|
185
|
-
else if (sectionType === 'node') {
|
|
186
|
-
currentSection = 'node';
|
|
187
|
-
currentItem = this.parseInlineParams(sectionParams);
|
|
188
|
-
}
|
|
189
|
-
else if (sectionType === 'connection') {
|
|
190
|
-
currentSection = 'connection';
|
|
191
|
-
currentItem = this.parseInlineParams(sectionParams);
|
|
192
|
-
}
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
// Handle multiline values
|
|
196
|
-
if (multilineKey) {
|
|
197
|
-
multilineValue += '\n' + line;
|
|
198
|
-
bracketDepth += (line.match(/[[{]/g) || []).length;
|
|
199
|
-
bracketDepth -= (line.match(/[\]}]/g) || []).length;
|
|
200
|
-
if (bracketDepth === 0) {
|
|
201
|
-
currentItem[multilineKey] = this.parseGodotValue(multilineValue);
|
|
202
|
-
multilineKey = '';
|
|
203
|
-
multilineValue = '';
|
|
204
|
-
}
|
|
205
|
-
continue;
|
|
206
|
-
}
|
|
207
|
-
// Parse property assignment
|
|
208
|
-
const propMatch = trimmed.match(/^(\w+)\s*=\s*(.*)$/);
|
|
209
|
-
if (propMatch) {
|
|
210
|
-
const key = propMatch[1];
|
|
211
|
-
const value = propMatch[2];
|
|
212
|
-
// Check if value starts multiline
|
|
213
|
-
bracketDepth = (value.match(/[[{]/g) || []).length;
|
|
214
|
-
bracketDepth -= (value.match(/[\]}]/g) || []).length;
|
|
215
|
-
if (bracketDepth > 0) {
|
|
216
|
-
multilineKey = key;
|
|
217
|
-
multilineValue = value;
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
currentItem[key] = this.parseGodotValue(value);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
// Save final item
|
|
97
|
+
constructor() {
|
|
98
|
+
super("godot");
|
|
99
|
+
this.extResources = /* @__PURE__ */ new Map();
|
|
100
|
+
this.subResources = /* @__PURE__ */ new Map();
|
|
101
|
+
this.nodes = [];
|
|
102
|
+
this.connections = [];
|
|
103
|
+
this.header = {};
|
|
104
|
+
}
|
|
105
|
+
async import(options) {
|
|
106
|
+
const startTime = Date.now();
|
|
107
|
+
this.options = options;
|
|
108
|
+
this.clearMessages();
|
|
109
|
+
this.extResources.clear();
|
|
110
|
+
this.subResources.clear();
|
|
111
|
+
this.nodes = [];
|
|
112
|
+
this.connections = [];
|
|
113
|
+
const errors = await this.validate(options.sourcePath);
|
|
114
|
+
if (errors.some((e) => e.fatal)) {
|
|
115
|
+
return {
|
|
116
|
+
...this.createEmptyResult(),
|
|
117
|
+
errors
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const scenes = [];
|
|
121
|
+
const assets = [];
|
|
122
|
+
try {
|
|
123
|
+
const content = await this.readFile(options.sourcePath);
|
|
124
|
+
const parsed = this.parseGodotScene(content, options.sourcePath);
|
|
125
|
+
if (parsed) {
|
|
126
|
+
const niceScene = this.convertParsedToNiceScene(parsed);
|
|
127
|
+
scenes.push(niceScene);
|
|
128
|
+
const extractedAssets = this.extractAssets();
|
|
129
|
+
assets.push(...extractedAssets);
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
this.addError(
|
|
133
|
+
"IMPORT_ERROR",
|
|
134
|
+
`Failed to import: ${error}`,
|
|
135
|
+
options.sourcePath,
|
|
136
|
+
void 0,
|
|
137
|
+
true
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return this.createResult(scenes, assets, startTime);
|
|
141
|
+
}
|
|
142
|
+
async parseFile(content, filePath) {
|
|
143
|
+
const stringContent = typeof content === "string" ? content : new TextDecoder().decode(content);
|
|
144
|
+
return this.parseGodotScene(stringContent, filePath);
|
|
145
|
+
}
|
|
146
|
+
async validate(sourcePath) {
|
|
147
|
+
const errors = [];
|
|
148
|
+
if (!this.canHandle(sourcePath)) {
|
|
149
|
+
errors.push({
|
|
150
|
+
code: "INVALID_FORMAT",
|
|
151
|
+
message: `File ${sourcePath} is not a valid Godot file`,
|
|
152
|
+
file: sourcePath,
|
|
153
|
+
fatal: true
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return errors;
|
|
157
|
+
}
|
|
158
|
+
// ----------------------------------------
|
|
159
|
+
// Godot Parsing
|
|
160
|
+
// ----------------------------------------
|
|
161
|
+
parseGodotScene(content, filePath) {
|
|
162
|
+
const lines = content.split("\n");
|
|
163
|
+
let currentSection = null;
|
|
164
|
+
let currentItem = {};
|
|
165
|
+
let bracketDepth = 0;
|
|
166
|
+
let multilineKey = "";
|
|
167
|
+
let multilineValue = "";
|
|
168
|
+
for (const line of lines) {
|
|
169
|
+
const trimmed = line.trim();
|
|
170
|
+
if (trimmed === "" || trimmed.startsWith(";")) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
const sectionMatch = trimmed.match(/^\[(\w+)(.*?)\]$/);
|
|
174
|
+
if (sectionMatch) {
|
|
225
175
|
this.saveCurrentItem(currentSection, currentItem);
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
176
|
+
currentItem = {};
|
|
177
|
+
const sectionType = sectionMatch[1];
|
|
178
|
+
const sectionParams = sectionMatch[2].trim();
|
|
179
|
+
if (sectionType === "gd_scene" || sectionType === "gd_resource") {
|
|
180
|
+
currentSection = "header";
|
|
181
|
+
this.header = this.parseInlineParams(sectionParams);
|
|
182
|
+
} else if (sectionType === "ext_resource") {
|
|
183
|
+
currentSection = "ext_resource";
|
|
184
|
+
currentItem = this.parseInlineParams(sectionParams);
|
|
185
|
+
} else if (sectionType === "sub_resource") {
|
|
186
|
+
currentSection = "sub_resource";
|
|
187
|
+
currentItem = this.parseInlineParams(sectionParams);
|
|
188
|
+
} else if (sectionType === "node") {
|
|
189
|
+
currentSection = "node";
|
|
190
|
+
currentItem = this.parseInlineParams(sectionParams);
|
|
191
|
+
} else if (sectionType === "connection") {
|
|
192
|
+
currentSection = "connection";
|
|
193
|
+
currentItem = this.parseInlineParams(sectionParams);
|
|
194
|
+
}
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (multilineKey) {
|
|
198
|
+
multilineValue += "\n" + line;
|
|
199
|
+
bracketDepth += (line.match(/[[{]/g) || []).length;
|
|
200
|
+
bracketDepth -= (line.match(/[\]}]/g) || []).length;
|
|
201
|
+
if (bracketDepth === 0) {
|
|
202
|
+
currentItem[multilineKey] = this.parseGodotValue(multilineValue);
|
|
203
|
+
multilineKey = "";
|
|
204
|
+
multilineValue = "";
|
|
205
|
+
}
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const propMatch = trimmed.match(/^(\w+)\s*=\s*(.*)$/);
|
|
209
|
+
if (propMatch) {
|
|
210
|
+
const key = propMatch[1];
|
|
211
|
+
const value = propMatch[2];
|
|
212
|
+
bracketDepth = (value.match(/[[{]/g) || []).length;
|
|
213
|
+
bracketDepth -= (value.match(/[\]}]/g) || []).length;
|
|
214
|
+
if (bracketDepth > 0) {
|
|
215
|
+
multilineKey = key;
|
|
216
|
+
multilineValue = value;
|
|
217
|
+
} else {
|
|
218
|
+
currentItem[key] = this.parseGodotValue(value);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this.saveCurrentItem(currentSection, currentItem);
|
|
223
|
+
const sceneName = filePath.substring(filePath.lastIndexOf("/") + 1).replace(/\.\w+$/, "");
|
|
224
|
+
const rootNode = this.nodes.find((n) => !n.parent);
|
|
225
|
+
return {
|
|
226
|
+
name: sceneName,
|
|
227
|
+
width: 1920,
|
|
228
|
+
height: 1080,
|
|
229
|
+
backgroundColor: "#1a1a2e",
|
|
230
|
+
layers: [],
|
|
231
|
+
entities: rootNode ? [this.convertNodeToEntity(rootNode)] : [],
|
|
232
|
+
properties: {
|
|
233
|
+
godotVersion: this.header.gdVersion,
|
|
234
|
+
format: this.header.format,
|
|
235
|
+
loadSteps: this.header.loadSteps
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
saveCurrentItem(section, item) {
|
|
240
|
+
if (!section || Object.keys(item).length === 0) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
switch (section) {
|
|
244
|
+
case "ext_resource": {
|
|
245
|
+
const extRes = {
|
|
246
|
+
id: String(item.id || ""),
|
|
247
|
+
type: String(item.type || ""),
|
|
248
|
+
path: String(item.path || ""),
|
|
249
|
+
uid: item.uid ? String(item.uid) : void 0
|
|
242
250
|
};
|
|
251
|
+
this.extResources.set(extRes.id, extRes);
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
case "sub_resource": {
|
|
255
|
+
const subRes = {
|
|
256
|
+
id: String(item.id || ""),
|
|
257
|
+
type: String(item.type || ""),
|
|
258
|
+
properties: { ...item }
|
|
259
|
+
};
|
|
260
|
+
delete subRes.properties.id;
|
|
261
|
+
delete subRes.properties.type;
|
|
262
|
+
this.subResources.set(subRes.id, subRes);
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
case "node": {
|
|
266
|
+
const node = {
|
|
267
|
+
name: String(item.name || ""),
|
|
268
|
+
type: item.type ? String(item.type) : void 0,
|
|
269
|
+
parent: item.parent ? String(item.parent) : void 0,
|
|
270
|
+
instance: item.instance ? String(item.instance) : void 0,
|
|
271
|
+
instancePlaceholder: item.instance_placeholder ? String(item.instance_placeholder) : void 0,
|
|
272
|
+
owner: item.owner ? String(item.owner) : void 0,
|
|
273
|
+
index: item.index ? Number(item.index) : void 0,
|
|
274
|
+
groups: item.groups ? item.groups : void 0,
|
|
275
|
+
properties: {},
|
|
276
|
+
children: []
|
|
277
|
+
};
|
|
278
|
+
for (const [key, value] of Object.entries(item)) {
|
|
279
|
+
if (![
|
|
280
|
+
"name",
|
|
281
|
+
"type",
|
|
282
|
+
"parent",
|
|
283
|
+
"instance",
|
|
284
|
+
"instance_placeholder",
|
|
285
|
+
"owner",
|
|
286
|
+
"index",
|
|
287
|
+
"groups"
|
|
288
|
+
].includes(key)) {
|
|
289
|
+
node.properties[key] = value;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
this.nodes.push(node);
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
case "connection": {
|
|
296
|
+
const conn = {
|
|
297
|
+
signal: String(item.signal || ""),
|
|
298
|
+
from: String(item.from || ""),
|
|
299
|
+
to: String(item.to || ""),
|
|
300
|
+
method: String(item.method || ""),
|
|
301
|
+
flags: item.flags ? Number(item.flags) : void 0,
|
|
302
|
+
binds: item.binds
|
|
303
|
+
};
|
|
304
|
+
this.connections.push(conn);
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
243
307
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
this.extResources.set(extRes.id, extRes);
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
case 'sub_resource': {
|
|
260
|
-
const subRes = {
|
|
261
|
-
id: String(item.id || ''),
|
|
262
|
-
type: String(item.type || ''),
|
|
263
|
-
properties: { ...item },
|
|
264
|
-
};
|
|
265
|
-
delete subRes.properties.id;
|
|
266
|
-
delete subRes.properties.type;
|
|
267
|
-
this.subResources.set(subRes.id, subRes);
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
case 'node': {
|
|
271
|
-
const node = {
|
|
272
|
-
name: String(item.name || ''),
|
|
273
|
-
type: item.type ? String(item.type) : undefined,
|
|
274
|
-
parent: item.parent ? String(item.parent) : undefined,
|
|
275
|
-
instance: item.instance ? String(item.instance) : undefined,
|
|
276
|
-
instancePlaceholder: item.instance_placeholder
|
|
277
|
-
? String(item.instance_placeholder)
|
|
278
|
-
: undefined,
|
|
279
|
-
owner: item.owner ? String(item.owner) : undefined,
|
|
280
|
-
index: item.index ? Number(item.index) : undefined,
|
|
281
|
-
groups: item.groups ? item.groups : undefined,
|
|
282
|
-
properties: {},
|
|
283
|
-
children: [],
|
|
284
|
-
};
|
|
285
|
-
// Copy remaining properties
|
|
286
|
-
for (const [key, value] of Object.entries(item)) {
|
|
287
|
-
if (![
|
|
288
|
-
'name',
|
|
289
|
-
'type',
|
|
290
|
-
'parent',
|
|
291
|
-
'instance',
|
|
292
|
-
'instance_placeholder',
|
|
293
|
-
'owner',
|
|
294
|
-
'index',
|
|
295
|
-
'groups',
|
|
296
|
-
].includes(key)) {
|
|
297
|
-
node.properties[key] = value;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
this.nodes.push(node);
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
case 'connection': {
|
|
304
|
-
const conn = {
|
|
305
|
-
signal: String(item.signal || ''),
|
|
306
|
-
from: String(item.from || ''),
|
|
307
|
-
to: String(item.to || ''),
|
|
308
|
-
method: String(item.method || ''),
|
|
309
|
-
flags: item.flags ? Number(item.flags) : undefined,
|
|
310
|
-
binds: item.binds,
|
|
311
|
-
};
|
|
312
|
-
this.connections.push(conn);
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
308
|
+
}
|
|
309
|
+
parseInlineParams(params) {
|
|
310
|
+
const result = {};
|
|
311
|
+
const paramRegex = /(\w+)=("(?:[^"\\]|\\.)*"|[^\s]+)/g;
|
|
312
|
+
let match;
|
|
313
|
+
while ((match = paramRegex.exec(params)) !== null) {
|
|
314
|
+
const key = match[1];
|
|
315
|
+
let value = match[2];
|
|
316
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
317
|
+
value = value.slice(1, -1).replace(/\\"/g, '"');
|
|
318
|
+
}
|
|
319
|
+
result[key] = this.parseGodotValue(value);
|
|
316
320
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const key = match[1];
|
|
324
|
-
let value = match[2];
|
|
325
|
-
// Remove quotes
|
|
326
|
-
if (value.startsWith('"') && value.endsWith('"')) {
|
|
327
|
-
value = value.slice(1, -1).replace(/\\"/g, '"');
|
|
328
|
-
}
|
|
329
|
-
result[key] = this.parseGodotValue(value);
|
|
330
|
-
}
|
|
331
|
-
return result;
|
|
321
|
+
return result;
|
|
322
|
+
}
|
|
323
|
+
parseGodotValue(value) {
|
|
324
|
+
value = value.trim();
|
|
325
|
+
if (value === "null") {
|
|
326
|
+
return null;
|
|
332
327
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
// Null
|
|
336
|
-
if (value === 'null') {
|
|
337
|
-
return null;
|
|
338
|
-
}
|
|
339
|
-
// Boolean
|
|
340
|
-
if (value === 'true') {
|
|
341
|
-
return true;
|
|
342
|
-
}
|
|
343
|
-
if (value === 'false') {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
// Number
|
|
347
|
-
if (/^-?\d+$/.test(value)) {
|
|
348
|
-
return parseInt(value, 10);
|
|
349
|
-
}
|
|
350
|
-
if (/^-?\d+\.\d+$/.test(value)) {
|
|
351
|
-
return parseFloat(value);
|
|
352
|
-
}
|
|
353
|
-
// String
|
|
354
|
-
if (value.startsWith('"') && value.endsWith('"')) {
|
|
355
|
-
return value.slice(1, -1).replace(/\\"/g, '"').replace(/\\n/g, '\n');
|
|
356
|
-
}
|
|
357
|
-
// Vector2
|
|
358
|
-
const vec2Match = value.match(/^Vector2\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)$/);
|
|
359
|
-
if (vec2Match) {
|
|
360
|
-
return {
|
|
361
|
-
_type: 'Vector2',
|
|
362
|
-
x: parseFloat(vec2Match[1]),
|
|
363
|
-
y: parseFloat(vec2Match[2]),
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
// Vector3
|
|
367
|
-
const vec3Match = value.match(/^Vector3\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)$/);
|
|
368
|
-
if (vec3Match) {
|
|
369
|
-
return {
|
|
370
|
-
_type: 'Vector3',
|
|
371
|
-
x: parseFloat(vec3Match[1]),
|
|
372
|
-
y: parseFloat(vec3Match[2]),
|
|
373
|
-
z: parseFloat(vec3Match[3]),
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
// Rect2
|
|
377
|
-
const rect2Match = value.match(/^Rect2\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)$/);
|
|
378
|
-
if (rect2Match) {
|
|
379
|
-
return {
|
|
380
|
-
_type: 'Rect2',
|
|
381
|
-
x: parseFloat(rect2Match[1]),
|
|
382
|
-
y: parseFloat(rect2Match[2]),
|
|
383
|
-
width: parseFloat(rect2Match[3]),
|
|
384
|
-
height: parseFloat(rect2Match[4]),
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
// Color
|
|
388
|
-
const colorMatch = value.match(/^Color\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*(?:,\s*([\d.-]+))?\s*\)$/);
|
|
389
|
-
if (colorMatch) {
|
|
390
|
-
return {
|
|
391
|
-
_type: 'Color',
|
|
392
|
-
r: parseFloat(colorMatch[1]),
|
|
393
|
-
g: parseFloat(colorMatch[2]),
|
|
394
|
-
b: parseFloat(colorMatch[3]),
|
|
395
|
-
a: colorMatch[4] ? parseFloat(colorMatch[4]) : 1.0,
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
// ExtResource
|
|
399
|
-
const extResMatch = value.match(/^ExtResource\s*\(\s*"?(\d+)"?\s*\)$/);
|
|
400
|
-
if (extResMatch) {
|
|
401
|
-
return { _type: 'ExtResource', id: extResMatch[1] };
|
|
402
|
-
}
|
|
403
|
-
// SubResource
|
|
404
|
-
const subResMatch = value.match(/^SubResource\s*\(\s*"?(\d+)"?\s*\)$/);
|
|
405
|
-
if (subResMatch) {
|
|
406
|
-
return { _type: 'SubResource', id: subResMatch[1] };
|
|
407
|
-
}
|
|
408
|
-
// Array
|
|
409
|
-
if (value.startsWith('[') && value.endsWith(']')) {
|
|
410
|
-
return this.parseGodotArray(value);
|
|
411
|
-
}
|
|
412
|
-
// Dictionary
|
|
413
|
-
if (value.startsWith('{') && value.endsWith('}')) {
|
|
414
|
-
return this.parseGodotDictionary(value);
|
|
415
|
-
}
|
|
416
|
-
// Unquoted string
|
|
417
|
-
return value;
|
|
328
|
+
if (value === "true") {
|
|
329
|
+
return true;
|
|
418
330
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
if (!content) {
|
|
422
|
-
return [];
|
|
423
|
-
}
|
|
424
|
-
const items = [];
|
|
425
|
-
let depth = 0;
|
|
426
|
-
let current = '';
|
|
427
|
-
for (let i = 0; i < content.length; i++) {
|
|
428
|
-
const char = content[i];
|
|
429
|
-
if (char === '[' || char === '{' || char === '(') {
|
|
430
|
-
depth++;
|
|
431
|
-
}
|
|
432
|
-
else if (char === ']' || char === '}' || char === ')') {
|
|
433
|
-
depth--;
|
|
434
|
-
}
|
|
435
|
-
if (char === ',' && depth === 0) {
|
|
436
|
-
items.push(this.parseGodotValue(current.trim()));
|
|
437
|
-
current = '';
|
|
438
|
-
}
|
|
439
|
-
else {
|
|
440
|
-
current += char;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
if (current.trim()) {
|
|
444
|
-
items.push(this.parseGodotValue(current.trim()));
|
|
445
|
-
}
|
|
446
|
-
return items;
|
|
331
|
+
if (value === "false") {
|
|
332
|
+
return false;
|
|
447
333
|
}
|
|
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
|
-
|
|
483
|
-
|
|
484
|
-
|
|
334
|
+
if (/^-?\d+$/.test(value)) {
|
|
335
|
+
return parseInt(value, 10);
|
|
336
|
+
}
|
|
337
|
+
if (/^-?\d+\.\d+$/.test(value)) {
|
|
338
|
+
return parseFloat(value);
|
|
339
|
+
}
|
|
340
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
341
|
+
return value.slice(1, -1).replace(/\\"/g, '"').replace(/\\n/g, "\n");
|
|
342
|
+
}
|
|
343
|
+
const vec2Match = value.match(/^Vector2\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)$/);
|
|
344
|
+
if (vec2Match) {
|
|
345
|
+
return {
|
|
346
|
+
_type: "Vector2",
|
|
347
|
+
x: parseFloat(vec2Match[1]),
|
|
348
|
+
y: parseFloat(vec2Match[2])
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
const vec3Match = value.match(
|
|
352
|
+
/^Vector3\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)$/
|
|
353
|
+
);
|
|
354
|
+
if (vec3Match) {
|
|
355
|
+
return {
|
|
356
|
+
_type: "Vector3",
|
|
357
|
+
x: parseFloat(vec3Match[1]),
|
|
358
|
+
y: parseFloat(vec3Match[2]),
|
|
359
|
+
z: parseFloat(vec3Match[3])
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
const rect2Match = value.match(
|
|
363
|
+
/^Rect2\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)$/
|
|
364
|
+
);
|
|
365
|
+
if (rect2Match) {
|
|
366
|
+
return {
|
|
367
|
+
_type: "Rect2",
|
|
368
|
+
x: parseFloat(rect2Match[1]),
|
|
369
|
+
y: parseFloat(rect2Match[2]),
|
|
370
|
+
width: parseFloat(rect2Match[3]),
|
|
371
|
+
height: parseFloat(rect2Match[4])
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
const colorMatch = value.match(
|
|
375
|
+
/^Color\s*\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*(?:,\s*([\d.-]+))?\s*\)$/
|
|
376
|
+
);
|
|
377
|
+
if (colorMatch) {
|
|
378
|
+
return {
|
|
379
|
+
_type: "Color",
|
|
380
|
+
r: parseFloat(colorMatch[1]),
|
|
381
|
+
g: parseFloat(colorMatch[2]),
|
|
382
|
+
b: parseFloat(colorMatch[3]),
|
|
383
|
+
a: colorMatch[4] ? parseFloat(colorMatch[4]) : 1
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
const extResMatch = value.match(/^ExtResource\s*\(\s*"?(\d+)"?\s*\)$/);
|
|
387
|
+
if (extResMatch) {
|
|
388
|
+
return { _type: "ExtResource", id: extResMatch[1] };
|
|
389
|
+
}
|
|
390
|
+
const subResMatch = value.match(/^SubResource\s*\(\s*"?(\d+)"?\s*\)$/);
|
|
391
|
+
if (subResMatch) {
|
|
392
|
+
return { _type: "SubResource", id: subResMatch[1] };
|
|
393
|
+
}
|
|
394
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
395
|
+
return this.parseGodotArray(value);
|
|
485
396
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
397
|
+
if (value.startsWith("{") && value.endsWith("}")) {
|
|
398
|
+
return this.parseGodotDictionary(value);
|
|
399
|
+
}
|
|
400
|
+
return value;
|
|
401
|
+
}
|
|
402
|
+
parseGodotArray(value) {
|
|
403
|
+
const content = value.slice(1, -1).trim();
|
|
404
|
+
if (!content) {
|
|
405
|
+
return [];
|
|
406
|
+
}
|
|
407
|
+
const items = [];
|
|
408
|
+
let depth = 0;
|
|
409
|
+
let current = "";
|
|
410
|
+
for (let i = 0; i < content.length; i++) {
|
|
411
|
+
const char = content[i];
|
|
412
|
+
if (char === "[" || char === "{" || char === "(") {
|
|
413
|
+
depth++;
|
|
414
|
+
} else if (char === "]" || char === "}" || char === ")") {
|
|
415
|
+
depth--;
|
|
416
|
+
}
|
|
417
|
+
if (char === "," && depth === 0) {
|
|
418
|
+
items.push(this.parseGodotValue(current.trim()));
|
|
419
|
+
current = "";
|
|
420
|
+
} else {
|
|
421
|
+
current += char;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (current.trim()) {
|
|
425
|
+
items.push(this.parseGodotValue(current.trim()));
|
|
426
|
+
}
|
|
427
|
+
return items;
|
|
428
|
+
}
|
|
429
|
+
parseGodotDictionary(value) {
|
|
430
|
+
const content = value.slice(1, -1).trim();
|
|
431
|
+
if (!content) {
|
|
432
|
+
return {};
|
|
433
|
+
}
|
|
434
|
+
const result = {};
|
|
435
|
+
let depth = 0;
|
|
436
|
+
let current = "";
|
|
437
|
+
let key = "";
|
|
438
|
+
let inKey = true;
|
|
439
|
+
for (let i = 0; i < content.length; i++) {
|
|
440
|
+
const char = content[i];
|
|
441
|
+
if (char === "[" || char === "{" || char === "(") {
|
|
442
|
+
depth++;
|
|
443
|
+
} else if (char === "]" || char === "}" || char === ")") {
|
|
444
|
+
depth--;
|
|
445
|
+
}
|
|
446
|
+
if (char === ":" && depth === 0 && inKey) {
|
|
447
|
+
key = current.trim().replace(/^"|"$/g, "");
|
|
448
|
+
current = "";
|
|
449
|
+
inKey = false;
|
|
450
|
+
} else if (char === "," && depth === 0) {
|
|
451
|
+
result[key] = this.parseGodotValue(current.trim());
|
|
452
|
+
current = "";
|
|
453
|
+
key = "";
|
|
454
|
+
inKey = true;
|
|
455
|
+
} else {
|
|
456
|
+
current += char;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (key && current.trim()) {
|
|
460
|
+
result[key] = this.parseGodotValue(current.trim());
|
|
461
|
+
}
|
|
462
|
+
return result;
|
|
463
|
+
}
|
|
464
|
+
convertNodeToEntity(node) {
|
|
465
|
+
const mapping = GODOT_NODE_MAPPING[node.type || ""] || {
|
|
466
|
+
niceType: node.type || "Node",
|
|
467
|
+
category: "unknown"
|
|
468
|
+
};
|
|
469
|
+
const children = this.nodes.filter((n) => {
|
|
470
|
+
if (!n.parent) {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
if (n.parent === ".") {
|
|
474
|
+
return node.parent === void 0;
|
|
475
|
+
}
|
|
476
|
+
return n.parent === node.name || n.parent.endsWith("/" + node.name);
|
|
477
|
+
});
|
|
478
|
+
const position = this.extractVector2(node.properties.position) || { x: 0, y: 0 };
|
|
479
|
+
const rotation = typeof node.properties.rotation === "number" ? node.properties.rotation * (180 / Math.PI) : 0;
|
|
480
|
+
const scale = this.extractVector2(node.properties.scale) || { x: 1, y: 1 };
|
|
481
|
+
const components = [];
|
|
482
|
+
components.push(this.convertGodotNodeToComponent(node));
|
|
483
|
+
if (node.properties.script) {
|
|
484
|
+
components.push({
|
|
485
|
+
type: "Script",
|
|
486
|
+
data: {
|
|
487
|
+
script: node.properties.script,
|
|
488
|
+
scriptType: "gdscript"
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
id: this.generateId(),
|
|
494
|
+
name: node.name,
|
|
495
|
+
type: mapping.niceType,
|
|
496
|
+
x: position.x,
|
|
497
|
+
y: position.y,
|
|
498
|
+
width: 1,
|
|
499
|
+
height: 1,
|
|
500
|
+
rotation,
|
|
501
|
+
scaleX: scale.x,
|
|
502
|
+
scaleY: scale.y,
|
|
503
|
+
visible: node.properties.visible !== false,
|
|
504
|
+
components,
|
|
505
|
+
children: children.map((c) => this.convertNodeToEntity(c)),
|
|
506
|
+
properties: {
|
|
507
|
+
godotType: node.type,
|
|
508
|
+
category: mapping.category,
|
|
509
|
+
groups: node.groups,
|
|
510
|
+
...node.properties
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
convertGodotNodeToComponent(node) {
|
|
515
|
+
const type = node.type || "Node";
|
|
516
|
+
switch (type) {
|
|
517
|
+
case "Sprite2D":
|
|
518
|
+
return {
|
|
519
|
+
type: "Sprite",
|
|
520
|
+
data: {
|
|
521
|
+
texture: node.properties.texture,
|
|
522
|
+
centered: node.properties.centered !== false,
|
|
523
|
+
offset: this.extractVector2(node.properties.offset),
|
|
524
|
+
flipH: node.properties.flip_h || false,
|
|
525
|
+
flipV: node.properties.flip_v || false,
|
|
526
|
+
hframes: node.properties.hframes || 1,
|
|
527
|
+
vframes: node.properties.vframes || 1,
|
|
528
|
+
frame: node.properties.frame || 0,
|
|
529
|
+
modulate: node.properties.modulate
|
|
530
|
+
}
|
|
490
531
|
};
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
532
|
+
case "AnimatedSprite2D":
|
|
533
|
+
return {
|
|
534
|
+
type: "AnimatedSprite",
|
|
535
|
+
data: {
|
|
536
|
+
spriteFrames: node.properties.sprite_frames,
|
|
537
|
+
animation: node.properties.animation,
|
|
538
|
+
frame: node.properties.frame || 0,
|
|
539
|
+
playing: node.properties.playing || false,
|
|
540
|
+
speedScale: node.properties.speed_scale || 1,
|
|
541
|
+
centered: node.properties.centered !== false,
|
|
542
|
+
offset: this.extractVector2(node.properties.offset),
|
|
543
|
+
flipH: node.properties.flip_h || false,
|
|
544
|
+
flipV: node.properties.flip_v || false
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
case "CharacterBody2D":
|
|
548
|
+
return {
|
|
549
|
+
type: "CharacterController2D",
|
|
550
|
+
data: {
|
|
551
|
+
motionMode: node.properties.motion_mode || 0,
|
|
552
|
+
upDirection: this.extractVector2(node.properties.up_direction) || { x: 0, y: -1 },
|
|
553
|
+
floorStopOnSlope: node.properties.floor_stop_on_slope || true,
|
|
554
|
+
floorMaxAngle: node.properties.floor_max_angle || 0.785398,
|
|
555
|
+
platformOnLeave: node.properties.platform_on_leave || 0,
|
|
556
|
+
safeMargin: node.properties.safe_margin || 0.08
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
case "RigidBody2D":
|
|
560
|
+
return {
|
|
561
|
+
type: "Rigidbody2D",
|
|
562
|
+
data: {
|
|
563
|
+
mass: node.properties.mass || 1,
|
|
564
|
+
physicsMaterialOverride: node.properties.physics_material_override,
|
|
565
|
+
gravityScale: node.properties.gravity_scale ?? 1,
|
|
566
|
+
freezeMode: node.properties.freeze_mode || 0,
|
|
567
|
+
freeze: node.properties.freeze || false,
|
|
568
|
+
customIntegrator: node.properties.custom_integrator || false,
|
|
569
|
+
continuousCd: node.properties.continuous_cd || 0,
|
|
570
|
+
linearVelocity: this.extractVector2(node.properties.linear_velocity),
|
|
571
|
+
angularVelocity: node.properties.angular_velocity || 0,
|
|
572
|
+
linearDamp: node.properties.linear_damp || 0,
|
|
573
|
+
angularDamp: node.properties.angular_damp || 0
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
case "CollisionShape2D":
|
|
577
|
+
return {
|
|
578
|
+
type: "Collider2D",
|
|
579
|
+
data: {
|
|
580
|
+
shape: node.properties.shape,
|
|
581
|
+
disabled: node.properties.disabled || false,
|
|
582
|
+
oneWayCollision: node.properties.one_way_collision || false,
|
|
583
|
+
oneWayCollisionMargin: node.properties.one_way_collision_margin || 1
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
case "Area2D":
|
|
587
|
+
return {
|
|
588
|
+
type: "Trigger2D",
|
|
589
|
+
data: {
|
|
590
|
+
monitorable: node.properties.monitorable ?? true,
|
|
591
|
+
monitoring: node.properties.monitoring ?? true,
|
|
592
|
+
priority: node.properties.priority || 0,
|
|
593
|
+
collisionLayer: node.properties.collision_layer,
|
|
594
|
+
collisionMask: node.properties.collision_mask,
|
|
595
|
+
gravitySpaceOverride: node.properties.gravity_space_override,
|
|
596
|
+
gravityPointCenter: this.extractVector2(node.properties.gravity_point_center),
|
|
597
|
+
gravity: node.properties.gravity
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
case "Camera2D":
|
|
601
|
+
return {
|
|
602
|
+
type: "Camera2D",
|
|
603
|
+
data: {
|
|
604
|
+
enabled: node.properties.enabled ?? true,
|
|
605
|
+
zoom: this.extractVector2(node.properties.zoom) || { x: 1, y: 1 },
|
|
606
|
+
offset: this.extractVector2(node.properties.offset),
|
|
607
|
+
anchorMode: node.properties.anchor_mode || 1,
|
|
608
|
+
rotationSmoothingEnabled: node.properties.rotation_smoothing_enabled || false,
|
|
609
|
+
positionSmoothingEnabled: node.properties.position_smoothing_enabled || false,
|
|
610
|
+
positionSmoothingSpeed: node.properties.position_smoothing_speed || 5,
|
|
611
|
+
limitLeft: node.properties.limit_left,
|
|
612
|
+
limitTop: node.properties.limit_top,
|
|
613
|
+
limitRight: node.properties.limit_right,
|
|
614
|
+
limitBottom: node.properties.limit_bottom,
|
|
615
|
+
limitSmoothed: node.properties.limit_smoothed || false
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
case "TileMap":
|
|
619
|
+
case "TileMapLayer":
|
|
620
|
+
return {
|
|
621
|
+
type: "Tilemap",
|
|
622
|
+
data: {
|
|
623
|
+
tileSet: node.properties.tile_set,
|
|
624
|
+
cellSize: this.extractVector2(node.properties.cell_size) || { x: 16, y: 16 },
|
|
625
|
+
quadrantSize: node.properties.quadrant_size || 16,
|
|
626
|
+
format: node.properties.format,
|
|
627
|
+
tileData: node.properties.tile_data || node.properties.layer_0 || node.properties.layer0
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
case "AudioStreamPlayer":
|
|
631
|
+
case "AudioStreamPlayer2D":
|
|
632
|
+
case "AudioStreamPlayer3D":
|
|
633
|
+
return {
|
|
634
|
+
type: "AudioSource",
|
|
635
|
+
data: {
|
|
636
|
+
stream: node.properties.stream,
|
|
637
|
+
volumeDb: node.properties.volume_db || 0,
|
|
638
|
+
pitchScale: node.properties.pitch_scale || 1,
|
|
639
|
+
playing: node.properties.playing || false,
|
|
640
|
+
autoplay: node.properties.autoplay || false,
|
|
641
|
+
bus: node.properties.bus || "Master",
|
|
642
|
+
maxDistance: node.properties.max_distance,
|
|
643
|
+
attenuation: node.properties.attenuation
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
case "AnimationPlayer":
|
|
647
|
+
return {
|
|
648
|
+
type: "Animator",
|
|
649
|
+
data: {
|
|
650
|
+
rootNode: node.properties.root_node,
|
|
651
|
+
autoplay: node.properties.autoplay,
|
|
652
|
+
currentAnimation: node.properties.current_animation,
|
|
653
|
+
playbackSpeed: node.properties.playback_speed || 1,
|
|
654
|
+
libraries: node.properties.libraries
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
case "GPUParticles2D":
|
|
658
|
+
case "CPUParticles2D":
|
|
659
|
+
return {
|
|
660
|
+
type: "ParticleSystem2D",
|
|
661
|
+
data: {
|
|
662
|
+
emitting: node.properties.emitting ?? true,
|
|
663
|
+
amount: node.properties.amount || 8,
|
|
664
|
+
lifetime: node.properties.lifetime || 1,
|
|
665
|
+
oneShot: node.properties.one_shot || false,
|
|
666
|
+
preprocess: node.properties.preprocess || 0,
|
|
667
|
+
speedScale: node.properties.speed_scale || 1,
|
|
668
|
+
explosiveness: node.properties.explosiveness || 0,
|
|
669
|
+
randomness: node.properties.randomness || 0,
|
|
670
|
+
texture: node.properties.texture,
|
|
671
|
+
processMaterial: node.properties.process_material
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
case "Light2D":
|
|
675
|
+
case "PointLight2D":
|
|
676
|
+
return {
|
|
677
|
+
type: "Light2D",
|
|
678
|
+
data: {
|
|
679
|
+
enabled: node.properties.enabled ?? true,
|
|
680
|
+
color: node.properties.color,
|
|
681
|
+
energy: node.properties.energy ?? 1,
|
|
682
|
+
texture: node.properties.texture,
|
|
683
|
+
textureScale: node.properties.texture_scale || 1,
|
|
684
|
+
blendMode: node.properties.blend_mode || 0,
|
|
685
|
+
shadowEnabled: node.properties.shadow_enabled || false,
|
|
686
|
+
shadowColor: node.properties.shadow_color
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
case "Label":
|
|
520
690
|
return {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
691
|
+
type: "Text",
|
|
692
|
+
data: {
|
|
693
|
+
text: node.properties.text || "",
|
|
694
|
+
horizontalAlignment: node.properties.horizontal_alignment || 0,
|
|
695
|
+
verticalAlignment: node.properties.vertical_alignment || 0,
|
|
696
|
+
autowrapMode: node.properties.autowrap_mode || 0,
|
|
697
|
+
clipText: node.properties.clip_text || false,
|
|
698
|
+
textOverrunBehavior: node.properties.text_overrun_behavior || 0,
|
|
699
|
+
theme: node.properties.theme,
|
|
700
|
+
themeOverride: node.properties.theme_override_colors || node.properties.theme_override_fonts
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
case "Button":
|
|
704
|
+
return {
|
|
705
|
+
type: "Button",
|
|
706
|
+
data: {
|
|
707
|
+
text: node.properties.text || "",
|
|
708
|
+
disabled: node.properties.disabled || false,
|
|
709
|
+
flat: node.properties.flat || false,
|
|
710
|
+
icon: node.properties.icon,
|
|
711
|
+
toggleMode: node.properties.toggle_mode || false,
|
|
712
|
+
buttonPressed: node.properties.button_pressed || false
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
default:
|
|
716
|
+
return {
|
|
717
|
+
type,
|
|
718
|
+
data: { ...node.properties }
|
|
540
719
|
};
|
|
541
720
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return {
|
|
547
|
-
type: 'Sprite',
|
|
548
|
-
data: {
|
|
549
|
-
texture: node.properties.texture,
|
|
550
|
-
centered: node.properties.centered !== false,
|
|
551
|
-
offset: this.extractVector2(node.properties.offset),
|
|
552
|
-
flipH: node.properties.flip_h || false,
|
|
553
|
-
flipV: node.properties.flip_v || false,
|
|
554
|
-
hframes: node.properties.hframes || 1,
|
|
555
|
-
vframes: node.properties.vframes || 1,
|
|
556
|
-
frame: node.properties.frame || 0,
|
|
557
|
-
modulate: node.properties.modulate,
|
|
558
|
-
},
|
|
559
|
-
};
|
|
560
|
-
case 'AnimatedSprite2D':
|
|
561
|
-
return {
|
|
562
|
-
type: 'AnimatedSprite',
|
|
563
|
-
data: {
|
|
564
|
-
spriteFrames: node.properties.sprite_frames,
|
|
565
|
-
animation: node.properties.animation,
|
|
566
|
-
frame: node.properties.frame || 0,
|
|
567
|
-
playing: node.properties.playing || false,
|
|
568
|
-
speedScale: node.properties.speed_scale || 1.0,
|
|
569
|
-
centered: node.properties.centered !== false,
|
|
570
|
-
offset: this.extractVector2(node.properties.offset),
|
|
571
|
-
flipH: node.properties.flip_h || false,
|
|
572
|
-
flipV: node.properties.flip_v || false,
|
|
573
|
-
},
|
|
574
|
-
};
|
|
575
|
-
case 'CharacterBody2D':
|
|
576
|
-
return {
|
|
577
|
-
type: 'CharacterController2D',
|
|
578
|
-
data: {
|
|
579
|
-
motionMode: node.properties.motion_mode || 0,
|
|
580
|
-
upDirection: this.extractVector2(node.properties.up_direction) || { x: 0, y: -1 },
|
|
581
|
-
floorStopOnSlope: node.properties.floor_stop_on_slope || true,
|
|
582
|
-
floorMaxAngle: node.properties.floor_max_angle || 0.785398,
|
|
583
|
-
platformOnLeave: node.properties.platform_on_leave || 0,
|
|
584
|
-
safeMargin: node.properties.safe_margin || 0.08,
|
|
585
|
-
},
|
|
586
|
-
};
|
|
587
|
-
case 'RigidBody2D':
|
|
588
|
-
return {
|
|
589
|
-
type: 'Rigidbody2D',
|
|
590
|
-
data: {
|
|
591
|
-
mass: node.properties.mass || 1.0,
|
|
592
|
-
physicsMaterialOverride: node.properties.physics_material_override,
|
|
593
|
-
gravityScale: node.properties.gravity_scale ?? 1.0,
|
|
594
|
-
freezeMode: node.properties.freeze_mode || 0,
|
|
595
|
-
freeze: node.properties.freeze || false,
|
|
596
|
-
customIntegrator: node.properties.custom_integrator || false,
|
|
597
|
-
continuousCd: node.properties.continuous_cd || 0,
|
|
598
|
-
linearVelocity: this.extractVector2(node.properties.linear_velocity),
|
|
599
|
-
angularVelocity: node.properties.angular_velocity || 0,
|
|
600
|
-
linearDamp: node.properties.linear_damp || 0,
|
|
601
|
-
angularDamp: node.properties.angular_damp || 0,
|
|
602
|
-
},
|
|
603
|
-
};
|
|
604
|
-
case 'CollisionShape2D':
|
|
605
|
-
return {
|
|
606
|
-
type: 'Collider2D',
|
|
607
|
-
data: {
|
|
608
|
-
shape: node.properties.shape,
|
|
609
|
-
disabled: node.properties.disabled || false,
|
|
610
|
-
oneWayCollision: node.properties.one_way_collision || false,
|
|
611
|
-
oneWayCollisionMargin: node.properties.one_way_collision_margin || 1.0,
|
|
612
|
-
},
|
|
613
|
-
};
|
|
614
|
-
case 'Area2D':
|
|
615
|
-
return {
|
|
616
|
-
type: 'Trigger2D',
|
|
617
|
-
data: {
|
|
618
|
-
monitorable: node.properties.monitorable ?? true,
|
|
619
|
-
monitoring: node.properties.monitoring ?? true,
|
|
620
|
-
priority: node.properties.priority || 0,
|
|
621
|
-
collisionLayer: node.properties.collision_layer,
|
|
622
|
-
collisionMask: node.properties.collision_mask,
|
|
623
|
-
gravitySpaceOverride: node.properties.gravity_space_override,
|
|
624
|
-
gravityPointCenter: this.extractVector2(node.properties.gravity_point_center),
|
|
625
|
-
gravity: node.properties.gravity,
|
|
626
|
-
},
|
|
627
|
-
};
|
|
628
|
-
case 'Camera2D':
|
|
629
|
-
return {
|
|
630
|
-
type: 'Camera2D',
|
|
631
|
-
data: {
|
|
632
|
-
enabled: node.properties.enabled ?? true,
|
|
633
|
-
zoom: this.extractVector2(node.properties.zoom) || { x: 1, y: 1 },
|
|
634
|
-
offset: this.extractVector2(node.properties.offset),
|
|
635
|
-
anchorMode: node.properties.anchor_mode || 1,
|
|
636
|
-
rotationSmoothingEnabled: node.properties.rotation_smoothing_enabled || false,
|
|
637
|
-
positionSmoothingEnabled: node.properties.position_smoothing_enabled || false,
|
|
638
|
-
positionSmoothingSpeed: node.properties.position_smoothing_speed || 5,
|
|
639
|
-
limitLeft: node.properties.limit_left,
|
|
640
|
-
limitTop: node.properties.limit_top,
|
|
641
|
-
limitRight: node.properties.limit_right,
|
|
642
|
-
limitBottom: node.properties.limit_bottom,
|
|
643
|
-
limitSmoothed: node.properties.limit_smoothed || false,
|
|
644
|
-
},
|
|
645
|
-
};
|
|
646
|
-
case 'TileMap':
|
|
647
|
-
case 'TileMapLayer':
|
|
648
|
-
return {
|
|
649
|
-
type: 'Tilemap',
|
|
650
|
-
data: {
|
|
651
|
-
tileSet: node.properties.tile_set,
|
|
652
|
-
cellSize: this.extractVector2(node.properties.cell_size) || { x: 16, y: 16 },
|
|
653
|
-
quadrantSize: node.properties.quadrant_size || 16,
|
|
654
|
-
format: node.properties.format,
|
|
655
|
-
tileData: node.properties.tile_data || node.properties.layer_0 || node.properties.layer0,
|
|
656
|
-
},
|
|
657
|
-
};
|
|
658
|
-
case 'AudioStreamPlayer':
|
|
659
|
-
case 'AudioStreamPlayer2D':
|
|
660
|
-
case 'AudioStreamPlayer3D':
|
|
661
|
-
return {
|
|
662
|
-
type: 'AudioSource',
|
|
663
|
-
data: {
|
|
664
|
-
stream: node.properties.stream,
|
|
665
|
-
volumeDb: node.properties.volume_db || 0,
|
|
666
|
-
pitchScale: node.properties.pitch_scale || 1.0,
|
|
667
|
-
playing: node.properties.playing || false,
|
|
668
|
-
autoplay: node.properties.autoplay || false,
|
|
669
|
-
bus: node.properties.bus || 'Master',
|
|
670
|
-
maxDistance: node.properties.max_distance,
|
|
671
|
-
attenuation: node.properties.attenuation,
|
|
672
|
-
},
|
|
673
|
-
};
|
|
674
|
-
case 'AnimationPlayer':
|
|
675
|
-
return {
|
|
676
|
-
type: 'Animator',
|
|
677
|
-
data: {
|
|
678
|
-
rootNode: node.properties.root_node,
|
|
679
|
-
autoplay: node.properties.autoplay,
|
|
680
|
-
currentAnimation: node.properties.current_animation,
|
|
681
|
-
playbackSpeed: node.properties.playback_speed || 1.0,
|
|
682
|
-
libraries: node.properties.libraries,
|
|
683
|
-
},
|
|
684
|
-
};
|
|
685
|
-
case 'GPUParticles2D':
|
|
686
|
-
case 'CPUParticles2D':
|
|
687
|
-
return {
|
|
688
|
-
type: 'ParticleSystem2D',
|
|
689
|
-
data: {
|
|
690
|
-
emitting: node.properties.emitting ?? true,
|
|
691
|
-
amount: node.properties.amount || 8,
|
|
692
|
-
lifetime: node.properties.lifetime || 1.0,
|
|
693
|
-
oneShot: node.properties.one_shot || false,
|
|
694
|
-
preprocess: node.properties.preprocess || 0,
|
|
695
|
-
speedScale: node.properties.speed_scale || 1.0,
|
|
696
|
-
explosiveness: node.properties.explosiveness || 0,
|
|
697
|
-
randomness: node.properties.randomness || 0,
|
|
698
|
-
texture: node.properties.texture,
|
|
699
|
-
processMaterial: node.properties.process_material,
|
|
700
|
-
},
|
|
701
|
-
};
|
|
702
|
-
case 'Light2D':
|
|
703
|
-
case 'PointLight2D':
|
|
704
|
-
return {
|
|
705
|
-
type: 'Light2D',
|
|
706
|
-
data: {
|
|
707
|
-
enabled: node.properties.enabled ?? true,
|
|
708
|
-
color: node.properties.color,
|
|
709
|
-
energy: node.properties.energy ?? 1.0,
|
|
710
|
-
texture: node.properties.texture,
|
|
711
|
-
textureScale: node.properties.texture_scale || 1.0,
|
|
712
|
-
blendMode: node.properties.blend_mode || 0,
|
|
713
|
-
shadowEnabled: node.properties.shadow_enabled || false,
|
|
714
|
-
shadowColor: node.properties.shadow_color,
|
|
715
|
-
},
|
|
716
|
-
};
|
|
717
|
-
case 'Label':
|
|
718
|
-
return {
|
|
719
|
-
type: 'Text',
|
|
720
|
-
data: {
|
|
721
|
-
text: node.properties.text || '',
|
|
722
|
-
horizontalAlignment: node.properties.horizontal_alignment || 0,
|
|
723
|
-
verticalAlignment: node.properties.vertical_alignment || 0,
|
|
724
|
-
autowrapMode: node.properties.autowrap_mode || 0,
|
|
725
|
-
clipText: node.properties.clip_text || false,
|
|
726
|
-
textOverrunBehavior: node.properties.text_overrun_behavior || 0,
|
|
727
|
-
theme: node.properties.theme,
|
|
728
|
-
themeOverride: node.properties.theme_override_colors || node.properties.theme_override_fonts,
|
|
729
|
-
},
|
|
730
|
-
};
|
|
731
|
-
case 'Button':
|
|
732
|
-
return {
|
|
733
|
-
type: 'Button',
|
|
734
|
-
data: {
|
|
735
|
-
text: node.properties.text || '',
|
|
736
|
-
disabled: node.properties.disabled || false,
|
|
737
|
-
flat: node.properties.flat || false,
|
|
738
|
-
icon: node.properties.icon,
|
|
739
|
-
toggleMode: node.properties.toggle_mode || false,
|
|
740
|
-
buttonPressed: node.properties.button_pressed || false,
|
|
741
|
-
},
|
|
742
|
-
};
|
|
743
|
-
default:
|
|
744
|
-
return {
|
|
745
|
-
type: type,
|
|
746
|
-
data: { ...node.properties },
|
|
747
|
-
};
|
|
748
|
-
}
|
|
721
|
+
}
|
|
722
|
+
extractVector2(value) {
|
|
723
|
+
if (!value) {
|
|
724
|
+
return void 0;
|
|
749
725
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
// ----------------------------------------
|
|
828
|
-
async readFile(path) {
|
|
829
|
-
if (typeof globalThis.process !== 'undefined' && globalThis.process.versions?.node) {
|
|
830
|
-
const fs = await import('fs');
|
|
831
|
-
return fs.readFileSync(path, 'utf-8');
|
|
832
|
-
}
|
|
833
|
-
else if (typeof fetch !== 'undefined') {
|
|
834
|
-
const response = await fetch(path);
|
|
835
|
-
return response.text();
|
|
836
|
-
}
|
|
837
|
-
throw new Error('Unable to read file in current environment');
|
|
726
|
+
if (typeof value === "object" && value !== null) {
|
|
727
|
+
if ("_type" in value && value._type === "Vector2") {
|
|
728
|
+
return { x: value.x, y: value.y };
|
|
729
|
+
}
|
|
730
|
+
if ("x" in value && "y" in value) {
|
|
731
|
+
return {
|
|
732
|
+
x: Number(value.x),
|
|
733
|
+
y: Number(value.y)
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return void 0;
|
|
738
|
+
}
|
|
739
|
+
extractAssets() {
|
|
740
|
+
const assets = [];
|
|
741
|
+
for (const [id, extRes] of this.extResources) {
|
|
742
|
+
let assetType = "data";
|
|
743
|
+
switch (extRes.type) {
|
|
744
|
+
case "Texture2D":
|
|
745
|
+
case "CompressedTexture2D":
|
|
746
|
+
case "AtlasTexture":
|
|
747
|
+
case "ImageTexture":
|
|
748
|
+
assetType = "texture";
|
|
749
|
+
break;
|
|
750
|
+
case "AudioStream":
|
|
751
|
+
case "AudioStreamMP3":
|
|
752
|
+
case "AudioStreamOGGVorbis":
|
|
753
|
+
case "AudioStreamWAV":
|
|
754
|
+
assetType = "audio";
|
|
755
|
+
break;
|
|
756
|
+
case "SpriteFrames":
|
|
757
|
+
case "Animation":
|
|
758
|
+
case "AnimationLibrary":
|
|
759
|
+
assetType = "animation";
|
|
760
|
+
break;
|
|
761
|
+
case "TileSet":
|
|
762
|
+
assetType = "tileset";
|
|
763
|
+
break;
|
|
764
|
+
case "Script":
|
|
765
|
+
case "GDScript":
|
|
766
|
+
case "CSharpScript":
|
|
767
|
+
assetType = "script";
|
|
768
|
+
break;
|
|
769
|
+
case "Shader":
|
|
770
|
+
case "VisualShader":
|
|
771
|
+
assetType = "shader";
|
|
772
|
+
break;
|
|
773
|
+
case "Font":
|
|
774
|
+
case "FontFile":
|
|
775
|
+
case "SystemFont":
|
|
776
|
+
assetType = "font";
|
|
777
|
+
break;
|
|
778
|
+
}
|
|
779
|
+
assets.push({
|
|
780
|
+
id: this.generateId(),
|
|
781
|
+
name: extRes.path.split("/").pop()?.replace(/\.\w+$/, "") || `resource_${id}`,
|
|
782
|
+
type: assetType,
|
|
783
|
+
path: extRes.path,
|
|
784
|
+
data: {
|
|
785
|
+
godotType: extRes.type,
|
|
786
|
+
extResourceId: id,
|
|
787
|
+
uid: extRes.uid
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
return assets;
|
|
792
|
+
}
|
|
793
|
+
// ----------------------------------------
|
|
794
|
+
// Helper Methods
|
|
795
|
+
// ----------------------------------------
|
|
796
|
+
async readFile(path) {
|
|
797
|
+
if (typeof globalThis.process !== "undefined" && globalThis.process.versions?.node) {
|
|
798
|
+
const fs = await import("fs");
|
|
799
|
+
return fs.readFileSync(path, "utf-8");
|
|
800
|
+
} else if (typeof fetch !== "undefined") {
|
|
801
|
+
const response = await fetch(path);
|
|
802
|
+
return response.text();
|
|
838
803
|
}
|
|
804
|
+
throw new Error("Unable to read file in current environment");
|
|
805
|
+
}
|
|
839
806
|
}
|
|
840
|
-
|
|
841
807
|
exports.GodotSceneImporter = GodotSceneImporter;
|