InAnimationMode() private method

private InAnimationMode ( ) : bool
return bool
Example #1
0
        private void DoPlayButtons(bool isOrWillEnterPlaymode)
        {
            bool isPlaying = EditorApplication.isPlaying;

            GUI.changed = false;
            int num = (!isPlaying) ? 0 : 4;

            if (AnimationMode.InAnimationMode())
            {
                num = 8;
            }
            Color color = GUI.color + new Color(0.01f, 0.01f, 0.01f, 0.01f);

            GUI.contentColor = new Color(1f / color.r, 1f / color.g, 1f / color.g, 1f / color.a);
            GUILayout.Toggle(isOrWillEnterPlaymode, Toolbar.s_PlayIcons[num], "CommandLeft", new GUILayoutOption[0]);
            GUI.backgroundColor = Color.white;
            if (GUI.changed)
            {
                Toolbar.TogglePlaying();
                GUIUtility.ExitGUI();
            }
            GUI.changed = false;
            bool isPaused = GUILayout.Toggle(EditorApplication.isPaused, Toolbar.s_PlayIcons[num + 1], "CommandMid", new GUILayoutOption[0]);

            if (GUI.changed)
            {
                EditorApplication.isPaused = isPaused;
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button(Toolbar.s_PlayIcons[num + 2], "CommandRight", new GUILayoutOption[0]))
            {
                EditorApplication.Step();
                GUIUtility.ExitGUI();
            }
        }
Example #2
0
 public static void AddPropertyModification(EditorCurveBinding binding, PropertyModification modification, bool keepPrefabOverride)
 {
     if (!AnimationMode.InAnimationMode())
     {
         throw new InvalidOperationException("AnimationMode.AddPropertyModification may only be called in animation mode.  See AnimationMode.StartAnimationMode.");
     }
     AnimationMode.Internal_AddPropertyModification(binding, modification, keepPrefabOverride);
 }
Example #3
0
 public static void EndSampling()
 {
     if (!AnimationMode.InAnimationMode())
     {
         throw new InvalidOperationException("AnimationMode.EndSampling may only be called in animation mode.  See AnimationMode.StartAnimationMode.");
     }
     AnimationMode.Internal_EndSampling();
 }
Example #4
0
 public static void SampleAnimationClip(GameObject gameObject, AnimationClip clip, float time)
 {
     if (!AnimationMode.InAnimationMode())
     {
         throw new InvalidOperationException("AnimationMode.SampleAnimationClip may only be called in animation mode.  See AnimationMode.StartAnimationMode.");
     }
     AnimationMode.Internal_SampleAnimationClip(gameObject, clip, time);
 }
Example #5
0
 internal static void RevertPropertyModificationsForGameObject(GameObject gameObject)
 {
     if (!AnimationMode.InAnimationMode())
     {
         throw new InvalidOperationException("AnimationMode.RevertPropertyModificationsForGameObject may only be called in animation mode.  See AnimationMode.StartAnimationMode.");
     }
     AnimationMode.Internal_RevertPropertyModificationsForGameObject(gameObject);
 }
Example #6
0
 internal static void RevertPropertyModificationsForObject(UnityEngine.Object target)
 {
     if (!AnimationMode.InAnimationMode())
     {
         throw new InvalidOperationException("AnimationMode.RevertPropertyModificationsForObject may only be called in animation mode.  See AnimationMode.StartAnimationMode.");
     }
     AnimationMode.Internal_RevertPropertyModificationsForObject(target);
 }
Example #7
0
 internal static void StartCandidateRecording(UnityEngine.Object driver)
 {
     if (!AnimationMode.InAnimationMode())
     {
         throw new InvalidOperationException("AnimationMode.StartCandidateRecording may only be called in animation mode.  See AnimationMode.StartAnimationMode.");
     }
     AnimationMode.Internal_StartCandidateRecording(driver);
 }
Example #8
0
 internal static void InitializePropertyModificationForObject(UnityEngine.Object target, AnimationClip clip)
 {
     if (!AnimationMode.InAnimationMode())
     {
         throw new InvalidOperationException("AnimationMode.InitializePropertyModificationForObject may only be called in animation mode.  See AnimationMode.StartAnimationMode.");
     }
     AnimationMode.Internal_InitializePropertyModificationForObject(target, clip);
 }
Example #9
0
        // Main editor window
        public void OnGUI()
        {
            if (AnimationMode.InAnimationMode())
            {
                AnimationMode.StopAnimationMode();
            }

            // Wait for user to select a GameObject
            if (bakeObject == null)
            {
                EditorGUILayout.HelpBox("Please select a GameObject", MessageType.Info);
                return;
            }

            if (buffer == null)
            {
                buffer = new VertaBuffer();
            }

            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Selected object: " + bakeObject.name);

            modelName = EditorGUILayout.TextField("Model Name", modelName);

            animationClip = EditorGUILayout.ObjectField(animationClip, typeof(AnimationClip), false) as AnimationClip;
            if (animationClip != null)
            {
                frameCount = GetFramesCount(animationClip);
                EditorGUILayout.LabelField("Frames to bake: " + frameCount);

                readyToBake = true;
            }


            if (GUILayout.Button("Bake mesh animations.") && readyToBake && !EditorApplication.isPlaying)
            {
                lockSelection = true;
                BakeMesh();
                lockSelection = false;
            }

            EditorGUILayout.EndVertical();
        }
Example #10
0
        public static void SetScaleDelta(Vector3 scaleDelta, Quaternion pivotRotation)
        {
            if (s_MouseDownState == null)
            {
                return;
            }

            SetLocalHandleOffsetScaleDelta(scaleDelta, pivotRotation);

            Object[] undoObjects = new Object[s_MouseDownState.Length];

            for (int i = 0; i < s_MouseDownState.Length; i++)
            {
                var cur = s_MouseDownState[i];
                undoObjects[i] = cur.transform;
            }
            if (AnimationMode.InAnimationMode())
            {
                Undo.RecordObjects(undoObjects, "Scale");
            }
            else
            {
                Undo.RegisterCompleteObjectUndo(undoObjects, "Scale");
            }

            Vector3 point = Tools.handlePosition;

            for (int i = 0; i < s_MouseDownState.Length; i++)
            {
                // Scale about handlePosition or local pivot based on pivotMode
                if (Tools.pivotMode == PivotMode.Pivot)
                {
                    point = s_MouseDownState[i].position;
                }
                if (individualSpace)
                {
                    pivotRotation = s_MouseDownState[i].rotation;
                }
                s_MouseDownState[i].SetScaleDelta(scaleDelta, point, pivotRotation, false);
            }
        }
Example #11
0
        public static void SetPositionDelta(Vector3 newPosition, Vector3 oldPosition)
        {
            if (s_MouseDownState == null)
            {
                return;
            }

            s_PreviousHandlePosition = newPosition;
            Vector3 positionDelta = newPosition - oldPosition;

            Object[] undoObjects = new Object[s_MouseDownState.Length];

            for (int i = 0; i < s_MouseDownState.Length; i++)
            {
                var cur = s_MouseDownState[i];
                undoObjects[i] = (cur.rectTransform != null ? (Object)cur.rectTransform : (Object)cur.transform);
            }
            if (AnimationMode.InAnimationMode())
            {
                Undo.RecordObjects(undoObjects, "Move");
            }
            else
            {
                Undo.RegisterCompleteObjectUndo(undoObjects, "Move");
            }

            if (s_MouseDownState.Length > 0)
            {
                s_MouseDownState[0].SetPositionDelta(positionDelta, true);
                Vector3 firstDelta = s_MouseDownState[0].transform.position - s_MouseDownState[0].position;

                for (int i = 1; i < s_MouseDownState.Length; i++)
                {
                    s_MouseDownState[i].SetPositionDelta(firstDelta, false);
                }
            }
        }
        public void RotationField(bool disabled)
        {
            Transform target1           = this.targets[0] as Transform;
            Vector3   localEulerAngles1 = target1.GetLocalEulerAngles(target1.rotationOrder);

            if ((double)this.m_OldEulerAngles.x != (double)localEulerAngles1.x || (double)this.m_OldEulerAngles.y != (double)localEulerAngles1.y || ((double)this.m_OldEulerAngles.z != (double)localEulerAngles1.z || this.m_OldRotationOrder != target1.rotationOrder))
            {
                this.m_EulerAngles      = target1.GetLocalEulerAngles(target1.rotationOrder);
                this.m_OldRotationOrder = target1.rotationOrder;
            }
            bool flag1 = false;
            bool flag2 = false;

            for (int index = 1; index < this.targets.Length; ++index)
            {
                Transform target2           = this.targets[index] as Transform;
                Vector3   localEulerAngles2 = target2.GetLocalEulerAngles(target2.rotationOrder);
                flag1  = ((flag1 ? 1 : 0) | ((double)localEulerAngles2.x != (double)localEulerAngles1.x || (double)localEulerAngles2.y != (double)localEulerAngles1.y ? 1 : ((double)localEulerAngles2.z != (double)localEulerAngles1.z ? 1 : 0))) != 0;
                flag2 |= target2.rotationOrder != target1.rotationOrder;
            }
            Rect       controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (!EditorGUIUtility.wideMode ? 2f : 1f), new GUILayoutOption[0]);
            GUIContent label       = EditorGUI.BeginProperty(controlRect, this.rotationContent, this.m_Rotation);

            EditorGUI.showMixedValue = flag1;
            EditorGUI.BeginChangeCheck();
            int    controlId = GUIUtility.GetControlID(TransformRotationGUI.s_FoldoutHash, EditorGUIUtility.native, controlRect);
            string empty     = string.Empty;

            if (AnimationMode.InAnimationMode() && target1.rotationOrder != RotationOrder.OrderZXY)
            {
                string str1;
                if (flag2)
                {
                    str1 = "Mixed";
                }
                else
                {
                    string str2 = target1.rotationOrder.ToString();
                    str1 = str2.Substring(str2.Length - 3);
                }
                label.text = label.text + " (" + str1 + ")";
            }
            Rect position = EditorGUI.MultiFieldPrefixLabel(controlRect, controlId, label, 3);

            position.height = EditorGUIUtility.singleLineHeight;
            EditorGUI.BeginDisabledGroup(disabled);
            this.m_EulerAngles = EditorGUI.Vector3Field(position, GUIContent.none, this.m_EulerAngles);
            EditorGUI.EndDisabledGroup();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObjects(this.targets, "Inspector");
                foreach (Transform target2 in this.targets)
                {
                    target2.SetLocalEulerAngles(this.m_EulerAngles, target2.rotationOrder);
                    if ((UnityEngine.Object)target2.parent != (UnityEngine.Object)null)
                    {
                        target2.SendTransformChangedScale();
                    }
                }
                this.m_Rotation.serializedObject.SetIsDifferentCacheDirty();
            }
            EditorGUI.showMixedValue = false;
            if (flag2)
            {
                EditorGUILayout.HelpBox("Transforms have different rotation orders, keyframes saved will have the same value but not the same local rotation", MessageType.Warning);
            }
            EditorGUI.EndProperty();
        }
        public void RotationField(bool disabled)
        {
            Transform transform        = this.targets[0] as Transform;
            Vector3   localEulerAngles = transform.GetLocalEulerAngles(transform.rotationOrder);

            if (((this.m_OldEulerAngles.x != localEulerAngles.x) || (this.m_OldEulerAngles.y != localEulerAngles.y)) || ((this.m_OldEulerAngles.z != localEulerAngles.z) || (this.m_OldRotationOrder != transform.rotationOrder)))
            {
                this.m_EulerAngles      = transform.GetLocalEulerAngles(transform.rotationOrder);
                this.m_OldRotationOrder = transform.rotationOrder;
            }
            bool flag  = false;
            bool flag2 = false;

            for (int i = 1; i < this.targets.Length; i++)
            {
                Transform transform2 = this.targets[i] as Transform;
                Vector3   vector2    = transform2.GetLocalEulerAngles(transform2.rotationOrder);
                flag  |= ((vector2.x != localEulerAngles.x) || (vector2.y != localEulerAngles.y)) || (vector2.z != localEulerAngles.z);
                flag2 |= transform2.rotationOrder != transform.rotationOrder;
            }
            Rect       totalPosition = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (!EditorGUIUtility.wideMode ? ((float)2) : ((float)1)), new GUILayoutOption[0]);
            GUIContent label         = EditorGUI.BeginProperty(totalPosition, this.rotationContent, this.m_Rotation);

            EditorGUI.showMixedValue = flag;
            EditorGUI.BeginChangeCheck();
            int    id  = GUIUtility.GetControlID(s_FoldoutHash, EditorGUIUtility.native, totalPosition);
            string str = string.Empty;

            if (AnimationMode.InAnimationMode() && (transform.rotationOrder != RotationOrder.OrderZXY))
            {
                if (flag2)
                {
                    str = "Mixed";
                }
                else
                {
                    str = transform.rotationOrder.ToString();
                    str = str.Substring(str.Length - 3);
                }
                label.text = label.text + " (" + str + ")";
            }
            totalPosition        = EditorGUI.MultiFieldPrefixLabel(totalPosition, id, label, 3);
            totalPosition.height = EditorGUIUtility.singleLineHeight;
            EditorGUI.BeginDisabledGroup(disabled);
            this.m_EulerAngles = EditorGUI.Vector3Field(totalPosition, GUIContent.none, this.m_EulerAngles);
            EditorGUI.EndDisabledGroup();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObjects(this.targets, "Inspector");
                foreach (Transform transform3 in this.targets)
                {
                    transform3.SetLocalEulerAngles(this.m_EulerAngles, transform3.rotationOrder);
                    if (transform3.parent != null)
                    {
                        transform3.SendTransformChangedScale();
                    }
                }
                this.m_Rotation.serializedObject.SetIsDifferentCacheDirty();
            }
            EditorGUI.showMixedValue = false;
            if (flag2)
            {
                EditorGUILayout.HelpBox("Transforms have different rotation orders, keyframes saved will have the same value but not the same local rotation", MessageType.Warning);
            }
            EditorGUI.EndProperty();
        }
        public void RotationField(bool disabled)
        {
            Transform transform        = this.targets[0] as Transform;
            Vector3   localEulerAngles = transform.GetLocalEulerAngles(transform.rotationOrder);

            if (this.m_OldEulerAngles.x != localEulerAngles.x || this.m_OldEulerAngles.y != localEulerAngles.y || this.m_OldEulerAngles.z != localEulerAngles.z || this.m_OldRotationOrder != transform.rotationOrder)
            {
                this.m_EulerAngles      = transform.GetLocalEulerAngles(transform.rotationOrder);
                this.m_OldRotationOrder = transform.rotationOrder;
            }
            bool flag  = false;
            bool flag2 = false;

            for (int i = 1; i < this.targets.Length; i++)
            {
                Transform transform2        = this.targets[i] as Transform;
                Vector3   localEulerAngles2 = transform2.GetLocalEulerAngles(transform2.rotationOrder);
                flag  |= (localEulerAngles2.x != localEulerAngles.x || localEulerAngles2.y != localEulerAngles.y || localEulerAngles2.z != localEulerAngles.z);
                flag2 |= (transform2.rotationOrder != transform.rotationOrder);
            }
            Rect       rect       = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (float)((!EditorGUIUtility.wideMode) ? 2 : 1), new GUILayoutOption[0]);
            GUIContent gUIContent = EditorGUI.BeginProperty(rect, this.rotationContent, this.m_Rotation);

            EditorGUI.showMixedValue = flag;
            EditorGUI.BeginChangeCheck();
            int controlID = GUIUtility.GetControlID(TransformRotationGUI.s_FoldoutHash, FocusType.Keyboard, rect);

            if (AnimationMode.InAnimationMode() && transform.rotationOrder != RotationOrder.OrderZXY)
            {
                string text;
                if (flag2)
                {
                    text = "Mixed";
                }
                else
                {
                    text = transform.rotationOrder.ToString();
                    text = text.Substring(text.Length - 3);
                }
                gUIContent.text = gUIContent.text + " (" + text + ")";
            }
            rect        = EditorGUI.MultiFieldPrefixLabel(rect, controlID, gUIContent, 3);
            rect.height = EditorGUIUtility.singleLineHeight;
            using (new EditorGUI.DisabledScope(disabled))
            {
                this.m_EulerAngles = EditorGUI.Vector3Field(rect, GUIContent.none, this.m_EulerAngles);
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObjects(this.targets, "Inspector");
                UnityEngine.Object[] array = this.targets;
                for (int j = 0; j < array.Length; j++)
                {
                    Transform transform3 = (Transform)array[j];
                    transform3.SetLocalEulerAngles(this.m_EulerAngles, transform3.rotationOrder);
                    if (transform3.parent != null)
                    {
                        transform3.SendTransformChangedScale();
                    }
                }
                this.m_Rotation.serializedObject.SetIsDifferentCacheDirty();
            }
            EditorGUI.showMixedValue = false;
            if (flag2)
            {
                EditorGUILayout.HelpBox("Transforms have different rotation orders, keyframes saved will have the same value but not the same local rotation", MessageType.Warning);
            }
            EditorGUI.EndProperty();
        }
Example #15
0
        internal bool DrawInspector(Rect contentRect)
        {
            if (GameObjectInspector.s_styles == null)
            {
                GameObjectInspector.s_styles = new GameObjectInspector.Styles();
            }
            base.serializedObject.Update();
            GameObject gameObject = this.target as GameObject;

            EditorGUIUtility.labelWidth = 52f;
            bool enabled = GUI.enabled;

            GUI.enabled = true;
            GUI.Label(new Rect(contentRect.x, contentRect.y, contentRect.width, contentRect.height + 3f), GUIContent.none, EditorStyles.inspectorBig);
            GUI.enabled = enabled;
            float      width      = contentRect.width;
            float      y          = contentRect.y;
            GUIContent gUIContent = null;
            PrefabType prefabType = PrefabType.None;

            if (this.m_AllOfSamePrefabType)
            {
                prefabType = PrefabUtility.GetPrefabType(gameObject);
                switch (prefabType)
                {
                case PrefabType.None:
                    gUIContent = GameObjectInspector.s_styles.goIcon;
                    break;

                case PrefabType.Prefab:
                case PrefabType.PrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    gUIContent = GameObjectInspector.s_styles.prefabIcon;
                    break;

                case PrefabType.ModelPrefab:
                case PrefabType.ModelPrefabInstance:
                case PrefabType.DisconnectedModelPrefabInstance:
                    gUIContent = GameObjectInspector.s_styles.modelIcon;
                    break;

                case PrefabType.MissingPrefabInstance:
                    gUIContent = GameObjectInspector.s_styles.prefabIcon;
                    break;
                }
            }
            else
            {
                gUIContent = GameObjectInspector.s_styles.typelessIcon;
            }
            EditorGUI.ObjectIconDropDown(new Rect(3f, 4f + y, 24f, 24f), base.targets, true, gUIContent.image as Texture2D, this.m_Icon);
            using (new EditorGUI.DisabledScope(prefabType == PrefabType.ModelPrefab))
            {
                EditorGUI.PropertyField(new Rect(34f, 4f + y, 14f, 14f), this.m_IsActive, GUIContent.none);
                float num    = GameObjectInspector.s_styles.staticFieldToggleWidth + 15f;
                float width2 = width - 52f - num - 5f;
                EditorGUI.DelayedTextField(new Rect(52f, 4f + y + 1f, width2, 16f), this.m_Name, GUIContent.none);
                Rect rect = new Rect(width - num, 4f + y, GameObjectInspector.s_styles.staticFieldToggleWidth, 16f);
                EditorGUI.BeginProperty(rect, GUIContent.none, this.m_StaticEditorFlags);
                EditorGUI.BeginChangeCheck();
                Rect position = rect;
                EditorGUI.showMixedValue |= GameObjectInspector.ShowMixedStaticEditorFlags((StaticEditorFlags)this.m_StaticEditorFlags.intValue);
                Event     current = Event.current;
                EventType type    = current.type;
                bool      flag    = current.type == EventType.MouseDown && current.button != 0;
                if (flag)
                {
                    current.type = EventType.Ignore;
                }
                bool flagValue = EditorGUI.ToggleLeft(position, "Static", gameObject.isStatic);
                if (flag)
                {
                    current.type = type;
                }
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    SceneModeUtility.SetStaticFlags(base.targets, -1, flagValue);
                    base.serializedObject.SetIsDifferentCacheDirty();
                }
                EditorGUI.EndProperty();
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = this.m_StaticEditorFlags.hasMultipleDifferentValues;
                int  changedFlags;
                bool flagValue2;
                EditorGUI.EnumMaskField(new Rect(rect.x + GameObjectInspector.s_styles.staticFieldToggleWidth, rect.y, 10f, 14f), GameObjectUtility.GetStaticEditorFlags(gameObject), GameObjectInspector.s_styles.staticDropdown, out changedFlags, out flagValue2);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    SceneModeUtility.SetStaticFlags(base.targets, changedFlags, flagValue2);
                    base.serializedObject.SetIsDifferentCacheDirty();
                }
                float num2 = 4f;
                float num3 = 4f;
                EditorGUIUtility.fieldWidth = (width - num2 - 52f - GameObjectInspector.s_styles.layerFieldWidth - num3) / 2f;
                string tag = null;
                try
                {
                    tag = gameObject.tag;
                }
                catch (Exception)
                {
                    tag = "Undefined";
                }
                EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.tagFieldWidth;
                Rect rect2 = new Rect(52f - EditorGUIUtility.labelWidth, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
                EditorGUI.BeginProperty(rect2, GUIContent.none, this.m_Tag);
                EditorGUI.BeginChangeCheck();
                string text = EditorGUI.TagField(rect2, EditorGUIUtility.TempContent("Tag"), tag);
                if (EditorGUI.EndChangeCheck())
                {
                    this.m_Tag.stringValue = text;
                    Undo.RecordObjects(base.targets, "Change Tag of " + this.targetTitle);
                    UnityEngine.Object[] targets = base.targets;
                    for (int i = 0; i < targets.Length; i++)
                    {
                        UnityEngine.Object @object = targets[i];
                        (@object as GameObject).tag = text;
                    }
                }
                EditorGUI.EndProperty();
                EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.layerFieldWidth;
                rect2 = new Rect(52f + EditorGUIUtility.fieldWidth + num2, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
                EditorGUI.BeginProperty(rect2, GUIContent.none, this.m_Layer);
                EditorGUI.BeginChangeCheck();
                int num4 = EditorGUI.LayerField(rect2, EditorGUIUtility.TempContent("Layer"), gameObject.layer);
                if (EditorGUI.EndChangeCheck())
                {
                    GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(base.targets.OfType <GameObject>(), "Change Layer", "Do you want to set layer to " + InternalEditorUtility.GetLayerName(num4) + " for all child objects as well?");
                    if (shouldIncludeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel)
                    {
                        this.m_Layer.intValue = num4;
                        this.SetLayer(num4, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                    }
                }
                EditorGUI.EndProperty();
                if (this.m_HasInstance)
                {
                    using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode))
                    {
                        float      num5        = (width - 52f - 5f) / 3f;
                        Rect       position2   = new Rect(52f + num5 * 0f, 44f + y, num5, 15f);
                        Rect       position3   = new Rect(52f + num5 * 1f, 44f + y, num5, 15f);
                        Rect       position4   = new Rect(52f + num5 * 2f, 44f + y, num5, 15f);
                        Rect       position5   = new Rect(52f, 44f + y, num5 * 3f, 15f);
                        GUIContent gUIContent2 = (base.targets.Length <= 1) ? GameObjectInspector.s_styles.goTypeLabel[(int)prefabType] : GameObjectInspector.s_styles.goTypeLabelMultiple;
                        if (gUIContent2 != null)
                        {
                            float x = GUI.skin.label.CalcSize(gUIContent2).x;
                            if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                            {
                                GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                                if (prefabType == PrefabType.MissingPrefabInstance)
                                {
                                    GUI.Label(new Rect(52f, 44f + y, width - 52f - 5f, 18f), gUIContent2, EditorStyles.whiteLabel);
                                }
                                else
                                {
                                    GUI.Label(new Rect(52f - x - 5f, 44f + y, width - 52f - 5f, 18f), gUIContent2, EditorStyles.whiteLabel);
                                }
                                GUI.contentColor = Color.white;
                            }
                            else
                            {
                                Rect position6 = new Rect(52f - x - 5f, 44f + y, x, 18f);
                                GUI.Label(position6, gUIContent2);
                            }
                        }
                        if (base.targets.Length > 1)
                        {
                            GUI.Label(position5, "Instance Management Disabled", GameObjectInspector.s_styles.instanceManagementInfo);
                        }
                        else
                        {
                            if (prefabType != PrefabType.MissingPrefabInstance && GUI.Button(position2, "Select", "MiniButtonLeft"))
                            {
                                Selection.activeObject = PrefabUtility.GetPrefabParent(this.target);
                                EditorGUIUtility.PingObject(Selection.activeObject);
                            }
                            if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance) && GUI.Button(position3, "Revert", "MiniButtonMid"))
                            {
                                Undo.RegisterFullObjectHierarchyUndo(gameObject, "Revert to prefab");
                                PrefabUtility.ReconnectToLastPrefab(gameObject);
                                PrefabUtility.RevertPrefabInstance(gameObject);
                                this.CalculatePrefabStatus();
                                Undo.RegisterCreatedObjectUndo(gameObject, "Reconnect prefab");
                                GUIUtility.ExitGUI();
                            }
                            using (new EditorGUI.DisabledScope(AnimationMode.InAnimationMode()))
                            {
                                if ((prefabType == PrefabType.ModelPrefabInstance || prefabType == PrefabType.PrefabInstance) && GUI.Button(position3, "Revert", "MiniButtonMid"))
                                {
                                    Undo.RegisterFullObjectHierarchyUndo(gameObject, "Revert Prefab Instance");
                                    PrefabUtility.RevertPrefabInstance(gameObject);
                                    this.CalculatePrefabStatus();
                                    Undo.RegisterCreatedObjectUndo(gameObject, "Revert prefab");
                                    GUIUtility.ExitGUI();
                                }
                                if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                                {
                                    GameObject gameObject2 = PrefabUtility.FindValidUploadPrefabInstanceRoot(gameObject);
                                    GUI.enabled = (gameObject2 != null && !AnimationMode.InAnimationMode());
                                    if (GUI.Button(position4, "Apply", "MiniButtonRight"))
                                    {
                                        UnityEngine.Object prefabParent = PrefabUtility.GetPrefabParent(gameObject2);
                                        string             assetPath    = AssetDatabase.GetAssetPath(prefabParent);
                                        bool flag2 = Provider.PromptAndCheckoutIfNeeded(new string[]
                                        {
                                            assetPath
                                        }, "The version control requires you to check out the prefab before applying changes.");
                                        if (flag2)
                                        {
                                            PrefabUtility.ReplacePrefab(gameObject2, prefabParent, ReplacePrefabOptions.ConnectToPrefab);
                                            this.CalculatePrefabStatus();
                                            EditorSceneManager.MarkSceneDirty(gameObject2.scene);
                                            GUIUtility.ExitGUI();
                                        }
                                    }
                                }
                            }
                            if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.ModelPrefabInstance) && GUI.Button(position4, "Open", "MiniButtonRight"))
                            {
                                AssetDatabase.OpenAsset(PrefabUtility.GetPrefabParent(this.target));
                                GUIUtility.ExitGUI();
                            }
                        }
                    }
                }
            }
            base.serializedObject.ApplyModifiedProperties();
            return(true);
        }
        public void RotationField(bool disabled)
        {
            Transform transform0   = targets[0] as Transform;
            Vector3   eulerAngles0 = transform0.GetLocalEulerAngles(transform0.rotationOrder);

            int  differentRotationMask  = 0b000;
            bool differentRotationOrder = false;

            for (int i = 1; i < targets.Length; i++)
            {
                Transform otherTransform = (targets[i] as Transform);
                if (differentRotationMask != 0b111)
                {
                    Vector3 otherLocalEuler = otherTransform.GetLocalEulerAngles(otherTransform.rotationOrder);
                    for (int j = 0; j < 3; j++)
                    {
                        if (otherLocalEuler[j] != eulerAngles0[j])
                        {
                            differentRotationMask |= 1 << j;
                        }
                    }
                }

                differentRotationOrder |= otherTransform.rotationOrder != transform0.rotationOrder;
            }

            Rect       r     = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
            GUIContent label = EditorGUI.BeginProperty(r, rotationContent, m_Rotation);

            m_EulerFloats[0].doubleVal = eulerAngles0.x;
            m_EulerFloats[1].doubleVal = eulerAngles0.y;
            m_EulerFloats[2].doubleVal = eulerAngles0.z;

            int id = GUIUtility.GetControlID(s_FoldoutHash, FocusType.Keyboard, r);

            if (AnimationMode.InAnimationMode() && transform0.rotationOrder != RotationOrder.OrderZXY)
            {
                string rotationLabel = differentRotationOrder ? "Mixed" : transform0.rotationOrder.ToString().Substring(RotationOrder.OrderXYZ.ToString().Length - 3);
                label.text = label.text + " (" + rotationLabel + ")";
            }

            // Using manual 3 float fields here instead of MultiFloatField or Vector3Field
            // since we want to query expression validity of each individually, and
            // so that the label and the fields can be disabled separately, similar to
            // regular property fields. Also want to avoid superfluous label, which
            // creates a focus target even when there's no content (Case 953241).
            r        = EditorGUI.MultiFieldPrefixLabel(r, id, label, 3);
            r.height = EditorGUIUtility.singleLineHeight;
            int eulerChangedMask = 0;

            using (new EditorGUI.DisabledScope(disabled))
            {
                var   eCount = m_EulerFloats.Length;
                float w      = (r.width - (eCount - 1) * EditorGUI.kSpacingSubLabel) / eCount;
                Rect  nr     = new Rect(r)
                {
                    width = w
                };
                var prevWidth  = EditorGUIUtility.labelWidth;
                var prevIndent = EditorGUI.indentLevel;
                EditorGUI.indentLevel = 0;
                for (int i = 0; i < m_EulerFloats.Length; i++)
                {
                    EditorGUIUtility.labelWidth = EditorGUI.GetLabelWidth(s_XYZLabels[i]);
                    EditorGUI.BeginChangeCheck();
                    EditorGUI.showMixedValue = (differentRotationMask & (1 << i)) != 0;
                    EditorGUI.FloatField(nr, s_XYZLabels[i], ref m_EulerFloats[i]);
                    if (EditorGUI.EndChangeCheck() && m_EulerFloats[i].hasResult)
                    {
                        eulerChangedMask |= 1 << i;
                    }
                    nr.x += w + EditorGUI.kSpacingSubLabel;
                }
                EditorGUIUtility.labelWidth = prevWidth;
                EditorGUI.indentLevel       = prevIndent;
            }

            if (eulerChangedMask != 0)
            {
                eulerAngles0 = new Vector3(
                    MathUtils.ClampToFloat(m_EulerFloats[0].doubleVal),
                    MathUtils.ClampToFloat(m_EulerFloats[1].doubleVal),
                    MathUtils.ClampToFloat(m_EulerFloats[2].doubleVal));
                Undo.RecordObjects(targets, "Inspector");  // Generic undo title as remove duplicates will discard the name.
                Undo.SetCurrentGroupName(string.Format("Set Rotation"));
                for (var idx = 0; idx < targets.Length; ++idx)
                {
                    var tr = targets[idx] as Transform;
                    if (tr == null)
                    {
                        continue;
                    }
                    var trEuler = tr.GetLocalEulerAngles(tr.rotationOrder);
                    // if we have any per-object expressions just entered, we need to evaluate
                    // it for each object with their own individual input value
                    for (int c = 0; c < 3; ++c)
                    {
                        if ((eulerChangedMask & (1 << c)) != 0)
                        {
                            if (m_EulerFloats[c].expression != null)
                            {
                                double trEulerComp = eulerAngles0[c];
                                if (m_EulerFloats[c].expression.Evaluate(ref trEulerComp, idx, targets.Length))
                                {
                                    trEuler[c] = MathUtils.ClampToFloat(trEulerComp);
                                }
                            }
                            else
                            {
                                trEuler[c] = MathUtils.ClampToFloat(eulerAngles0[c]);
                            }
                        }
                    }
                    tr.SetLocalEulerAngles(trEuler, tr.rotationOrder);
                    if (tr.parent != null)
                    {
                        tr.SendTransformChangedScale(); // force scale update, needed if tr has non-uniformly scaled parent.
                    }
                }
                m_Rotation.serializedObject.SetIsDifferentCacheDirty();
            }

            EditorGUI.showMixedValue = false;

            if (differentRotationOrder)
            {
                EditorGUILayout.HelpBox("Transforms have different rotation orders, keyframes saved will have the same value but not the same local rotation", MessageType.Warning);
            }

            EditorGUI.EndProperty();
        }
        internal bool DrawInspector(Rect contentRect)
        {
            int  num6;
            bool flag4;

            if (s_styles == null)
            {
                s_styles = new Styles();
            }
            base.serializedObject.Update();
            GameObject target = this.target as GameObject;

            EditorGUIUtility.labelWidth = 52f;
            bool enabled = GUI.enabled;

            GUI.enabled = true;
            GUI.Label(new Rect(contentRect.x, contentRect.y, contentRect.width, contentRect.height + 3f), GUIContent.none, EditorStyles.inspectorBig);
            GUI.enabled = enabled;
            float      width  = contentRect.width;
            float      y      = contentRect.y;
            GUIContent goIcon = null;
            PrefabType none   = PrefabType.None;

            if (this.m_AllOfSamePrefabType)
            {
                none = PrefabUtility.GetPrefabType(target);
                switch (none)
                {
                case PrefabType.None:
                    goIcon = s_styles.goIcon;
                    break;

                case PrefabType.Prefab:
                case PrefabType.PrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    goIcon = s_styles.prefabIcon;
                    break;

                case PrefabType.ModelPrefab:
                case PrefabType.ModelPrefabInstance:
                case PrefabType.DisconnectedModelPrefabInstance:
                    goIcon = s_styles.modelIcon;
                    break;

                case PrefabType.MissingPrefabInstance:
                    goIcon = s_styles.prefabIcon;
                    break;
                }
            }
            else
            {
                goIcon = s_styles.typelessIcon;
            }
            EditorGUI.ObjectIconDropDown(new Rect(3f, 4f + y, 24f, 24f), base.targets, true, goIcon.image as Texture2D, this.m_Icon);
            EditorGUI.BeginDisabledGroup(none == PrefabType.ModelPrefab);
            EditorGUI.PropertyField(new Rect(34f, 4f + y, 14f, 14f), this.m_IsActive, GUIContent.none);
            float num3 = s_styles.staticFieldToggleWidth + 15f;
            float num4 = ((width - 52f) - num3) - 5f;

            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Name.hasMultipleDifferentValues;
            string name = EditorGUI.DelayedTextField(new Rect(52f, (4f + y) + 1f, num4, 16f), target.name, null, EditorStyles.textField);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                foreach (UnityEngine.Object obj3 in base.targets)
                {
                    ObjectNames.SetNameSmart(obj3 as GameObject, name);
                }
            }
            Rect totalPosition = new Rect(width - num3, 4f + y, s_styles.staticFieldToggleWidth, 16f);

            EditorGUI.BeginProperty(totalPosition, GUIContent.none, this.m_StaticEditorFlags);
            EditorGUI.BeginChangeCheck();
            Rect position = totalPosition;

            EditorGUI.showMixedValue |= ShowMixedStaticEditorFlags((StaticEditorFlags)this.m_StaticEditorFlags.intValue);
            Event     current = Event.current;
            EventType type    = current.type;
            bool      flag2   = (current.type == EventType.MouseDown) && (current.button != 0);

            if (flag2)
            {
                current.type = EventType.Ignore;
            }
            bool flagValue = EditorGUI.ToggleLeft(position, "Static", target.isStatic);

            if (flag2)
            {
                current.type = type;
            }
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(base.targets, -1, flagValue);
                base.serializedObject.SetIsDifferentCacheDirty();
            }
            EditorGUI.EndProperty();
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_StaticEditorFlags.hasMultipleDifferentValues;
            EditorGUI.EnumMaskField(new Rect(totalPosition.x + s_styles.staticFieldToggleWidth, totalPosition.y, 10f, 14f), GameObjectUtility.GetStaticEditorFlags(target), s_styles.staticDropdown, out num6, out flag4);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(base.targets, num6, flag4);
                base.serializedObject.SetIsDifferentCacheDirty();
            }
            float num7 = 4f;
            float num8 = 4f;

            EditorGUIUtility.fieldWidth = ((((width - num7) - 52f) - s_styles.layerFieldWidth) - num8) / 2f;
            string tag = null;

            try
            {
                tag = target.tag;
            }
            catch (Exception)
            {
                tag = "Undefined";
            }
            EditorGUIUtility.labelWidth = s_styles.tagFieldWidth;
            Rect rect3 = new Rect(52f - EditorGUIUtility.labelWidth, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);

            EditorGUI.BeginProperty(rect3, GUIContent.none, this.m_Tag);
            EditorGUI.BeginChangeCheck();
            string str3 = EditorGUI.TagField(rect3, EditorGUIUtility.TempContent("Tag"), tag);

            if (EditorGUI.EndChangeCheck())
            {
                this.m_Tag.stringValue = str3;
                Undo.RecordObjects(base.targets, "Change Tag of " + this.targetTitle);
                foreach (UnityEngine.Object obj4 in base.targets)
                {
                    (obj4 as GameObject).tag = str3;
                }
            }
            EditorGUI.EndProperty();
            EditorGUIUtility.labelWidth = s_styles.layerFieldWidth;
            rect3 = new Rect((52f + EditorGUIUtility.fieldWidth) + num7, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
            EditorGUI.BeginProperty(rect3, GUIContent.none, this.m_Layer);
            EditorGUI.BeginChangeCheck();
            int layer = EditorGUI.LayerField(rect3, EditorGUIUtility.TempContent("Layer"), target.layer);

            if (EditorGUI.EndChangeCheck())
            {
                GameObjectUtility.ShouldIncludeChildren children = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(base.targets.OfType <GameObject>(), "Change Layer", "Do you want to set layer to " + InternalEditorUtility.GetLayerName(layer) + " for all child objects as well?");
                if (children != GameObjectUtility.ShouldIncludeChildren.Cancel)
                {
                    this.m_Layer.intValue = layer;
                    this.SetLayer(layer, children == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                }
            }
            EditorGUI.EndProperty();
            if (!this.m_HasInstance || EditorApplication.isPlayingOrWillChangePlaymode)
            {
                goto Label_0992;
            }
            float      num11    = ((width - 52f) - 5f) / 3f;
            Rect       rect4    = new Rect(52f + (num11 * 0f), 44f + y, num11, 15f);
            Rect       rect5    = new Rect(52f + (num11 * 1f), 44f + y, num11, 15f);
            Rect       rect6    = new Rect(52f + (num11 * 2f), 44f + y, num11, 15f);
            Rect       rect7    = new Rect(52f, 44f + y, num11 * 3f, 15f);
            GUIContent content2 = (base.targets.Length <= 1) ? s_styles.goTypeLabel[(int)none] : s_styles.goTypeLabelMultiple;

            if (content2 != null)
            {
                float x = GUI.skin.label.CalcSize(content2).x;
                switch (none)
                {
                case PrefabType.DisconnectedModelPrefabInstance:
                case PrefabType.MissingPrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                    if (none == PrefabType.MissingPrefabInstance)
                    {
                        GUI.Label(new Rect(52f, 44f + y, (width - 52f) - 5f, 18f), content2, EditorStyles.whiteLabel);
                    }
                    else
                    {
                        GUI.Label(new Rect((52f - x) - 5f, 44f + y, (width - 52f) - 5f, 18f), content2, EditorStyles.whiteLabel);
                    }
                    GUI.contentColor = Color.white;
                    goto Label_078B;
                }
                Rect rect8 = new Rect((52f - x) - 5f, 44f + y, x, 18f);
                GUI.Label(rect8, content2);
            }
Label_078B:
            if (base.targets.Length > 1)
            {
                GUI.Label(rect7, "Instance Management Disabled", s_styles.instanceManagementInfo);
            }
            else
            {
                if ((none != PrefabType.MissingPrefabInstance) && GUI.Button(rect4, "Select", "MiniButtonLeft"))
                {
                    Selection.activeObject = PrefabUtility.GetPrefabParent(this.target);
                    EditorGUIUtility.PingObject(Selection.activeObject);
                }
                if (((none == PrefabType.DisconnectedModelPrefabInstance) || (none == PrefabType.DisconnectedPrefabInstance)) && GUI.Button(rect5, "Revert", "MiniButtonMid"))
                {
                    Undo.RegisterFullObjectHierarchyUndo(target, "Revert to prefab");
                    PrefabUtility.ReconnectToLastPrefab(target);
                    PrefabUtility.RevertPrefabInstance(target);
                    this.CalculatePrefabStatus();
                    Undo.RegisterCreatedObjectUndo(target, "Reconnect prefab");
                    GUIUtility.ExitGUI();
                }
                bool flag5 = GUI.enabled;
                GUI.enabled = GUI.enabled && !AnimationMode.InAnimationMode();
                if (((none == PrefabType.ModelPrefabInstance) || (none == PrefabType.PrefabInstance)) && GUI.Button(rect5, "Revert", "MiniButtonMid"))
                {
                    Undo.RegisterFullObjectHierarchyUndo(target, "Revert Prefab Instance");
                    PrefabUtility.RevertPrefabInstance(target);
                    this.CalculatePrefabStatus();
                    GUIUtility.ExitGUI();
                }
                if ((none == PrefabType.PrefabInstance) || (none == PrefabType.DisconnectedPrefabInstance))
                {
                    GameObject source = PrefabUtility.FindValidUploadPrefabInstanceRoot(target);
                    GUI.enabled = (source != null) && !AnimationMode.InAnimationMode();
                    if (GUI.Button(rect6, "Apply", "MiniButtonRight"))
                    {
                        UnityEngine.Object prefabParent = PrefabUtility.GetPrefabParent(source);
                        string             assetPath    = AssetDatabase.GetAssetPath(prefabParent);
                        string[]           assets       = new string[] { assetPath };
                        if (Provider.PromptAndCheckoutIfNeeded(assets, "The version control requires you to check out the prefab before applying changes."))
                        {
                            PrefabUtility.ReplacePrefab(source, prefabParent, ReplacePrefabOptions.ConnectToPrefab);
                            this.CalculatePrefabStatus();
                            GUIUtility.ExitGUI();
                        }
                    }
                }
                GUI.enabled = flag5;
                if (((none == PrefabType.DisconnectedModelPrefabInstance) || (none == PrefabType.ModelPrefabInstance)) && GUI.Button(rect6, "Open", "MiniButtonRight"))
                {
                    AssetDatabase.OpenAsset(PrefabUtility.GetPrefabParent(this.target));
                    GUIUtility.ExitGUI();
                }
            }
Label_0992:
            EditorGUI.EndDisabledGroup();
            base.serializedObject.ApplyModifiedProperties();
            return(true);
        }
        internal bool DrawInspector(Rect contentRect)
        {
            if (GameObjectInspector.s_styles == null)
            {
                GameObjectInspector.s_styles = new GameObjectInspector.Styles();
            }
            this.serializedObject.Update();
            GameObject target1 = this.target as GameObject;

            EditorGUIUtility.labelWidth = 52f;
            bool enabled1 = GUI.enabled;

            GUI.enabled = true;
            GUI.Label(new Rect(contentRect.x, contentRect.y, contentRect.width, contentRect.height + 3f), GUIContent.none, EditorStyles.inspectorBig);
            GUI.enabled = enabled1;
            float      width1     = contentRect.width;
            float      y          = contentRect.y;
            GUIContent guiContent = (GUIContent)null;
            PrefabType prefabType = PrefabType.None;

            if (this.m_AllOfSamePrefabType)
            {
                prefabType = PrefabUtility.GetPrefabType((UnityEngine.Object)target1);
                switch (prefabType)
                {
                case PrefabType.None:
                    guiContent = GameObjectInspector.s_styles.goIcon;
                    break;

                case PrefabType.Prefab:
                case PrefabType.PrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    guiContent = GameObjectInspector.s_styles.prefabIcon;
                    break;

                case PrefabType.ModelPrefab:
                case PrefabType.ModelPrefabInstance:
                case PrefabType.DisconnectedModelPrefabInstance:
                    guiContent = GameObjectInspector.s_styles.modelIcon;
                    break;

                case PrefabType.MissingPrefabInstance:
                    guiContent = GameObjectInspector.s_styles.prefabIcon;
                    break;
                }
            }
            else
            {
                guiContent = GameObjectInspector.s_styles.typelessIcon;
            }
            EditorGUI.ObjectIconDropDown(new Rect(3f, 4f + y, 24f, 24f), this.targets, true, guiContent.image as Texture2D, this.m_Icon);
            EditorGUI.BeginDisabledGroup(prefabType == PrefabType.ModelPrefab);
            EditorGUI.PropertyField(new Rect(34f, 4f + y, 14f, 14f), this.m_IsActive, GUIContent.none);
            float num1   = GameObjectInspector.s_styles.staticFieldToggleWidth + 15f;
            float width2 = (float)((double)width1 - 52.0 - (double)num1 - 5.0);

            EditorGUI.DelayedTextField(new Rect(52f, (float)(4.0 + (double)y + 1.0), width2, 16f), this.m_Name, GUIContent.none);
            Rect totalPosition = new Rect(width1 - num1, 4f + y, GameObjectInspector.s_styles.staticFieldToggleWidth, 16f);

            EditorGUI.BeginProperty(totalPosition, GUIContent.none, this.m_StaticEditorFlags);
            EditorGUI.BeginChangeCheck();
            Rect position1 = totalPosition;

            EditorGUI.showMixedValue |= GameObjectInspector.ShowMixedStaticEditorFlags((StaticEditorFlags)this.m_StaticEditorFlags.intValue);
            Event     current = Event.current;
            EventType type    = current.type;
            bool      flag    = current.type == EventType.MouseDown && current.button != 0;

            if (flag)
            {
                current.type = EventType.Ignore;
            }
            bool flagValue = EditorGUI.ToggleLeft(position1, "Static", target1.isStatic);

            if (flag)
            {
                current.type = type;
            }
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(this.targets, -1, flagValue);
                this.serializedObject.SetIsDifferentCacheDirty();
            }
            EditorGUI.EndProperty();
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_StaticEditorFlags.hasMultipleDifferentValues;
            int  changedFlags;
            bool changedToValue;

            EditorGUI.EnumMaskField(new Rect(totalPosition.x + GameObjectInspector.s_styles.staticFieldToggleWidth, totalPosition.y, 10f, 14f), (Enum)GameObjectUtility.GetStaticEditorFlags(target1), GameObjectInspector.s_styles.staticDropdown, out changedFlags, out changedToValue);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(this.targets, changedFlags, changedToValue);
                this.serializedObject.SetIsDifferentCacheDirty();
            }
            float num2 = 4f;
            float num3 = 4f;

            EditorGUIUtility.fieldWidth = (float)(((double)width1 - (double)num2 - 52.0 - (double)GameObjectInspector.s_styles.layerFieldWidth - (double)num3) / 2.0);
            string tag;

            try
            {
                tag = target1.tag;
            }
            catch (Exception ex)
            {
                tag = "Undefined";
            }
            EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.tagFieldWidth;
            Rect rect = new Rect(52f - EditorGUIUtility.labelWidth, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);

            EditorGUI.BeginProperty(rect, GUIContent.none, this.m_Tag);
            EditorGUI.BeginChangeCheck();
            string str = EditorGUI.TagField(rect, EditorGUIUtility.TempContent("Tag"), tag);

            if (EditorGUI.EndChangeCheck())
            {
                this.m_Tag.stringValue = str;
                Undo.RecordObjects(this.targets, "Change Tag of " + this.targetTitle);
                foreach (UnityEngine.Object target2 in this.targets)
                {
                    (target2 as GameObject).tag = str;
                }
            }
            EditorGUI.EndProperty();
            EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.layerFieldWidth;
            rect = new Rect(52f + EditorGUIUtility.fieldWidth + num2, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
            EditorGUI.BeginProperty(rect, GUIContent.none, this.m_Layer);
            EditorGUI.BeginChangeCheck();
            int layer = EditorGUI.LayerField(rect, EditorGUIUtility.TempContent("Layer"), target1.layer);

            if (EditorGUI.EndChangeCheck())
            {
                GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(this.targets.OfType <GameObject>(), "Change Layer", "Do you want to set layer to " + InternalEditorUtility.GetLayerName(layer) + " for all child objects as well?");
                if (shouldIncludeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel)
                {
                    this.m_Layer.intValue = layer;
                    this.SetLayer(layer, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                }
            }
            EditorGUI.EndProperty();
            if (this.m_HasInstance && !EditorApplication.isPlayingOrWillChangePlaymode)
            {
                float      width3    = (float)(((double)width1 - 52.0 - 5.0) / 3.0);
                Rect       position2 = new Rect((float)(52.0 + (double)width3 * 0.0), 44f + y, width3, 15f);
                Rect       position3 = new Rect((float)(52.0 + (double)width3 * 1.0), 44f + y, width3, 15f);
                Rect       position4 = new Rect((float)(52.0 + (double)width3 * 2.0), 44f + y, width3, 15f);
                Rect       position5 = new Rect(52f, 44f + y, width3 * 3f, 15f);
                GUIContent content   = this.targets.Length <= 1 ? GameObjectInspector.s_styles.goTypeLabel[(int)prefabType] : GameObjectInspector.s_styles.goTypeLabelMultiple;
                if (content != null)
                {
                    float x = GUI.skin.label.CalcSize(content).x;
                    if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                    {
                        GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                        if (prefabType == PrefabType.MissingPrefabInstance)
                        {
                            GUI.Label(new Rect(52f, 44f + y, (float)((double)width1 - 52.0 - 5.0), 18f), content, EditorStyles.whiteLabel);
                        }
                        else
                        {
                            GUI.Label(new Rect((float)(52.0 - (double)x - 5.0), 44f + y, (float)((double)width1 - 52.0 - 5.0), 18f), content, EditorStyles.whiteLabel);
                        }
                        GUI.contentColor = Color.white;
                    }
                    else
                    {
                        GUI.Label(new Rect((float)(52.0 - (double)x - 5.0), 44f + y, x, 18f), content);
                    }
                }
                if (this.targets.Length > 1)
                {
                    GUI.Label(position5, "Instance Management Disabled", GameObjectInspector.s_styles.instanceManagementInfo);
                }
                else
                {
                    if (prefabType != PrefabType.MissingPrefabInstance && GUI.Button(position2, "Select", (GUIStyle)"MiniButtonLeft"))
                    {
                        Selection.activeObject = PrefabUtility.GetPrefabParent(this.target);
                        EditorGUIUtility.PingObject(Selection.activeObject);
                    }
                    if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance) && GUI.Button(position3, "Revert", (GUIStyle)"MiniButtonMid"))
                    {
                        Undo.RegisterFullObjectHierarchyUndo((UnityEngine.Object)target1, "Revert to prefab");
                        PrefabUtility.ReconnectToLastPrefab(target1);
                        PrefabUtility.RevertPrefabInstance(target1);
                        this.CalculatePrefabStatus();
                        Undo.RegisterCreatedObjectUndo((UnityEngine.Object)target1, "Reconnect prefab");
                        GUIUtility.ExitGUI();
                    }
                    bool enabled2 = GUI.enabled;
                    GUI.enabled = GUI.enabled && !AnimationMode.InAnimationMode();
                    if ((prefabType == PrefabType.ModelPrefabInstance || prefabType == PrefabType.PrefabInstance) && GUI.Button(position3, "Revert", (GUIStyle)"MiniButtonMid"))
                    {
                        Undo.RegisterFullObjectHierarchyUndo((UnityEngine.Object)target1, "Revert Prefab Instance");
                        PrefabUtility.RevertPrefabInstance(target1);
                        this.CalculatePrefabStatus();
                        Undo.RegisterCreatedObjectUndo((UnityEngine.Object)target1, "Revert prefab");
                        GUIUtility.ExitGUI();
                    }
                    if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                    {
                        GameObject prefabInstanceRoot = PrefabUtility.FindValidUploadPrefabInstanceRoot(target1);
                        GUI.enabled = (UnityEngine.Object)prefabInstanceRoot != (UnityEngine.Object)null && !AnimationMode.InAnimationMode();
                        if (GUI.Button(position4, "Apply", (GUIStyle)"MiniButtonRight"))
                        {
                            UnityEngine.Object prefabParent = PrefabUtility.GetPrefabParent((UnityEngine.Object)prefabInstanceRoot);
                            if (Provider.PromptAndCheckoutIfNeeded(new string[1] {
                                AssetDatabase.GetAssetPath(prefabParent)
                            }, "The version control requires you to check out the prefab before applying changes."))
                            {
                                PrefabUtility.ReplacePrefab(prefabInstanceRoot, prefabParent, ReplacePrefabOptions.ConnectToPrefab);
                                this.CalculatePrefabStatus();
                                EditorSceneManager.MarkSceneDirty(prefabInstanceRoot.scene);
                                GUIUtility.ExitGUI();
                            }
                        }
                    }
                    GUI.enabled = enabled2;
                    if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.ModelPrefabInstance) && GUI.Button(position4, "Open", (GUIStyle)"MiniButtonRight"))
                    {
                        AssetDatabase.OpenAsset(PrefabUtility.GetPrefabParent(this.target));
                        GUIUtility.ExitGUI();
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
            this.serializedObject.ApplyModifiedProperties();
            return(true);
        }
Example #19
0
 static public bool InAnimationMode()
 {
     return(AnimationMode.InAnimationMode());
 }
        private void DoPrefabButtons(PrefabType prefabType, GameObject go)
        {
            // @TODO: If/when we support multi-editing of prefab/model instances,
            // handle it here. Only show prefab bar if all are same type?
            if (!m_HasInstance)
            {
                return;
            }

            using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode))
            {
                EditorGUILayout.BeginHorizontal();

                // Prefab information
                GUIContent prefixLabel = targets.Length > 1 ? s_Styles.goTypeLabelMultiple : s_Styles.goTypeLabel[(int)prefabType];

                if (prefixLabel != null)
                {
                    EditorGUILayout.BeginHorizontal(GUILayout.Width(kIconSize + s_Styles.tagFieldWidth));
                    GUILayout.FlexibleSpace();
                    if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                    {
                        GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                        GUILayout.Label(prefixLabel, EditorStyles.whiteLabel, GUILayout.ExpandWidth(false));
                        GUI.contentColor = Color.white;
                    }
                    else
                    {
                        GUILayout.Label(prefixLabel, GUILayout.ExpandWidth(false));
                    }
                    EditorGUILayout.EndHorizontal();
                }

                if (targets.Length > 1)
                {
                    GUILayout.Label("Instance Management Disabled", s_Styles.instanceManagementInfo);
                }
                else
                {
                    // Select prefab
                    if (prefabType != PrefabType.MissingPrefabInstance)
                    {
                        if (GUILayout.Button("Select", "MiniButtonLeft"))
                        {
                            Selection.activeObject = PrefabUtility.GetCorrespondingObjectFromSource(target);
                            EditorGUIUtility.PingObject(Selection.activeObject);
                        }
                    }

                    using (new EditorGUI.DisabledScope(AnimationMode.InAnimationMode()))
                    {
                        if (prefabType != PrefabType.MissingPrefabInstance)
                        {
                            // Revert this gameobject and components to prefab
                            if (GUILayout.Button("Revert", "MiniButtonMid"))
                            {
                                PrefabUtility.RevertPrefabInstanceWithUndo(go);

                                // case931300 - The selected gameobject might get destroyed by RevertPrefabInstance
                                if (go != null)
                                {
                                    CalculatePrefabStatus();
                                }

                                // This is necessary because Revert can potentially destroy game objects and components
                                // In that case the Editor classes would be destroyed but still be invoked. (case 837113)
                                GUIUtility.ExitGUI();
                            }

                            // Apply to prefab
                            if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                            {
                                GameObject rootUploadGameObject = PrefabUtility.FindValidUploadPrefabInstanceRoot(go);

                                GUI.enabled = rootUploadGameObject != null && !AnimationMode.InAnimationMode();

                                if (GUILayout.Button("Apply", "MiniButtonRight"))
                                {
                                    UnityObject correspondingAssetObject = PrefabUtility.GetCorrespondingObjectFromSource(rootUploadGameObject);
                                    string      prefabAssetPath = AssetDatabase.GetAssetPath(correspondingAssetObject);
                                    bool        isRootFolder, isReadonly;
                                    bool        validPath = AssetDatabase.GetAssetFolderInfo(prefabAssetPath, out isRootFolder, out isReadonly);

                                    if (validPath && isReadonly)
                                    {
                                        string prefabName = FileUtil.GetLastPathNameComponent(FileUtil.GetPathWithoutExtension(prefabAssetPath));
                                        EditorUtility.DisplayDialog("Cannot apply changes", string.Format("Original prefab \"{0}\" is immutable.", prefabName), "Close");
                                    }
                                    else
                                    {
                                        bool editablePrefab = Provider.PromptAndCheckoutIfNeeded(
                                            new string[] { prefabAssetPath },
                                            "The version control requires you to check out the prefab before applying changes.");

                                        if (editablePrefab)
                                        {
                                            PrefabUtility.ReplacePrefabWithUndo(rootUploadGameObject);

                                            CalculatePrefabStatus();

                                            // This is necessary because ReplacePrefab can potentially destroy game objects and components
                                            // In that case the Editor classes would be destroyed but still be invoked. (case 468434)
                                            GUIUtility.ExitGUI();
                                        }
                                    }
                                }
                            }
                        }
                    }

                    // Edit model prefab
                    if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.ModelPrefabInstance)
                    {
                        if (GUILayout.Button("Open", "MiniButtonRight"))
                        {
                            AssetDatabase.OpenAsset(PrefabUtility.GetCorrespondingObjectFromSource(target));
                            GUIUtility.ExitGUI();
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
        }
Example #21
0
        // Main editor window
        public void OnGUI()
        {
            if (AnimationMode.InAnimationMode())
            {
                AnimationMode.StopAnimationMode();
            }

            int needSize = 110;

            // Wait for user to select a GameObject
            if (bakeObject == null)
            {
                EditorGUILayout.HelpBox("Please select a GameObject", MessageType.Info);
                return;
            }

            if (buffer == null)
            {
                buffer = new VertaBuffer();
            }

            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Selected object: " + bakeObject.name);

            modelName = EditorGUILayout.TextField("Model Name", modelName);

            targetPathObject = EditorGUILayout.ObjectField("Output folder", targetPathObject, typeof(Object), true);

            bakeOnlyMesh = EditorGUILayout.Toggle("No animations", bakeOnlyMesh);

            if (!bakeOnlyMesh)
            {
                needSize += 20;
            }

            debugMeshOutput = EditorGUILayout.Toggle("Output debug mesh", debugMeshOutput);


            if (!bakeOnlyMesh)
            {
                int newLen = EditorGUILayout.IntField("Number of clips:", animationClips.Length);
                newLen = Math.Min(newLen, 5);
                if (newLen != animationClips.Length)
                {
                    Array.Resize(ref animationClips, newLen);
                }

                EditorGUILayout.BeginVertical();
                for (int i = 0; i < animationClips.Length; i++)
                {
                    animationClips[i] = EditorGUILayout.ObjectField(animationClips[i], typeof(AnimationClip), false) as AnimationClip;
                    needSize         += 19;
                }
                EditorGUILayout.EndVertical();

                if (animationClips != null && animationClips.Length > 0)
                {
                    int tmpFrameCount = 0;
                    foreach (AnimationClip clip in animationClips)
                    {
                        tmpFrameCount += GetFramesCount(clip);
                    }

                    frameCount = tmpFrameCount;
                    EditorGUILayout.LabelField("Frames to bake: " + frameCount);
                    needSize += 10;
                }
            }
            else
            {
                frameCount = 1;
            }

            minSize = new Vector2(300, needSize);
            maxSize = new Vector2(300, needSize);

            bool clipsReady = animationClips != null && animationClips.Length > 0;

            if (clipsReady)
            {
                clipsReady = animationClips.All(clip => clip != null);
            }

            readyToBake = (clipsReady || bakeOnlyMesh) && !EditorApplication.isPlaying &&
                          !modelName.Equals("");

            if (GUILayout.Button("Bake mesh animations.") && readyToBake)
            {
                lockSelection = true;
                BakeMesh();
                lockSelection = false;
            }

            EditorGUILayout.EndVertical();
        }
 private void DoPrefabButtons(PrefabType prefabType, GameObject go)
 {
     if (this.m_HasInstance)
     {
         using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode))
         {
             EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUIContent gUIContent = (base.targets.Length <= 1) ? GameObjectInspector.s_Styles.goTypeLabel[(int)prefabType] : GameObjectInspector.s_Styles.goTypeLabelMultiple;
             if (gUIContent != null)
             {
                 EditorGUILayout.BeginHorizontal(new GUILayoutOption[]
                 {
                     GUILayout.Width(24f + GameObjectInspector.s_Styles.tagFieldWidth)
                 });
                 GUILayout.FlexibleSpace();
                 if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                 {
                     GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                     GUILayout.Label(gUIContent, EditorStyles.whiteLabel, new GUILayoutOption[]
                     {
                         GUILayout.ExpandWidth(false)
                     });
                     GUI.contentColor = Color.white;
                 }
                 else
                 {
                     GUILayout.Label(gUIContent, new GUILayoutOption[]
                     {
                         GUILayout.ExpandWidth(false)
                     });
                 }
                 EditorGUILayout.EndHorizontal();
             }
             if (base.targets.Length > 1)
             {
                 GUILayout.Label("Instance Management Disabled", GameObjectInspector.s_Styles.instanceManagementInfo, new GUILayoutOption[0]);
             }
             else
             {
                 if (prefabType != PrefabType.MissingPrefabInstance)
                 {
                     if (GUILayout.Button("Select", "MiniButtonLeft", new GUILayoutOption[0]))
                     {
                         Selection.activeObject = PrefabUtility.GetPrefabParent(base.target);
                         EditorGUIUtility.PingObject(Selection.activeObject);
                     }
                 }
                 using (new EditorGUI.DisabledScope(AnimationMode.InAnimationMode()))
                 {
                     if (prefabType != PrefabType.MissingPrefabInstance)
                     {
                         if (GUILayout.Button("Revert", "MiniButtonMid", new GUILayoutOption[0]))
                         {
                             PrefabUtility.RevertPrefabInstanceWithUndo(go);
                             if (go != null)
                             {
                                 this.CalculatePrefabStatus();
                             }
                             GUIUtility.ExitGUI();
                         }
                         if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                         {
                             GameObject gameObject = PrefabUtility.FindValidUploadPrefabInstanceRoot(go);
                             GUI.enabled = (gameObject != null && !AnimationMode.InAnimationMode());
                             if (GUILayout.Button("Apply", "MiniButtonRight", new GUILayoutOption[0]))
                             {
                                 UnityEngine.Object prefabParent = PrefabUtility.GetPrefabParent(gameObject);
                                 string             assetPath    = AssetDatabase.GetAssetPath(prefabParent);
                                 bool flag = Provider.PromptAndCheckoutIfNeeded(new string[]
                                 {
                                     assetPath
                                 }, "The version control requires you to check out the prefab before applying changes.");
                                 if (flag)
                                 {
                                     PrefabUtility.ReplacePrefabWithUndo(gameObject);
                                     this.CalculatePrefabStatus();
                                     GUIUtility.ExitGUI();
                                 }
                             }
                         }
                     }
                 }
                 if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.ModelPrefabInstance)
                 {
                     if (GUILayout.Button("Open", "MiniButtonRight", new GUILayoutOption[0]))
                     {
                         AssetDatabase.OpenAsset(PrefabUtility.GetPrefabParent(base.target));
                         GUIUtility.ExitGUI();
                     }
                 }
             }
             EditorGUILayout.EndHorizontal();
         }
     }
 }
Example #23
0
        public void RotationField(bool disabled)
        {
            Transform t          = targets[0] as Transform;
            Vector3   localEuler = t.GetLocalEulerAngles(t.rotationOrder);

            if (
                m_OldEulerAngles.x != localEuler.x ||
                m_OldEulerAngles.y != localEuler.y ||
                m_OldEulerAngles.z != localEuler.z ||
                m_OldRotationOrder != t.rotationOrder
                )
            {
                m_EulerAngles      = t.GetLocalEulerAngles(t.rotationOrder);
                m_OldRotationOrder = t.rotationOrder;
            }
            bool differentRotation      = false;
            bool differentRotationOrder = false;

            for (int i = 1; i < targets.Length; i++)
            {
                Transform otherTransform  = (targets[i] as Transform);
                Vector3   otherLocalEuler = otherTransform.GetLocalEulerAngles(otherTransform.rotationOrder);
                differentRotation |= (otherLocalEuler.x != localEuler.x ||
                                      otherLocalEuler.y != localEuler.y ||
                                      otherLocalEuler.z != localEuler.z);

                differentRotationOrder |= otherTransform.rotationOrder != t.rotationOrder;
            }

            Rect       r     = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
            GUIContent label = EditorGUI.BeginProperty(r, rotationContent, m_Rotation);

            EditorGUI.showMixedValue = differentRotation;

            EditorGUI.BeginChangeCheck();

            int    id            = GUIUtility.GetControlID(s_FoldoutHash, FocusType.Keyboard, r);
            string rotationLabel = "";

            if (AnimationMode.InAnimationMode() && t.rotationOrder != RotationOrder.OrderZXY)
            {
                if (differentRotationOrder)
                {
                    rotationLabel = "Mixed";
                }
                else
                {
                    rotationLabel = (t.rotationOrder).ToString();
                    rotationLabel = rotationLabel.Substring(rotationLabel.Length - 3);
                }

                label.text = label.text + " (" + rotationLabel + ")";
            }

            r        = EditorGUI.MultiFieldPrefixLabel(r, id, label, 3);
            r.height = EditorGUIUtility.singleLineHeight;
            using (new EditorGUI.DisabledScope(disabled))
            {
                m_EulerAngles = EditorGUI.Vector3Field(r, GUIContent.none, m_EulerAngles);
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObjects(targets, "Inspector");  // Generic undo title to be consistent with Position and Scale changes.
                foreach (Transform tr in targets)
                {
                    tr.SetLocalEulerAngles(m_EulerAngles, tr.rotationOrder);
                    if (tr.parent != null)
                    {
                        tr.SendTransformChangedScale(); // force scale update, needed if tr has non-uniformly scaled parent.
                    }
                }
                m_Rotation.serializedObject.SetIsDifferentCacheDirty();
            }

            EditorGUI.showMixedValue = false;

            if (differentRotationOrder)
            {
                EditorGUILayout.HelpBox("Transforms have different rotation orders, keyframes saved will have the same value but not the same local rotation", MessageType.Warning);
            }

            EditorGUI.EndProperty();
        }
Example #24
0
        public void RotationField(bool disabled)
        {
            Transform t          = targets[0] as Transform;
            Vector3   localEuler = t.GetLocalEulerAngles(t.rotationOrder);

            if (
                m_OldEulerAngles.x != localEuler.x ||
                m_OldEulerAngles.y != localEuler.y ||
                m_OldEulerAngles.z != localEuler.z ||
                m_OldRotationOrder != t.rotationOrder
                )
            {
                m_EulerAngles      = t.GetLocalEulerAngles(t.rotationOrder);
                m_OldRotationOrder = t.rotationOrder;
            }

            var  targetRotationOrder    = t.rotationOrder;
            bool differentRotation      = false;
            bool differentRotationOrder = false;

            for (int i = 1; i < targets.Length; i++)
            {
                Transform otherTransform = (targets[i] as Transform);
                if (!differentRotation)
                {
                    Vector3 otherLocalEuler = otherTransform.GetLocalEulerAngles(otherTransform.rotationOrder);
                    differentRotation = (otherLocalEuler.x != localEuler.x || otherLocalEuler.y != localEuler.y || otherLocalEuler.z != localEuler.z);
                }

                differentRotationOrder |= otherTransform.rotationOrder != targetRotationOrder;
            }

            Rect       r     = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
            GUIContent label = EditorGUI.BeginProperty(r, rotationContent, m_Rotation);

            m_EulerFloats[0] = m_EulerAngles.x;
            m_EulerFloats[1] = m_EulerAngles.y;
            m_EulerFloats[2] = m_EulerAngles.z;

            EditorGUI.showMixedValue = differentRotation;

            EditorGUI.BeginChangeCheck();

            int    id            = GUIUtility.GetControlID(s_FoldoutHash, FocusType.Keyboard, r);
            string rotationLabel = "";

            if (AnimationMode.InAnimationMode() && t.rotationOrder != RotationOrder.OrderZXY)
            {
                if (differentRotationOrder)
                {
                    rotationLabel = "Mixed";
                }
                else
                {
                    rotationLabel = (t.rotationOrder).ToString();
                    rotationLabel = rotationLabel.Substring(rotationLabel.Length - 3);
                }

                label.text = label.text + " (" + rotationLabel + ")";
            }

            // Using MultiFieldPrefixLabel/MultiFloatField here instead of Vector3Field
            // so that the label and the float fields can be disabled separately,
            // similar to other property-driven controls
            // Using MultiFloatField instead of Vector3Field to avoid superfluous label
            // (which creates a focus target even when there's no content (Case 953241))
            r        = EditorGUI.MultiFieldPrefixLabel(r, id, label, 3);
            r.height = EditorGUIUtility.singleLineHeight;
            using (new EditorGUI.DisabledScope(disabled))
                EditorGUI.MultiFloatField(r, s_XYZLabels, m_EulerFloats);

            if (EditorGUI.EndChangeCheck())
            {
                m_EulerAngles = new Vector3(m_EulerFloats[0], m_EulerFloats[1], m_EulerFloats[2]);
                Undo.RecordObjects(targets, "Inspector");  // Generic undo title to be consistent with Position and Scale changes.
                foreach (Transform tr in targets)
                {
                    tr.SetLocalEulerAngles(m_EulerAngles, tr.rotationOrder);
                    if (tr.parent != null)
                    {
                        tr.SendTransformChangedScale(); // force scale update, needed if tr has non-uniformly scaled parent.
                    }
                }
                m_Rotation.serializedObject.SetIsDifferentCacheDirty();
            }

            EditorGUI.showMixedValue = false;

            if (differentRotationOrder)
            {
                EditorGUILayout.HelpBox("Transforms have different rotation orders, keyframes saved will have the same value but not the same local rotation", MessageType.Warning);
            }

            EditorGUI.EndProperty();
        }