public void ReplaceAnimation(WorkspaceAnimation animation, Animator animator, int id, int overrideIndex, int resampleCount, bool linear, bool EulerFilter, double filterPrecision, string method, int insertPos, bool negateQuaternions, double filterTolerance) { AnimationClip clip = Parser.m_AnimationClips[id].instance; if (overrideIndex >= 0) { AnimatorOverrideController animatorOverride = (AnimatorOverrideController)Parser.file.Components[overrideIndex]; clip = GetOverrideClip(clip, animatorOverride); } var replaceMethod = (ReplaceAnimationMethod)Enum.Parse(typeof(ReplaceAnimationMethod), method); Operations.ReplaceAnimation(animation, animator, clip, resampleCount, linear, EulerFilter, (float)filterPrecision, replaceMethod, insertPos, negateQuaternions, (float)filterTolerance); uint clipNameID = Animator.StringToHash(clip.m_Name); for (int i = 0; i < Parser.m_Controller.m_StateMachineArray.Length; i++) { StateMachineConstant stateMachine = Parser.m_Controller.m_StateMachineArray[i]; for (int j = 0; j < stateMachine.m_StateConstantArray.Count; j++) { StateConstant state = stateMachine.m_StateConstantArray[j]; if (state.m_NameID == clipNameID) { state.m_Speed = 1; i = Parser.m_Controller.m_StateMachineArray.Length; break; } } } Changed = true; }
public void ReplaceAnimation(WorkspaceAnimation animation, Animator animator, int id, int resampleCount, bool linear, bool EulerFilter, double filterPrecision, string method, int insertPos, bool negateQuaternions, double filterTolerance) { AnimationClip clip = id < 0 ? Parser.m_Animation.instance : Parser.m_Animations[id].instance; var replaceMethod = (ReplaceAnimationMethod)Enum.Parse(typeof(ReplaceAnimationMethod), method); Operations.ReplaceAnimation(animation, animator, clip, resampleCount, linear, EulerFilter, (float)filterPrecision, replaceMethod, insertPos, negateQuaternions, (float)filterTolerance); Changed = true; }