bill il y a 4 mois
Parent
commit
65538be5b1
3 fichiers modifiés avec 19 ajouts et 4 suppressions
  1. 2 0
      src/sdk/sdk.ts
  2. 0 3
      src/views/animation/index.vue
  3. 17 1
      src/views/animation/right/action.vue

+ 2 - 0
src/sdk/sdk.ts

@@ -472,6 +472,8 @@ export type AnimationModelAction3D = {
   changeSpeed: (n: number) => void;
   // 修改动持续时间 单位为秒
   changeDuration: (n: number) => void;
+
+  chose: (b: boolean) => void
 };
 
 export type AnimationModelPath3D = {

+ 0 - 3
src/views/animation/index.vue

@@ -98,9 +98,6 @@ const activeAttrib = ref<Active>();
 
 const follow = ref(false);
 const frameAction = ref<string>();
-watchEffect(() => {
-  console.error("floow", follow.value || play.value);
-});
 
 const amM = computed(() => focusAM.value && amMap[getAMKey(focusAM.value)]);
 

+ 17 - 1
src/views/animation/right/action.vue

@@ -54,7 +54,7 @@ import { Slider, TabPane, Tabs } from "ant-design-vue";
 import { AnimationModel, AnimationModelAction } from "@/api";
 import SignItem from "@/views/tagging-position/sign-item.vue";
 import { amMap } from "@/sdk/association/animation";
-import { computed, ref } from "vue";
+import { computed, ref, watch, watchEffect } from "vue";
 import { round } from "@/utils";
 
 const props = defineProps<{ data: AnimationModelAction; am: AnimationModel }>();
@@ -67,6 +67,22 @@ const dur = computed(() => {
     return action?.duration / props.data.speed;
   }
 });
+
+watch(
+  () => amMap[props.am.id]?.actions[props.data.id],
+  (action, _, onCleanup) => {
+    console.log(action);
+    if (action) {
+      console.log("chose", true);
+      action.chose && action.chose(true);
+      onCleanup(() => {
+        action.chose && action.chose(false);
+        console.log("chose", false);
+      });
+    }
+  },
+  { immediate: true }
+);
 </script>
 
 <style scoped lang="scss">