diff --git a/Assets/VRM10/Runtime/Components/VrmAnimationInstance/Vrm10AnimationInstance.cs b/Assets/VRM10/Runtime/Components/VrmAnimationInstance/Vrm10AnimationInstance.cs index 2835f6ab6..dd9475ea4 100644 --- a/Assets/VRM10/Runtime/Components/VrmAnimationInstance/Vrm10AnimationInstance.cs +++ b/Assets/VRM10/Runtime/Components/VrmAnimationInstance/Vrm10AnimationInstance.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using UniGLTF; using UniHumanoid; using UnityEngine; +using UnityEngine.Timeline; namespace UniVRM10 { - public class Vrm10AnimationInstance : MonoBehaviour, IVrm10Animation + public class Vrm10AnimationInstance : MonoBehaviour, IVrm10Animation, ITimeControl { public SkinnedMeshRenderer BoxMan; public void ShowBoxMan(bool enable) @@ -330,5 +331,33 @@ namespace UniVRM10 } } } + + Animation m_animation; + AnimationState m_state; + + public void OnControlTimeStart() + { + m_animation = GetComponent(); + foreach (AnimationState state in m_animation) + { + m_state = state; + break; + } + m_state.speed = 0; + m_state.enabled = true; + m_animation.Play(); + } + + public void OnControlTimeStop() + { + m_animation.Stop(); + m_state = null; + } + + public void SetTime(double time) + { + m_state.time = (float)time; + m_animation.Sample(); + } } } diff --git a/Assets/VRM10/Runtime/VRM10.asmdef b/Assets/VRM10/Runtime/VRM10.asmdef index 5977538c1..decb9b22a 100644 --- a/Assets/VRM10/Runtime/VRM10.asmdef +++ b/Assets/VRM10/Runtime/VRM10.asmdef @@ -9,7 +9,8 @@ "GUID:f2ca1407928ebdc4bbe7765cc278be44", "GUID:2665a8d13d1b3f18800f46e256720795", "GUID:1cd941934d098654fa21a13f28346412", - "GUID:3e5d614bc16b50d41bd94c8d7444ca46" + "GUID:3e5d614bc16b50d41bd94c8d7444ca46", + "GUID:f06555f75b070af458a003d92f9efb00" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef index 619093ce2..c052016e8 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef @@ -7,7 +7,8 @@ "GUID:1cd941934d098654fa21a13f28346412", "GUID:e47c917724578cc43b5506c17a27e9a0", "GUID:308b348fb80d89d42a9620951b0f60db", - "GUID:3e5d614bc16b50d41bd94c8d7444ca46" + "GUID:3e5d614bc16b50d41bd94c8d7444ca46", + "GUID:f06555f75b070af458a003d92f9efb00" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10.Samples.VRM10Viewer.asmdef b/Assets/VRM10_Samples/VRM10Viewer/VRM10.Samples.VRM10Viewer.asmdef index f40e22e2d..b5eb2e01e 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10.Samples.VRM10Viewer.asmdef +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10.Samples.VRM10Viewer.asmdef @@ -6,7 +6,8 @@ "GUID:8d76e605759c3f64a957d63ef96ada7c", "GUID:e47c917724578cc43b5506c17a27e9a0", "GUID:1cd941934d098654fa21a13f28346412", - "GUID:3e5d614bc16b50d41bd94c8d7444ca46" + "GUID:3e5d614bc16b50d41bd94c8d7444ca46", + "GUID:f06555f75b070af458a003d92f9efb00" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Packages/manifest.json b/Packages/manifest.json index f9ea8d730..74a8bf431 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -10,6 +10,7 @@ "com.unity.postprocessing": "3.4.0", "com.unity.render-pipelines.universal": "14.0.11", "com.unity.test-framework": "1.1.33", + "com.unity.timeline": "1.7.6", "com.unity.ugui": "1.0.0", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 505cc4874..60e20e145 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -141,6 +141,18 @@ }, "url": "https://packages.unity.com" }, + "com.unity.timeline": { + "version": "1.7.6", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.ugui": { "version": "1.0.0", "depth": 0, diff --git a/ProjectSettings/TimelineSettings.asset b/ProjectSettings/TimelineSettings.asset new file mode 100644 index 000000000..b21943ab5 --- /dev/null +++ b/ProjectSettings/TimelineSettings.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 53 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a287be6c49135cd4f9b2b8666c39d999, type: 3} + m_Name: + m_EditorClassIdentifier: + assetDefaultFramerate: 60 + m_DefaultFrameRate: 60