protected override void RenameEnded()
        {
            string name     = !string.IsNullOrEmpty(base.GetRenameOverlay().name) ? base.GetRenameOverlay().name : base.GetRenameOverlay().originalName;
            int    userData = base.GetRenameOverlay().userData;

            if (base.GetRenameOverlay().userAcceptedRename)
            {
                ObjectNames.SetNameSmartWithInstanceID(userData, name);
                TreeViewItem item = base.m_TreeView.data.FindItem(userData);
                if (item != null)
                {
                    item.displayName = name;
                }
                EditorApplication.RepaintAnimationWindow();
            }
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            bool     flag     = base.targets.Length > 1;
            Animator animator = this.target as Animator;

            base.serializedObject.UpdateIfDirtyOrScript();
            this.UpdateShowOptions();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(this.m_Controller, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                EditorApplication.RepaintAnimationWindow();
            }
            EditorGUILayout.PropertyField(this.m_Avatar, new GUILayoutOption[0]);
            if (animator.supportsOnAnimatorMove && !flag)
            {
                EditorGUILayout.LabelField("Apply Root Motion", "Handled by Script", new GUILayoutOption[0]);
            }
            else
            {
                EditorGUILayout.PropertyField(this.m_ApplyRootMotion, AnimatorInspector.styles.applyRootMotion, new GUILayoutOption[0]);
                if (Event.current.type == EventType.Layout)
                {
                    this.m_IsRootPositionOrRotationControlledByCurves = animator.isRootPositionOrRotationControlledByCurves;
                }
                if (!this.m_ApplyRootMotion.boolValue && this.m_IsRootPositionOrRotationControlledByCurves)
                {
                    EditorGUILayout.HelpBox("Root position or rotation are controlled by curves", MessageType.Info, true);
                }
            }
            EditorGUILayout.PropertyField(this.m_UpdateMode, AnimatorInspector.styles.updateMode, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_CullingMode, AnimatorInspector.styles.cullingMode, new GUILayoutOption[0]);
            if (!flag)
            {
                EditorGUILayout.HelpBox(animator.GetStats(), MessageType.Info, true);
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowWarningMessage.faded))
            {
                EditorGUILayout.HelpBox(this.WarningMessage, MessageType.Warning, true);
            }
            EditorGUILayout.EndFadeGroup();
            base.serializedObject.ApplyModifiedProperties();
        }
        override protected void RenameEnded()
        {
            string name         = string.IsNullOrEmpty(GetRenameOverlay().name) ? GetRenameOverlay().originalName : GetRenameOverlay().name;
            int    instanceID   = GetRenameOverlay().userData;
            bool   userAccepted = GetRenameOverlay().userAcceptedRename;

            if (userAccepted)
            {
                ObjectNames.SetNameSmartWithInstanceID(instanceID, name);

                // Manually set the name so no visual pop happens
                TreeViewItem item = m_TreeView.data.FindItem(instanceID);

                if (item != null)
                {
                    item.displayName = name;
                }

                EditorApplication.RepaintAnimationWindow();
            }
        }