@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,546 +1,506 @@
|
|
|
1
|
-
import { SceneImporter } from
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Live2DImporter.ts
|
|
5
|
-
* @description Live2D Cubism Model Importer
|
|
6
|
-
* PRO-1.3: Scene Format Interoperability
|
|
7
|
-
*
|
|
8
|
-
* Live2D is a technology for animating 2D characters.
|
|
9
|
-
* Supports Cubism 3.0+ model format.
|
|
10
|
-
*
|
|
11
|
-
* File Types:
|
|
12
|
-
* - *.model3.json - Model settings
|
|
13
|
-
* - *.moc3 - Model data (binary)
|
|
14
|
-
* - *.physics3.json - Physics settings
|
|
15
|
-
* - *.pose3.json - Pose settings
|
|
16
|
-
* - *.exp3.json - Expression settings
|
|
17
|
-
* - *.motion3.json - Motion data
|
|
18
|
-
* - *.cdi3.json - Display info
|
|
19
|
-
*/
|
|
20
|
-
// ============================================================
|
|
21
|
-
// Live2D Importer
|
|
22
|
-
// ============================================================
|
|
1
|
+
import { SceneImporter } from "./SceneImporter.js";
|
|
23
2
|
class Live2DImporter extends SceneImporter {
|
|
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
|
-
for (const motionRef of motionRefs) {
|
|
83
|
-
assets.push({
|
|
84
|
-
id: this.generateId(),
|
|
85
|
-
name: this.extractFileName(motionRef.File),
|
|
86
|
-
type: 'animation',
|
|
87
|
-
path: motionRef.File,
|
|
88
|
-
data: {
|
|
89
|
-
group,
|
|
90
|
-
fadeInTime: motionRef.FadeInTime,
|
|
91
|
-
fadeOutTime: motionRef.FadeOutTime,
|
|
92
|
-
sound: motionRef.Sound,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// Add expression assets
|
|
99
|
-
if (this.model.FileReferences.Expressions) {
|
|
100
|
-
for (const expRef of this.model.FileReferences.Expressions) {
|
|
101
|
-
assets.push({
|
|
102
|
-
id: this.generateId(),
|
|
103
|
-
name: expRef.Name,
|
|
104
|
-
type: 'data',
|
|
105
|
-
path: expRef.File,
|
|
106
|
-
data: { type: 'expression' },
|
|
107
|
-
});
|
|
108
|
-
}
|
|
3
|
+
constructor() {
|
|
4
|
+
super("live2d");
|
|
5
|
+
this.model = null;
|
|
6
|
+
this.physics = null;
|
|
7
|
+
this.pose = null;
|
|
8
|
+
this.displayInfo = null;
|
|
9
|
+
this.expressions = /* @__PURE__ */ new Map();
|
|
10
|
+
this.motions = /* @__PURE__ */ new Map();
|
|
11
|
+
}
|
|
12
|
+
canHandle(filePath) {
|
|
13
|
+
const name = filePath.toLowerCase();
|
|
14
|
+
return name.endsWith(".model3.json") || name.endsWith(".moc3") || name.endsWith(".physics3.json") || name.endsWith(".pose3.json") || name.endsWith(".exp3.json") || name.endsWith(".motion3.json") || name.endsWith(".cdi3.json");
|
|
15
|
+
}
|
|
16
|
+
async import(options) {
|
|
17
|
+
const startTime = Date.now();
|
|
18
|
+
this.options = options;
|
|
19
|
+
this.clearMessages();
|
|
20
|
+
const scenes = [];
|
|
21
|
+
const assets = [];
|
|
22
|
+
try {
|
|
23
|
+
const fileName = options.sourcePath.toLowerCase();
|
|
24
|
+
const content = await this.readFile(options.sourcePath);
|
|
25
|
+
if (fileName.endsWith(".model3.json")) {
|
|
26
|
+
this.model = JSON.parse(content);
|
|
27
|
+
if (options.resolveDependencies) {
|
|
28
|
+
await this.loadDependencies(options.sourcePath);
|
|
29
|
+
}
|
|
30
|
+
const scene = this.convertModelToScene(options.sourcePath);
|
|
31
|
+
scenes.push(scene);
|
|
32
|
+
for (const texture of this.model.FileReferences.Textures) {
|
|
33
|
+
assets.push({
|
|
34
|
+
id: this.generateId(),
|
|
35
|
+
name: this.extractFileName(texture),
|
|
36
|
+
type: "texture",
|
|
37
|
+
path: texture,
|
|
38
|
+
data: {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
assets.push({
|
|
42
|
+
id: this.generateId(),
|
|
43
|
+
name: this.extractFileName(this.model.FileReferences.Moc),
|
|
44
|
+
type: "data",
|
|
45
|
+
path: this.model.FileReferences.Moc,
|
|
46
|
+
data: { type: "moc3" }
|
|
47
|
+
});
|
|
48
|
+
if (this.model.FileReferences.Motions) {
|
|
49
|
+
for (const [group, motionRefs] of Object.entries(this.model.FileReferences.Motions)) {
|
|
50
|
+
for (const motionRef of motionRefs) {
|
|
51
|
+
assets.push({
|
|
52
|
+
id: this.generateId(),
|
|
53
|
+
name: this.extractFileName(motionRef.File),
|
|
54
|
+
type: "animation",
|
|
55
|
+
path: motionRef.File,
|
|
56
|
+
data: {
|
|
57
|
+
group,
|
|
58
|
+
fadeInTime: motionRef.FadeInTime,
|
|
59
|
+
fadeOutTime: motionRef.FadeOutTime,
|
|
60
|
+
sound: motionRef.Sound
|
|
109
61
|
}
|
|
62
|
+
});
|
|
110
63
|
}
|
|
111
|
-
|
|
112
|
-
const motion = JSON.parse(content);
|
|
113
|
-
assets.push({
|
|
114
|
-
id: this.generateId(),
|
|
115
|
-
name: this.extractFileName(options.sourcePath),
|
|
116
|
-
type: 'animation',
|
|
117
|
-
path: options.sourcePath,
|
|
118
|
-
data: {
|
|
119
|
-
duration: motion.Meta.Duration,
|
|
120
|
-
fps: motion.Meta.Fps,
|
|
121
|
-
loop: motion.Meta.Loop,
|
|
122
|
-
curveCount: motion.Meta.CurveCount,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
else if (fileName.endsWith('.exp3.json')) {
|
|
127
|
-
const expression = JSON.parse(content);
|
|
128
|
-
assets.push({
|
|
129
|
-
id: this.generateId(),
|
|
130
|
-
name: this.extractFileName(options.sourcePath),
|
|
131
|
-
type: 'data',
|
|
132
|
-
path: options.sourcePath,
|
|
133
|
-
data: {
|
|
134
|
-
type: 'expression',
|
|
135
|
-
fadeInTime: expression.FadeInTime,
|
|
136
|
-
fadeOutTime: expression.FadeOutTime,
|
|
137
|
-
parameterCount: expression.Parameters?.length || 0,
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
}
|
|
64
|
+
}
|
|
141
65
|
}
|
|
142
|
-
|
|
143
|
-
|
|
66
|
+
if (this.model.FileReferences.Expressions) {
|
|
67
|
+
for (const expRef of this.model.FileReferences.Expressions) {
|
|
68
|
+
assets.push({
|
|
69
|
+
id: this.generateId(),
|
|
70
|
+
name: expRef.Name,
|
|
71
|
+
type: "data",
|
|
72
|
+
path: expRef.File,
|
|
73
|
+
data: { type: "expression" }
|
|
74
|
+
});
|
|
75
|
+
}
|
|
144
76
|
}
|
|
145
|
-
|
|
77
|
+
} else if (fileName.endsWith(".motion3.json")) {
|
|
78
|
+
const motion = JSON.parse(content);
|
|
79
|
+
assets.push({
|
|
80
|
+
id: this.generateId(),
|
|
81
|
+
name: this.extractFileName(options.sourcePath),
|
|
82
|
+
type: "animation",
|
|
83
|
+
path: options.sourcePath,
|
|
84
|
+
data: {
|
|
85
|
+
duration: motion.Meta.Duration,
|
|
86
|
+
fps: motion.Meta.Fps,
|
|
87
|
+
loop: motion.Meta.Loop,
|
|
88
|
+
curveCount: motion.Meta.CurveCount
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
} else if (fileName.endsWith(".exp3.json")) {
|
|
92
|
+
const expression = JSON.parse(content);
|
|
93
|
+
assets.push({
|
|
94
|
+
id: this.generateId(),
|
|
95
|
+
name: this.extractFileName(options.sourcePath),
|
|
96
|
+
type: "data",
|
|
97
|
+
path: options.sourcePath,
|
|
98
|
+
data: {
|
|
99
|
+
type: "expression",
|
|
100
|
+
fadeInTime: expression.FadeInTime,
|
|
101
|
+
fadeOutTime: expression.FadeOutTime,
|
|
102
|
+
parameterCount: expression.Parameters?.length || 0
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
} catch (error) {
|
|
107
|
+
this.addError(
|
|
108
|
+
"IMPORT_ERROR",
|
|
109
|
+
`Failed to import: ${error}`,
|
|
110
|
+
options.sourcePath,
|
|
111
|
+
void 0,
|
|
112
|
+
true
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return this.createResult(scenes, assets, startTime);
|
|
116
|
+
}
|
|
117
|
+
async parseFile(content, filePath) {
|
|
118
|
+
const stringContent = typeof content === "string" ? content : new TextDecoder().decode(content);
|
|
119
|
+
try {
|
|
120
|
+
if (filePath.toLowerCase().endsWith(".model3.json")) {
|
|
121
|
+
this.model = JSON.parse(stringContent);
|
|
122
|
+
return this.convertModelToParsed();
|
|
123
|
+
}
|
|
124
|
+
} catch {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
async validate(sourcePath) {
|
|
130
|
+
const errors = [];
|
|
131
|
+
if (!this.canHandle(sourcePath)) {
|
|
132
|
+
errors.push({
|
|
133
|
+
code: "INVALID_FORMAT",
|
|
134
|
+
message: `File ${sourcePath} is not a valid Live2D file`,
|
|
135
|
+
file: sourcePath,
|
|
136
|
+
fatal: true
|
|
137
|
+
});
|
|
146
138
|
}
|
|
147
|
-
|
|
148
|
-
|
|
139
|
+
return errors;
|
|
140
|
+
}
|
|
141
|
+
// ----------------------------------------
|
|
142
|
+
// Load Dependencies
|
|
143
|
+
// ----------------------------------------
|
|
144
|
+
async loadDependencies(modelPath) {
|
|
145
|
+
if (!this.model) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const baseDir = this.getBaseDirectory(modelPath);
|
|
149
|
+
if (this.model.FileReferences.Physics) {
|
|
150
|
+
try {
|
|
151
|
+
const physicsContent = await this.readFile(baseDir + this.model.FileReferences.Physics);
|
|
152
|
+
this.physics = JSON.parse(physicsContent);
|
|
153
|
+
} catch {
|
|
154
|
+
this.addWarning(
|
|
155
|
+
"PHYSICS_NOT_FOUND",
|
|
156
|
+
"Physics file not found",
|
|
157
|
+
this.model.FileReferences.Physics
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (this.model.FileReferences.Pose) {
|
|
162
|
+
try {
|
|
163
|
+
const poseContent = await this.readFile(baseDir + this.model.FileReferences.Pose);
|
|
164
|
+
this.pose = JSON.parse(poseContent);
|
|
165
|
+
} catch {
|
|
166
|
+
this.addWarning("POSE_NOT_FOUND", "Pose file not found", this.model.FileReferences.Pose);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (this.model.FileReferences.DisplayInfo) {
|
|
170
|
+
try {
|
|
171
|
+
const displayContent = await this.readFile(baseDir + this.model.FileReferences.DisplayInfo);
|
|
172
|
+
this.displayInfo = JSON.parse(displayContent);
|
|
173
|
+
} catch {
|
|
174
|
+
this.addWarning(
|
|
175
|
+
"DISPLAY_NOT_FOUND",
|
|
176
|
+
"Display info file not found",
|
|
177
|
+
this.model.FileReferences.DisplayInfo
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (this.model.FileReferences.Expressions) {
|
|
182
|
+
for (const expRef of this.model.FileReferences.Expressions) {
|
|
149
183
|
try {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
184
|
+
const expContent = await this.readFile(baseDir + expRef.File);
|
|
185
|
+
this.expressions.set(expRef.Name, JSON.parse(expContent));
|
|
186
|
+
} catch {
|
|
187
|
+
this.addWarning(
|
|
188
|
+
"EXPRESSION_NOT_FOUND",
|
|
189
|
+
`Expression not found: ${expRef.Name}`,
|
|
190
|
+
expRef.File
|
|
191
|
+
);
|
|
154
192
|
}
|
|
155
|
-
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
return null;
|
|
193
|
+
}
|
|
159
194
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
195
|
+
if (this.model.FileReferences.Motions) {
|
|
196
|
+
for (const [group, motionRefs] of Object.entries(this.model.FileReferences.Motions)) {
|
|
197
|
+
for (const motionRef of motionRefs.slice(0, 5)) {
|
|
198
|
+
try {
|
|
199
|
+
const motionContent = await this.readFile(baseDir + motionRef.File);
|
|
200
|
+
const motionName = `${group}_${this.extractFileName(motionRef.File)}`;
|
|
201
|
+
this.motions.set(motionName, JSON.parse(motionContent));
|
|
202
|
+
} catch {
|
|
203
|
+
this.addWarning(
|
|
204
|
+
"MOTION_NOT_FOUND",
|
|
205
|
+
`Motion not found: ${motionRef.File}`,
|
|
206
|
+
motionRef.File
|
|
207
|
+
);
|
|
208
|
+
}
|
|
169
209
|
}
|
|
170
|
-
|
|
210
|
+
}
|
|
171
211
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const baseDir = this.getBaseDirectory(modelPath);
|
|
180
|
-
// Load physics
|
|
181
|
-
if (this.model.FileReferences.Physics) {
|
|
182
|
-
try {
|
|
183
|
-
const physicsContent = await this.readFile(baseDir + this.model.FileReferences.Physics);
|
|
184
|
-
this.physics = JSON.parse(physicsContent);
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
this.addWarning('PHYSICS_NOT_FOUND', 'Physics file not found', this.model.FileReferences.Physics);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
// Load pose
|
|
191
|
-
if (this.model.FileReferences.Pose) {
|
|
192
|
-
try {
|
|
193
|
-
const poseContent = await this.readFile(baseDir + this.model.FileReferences.Pose);
|
|
194
|
-
this.pose = JSON.parse(poseContent);
|
|
195
|
-
}
|
|
196
|
-
catch {
|
|
197
|
-
this.addWarning('POSE_NOT_FOUND', 'Pose file not found', this.model.FileReferences.Pose);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
// Load display info
|
|
201
|
-
if (this.model.FileReferences.DisplayInfo) {
|
|
202
|
-
try {
|
|
203
|
-
const displayContent = await this.readFile(baseDir + this.model.FileReferences.DisplayInfo);
|
|
204
|
-
this.displayInfo = JSON.parse(displayContent);
|
|
205
|
-
}
|
|
206
|
-
catch {
|
|
207
|
-
this.addWarning('DISPLAY_NOT_FOUND', 'Display info file not found', this.model.FileReferences.DisplayInfo);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
// Load expressions
|
|
211
|
-
if (this.model.FileReferences.Expressions) {
|
|
212
|
-
for (const expRef of this.model.FileReferences.Expressions) {
|
|
213
|
-
try {
|
|
214
|
-
const expContent = await this.readFile(baseDir + expRef.File);
|
|
215
|
-
this.expressions.set(expRef.Name, JSON.parse(expContent));
|
|
216
|
-
}
|
|
217
|
-
catch {
|
|
218
|
-
this.addWarning('EXPRESSION_NOT_FOUND', `Expression not found: ${expRef.Name}`, expRef.File);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
// Load motions (limited to avoid too many requests)
|
|
223
|
-
if (this.model.FileReferences.Motions) {
|
|
224
|
-
for (const [group, motionRefs] of Object.entries(this.model.FileReferences.Motions)) {
|
|
225
|
-
for (const motionRef of motionRefs.slice(0, 5)) {
|
|
226
|
-
// Limit to first 5 per group
|
|
227
|
-
try {
|
|
228
|
-
const motionContent = await this.readFile(baseDir + motionRef.File);
|
|
229
|
-
const motionName = `${group}_${this.extractFileName(motionRef.File)}`;
|
|
230
|
-
this.motions.set(motionName, JSON.parse(motionContent));
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
this.addWarning('MOTION_NOT_FOUND', `Motion not found: ${motionRef.File}`, motionRef.File);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
212
|
+
}
|
|
213
|
+
// ----------------------------------------
|
|
214
|
+
// Model Conversion
|
|
215
|
+
// ----------------------------------------
|
|
216
|
+
convertModelToScene(sourcePath) {
|
|
217
|
+
if (!this.model) {
|
|
218
|
+
throw new Error("No model loaded");
|
|
238
219
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
version: this.model.Version,
|
|
265
|
-
moc: this.model.FileReferences.Moc,
|
|
266
|
-
textures: this.model.FileReferences.Textures,
|
|
267
|
-
hasPhysics: !!this.model.FileReferences.Physics,
|
|
268
|
-
hasPose: !!this.model.FileReferences.Pose,
|
|
269
|
-
expressionCount: this.model.FileReferences.Expressions?.length || 0,
|
|
270
|
-
motionGroups: this.model.FileReferences.Motions
|
|
271
|
-
? Object.keys(this.model.FileReferences.Motions)
|
|
272
|
-
: [],
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
children: [],
|
|
277
|
-
tags: ['live2d', 'model'],
|
|
278
|
-
active: true,
|
|
279
|
-
};
|
|
280
|
-
// Add hit areas
|
|
281
|
-
if (this.model.HitAreas) {
|
|
282
|
-
for (const hitArea of this.model.HitAreas) {
|
|
283
|
-
rootEntity.components.push({
|
|
284
|
-
type: 'HitArea',
|
|
285
|
-
data: {
|
|
286
|
-
id: hitArea.Id,
|
|
287
|
-
name: hitArea.Name,
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
// Add parameter groups
|
|
293
|
-
if (this.model.Groups) {
|
|
294
|
-
for (const group of this.model.Groups) {
|
|
295
|
-
rootEntity.components.push({
|
|
296
|
-
type: 'ParameterGroup',
|
|
297
|
-
data: {
|
|
298
|
-
target: group.Target,
|
|
299
|
-
name: group.Name,
|
|
300
|
-
ids: group.Ids,
|
|
301
|
-
},
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
// Add physics component
|
|
306
|
-
if (this.physics) {
|
|
307
|
-
rootEntity.components.push({
|
|
308
|
-
type: 'Live2DPhysics',
|
|
309
|
-
data: {
|
|
310
|
-
settingCount: this.physics.Meta.PhysicsSettingCount,
|
|
311
|
-
gravity: this.physics.Meta.EffectiveForces?.Gravity,
|
|
312
|
-
wind: this.physics.Meta.EffectiveForces?.Wind,
|
|
313
|
-
settings: this.physics.PhysicsSettings.map((s) => ({
|
|
314
|
-
id: s.Id,
|
|
315
|
-
inputCount: s.Input.length,
|
|
316
|
-
outputCount: s.Output.length,
|
|
317
|
-
vertexCount: s.Vertices.length,
|
|
318
|
-
})),
|
|
319
|
-
},
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
// Add pose component
|
|
323
|
-
if (this.pose) {
|
|
324
|
-
rootEntity.components.push({
|
|
325
|
-
type: 'Live2DPose',
|
|
326
|
-
data: {
|
|
327
|
-
fadeInTime: this.pose.FadeInTime,
|
|
328
|
-
groupCount: this.pose.Groups.length,
|
|
329
|
-
groups: this.pose.Groups,
|
|
330
|
-
},
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
// Add expressions
|
|
334
|
-
for (const [expName, exp] of this.expressions) {
|
|
335
|
-
rootEntity.components.push({
|
|
336
|
-
type: 'Expression',
|
|
337
|
-
data: {
|
|
338
|
-
name: expName,
|
|
339
|
-
fadeInTime: exp.FadeInTime,
|
|
340
|
-
fadeOutTime: exp.FadeOutTime,
|
|
341
|
-
parameters: exp.Parameters,
|
|
342
|
-
},
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
// Add motions
|
|
346
|
-
for (const [motionName, motion] of this.motions) {
|
|
347
|
-
rootEntity.components.push({
|
|
348
|
-
type: 'Animation',
|
|
349
|
-
data: {
|
|
350
|
-
name: motionName,
|
|
351
|
-
duration: motion.Meta.Duration,
|
|
352
|
-
fps: motion.Meta.Fps,
|
|
353
|
-
loop: motion.Meta.Loop,
|
|
354
|
-
curveCount: motion.Meta.CurveCount,
|
|
355
|
-
curves: this.convertMotionCurves(motion),
|
|
356
|
-
},
|
|
357
|
-
});
|
|
220
|
+
const name = this.extractFileName(sourcePath).replace(".model3", "");
|
|
221
|
+
const entities = [];
|
|
222
|
+
const rootEntity = {
|
|
223
|
+
id: this.generateId(),
|
|
224
|
+
name,
|
|
225
|
+
components: [
|
|
226
|
+
{
|
|
227
|
+
type: "Transform",
|
|
228
|
+
data: {
|
|
229
|
+
position: { x: 0, y: 0 },
|
|
230
|
+
rotation: 0,
|
|
231
|
+
scale: { x: 1, y: 1 }
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: "Live2DModel",
|
|
236
|
+
data: {
|
|
237
|
+
version: this.model.Version,
|
|
238
|
+
moc: this.model.FileReferences.Moc,
|
|
239
|
+
textures: this.model.FileReferences.Textures,
|
|
240
|
+
hasPhysics: !!this.model.FileReferences.Physics,
|
|
241
|
+
hasPose: !!this.model.FileReferences.Pose,
|
|
242
|
+
expressionCount: this.model.FileReferences.Expressions?.length || 0,
|
|
243
|
+
motionGroups: this.model.FileReferences.Motions ? Object.keys(this.model.FileReferences.Motions) : []
|
|
244
|
+
}
|
|
358
245
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
246
|
+
],
|
|
247
|
+
children: [],
|
|
248
|
+
tags: ["live2d", "model"],
|
|
249
|
+
active: true
|
|
250
|
+
};
|
|
251
|
+
if (this.model.HitAreas) {
|
|
252
|
+
for (const hitArea of this.model.HitAreas) {
|
|
253
|
+
rootEntity.components.push({
|
|
254
|
+
type: "HitArea",
|
|
255
|
+
data: {
|
|
256
|
+
id: hitArea.Id,
|
|
257
|
+
name: hitArea.Name
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
370
261
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
type: 'Live2DModel',
|
|
381
|
-
x: 0,
|
|
382
|
-
y: 0,
|
|
383
|
-
width: 800,
|
|
384
|
-
height: 800,
|
|
385
|
-
rotation: 0,
|
|
386
|
-
scaleX: 1,
|
|
387
|
-
scaleY: 1,
|
|
388
|
-
visible: true,
|
|
389
|
-
components: [],
|
|
390
|
-
children: [],
|
|
391
|
-
properties: {
|
|
392
|
-
version: this.model.Version,
|
|
393
|
-
moc: this.model.FileReferences.Moc,
|
|
394
|
-
textures: this.model.FileReferences.Textures,
|
|
395
|
-
physics: this.model.FileReferences.Physics,
|
|
396
|
-
pose: this.model.FileReferences.Pose,
|
|
397
|
-
expressions: this.model.FileReferences.Expressions?.map((e) => e.Name),
|
|
398
|
-
motionGroups: this.model.FileReferences.Motions
|
|
399
|
-
? Object.keys(this.model.FileReferences.Motions)
|
|
400
|
-
: [],
|
|
401
|
-
hitAreas: this.model.HitAreas?.map((h) => h.Name),
|
|
402
|
-
groups: this.model.Groups?.map((g) => g.Name),
|
|
403
|
-
},
|
|
262
|
+
if (this.model.Groups) {
|
|
263
|
+
for (const group of this.model.Groups) {
|
|
264
|
+
rootEntity.components.push({
|
|
265
|
+
type: "ParameterGroup",
|
|
266
|
+
data: {
|
|
267
|
+
target: group.Target,
|
|
268
|
+
name: group.Name,
|
|
269
|
+
ids: group.Ids
|
|
270
|
+
}
|
|
404
271
|
});
|
|
405
|
-
|
|
406
|
-
if (this.model.HitAreas) {
|
|
407
|
-
for (const hitArea of this.model.HitAreas) {
|
|
408
|
-
entities.push({
|
|
409
|
-
id: hitArea.Id,
|
|
410
|
-
name: hitArea.Name,
|
|
411
|
-
type: 'HitArea',
|
|
412
|
-
x: 0,
|
|
413
|
-
y: 0,
|
|
414
|
-
width: 100,
|
|
415
|
-
height: 100,
|
|
416
|
-
rotation: 0,
|
|
417
|
-
scaleX: 1,
|
|
418
|
-
scaleY: 1,
|
|
419
|
-
visible: true,
|
|
420
|
-
components: [],
|
|
421
|
-
children: [],
|
|
422
|
-
properties: {
|
|
423
|
-
meshId: hitArea.Id,
|
|
424
|
-
},
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return {
|
|
429
|
-
name: 'Live2D Model',
|
|
430
|
-
width: 800,
|
|
431
|
-
height: 800,
|
|
432
|
-
backgroundColor: '#1a1a2e',
|
|
433
|
-
layers: [
|
|
434
|
-
{
|
|
435
|
-
name: 'Model',
|
|
436
|
-
type: 'object',
|
|
437
|
-
visible: true,
|
|
438
|
-
opacity: 1,
|
|
439
|
-
offsetX: 0,
|
|
440
|
-
offsetY: 0,
|
|
441
|
-
zIndex: 0,
|
|
442
|
-
properties: {},
|
|
443
|
-
},
|
|
444
|
-
],
|
|
445
|
-
entities,
|
|
446
|
-
properties: {
|
|
447
|
-
version: this.model.Version,
|
|
448
|
-
textureCount: this.model.FileReferences.Textures.length,
|
|
449
|
-
},
|
|
450
|
-
};
|
|
272
|
+
}
|
|
451
273
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
274
|
+
if (this.physics) {
|
|
275
|
+
rootEntity.components.push({
|
|
276
|
+
type: "Live2DPhysics",
|
|
277
|
+
data: {
|
|
278
|
+
settingCount: this.physics.Meta.PhysicsSettingCount,
|
|
279
|
+
gravity: this.physics.Meta.EffectiveForces?.Gravity,
|
|
280
|
+
wind: this.physics.Meta.EffectiveForces?.Wind,
|
|
281
|
+
settings: this.physics.PhysicsSettings.map((s) => ({
|
|
282
|
+
id: s.Id,
|
|
283
|
+
inputCount: s.Input.length,
|
|
284
|
+
outputCount: s.Output.length,
|
|
285
|
+
vertexCount: s.Vertices.length
|
|
286
|
+
}))
|
|
287
|
+
}
|
|
288
|
+
});
|
|
464
289
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
types.push('linear');
|
|
473
|
-
i += 3; // type + point
|
|
474
|
-
break;
|
|
475
|
-
case 1: // Bezier
|
|
476
|
-
types.push('bezier');
|
|
477
|
-
i += 7; // type + 2 control points + point
|
|
478
|
-
break;
|
|
479
|
-
case 2: // Stepped
|
|
480
|
-
types.push('stepped');
|
|
481
|
-
i += 3;
|
|
482
|
-
break;
|
|
483
|
-
case 3: // Inverse stepped
|
|
484
|
-
types.push('inverseStep');
|
|
485
|
-
i += 3;
|
|
486
|
-
break;
|
|
487
|
-
default:
|
|
488
|
-
i++;
|
|
489
|
-
}
|
|
290
|
+
if (this.pose) {
|
|
291
|
+
rootEntity.components.push({
|
|
292
|
+
type: "Live2DPose",
|
|
293
|
+
data: {
|
|
294
|
+
fadeInTime: this.pose.FadeInTime,
|
|
295
|
+
groupCount: this.pose.Groups.length,
|
|
296
|
+
groups: this.pose.Groups
|
|
490
297
|
}
|
|
491
|
-
|
|
298
|
+
});
|
|
492
299
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
case 3:
|
|
502
|
-
count++;
|
|
503
|
-
i += 3;
|
|
504
|
-
break;
|
|
505
|
-
case 1:
|
|
506
|
-
count++;
|
|
507
|
-
i += 7;
|
|
508
|
-
break;
|
|
509
|
-
default:
|
|
510
|
-
i++;
|
|
511
|
-
}
|
|
300
|
+
for (const [expName, exp] of this.expressions) {
|
|
301
|
+
rootEntity.components.push({
|
|
302
|
+
type: "Expression",
|
|
303
|
+
data: {
|
|
304
|
+
name: expName,
|
|
305
|
+
fadeInTime: exp.FadeInTime,
|
|
306
|
+
fadeOutTime: exp.FadeOutTime,
|
|
307
|
+
parameters: exp.Parameters
|
|
512
308
|
}
|
|
513
|
-
|
|
309
|
+
});
|
|
514
310
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
311
|
+
for (const [motionName, motion] of this.motions) {
|
|
312
|
+
rootEntity.components.push({
|
|
313
|
+
type: "Animation",
|
|
314
|
+
data: {
|
|
315
|
+
name: motionName,
|
|
316
|
+
duration: motion.Meta.Duration,
|
|
317
|
+
fps: motion.Meta.Fps,
|
|
318
|
+
loop: motion.Meta.Loop,
|
|
319
|
+
curveCount: motion.Meta.CurveCount,
|
|
320
|
+
curves: this.convertMotionCurves(motion)
|
|
522
321
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
entities.push(rootEntity);
|
|
325
|
+
return {
|
|
326
|
+
id: this.generateId(),
|
|
327
|
+
name,
|
|
328
|
+
entities,
|
|
329
|
+
settings: {
|
|
330
|
+
width: 800,
|
|
331
|
+
// Default canvas size
|
|
332
|
+
height: 800,
|
|
333
|
+
backgroundColor: "#1a1a2e"
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
convertModelToParsed() {
|
|
338
|
+
if (!this.model) {
|
|
339
|
+
throw new Error("No model loaded");
|
|
340
|
+
}
|
|
341
|
+
const entities = [];
|
|
342
|
+
entities.push({
|
|
343
|
+
id: "model",
|
|
344
|
+
name: "Live2D Model",
|
|
345
|
+
type: "Live2DModel",
|
|
346
|
+
x: 0,
|
|
347
|
+
y: 0,
|
|
348
|
+
width: 800,
|
|
349
|
+
height: 800,
|
|
350
|
+
rotation: 0,
|
|
351
|
+
scaleX: 1,
|
|
352
|
+
scaleY: 1,
|
|
353
|
+
visible: true,
|
|
354
|
+
components: [],
|
|
355
|
+
children: [],
|
|
356
|
+
properties: {
|
|
357
|
+
version: this.model.Version,
|
|
358
|
+
moc: this.model.FileReferences.Moc,
|
|
359
|
+
textures: this.model.FileReferences.Textures,
|
|
360
|
+
physics: this.model.FileReferences.Physics,
|
|
361
|
+
pose: this.model.FileReferences.Pose,
|
|
362
|
+
expressions: this.model.FileReferences.Expressions?.map((e) => e.Name),
|
|
363
|
+
motionGroups: this.model.FileReferences.Motions ? Object.keys(this.model.FileReferences.Motions) : [],
|
|
364
|
+
hitAreas: this.model.HitAreas?.map((h) => h.Name),
|
|
365
|
+
groups: this.model.Groups?.map((g) => g.Name)
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
if (this.model.HitAreas) {
|
|
369
|
+
for (const hitArea of this.model.HitAreas) {
|
|
370
|
+
entities.push({
|
|
371
|
+
id: hitArea.Id,
|
|
372
|
+
name: hitArea.Name,
|
|
373
|
+
type: "HitArea",
|
|
374
|
+
x: 0,
|
|
375
|
+
y: 0,
|
|
376
|
+
width: 100,
|
|
377
|
+
height: 100,
|
|
378
|
+
rotation: 0,
|
|
379
|
+
scaleX: 1,
|
|
380
|
+
scaleY: 1,
|
|
381
|
+
visible: true,
|
|
382
|
+
components: [],
|
|
383
|
+
children: [],
|
|
384
|
+
properties: {
|
|
385
|
+
meshId: hitArea.Id
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
name: "Live2D Model",
|
|
392
|
+
width: 800,
|
|
393
|
+
height: 800,
|
|
394
|
+
backgroundColor: "#1a1a2e",
|
|
395
|
+
layers: [
|
|
396
|
+
{
|
|
397
|
+
name: "Model",
|
|
398
|
+
type: "object",
|
|
399
|
+
visible: true,
|
|
400
|
+
opacity: 1,
|
|
401
|
+
offsetX: 0,
|
|
402
|
+
offsetY: 0,
|
|
403
|
+
zIndex: 0,
|
|
404
|
+
properties: {}
|
|
526
405
|
}
|
|
527
|
-
|
|
406
|
+
],
|
|
407
|
+
entities,
|
|
408
|
+
properties: {
|
|
409
|
+
version: this.model.Version,
|
|
410
|
+
textureCount: this.model.FileReferences.Textures.length
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
// ----------------------------------------
|
|
415
|
+
// Motion Conversion
|
|
416
|
+
// ----------------------------------------
|
|
417
|
+
convertMotionCurves(motion) {
|
|
418
|
+
return motion.Curves.map((curve) => ({
|
|
419
|
+
target: curve.Target,
|
|
420
|
+
id: curve.Id,
|
|
421
|
+
fadeInTime: curve.FadeInTime,
|
|
422
|
+
fadeOutTime: curve.FadeOutTime,
|
|
423
|
+
segmentType: this.getSegmentTypes(curve.Segments),
|
|
424
|
+
keyframeCount: this.countKeyframes(curve.Segments)
|
|
425
|
+
}));
|
|
426
|
+
}
|
|
427
|
+
getSegmentTypes(segments) {
|
|
428
|
+
const types = [];
|
|
429
|
+
let i = 0;
|
|
430
|
+
while (i < segments.length) {
|
|
431
|
+
const type = segments[i];
|
|
432
|
+
switch (type) {
|
|
433
|
+
case 0:
|
|
434
|
+
types.push("linear");
|
|
435
|
+
i += 3;
|
|
436
|
+
break;
|
|
437
|
+
case 1:
|
|
438
|
+
types.push("bezier");
|
|
439
|
+
i += 7;
|
|
440
|
+
break;
|
|
441
|
+
case 2:
|
|
442
|
+
types.push("stepped");
|
|
443
|
+
i += 3;
|
|
444
|
+
break;
|
|
445
|
+
case 3:
|
|
446
|
+
types.push("inverseStep");
|
|
447
|
+
i += 3;
|
|
448
|
+
break;
|
|
449
|
+
default:
|
|
450
|
+
i++;
|
|
451
|
+
}
|
|
528
452
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
453
|
+
return [...new Set(types)];
|
|
454
|
+
}
|
|
455
|
+
countKeyframes(segments) {
|
|
456
|
+
let count = 1;
|
|
457
|
+
let i = 0;
|
|
458
|
+
while (i < segments.length) {
|
|
459
|
+
const type = segments[i];
|
|
460
|
+
switch (type) {
|
|
461
|
+
case 0:
|
|
462
|
+
case 2:
|
|
463
|
+
case 3:
|
|
464
|
+
count++;
|
|
465
|
+
i += 3;
|
|
466
|
+
break;
|
|
467
|
+
case 1:
|
|
468
|
+
count++;
|
|
469
|
+
i += 7;
|
|
470
|
+
break;
|
|
471
|
+
default:
|
|
472
|
+
i++;
|
|
473
|
+
}
|
|
532
474
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
475
|
+
return count;
|
|
476
|
+
}
|
|
477
|
+
// ----------------------------------------
|
|
478
|
+
// Utilities
|
|
479
|
+
// ----------------------------------------
|
|
480
|
+
async readFile(path) {
|
|
481
|
+
if (typeof globalThis.process !== "undefined" && globalThis.process.versions?.node) {
|
|
482
|
+
const fs = await import("fs");
|
|
483
|
+
return fs.readFileSync(path, "utf-8");
|
|
484
|
+
} else if (typeof fetch !== "undefined") {
|
|
485
|
+
const response = await fetch(path);
|
|
486
|
+
return response.text();
|
|
537
487
|
}
|
|
488
|
+
throw new Error("Unable to read file in current environment");
|
|
489
|
+
}
|
|
490
|
+
getBaseDirectory(path) {
|
|
491
|
+
const lastSlash = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
|
|
492
|
+
return lastSlash >= 0 ? path.substring(0, lastSlash + 1) : "";
|
|
493
|
+
}
|
|
494
|
+
extractFileName(path) {
|
|
495
|
+
const name = path.substring(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1);
|
|
496
|
+
const dotIndex = name.lastIndexOf(".");
|
|
497
|
+
return dotIndex > 0 ? name.substring(0, dotIndex) : name;
|
|
498
|
+
}
|
|
538
499
|
}
|
|
539
|
-
// ============================================================
|
|
540
|
-
// Factory Function
|
|
541
|
-
// ============================================================
|
|
542
500
|
function createLive2DImporter() {
|
|
543
|
-
|
|
501
|
+
return new Live2DImporter();
|
|
544
502
|
}
|
|
545
|
-
|
|
546
|
-
|
|
503
|
+
export {
|
|
504
|
+
Live2DImporter,
|
|
505
|
+
createLive2DImporter
|
|
506
|
+
};
|