bill 1 месяц назад
Родитель
Сommit
748dcbb2c5

+ 1 - 1
src/components/static-preview/resource.vue

@@ -51,7 +51,7 @@ const props = defineProps<{
 
 const url = computed(() =>
   typeof props.data === "string"
-    ? getResource(props.data)
+    ? getResources(props.data)
     : URL.createObjectURL(props.data)
 );
 

+ 2 - 2
src/components/static-preview/sign.vue

@@ -8,7 +8,7 @@
 
 <script lang="ts" setup>
 import { ref, watchEffect } from "vue";
-import { getResource } from "@/env";
+import { getResource, getResources } from "@/env";
 import ResourceView from "./resource.vue";
 import type { MediaItem } from "./index.vue";
 
@@ -18,7 +18,7 @@ defineEmits<{ (e: "close", v: boolean): void }>();
 const staticURL = ref("");
 watchEffect(() => {
   const data = props.media.url;
-  const url = typeof data === "string" ? getResource(data) : URL.createObjectURL(data);
+  const url = typeof data === "string" ? getResources(data) : URL.createObjectURL(data);
 
   staticURL.value = url;
   return () => URL.revokeObjectURL(url);

+ 3 - 2
src/components/tagging/sign-new.vue

@@ -108,7 +108,7 @@ const [posStyle, pos, pause, recovery] = usePixel(() => undefined);
 
 const queryItems = computed(() =>
   props.tagging.images.map((image) => ({
-    url: getResource(getFileUrl(image)),
+    url: getResources(getFileUrl(image)),
   }))
 );
 console.log(props.tagging.styleId);
@@ -130,7 +130,8 @@ tag.showDelete = (show) => {
 tag.changeCanMove(false);
 
 const changePos = () => {
-  pos.value = { localPos: tag.getImageCenter(), modelId: props.scenePos.modelId };
+  const old = { localPos: tag.getImageCenter(), modelId: props.scenePos.modelId };
+  console.log(pos.value, old);
 };
 
 watch(taggingStyle, (icon) => icon && tag.changeImage(getFileUrl(icon.icon)));

+ 4 - 4
src/components/tagging/sign.vue

@@ -10,7 +10,7 @@
     <ui-tip :tip="tagging.title" foreShow tipV="top" class="tag-tip">
       <img
         class="tag-img"
-        :src="getResource(getFileUrl(taggingStyle.icon))"
+        :src="getResources(getFileUrl(taggingStyle.icon))"
         @click="iconClickHandler"
         v-if="taggingStyle"
       />
@@ -21,7 +21,7 @@
         <ui-audio
           v-if="tagging.audio"
           class="audio"
-          :src="getResource(getFileUrl(tagging.audio))"
+          :src="getResources(getFileUrl(tagging.audio))"
           ref="audio"
         />
         <div class="content">
@@ -65,7 +65,7 @@ import Preview from "../static-preview/index.vue";
 import { getTaggingStyle, getFuseModel } from "@/store";
 import { getFileUrl, MetaType } from "@/utils";
 import { sdk } from "@/sdk";
-import { custom, getResource } from "@/env";
+import { custom, getResource, getResources } from "@/env";
 import { useViewStack } from "@/hook";
 
 import type { Tagging, TaggingPosition } from "@/store";
@@ -116,7 +116,7 @@ const isHover = ref(false);
 const queryItems = computed(() =>
   props.tagging.images.map((image) => ({
     type: MetaType.image,
-    url: getResource(getFileUrl(image)),
+    url: getResources(getFileUrl(image)),
   }))
 );
 

+ 0 - 1
src/env/index.ts

@@ -197,7 +197,6 @@ export const getResources = (uri: string) => {
 
   const baseURL = new URL(root);
   const url = new URL(uri, root);
-  console.log(root, uri);
   const basePath =
     baseURL.pathname[baseURL.pathname.length - 1] === "/"
       ? baseURL.pathname.substring(0, baseURL.pathname.length - 1)

+ 2 - 2
src/lang/locales/en.json

@@ -312,8 +312,8 @@
       "rotation": "Rotate icon",
       "scale": "Icon size",
       "type": "Icon placement method",
-      "typeVal[0]": "Hover",
-      "typeVal[1]": "Attach",
+      "typeVal0": "Hover",
+      "typeVal1": "Attach",
       "visibilityRange": "Visible range"
     },
     "posTip": "Click on the model to select the tag position.",

+ 2 - 2
src/lang/locales/ja.json

@@ -309,8 +309,8 @@
       "rotation": "アイコン回転",
       "scale": "アイコンサイズ",
       "type": "アイコン配置方法",
-      "typeVal[0]": "浮遊",
-      "typeVal[1]": "地面/壁面",
+      "typeVal0": "浮遊",
+      "typeVal1": "地面/壁面",
       "visibilityRange": "表示範囲"
     },
     "posTip": "モデル上をクリックしてタグ位置を選択してください",

+ 2 - 2
src/lang/locales/ko.json

@@ -309,8 +309,8 @@
       "rotation": "회전 아이콘",
       "scale": "아이콘 크기",
       "type": "아이콘 배치 방법",
-      "typeVal[0]": "부유하다",
-      "typeVal[1]": "땅/벽에 붙이다",
+      "typeVal0": "부유하다",
+      "typeVal1": "땅/벽에 붙이다",
       "visibilityRange": "시야 범위"
     },
     "posTip": "모델 위에서 클릭하여 라벨 위치를 선택해 주세요",

+ 2 - 2
src/lang/locales/zh.json

@@ -381,8 +381,8 @@
       "rotation": "旋转图标",
       "scale": "图标大小",
       "type": "图标放置方式",
-      "typeVal[0]": "悬浮",
-      "typeVal[1]": "贴地/墙",
+      "typeVal0": "悬浮",
+      "typeVal1": "贴地/墙",
       "visibilityRange": "可见范围"
     },
     "posTip": "请在模型上单击选择标签位置",

+ 3 - 2
src/layout/edit/scene-select.vue

@@ -93,7 +93,7 @@ import {
 } from "@/store";
 
 import { fetchScenesAll, SceneType, uploadMaterialToModel, type Scene } from "@/api";
-import { activeModel, getSceneModel } from "@/sdk";
+import { activeModel, getSceneModel, sceneModelMap } from "@/sdk";
 import { selectMaterials, selectMaterials1 } from "@/components/materials/quisk";
 import { lang, ui18n } from "@/lang";
 import { custom } from "@/env";
@@ -205,7 +205,7 @@ const addModelHandler = createLoadPack(async (attachs: any[]) => {
       attach
     }
   });
-  const addPromises = items.map(item => addFuseModel(item.data, item.attach));
+  const addPromises = items.map(item => addFuseModel(item.data, item.attach).then(data => item.data = data));
 
   const addModels = await Promise.all(addPromises);
   await new Promise<void>((resolve) => {
@@ -222,6 +222,7 @@ const addModelHandler = createLoadPack(async (attachs: any[]) => {
   });
 
   items.forEach(item => {
+    console.error('--->', item, getSceneModel(item.data), sceneModelMap)
     if (getSceneModel(item.data)) {
       item.data.rotation = getSceneModel(item.data)!.getDefaultRotation();
     }

+ 0 - 6
src/layout/model-list/index.vue

@@ -34,12 +34,6 @@ import { flyModel } from "@/hook/use-fly";
 import { sdk } from "@/sdk/sdk";
 import { ui18n } from "@/lang";
 
-watchEffect(
-  () => {
-    console.error("modeChange", custom.showMode);
-  },
-  { flush: "sync" }
-);
 export type ModelListProps = {
   title?: string;
   canChange?: boolean;

+ 2 - 2
src/sdk/association/animation.ts

@@ -33,7 +33,7 @@ import { Size } from "@/components/drawing/dec";
 import router, { RoutesName } from "@/router";
 import { isEdit, isTemploraryID, paths } from "@/store";
 import { Color } from "three";
-import { custom, getResource, showAMsStack } from "@/env";
+import { custom, getResource, getResources, showAMsStack } from "@/env";
 
 export let animationGroup: AnimationGroup;
 export const getAMKey = (am: AnimationModel) => am.key || am.id;
@@ -76,7 +76,7 @@ export const addAM = (data: AnimationModel): Promise<AnimationModel3D> => {
         };
         const am = animationGroup.addAnimationModel({
           ...data,
-          url: getResource(data.url),
+          url: getResources(data.url),
           quaAtPath: data.mat?.quaAtPath,
         });
         am.bus.on("loadDone", () => {

+ 1 - 1
src/sdk/association/fuseMode.ts

@@ -25,7 +25,7 @@ import { currentLayout, RoutesName } from "@/router";
 import { unsetFactory } from "@/utils/unset";
 import { getTaggingPosNode, taggingGroup } from "./tagging";
 
-const us = unsetFactory()
+export const us = unsetFactory()
 
 // -----------------模型关联--------------------
 

+ 5 - 4
src/store/sys.ts

@@ -6,6 +6,7 @@ import { useViewStack } from "@/hook";
 import type { UnwrapRef } from "vue";
 import { currentMeta } from "@/router";
 import { ui18n } from "@/lang";
+import { stackVar } from "@/components/drawing/hook";
 
 const Flags = {
   EDIT: 0b10,
@@ -100,11 +101,11 @@ export type AutoSetModeSetting<T> = {
   recovery?: () => void;
 };
 
-let isUnset = false;
+export let isUnset = stackVar(false);
 export const unSetModelUpdate = (run: () => void) => {
-  isUnset = true;
+  const pop = isUnset.push(true)
   run();
-  nextTick(() => (isUnset = false));
+  nextTick(pop);
 };
 export const autoSetModeCallback = <T extends object>(
   current: T,
@@ -137,7 +138,7 @@ export const autoSetModeCallback = <T extends object>(
   };
 
   const handler = (newv: UnwrapRef<T>, oldv?: UnwrapRef<T>) => {
-    if (isSave || isUnset || isLeaveIng) return;
+    if (isSave || isUnset.value || isLeaveIng) return;
     if (!setting.isUpdate || setting.isUpdate(newv, oldv)) {
       isEdit.value || enterEdit();
       isOld.value || enterOld();

+ 5 - 3
src/utils/unset.ts

@@ -1,17 +1,19 @@
+import { isUnset as isStoreUnset } from "@/store";
 import { nextTick } from "vue";
 
 export const unsetFactory = () => {
   let isUnSet = false;
+  
   const unSet = (fn: () => void) => {
-    console.error("unset");
+    const pop = isStoreUnset.push(true)
     isUnSet = true;
     fn();
-    nextTick(() => (isUnSet = false));
+    nextTick(pop)
   };
 
   return {
     get isUnSet() {
-      return isUnSet
+      return isStoreUnset.value
     },
     unSet
   }

+ 1 - 2
src/views/guide/guide/edit-paths.vue

@@ -71,8 +71,7 @@
               class="path-animation"
               v-if="path.playAnimation"
             />
-
-            <img :src="getResource(getFileUrl(path.cover))" />
+            <img :src="getResources(getFileUrl(path.cover))" />
           </div>
           <div class="set-phone-attr" v-if="i !== paths.length - 1">
             <ui-input

+ 1 - 1
src/views/record/shot.vue

@@ -181,7 +181,7 @@ export default defineComponent({
         const existsVideos = [];
 
         if (props.record.url) {
-          existsVideos.push(getResource(props.record.url));
+          existsVideos.push(getResources(props.record.url));
         }
         const fragmentBlobs = getRecordFragmentBlobs(props.record);
         existsVideos.push(...fragmentBlobs, ...blobs);

+ 1 - 1
src/views/record/sign.vue

@@ -124,7 +124,7 @@ export default defineComponent({
       rename: () => (isEditTitle.value = true),
       play: () => (isPlayVideo.value = true),
       download() {
-        const url = getResource(props.record.url!);
+        const url = getResources(props.record.url!);
         const ext = getExtname(url) || "mp4";
         loadPack(saveAs(url, `${props.record.title}.${ext}`));
       },

+ 3 - 3
src/views/tagging-position/sign.vue

@@ -16,14 +16,14 @@
             :value="TaggingPositionType['2d']"
             size="middle"
           >
-            {{$t('tagging.posTabs.typeVal[0]')}}
+            {{ $t("tagging.posTabs.typeVal0") }}
           </RadioButton>
           <RadioButton
             style="width: 50%; text-align: center"
             :value="TaggingPositionType['3d']"
             size="middle"
           >
-            {{$t('tagging.posTabs.typeVal[1]')}}
+            {{ $t("tagging.posTabs.typeVal1") }}
           </RadioButton>
         </RadioGroup>
       </SignItem>
@@ -80,7 +80,7 @@
         </template>
       </SignItem>
       <Button block type="primary" danger ghost size="large" @click="$emit('delete')">
-        {{$t('sys.del')}}
+        {{ $t("sys.del") }}
       </Button>
     </div>
   </CollapsePanel>

+ 1 - 1
src/views/tagging/hot/sign.vue

@@ -75,7 +75,7 @@ const emit = defineEmits<{
 
 const findImage = computed(() => {
   let img = props.tagging.images.find(
-    (a) => getUrlType(getResource(getFileUrl(a))) === MetaType.image
+    (a) => getUrlType(getResources(getFileUrl(a))) === MetaType.image
   );
   if (!img) {
     return getTaggingStyle(props.tagging.styleId)?.icon;

+ 1 - 1
src/views/view/sign.vue

@@ -2,7 +2,7 @@
   <ui-group-option class="sign" :class="{ active, search }">
     <div class="content">
       <span class="cover" @click="flyView(view)">
-        <img :src="getResource(getFileUrl(view.cover))" alt="" />
+        <img :src="getResources(getFileUrl(view.cover))" alt="" />
       </span>
       <ui-input
         class="view-title-input"