Example #1
0
        private void SetupWizardOnGUI(Rect position)
        {
            GUI.Label(position, GUIContent.none, AnimationWindowStyles.dopeSheetBackground);
            Rect position2 = new Rect(position.x, position.y, position.width - 15f, position.height - 15f);

            GUI.BeginClip(position2);
            GUI.enabled = true;
            this.m_State.showCurveEditor = false;
            this.m_State.timeArea        = this.m_DopeSheet;
            this.m_State.timeArea.SetShownHRangeInsideMargins(0f, 1f);
            bool flag = this.m_State.activeGameObject && !EditorUtility.IsPersistent(this.m_State.activeGameObject);

            if (flag)
            {
                string     arg       = (this.m_State.activeRootGameObject || this.m_State.activeAnimationClip) ? AnimationWindowStyles.animationClip.text : AnimationWindowStyles.animatorAndAnimationClip.text;
                string     t         = string.Format(AnimationWindowStyles.formatIsMissing.text, this.m_State.activeGameObject.name, arg);
                GUIContent content   = GUIContent.Temp(t);
                Vector2    vector    = GUI.skin.label.CalcSize(content);
                Rect       position3 = new Rect(position2.width * 0.5f - vector.x * 0.5f, position2.height * 0.5f - vector.y * 0.5f, vector.x, vector.y);
                GUI.Label(position3, content);
                Rect position4 = new Rect(position2.width * 0.5f - 35f, position3.yMax + 3f, 70f, 20f);
                if (GUI.Button(position4, AnimationWindowStyles.create))
                {
                    if (AnimationWindowUtility.InitializeGameobjectForAnimation(this.m_State.activeGameObject))
                    {
                        Component closestAnimationPlayerComponentInParents = AnimationWindowUtility.GetClosestAnimationPlayerComponentInParents(this.m_State.activeGameObject.transform);
                        this.m_State.activeAnimationClip = AnimationUtility.GetAnimationClips(closestAnimationPlayerComponentInParents.gameObject)[0];
                    }
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                Color color = GUI.color;
                GUI.color = Color.gray;
                Vector2 vector2   = GUI.skin.label.CalcSize(AnimationWindowStyles.noAnimatableObjectSelectedText);
                Rect    position5 = new Rect(position2.width * 0.5f - vector2.x * 0.5f, position2.height * 0.5f - vector2.y * 0.5f, vector2.x, vector2.y);
                GUI.Label(position5, AnimationWindowStyles.noAnimatableObjectSelectedText);
                GUI.color = color;
            }
            GUI.EndClip();
            GUI.enabled = false;
        }
Example #2
0
        private void SetupWizardOnGUI(Rect position)
        {
            Rect position1 = new Rect(position.x, position.y, position.width - 15f, position.height - 15f);

            GUI.BeginClip(position1);
            GUI.enabled = true;
            this.m_State.showCurveEditor = false;
            this.m_State.timeArea        = (TimeArea)this.m_DopeSheet;
            this.m_State.timeArea.SetShownHRangeInsideMargins(0.0f, 1f);
            if ((bool)((UnityEngine.Object)Selection.activeGameObject) && !EditorUtility.IsPersistent((UnityEngine.Object)Selection.activeGameObject))
            {
                string     str       = (bool)((UnityEngine.Object) this.m_State.activeRootGameObject) || (bool)((UnityEngine.Object) this.m_State.activeAnimationClip) ? AnimationWindowStyles.animationClip.text : AnimationWindowStyles.animatorAndAnimationClip.text;
                GUIContent content   = GUIContent.Temp(string.Format(AnimationWindowStyles.formatIsMissing.text, (object)Selection.activeGameObject.name, (object)str));
                Vector2    vector2   = GUI.skin.label.CalcSize(content);
                Rect       position2 = new Rect((float)((double)position1.width * 0.5 - (double)vector2.x * 0.5), (float)((double)position1.height * 0.5 - (double)vector2.y * 0.5), vector2.x, vector2.y);
                GUI.Label(position2, content);
                if (GUI.Button(new Rect((float)((double)position1.width * 0.5 - 35.0), position2.yMax + 3f, 70f, 20f), AnimationWindowStyles.create) && AnimationWindowUtility.InitializeGameobjectForAnimation(Selection.activeGameObject))
                {
                    this.m_State.activeAnimationClip = AnimationUtility.GetAnimationClips(AnimationWindowUtility.GetClosestAnimationPlayerComponentInParents(Selection.activeGameObject.transform).gameObject)[0];
                    this.m_State.recording           = true;
                    this.m_State.currentTime         = 0.0f;
                    this.m_State.ResampleAnimation();
                }
            }
            else
            {
                Color color = GUI.color;
                GUI.color = Color.gray;
                Vector2 vector2 = GUI.skin.label.CalcSize(AnimationWindowStyles.noAnimatableObjectSelectedText);
                GUI.Label(new Rect((float)((double)position1.width * 0.5 - (double)vector2.x * 0.5), (float)((double)position1.height * 0.5 - (double)vector2.y * 0.5), vector2.x, vector2.y), AnimationWindowStyles.noAnimatableObjectSelectedText);
                GUI.color = color;
            }
            GUI.EndClip();
            GUI.enabled = false;
        }