Skip to content

Commit 8b03c8f

Browse files
committed
fix(stage-ui): selectedMotionGroup can be empty string (fix #870)
1 parent 0771100 commit 8b03c8f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • packages/stage-ui/src/components/scenes/live2d

packages/stage-ui/src/components/scenes/live2d/Model.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async function loadModel() {
255255
const selectedMotionIndex = localStorage.getItem('selected-runtime-motion-index')
256256
257257
// Configure the selected motion to loop
258-
if (selectedMotionGroup && selectedMotionIndex) {
258+
if (selectedMotionGroup !== null && selectedMotionIndex) {
259259
const groupIndex = (motionManager.groups as Record<string, any>)[selectedMotionGroup]
260260
if (groupIndex !== undefined && motionManager.motionGroups[groupIndex]) {
261261
const motionIndex = Number.parseInt(selectedMotionIndex)
@@ -268,7 +268,7 @@ async function loadModel() {
268268
}
269269
}
270270
271-
if (selectedMotionGroup && selectedMotionIndex && live2dIdleAnimationEnabled.value) {
271+
if (selectedMotionGroup !== null && selectedMotionIndex && live2dIdleAnimationEnabled.value) {
272272
setTimeout(() => {
273273
console.info('Playing selected runtime motion:', selectedMotionGroup, selectedMotionIndex)
274274
currentMotion.value = {
@@ -322,7 +322,7 @@ async function loadModel() {
322322
const selectedMotionGroup = localStorage.getItem('selected-runtime-motion-group')
323323
const selectedMotionIndex = localStorage.getItem('selected-runtime-motion-index')
324324
325-
if (selectedMotionGroup && selectedMotionIndex && live2dIdleAnimationEnabled.value) {
325+
if (selectedMotionGroup !== null && selectedMotionIndex && live2dIdleAnimationEnabled.value) {
326326
// Restart the selected runtime motion immediately for seamless looping
327327
console.info('Motion finished, restarting runtime motion:', selectedMotionGroup, selectedMotionIndex)
328328
// Use requestAnimationFrame to restart on the next frame for smooth transition

0 commit comments

Comments
 (0)