From 91e05a64c5e1ea3bbc0b51f024ac4c3cd94f9e97 Mon Sep 17 00:00:00 2001 From: Ayaka Neko Date: Thu, 21 Aug 2025 03:45:46 +0800 Subject: [PATCH] fix(stage-ui): live2d model not loading --- .../stage-tamagotchi/src/layouts/settings.vue | 4 +- .../Settings/Live2DModelControlButton.vue | 22 --- .../src/components/Layouts/Section.vue | 7 +- .../Settings/ModelSettings/Live2D.vue | 39 ++-- .../src/components/Scenes/Live2D/Model.vue | 178 ++++++++++-------- packages/stage-ui/src/stores/live2d.ts | 2 - 6 files changed, 120 insertions(+), 132 deletions(-) delete mode 100644 apps/stage-web/src/components/Settings/Live2DModelControlButton.vue diff --git a/apps/stage-tamagotchi/src/layouts/settings.vue b/apps/stage-tamagotchi/src/layouts/settings.vue index e10c99bbd..45284098f 100644 --- a/apps/stage-tamagotchi/src/layouts/settings.vue +++ b/apps/stage-tamagotchi/src/layouts/settings.vue @@ -147,14 +147,14 @@ onMounted(() => updateThemeColor()) >
-
+
-
+
diff --git a/apps/stage-web/src/components/Settings/Live2DModelControlButton.vue b/apps/stage-web/src/components/Settings/Live2DModelControlButton.vue deleted file mode 100644 index 7c2cb19c3..000000000 --- a/apps/stage-web/src/components/Settings/Live2DModelControlButton.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - diff --git a/packages/stage-ui/src/components/Layouts/Section.vue b/packages/stage-ui/src/components/Layouts/Section.vue index 30673cd5f..3f3b76ce3 100644 --- a/packages/stage-ui/src/components/Layouts/Section.vue +++ b/packages/stage-ui/src/components/Layouts/Section.vue @@ -6,6 +6,7 @@ withDefaults(defineProps<{ icon: string innerClass?: string expand?: boolean + size?: 'sm' | 'md' }>(), { expand: true, }) @@ -21,8 +22,8 @@ withDefaults(defineProps<{ hover="bg-neutral-200 dark:bg-neutral-700" @click="slotProps.setVisible(!slotProps.visible)" > -
-
+
+
{{ title }}
-
+
diff --git a/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/Live2D.vue b/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/Live2D.vue index 075702683..f63ab2416 100644 --- a/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/Live2D.vue +++ b/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/Live2D.vue @@ -5,10 +5,10 @@ import localforage from 'localforage' import { Checkbox, FieldRange, Input } from '@proj-airi/ui' import { useFileDialog, useObjectUrl } from '@vueuse/core' import { storeToRefs } from 'pinia' -import { ref, watch } from 'vue' +import { ref } from 'vue' import { useI18n } from 'vue-i18n' -import { Emotion, EmotionNeutralMotionName } from '../../../../constants' +import { Emotion } from '../../../../constants' import { useLive2d, useSettings } from '../../../../stores' import { Section } from '../../../Layouts' import { Button } from '../../../Misc' @@ -36,7 +36,6 @@ const live2d = useLive2d() const { modelFile, motionMap, - loadingModel, availableMotions, modelUrl, currentMotion, @@ -49,30 +48,10 @@ modelFileDialog.onChange((files) => { if (files && files.length > 0) { motionMap.value = {} modelFile.value = files[0] - loadingModel.value = true live2d.shouldUpdateView() } }) -watch(loadingModel, (value) => { - if (value) { - return - } - - if (!modelFile.value) { - return - } - - availableMotions.value.forEach((motion) => { - if (motion.motionName in Emotion) { - motionMap.value[motion.fileName] = motion.motionName - } - else { - motionMap.value[motion.fileName] = EmotionNeutralMotionName - } - }) -}) - async function patchMotionMap(source: File, motionMap: Record): Promise { if (!Object.keys(motionMap).length) return source @@ -115,7 +94,6 @@ async function saveMotionMap() { const patchedFile = await patchMotionMap(fileFromIndexedDB, motionMap.value) modelFile.value = patchedFile - loadingModel.value = true } const exportObjectUrl = useObjectUrl(modelFile) @@ -130,6 +108,8 @@ const exportObjectUrl = useObjectUrl(modelFile) 'bg-white/80 dark:bg-black/75', 'backdrop-blur-lg', ]" + size="sm" + :expand="false" >