void Restore() { if (animator != null) { animator.runtimeAnimatorController = wasController; animator.applyRootMotion = wasRootMotion; animator.cullingMode = wasCullingMode; animator.enabled = wasEnabled; } #if UNITY_2017_1_OR_NEWER if (graph.IsValid()) { graph.Destroy(); } #elif UNITY_5_6_OR_NEWER if (graph.IsValid()) { graph.Destroy(); } #else mixerPlayable.Destroy(); if (Application.isPlaying && animator.runtimeAnimatorController != null) { RestoreAnimatorInfo(); } #endif }
/************************************************************************************************************************/ #endif /************************************************************************************************************************/ /// <summary> /// Called by Unity when this component is first created. /// <para></para> /// Initialises everything needed to play the <see cref="Clip"/>. /// </summary> private void Awake() { if (_Clip == null || _Animator == null) { return; } if (_Graph.IsValid()) { _Graph.Destroy(); } _Playable = AnimationPlayableUtilities.PlayClip(_Animator, _Clip, out _Graph); _Playable.SetSpeed(_Speed); if (!_FootIK) { _Playable.SetApplyFootIK(false); } if (!_Clip.isLooping) { _Playable.SetDuration(_Clip.length); } }
void ResetAnim() { m_Graph.Destroy(); m_Handles.Dispose(); m_BoneWeights.Dispose(); OnEnable(); }
public void StopPreviewing() { IsShowingPreview = false; previewGraph.Destroy(); animationPlayer.gameObject.GetComponent <Animator>().Update(0f); }
void OnApplicationQuit() { if (haveGraph) { graph.Destroy(); } haveGraph = false; }
public void PlayClip(AnimationClip c, bool randomStart) { if (playableGraph.IsValid()) { playableGraph.Destroy(); } clip = c; Play(randomStart); }
private void Reset() { if (m_Graph.IsValid()) { m_Graph.Destroy(); } m_Initialized = false; }
private void OnDestroy() { if (graph.IsValid()) { graph.Destroy(); } }
void OnDisable() { if (playableGraph.IsValid()) { playableGraph.Destroy(); } }
private void OnDisable() { if (m_graph.IsValid()) { m_graph.Destroy(); } }
public override void OnPlayableDestroy(Playable playable) { if (playableGraph.IsValid()) { playableGraph.Destroy(); } }
void OnDisable() { m_Graph.Destroy(); emptyGraph.Destroy(); m_Handles.Dispose(); m_BoneWeights.Dispose(); }
public void Release() { if (_playableGraph.IsValid()) { _playableGraph.Destroy(); } }
public void Release() { #if UNITY_2018_3_OR_NEWER #if VERYANIMATION_ANIMATIONRIGGING if (m_RigBuilder != null) { m_RigBuilder.StopPreview(); } if (m_VARigBuilder != null) { m_VARigBuilder.StopPreview(); } #endif if (m_PlayableGraph.IsValid()) { m_PlayableGraph.Destroy(); } #else if (animator != null) { animator.enabled = true; //In order to avoid the mysterious behavior where an event is called from "UnityEditor.Handles: DrawCameraImpl", it is invalid except when updating } #endif #region Save if (animator != null) { animator.fireEvents = saveFireEvents; } #endregion animationClipValueSave.ResetValue(); transformPoseSave.ResetOriginalTransform(); blendShapeWeightSave.ResetOriginalWeight(); }
/// <summary> /// This function is called when the MonoBehaviour will be destroyed. /// </summary> void OnDestroy() { if (_playableGraph.IsValid()) { _playableGraph.Destroy(); } }
public void Dispose() { if (m_Graph.IsValid()) { m_Graph.Destroy(); } }
void OnDisable() { // Destroys all Playables and Outputs created by the graph. playableGraph.Destroy(); }
public void OnDestroy() { if (graph.IsValid()) { graph.Destroy(); } }
protected void Cleanup() { if (graph.IsValid()) { graph.Stop(); } if (mixerCoroutine != null) { StopCoroutine(mixerCoroutine); mixerCoroutine = null; } if (currentPlayable.IsValid()) { currentPlayable.Destroy(); } if (previousPlayable.IsValid()) { previousPlayable.Destroy(); } if (mixer.IsValid()) { mixer.Destroy(); } if (graph.IsValid()) { graph.Destroy(); } }
private void OnDestroy() { if (playableGraph.IsValid()) { playableGraph.Destroy(); } }
/// <summary> /// Use animation Playables API to control keyed values, blended between the first frame of 2 animation clips. /// </summary> /// <param name="valueForAdaptationCurve">A value to evaluate into adaptation curve producing a real blend value for 2 clips.</param> /// <param name="animator">The control target for animation playables. The clips used must be able to control the keyed fields traveling down from this animator component.</param> public void Adapt(float valueForAdaptationCurve, Animator animator) { if (!Adaptable) { return; } float blend = adaptationCurve.Evaluate(valueForAdaptationCurve); //Connect up a playable graph, evaluate once, then we're done with them. PlayableGraph pg = PlayableGraph.Create("AdaptationGraph"); pg.SetTimeUpdateMode(DirectorUpdateMode.Manual); var mixer = AnimationMixerPlayable.Create(pg, 2, normalizeWeights: true); //Not sure if the mixer should be "cross fade" like this, or should we do 0~1 weight over 1 weight? //But I think that's for AnimationLayerMixerPlayable ? mixer.SetInputWeight(inputIndex: 0, weight: 1 - blend); mixer.SetInputWeight(inputIndex: 1, weight: blend); var normalStateAcp = AnimationClipPlayable.Create(pg, normalState); var fullyAdaptedStateAcp = AnimationClipPlayable.Create(pg, fullyAdaptedState); pg.Connect(normalStateAcp, sourceOutputPort: 0, mixer, destinationInputPort: 0); pg.Connect(fullyAdaptedStateAcp, sourceOutputPort: 0, mixer, destinationInputPort: 1); var output = AnimationPlayableOutput.Create(pg, "AdaptationGraphOutput", animator); output.SetSourcePlayable(mixer); pg.Evaluate(); pg.Destroy(); }
void OnDestroy() { if (_graph.IsValid()) { _graph.Destroy(); } }
public void OnDestroy() { if (m_Graph.IsValid()) { m_Graph.Destroy(); } }
private void OnDestroy() { #if UNITY_EDITOR GraphVisualizerClient.Hide(_graph); #endif _graph.Destroy(); }
void OnDisable() { if (m_PlayableGraph.IsValid()) { m_AnimGraph.Shutdown(); m_PlayableGraph.Destroy(); } }
protected virtual void OnDestroy() { if (_graph.IsValid()) { _graph.Stop(); _graph.Destroy(); } }
/// <summary> /// Called by Unity. /// </summary> private void OnDisable() { // Destroy _playableGrap. if (_playableGrap.IsValid()) { _playableGrap.Destroy(); } }
void OnDestroy() { // Destroys all Playables and Outputs created by the graph. if (playableGraph.IsValid()) { playableGraph.Destroy(); } }
//... protected override void OnExit() { if (isMasterTrack) { animator.applyRootMotion = wasRootMotion; animator.cullingMode = wasCullingMode; if (graph.IsValid()) { graph.Destroy(); } if (useRootMotion) { ApplyBakedRootMotion(endTime - startTime); } } }
void DisposeGraph() { if (g.IsValid()) { g.Stop(); g.Destroy(); } }