//============================================================================================ /** * @brief Updates the pose debug data for the editor pose debugging functionality. * *********************************************************************************************/ public void UpdatePoseDebug() { var playable = m_animationMixer.GetInput(0); if (playable.IsValid()) { MxMPlayableGraph.DestroySubgraph(playable); } transform.SetPositionAndRotation(basePosition, baseRotation); SetupPoseInSlot(ref CurrentAnimData.Poses[m_debugPoseId], 0, 1f); m_animationMixer.SetInputWeight(0, 1f); MxMPlayableGraph.Evaluate(0f); SceneView.RepaintAll(); }
//============================================================================================ /** * @brief Stops pose debugging and destroys the playable graph * *********************************************************************************************/ public void StopPoseDebug() { if (!m_debugPosesActive) { return; } if (m_animData.Length > 0 && m_animData[0] != null) { CurrentAnimData = m_animData[0]; } if (CurrentAnimData != null) { m_debugPosesActive = false; PoseData pose = CurrentAnimData.Poses[0]; AnimationClip clip = CurrentAnimData.Clips[pose.PrimaryClipId]; var clipPlayable = m_animationMixer.GetInput(0); if (!clipPlayable.IsNull()) { m_animationMixer.DisconnectInput(0); clipPlayable.Destroy(); } clipPlayable = AnimationClipPlayable.Create(MxMPlayableGraph, clip); MxMPlayableGraph.Connect(clipPlayable, 0, m_animationMixer, 0); clipPlayable.SetTime(0.0); clipPlayable.SetTime(0.0); MxMPlayableGraph.Evaluate(0f); SceneView.RepaintAll(); MxMPlayableGraph.Destroy(); transform.SetPositionAndRotation(basePosition, baseRotation); } }