From 92ae0c07307bca56704e7f0ea4714f96778ada0f Mon Sep 17 00:00:00 2001 From: Lilia_Chen Date: Thu, 14 Aug 2025 15:15:21 +0100 Subject: [PATCH] feat(stage-ui): Switch between hemisphere light and sky box (#357) --- .../stage-ui/src/components/Layouts/Tabs.vue | 146 ++++++++++++++++++ .../stage-ui/src/components/Layouts/index.ts | 1 + .../Scenarios/Settings/ModelSettings/VRM.vue | 108 +++++++++---- .../stage-ui/src/components/Scenes/VRM.vue | 25 +-- .../src/components/Scenes/VRM/Environment.vue | 116 +++++++++++--- .../src/components/Scenes/VRM/Model.vue | 7 +- packages/stage-ui/src/stores/vrm.ts | 11 ++ 7 files changed, 354 insertions(+), 60 deletions(-) create mode 100644 packages/stage-ui/src/components/Layouts/Tabs.vue diff --git a/packages/stage-ui/src/components/Layouts/Tabs.vue b/packages/stage-ui/src/components/Layouts/Tabs.vue new file mode 100644 index 000000000..e8ec0c015 --- /dev/null +++ b/packages/stage-ui/src/components/Layouts/Tabs.vue @@ -0,0 +1,146 @@ + + + + + diff --git a/packages/stage-ui/src/components/Layouts/index.ts b/packages/stage-ui/src/components/Layouts/index.ts index 4ac072c37..eb7b62c1f 100644 --- a/packages/stage-ui/src/components/Layouts/index.ts +++ b/packages/stage-ui/src/components/Layouts/index.ts @@ -1,3 +1,4 @@ export { default as Callout } from './Callout.vue' export { default as PageHeader } from './PageHeader.vue' export { default as Section } from './Section.vue' +export { default as Tabs } from './Tabs.vue' diff --git a/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/VRM.vue b/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/VRM.vue index bfeee1aed..7876e8358 100644 --- a/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/VRM.vue +++ b/packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/VRM.vue @@ -7,7 +7,7 @@ import { useI18n } from 'vue-i18n' import { useVRM } from '../../../../stores' import { Container, PropertyColor, PropertyNumber, PropertyPoint } from '../../../DataPane' -import { Callout } from '../../../Layouts' +import { Callout, Tabs } from '../../../Layouts' import { Button } from '../../../Misc' import { ColorPalette } from '../../../Widgets' @@ -50,7 +50,10 @@ const { hemisphereLightIntensity, hemisphereSkyColor, hemisphereGroundColor, + + envSelect, } = storeToRefs(vrm) +const { defaultModelUrl } = vrm // 普通字符串 const trackingOptions = computed(() => [ { value: 'camera', label: t('settings.vrm.scale-and-position.eye-tracking-mode.options.option.camera'), class: 'col-start-3' }, @@ -72,12 +75,48 @@ const urlRef = computed({ }, }) -function handleUrlLoad() { - const parsedUrl = new URL(urlRef.value, 'https://example.com') - if (parsedUrl.origin === 'https://example.com') { - modelUrl.value = urlRef.value +async function handleUrlLoad() { + const raw = (modelUrl.value || '').trim() + // If empty input, reset to default + if (!raw) { + modelFile.value = null + urlRef.value = defaultModelUrl + return } + // 3) parse URL + let parsedUrl: URL + try { + parsedUrl = new URL(raw, window.location.origin) + } + catch { + console.warn('Illegal URL input') + return + } + if (!['http:', 'https:', 'blob:', 'data:'].includes(parsedUrl.protocol)) + return + + modelUrl.value = parsedUrl.href } + +// switch between hemisphere light and sky box +const tabList = [ + { + value: 'hemisphere', + label: 'Hemisphere', + icon: { + idle: 'i-solar:forbidden-circle-linear rotate-45', + active: 'i-solar:forbidden-circle-bold rotate-45', + }, + }, + { + value: 'skyBox', + label: 'SkyBox', + icon: { + idle: 'i-solar:gallery-circle-linear', + active: 'i-solar:gallery-circle-bold', + }, + }, +]