private void InitController()
{
if ((this.m_AvatarPreview != null) && (this.m_AvatarPreview.Animator != null))
{
if (this.m_Controller == null)
{
this.m_Controller = new UnityEditor.Animations.AnimatorController();
this.m_Controller.pushUndo = false;
this.m_Controller.hideFlags = HideFlags.HideAndDontSave;
this.m_Controller.AddLayer("preview");
this.m_StateMachine = this.m_Controller.layers[0].stateMachine;
this.m_StateMachine.pushUndo = false;
this.m_StateMachine.hideFlags = HideFlags.HideAndDontSave;
if (this.m_ClipInfo != null)
{
this.InitMask();
UnityEditor.Animations.AnimatorControllerLayer[] layers = this.m_Controller.layers;
layers[0].avatarMask = this.m_Mask;
this.m_Controller.layers = layers;
}
}
if (this.m_State == null)
{
this.m_State = this.m_StateMachine.AddState("preview");
this.m_State.pushUndo = false;
UnityEditor.Animations.AnimatorControllerLayer[] layerArray2 = this.m_Controller.layers;
this.m_State.motion = this.m_Clip;
this.m_Controller.layers = layerArray2;
this.m_State.iKOnFeet = this.m_AvatarPreview.IKOnFeet;
this.m_State.hideFlags = HideFlags.HideAndDontSave;
}
UnityEditor.Animations.AnimatorController.SetAnimatorController(this.m_AvatarPreview.Animator, this.m_Controller);
if (UnityEditor.Animations.AnimatorController.GetEffectiveAnimatorController(this.m_AvatarPreview.Animator) != this.m_Controller)
{
UnityEditor.Animations.AnimatorController.SetAnimatorController(this.m_AvatarPreview.Animator, this.m_Controller);
}
}
}