//private GenerateActivation() //{ //} private void Initial() { Director = gameObject.GetComponent <PlayableDirector>(); MyTimelineAsset = Director.playableAsset as TimelineAsset; AiueoTrack = GetTrack("AIUEO Label") as LabelTrack; BlinkTrack = GetTrack("Blink Label") as LabelTrack; AiueoShapeTrack = GetTrack("AIUEO") as BlendShapeTrack; BlinkShapeTrack = GetTrack("Blink") as BlendShapeTrack; UpperTeethShapeTracK = GetTrack("UpperTeeth") as BlendShapeTrack; ButtomTeethShapeTracK = GetTrack("ButtomTeeth") as BlendShapeTrack; }
private void AddBlendShapeClip(double start, double duration, BlendShapeTrack track, AnimationCurve[] curves) { TimelineClip timelineClip = track.CreateDefaultClip(); timelineClip.start = start; timelineClip.duration = duration; BlendShapeClip clipAsset = timelineClip.asset as BlendShapeClip; PlayableGraph graph = Director.playableGraph; string[] name = new string[5] { "A", "I", "U", "E", "O" }; if (track.name == "AIUEO") { graph.GetResolver().SetReferenceValue(clipAsset.Mesh.exposedName, GameObject.Find("TKVR01_001_CH_Mesh_Face")); } if (track.name == "UpperTeeth") { graph.GetResolver().SetReferenceValue(clipAsset.Mesh.exposedName, GameObject.Find("TKVR01_001_CH_Mesh_Teeth_upper")); } if (track.name == "ButtomTeeth") { graph.GetResolver().SetReferenceValue(clipAsset.Mesh.exposedName, GameObject.Find("TKVR01_001_CH_Mesh_Teeth_buttom")); } if (track.name == "Blink") { clipAsset.AddShape(new BlendShapeClip.Shape(8, "BlinkBoth", timelineClip, curves[0])); } else if (track.name == "AIUEO") { int startIndex = 11; for (int i = 0; i < 5; i++) { clipAsset.AddShape(new BlendShapeClip.Shape(startIndex + i, name[i], timelineClip, curves[i])); } } else { int startIndex = 8; for (int i = 0; i < 5; i++) { clipAsset.AddShape(new BlendShapeClip.Shape(startIndex + i, name[i], timelineClip, curves[i])); } } }