예제 #1
0
    public void SetUpTrackProperties(AnimatedObject aObj, Vector3 trackPosition, Timeline t, int i, Material unselectedCol, Material selectedCol)
    {
        animatedObject = aObj;
        timeline       = t;
        aObj.beizerPathGroup.beizerPathData.animTrack = this;

        transform.parent        = timeline.transform;
        transform.localPosition = trackPosition;

        clip          = new AnimationClip();
        clip.name     = $"FunClip {i}";
        clip.wrapMode = WrapMode.Loop;
        Debug.Log("wrapMode " + clip.wrapMode);

        unselectedColor = unselectedCol;
        selectedColor   = selectedCol;

        AnimationClipSettings tSettings = AnimationUtility.GetAnimationClipSettings(clip);

        Debug.Log(tSettings.loopTime);
        tSettings.loopTime = true;
        Debug.Log(tSettings.loopTime);

        AnimationUtility.SetAnimationClipSettings(clip, tSettings);


        AssetDatabase.CreateAsset(clip, $"Assets/clip_{i}.anim");
        animCurve           = ScriptableObject.CreateInstance <AnimCurve>();
        animCurve.clip      = clip;
        animCurve.animTrack = this;
        animCurve.SetupAnimationCurves();
        timeline.trackSectionData.ConnectTracksToPlayableGraph(clip, animatedObject.GetComponent <Animator>());
        SubscribeToAnimationEvents();

        Debug.Log(animCurve);
    }