/// <summary> /// Instantiates an <see cref="AnimationClip"/>. /// </summary> /// <param name="shouldImportAsOriginalWorkflow">Should import as original workflow.</param> /// <param name="shouldClearAnimationCurves">Should clear animation clip curves.</param> /// <param name="isCallFormModelJson">Is function call form <see cref="CubismModel3Json"/>.</param> /// <param name="poseJson">pose3.json asset.</param> /// <returns>The instantiated clip on success; <see langword="null"/> otherwise.</returns> /// <remarks> /// Note this method generates <see cref="AnimationClip.legacy"/> clips when called at runtime. /// </remarks> public AnimationClip ToAnimationClip(bool shouldImportAsOriginalWorkflow = false, bool shouldClearAnimationCurves = false, bool isCallFormModelJson = false, CubismPose3Json poseJson = null) { // Check béziers restriction flag. if (!Meta.AreBeziersRestricted) { Debug.LogWarning("Béziers are not restricted and curves might be off. Please export motions from Cubism in restricted mode for perfect match."); } // Create animation clip. var animationClip = new AnimationClip { #if UNITY_EDITOR frameRate = Meta.Fps #else frameRate = Meta.Fps, legacy = true, wrapMode = (Meta.Loop) ? WrapMode.Loop : WrapMode.Default #endif }; return(ToAnimationClip(animationClip, shouldImportAsOriginalWorkflow, shouldClearAnimationCurves, isCallFormModelJson, poseJson)); }