Example #1
0
 private void OnBecameVisible()
 {
     if (this.m_IsVisible)
     {
         return;
     }
     this.m_IsVisible = true;
     this.InitEffectUI();
     SceneView.RepaintAll();
     InspectorWindow.RepaintAllInspectors();
 }
 private static InspectorWindow FirstInspectorWithGameObject()
 {
     foreach (InspectorWindow current in InspectorWindow.GetInspectors())
     {
         if (current.GetInspectedObject() is GameObject)
         {
             return(current);
         }
     }
     return(null);
 }
Example #3
0
        private void UpdateViews()
        {
            AudioMixerWindow mixerWindow = (AudioMixerWindow)WindowLayout.FindEditorWindowOfType(typeof(AudioMixerWindow));

            if (mixerWindow != null)
            {
                mixerWindow.Repaint();
            }

            InspectorWindow.RepaintAllInspectors();
        }
Example #4
0
 private static InspectorWindow FirstInspectorWithGameObject()
 {
     foreach (var insp in InspectorWindow.GetInspectors())
     {
         if (insp.GetInspectedObject() is GameObject)
         {
             return(insp);
         }
     }
     return(null);
 }
Example #5
0
        public void OnTreeSelectionChanged(int[] selection)
        {
            var groups = GetAudioMixerGroupsFromNodeIDs(selection);

            Selection.objects = groups.ToArray();
            m_Controller.OnUnitySelectionChanged();
            if (groups.Count == 1)
            {
                m_ScrollToItem = groups[0];
            }
            InspectorWindow.RepaintAllInspectors();
        }
        public void OnTreeSelectionChanged(int[] selection)
        {
            List <AudioMixerGroupController> audioMixerGroupsFromNodeIDs = this.GetAudioMixerGroupsFromNodeIDs(selection);

            Selection.objects = audioMixerGroupsFromNodeIDs.ToArray();
            this.m_Controller.OnUnitySelectionChanged();
            if (audioMixerGroupsFromNodeIDs.Count == 1)
            {
                this.m_ScrollToItem = audioMixerGroupsFromNodeIDs[0];
            }
            InspectorWindow.RepaintAllInspectors();
        }
Example #7
0
        private void HandleBrushPicking()
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && IsPickingEvent(evt) && !isHotControl)
            {
                m_ModeBeforePicking = EditMode.SceneViewEditMode.GridPainting;
                if (inEditMode && EditMode.editMode != EditMode.SceneViewEditMode.GridPicking)
                {
                    m_ModeBeforePicking = EditMode.editMode;
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridPicking, GridPaintingState.instance);
                }

                m_MarqueeStart            = mouseGridPosition;
                m_MarqueeType             = MarqueeType.Pick;
                s_LastActivePaintableGrid = this;
                Event.current.Use();
                GUI.changed           = true;
                GUIUtility.hotControl = m_PermanentControlID;
                OnBrushPickStarted();
            }
            if (evt.type == EventType.MouseDrag && isHotControl && m_MarqueeStart.HasValue && m_MarqueeType == MarqueeType.Pick && IsPickingEvent(evt))
            {
                RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                OnBrushPickDragged(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, 0), new Vector3Int(rect.size.x, rect.size.y, 1)));
                Event.current.Use();
                GUI.changed = true;
            }
            if (evt.type == EventType.MouseUp && m_MarqueeStart.HasValue && m_MarqueeType == MarqueeType.Pick && IsPickingEvent(evt))
            {
                RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                if (isHotControl)
                {
                    Vector2Int pivot = GetMarqueePivot(m_MarqueeStart.Value, mouseGridPosition);
                    PickBrush(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, 0), new Vector3Int(rect.size.x, rect.size.y, 1)), new Vector3Int(pivot.x, pivot.y, 0));

                    if (inEditMode && EditMode.editMode != m_ModeBeforePicking)
                    {
                        EditMode.ChangeEditMode(m_ModeBeforePicking, GridPaintingState.instance);
                    }

                    GridPaletteBrushes.ActiveGridBrushAssetChanged();
                    s_LastActivePaintableGrid = this;
                    InspectorWindow.RepaintAllInspectors();
                    Event.current.Use();
                    GUI.changed           = true;
                    GUIUtility.hotControl = 0;
                }
                m_MarqueeType  = MarqueeType.None;
                m_MarqueeStart = null;
            }
        }
Example #8
0
 private void ChangeInspectorLock(bool locked)
 {
     foreach (InspectorWindow window in InspectorWindow.GetAllInspectorWindows())
     {
         foreach (Editor editor in window.GetTracker().activeEditors)
         {
             if (editor == this)
             {
                 this.m_InspectorLocked = window.isLocked;
                 window.isLocked        = locked;
             }
         }
     }
 }
Example #9
0
 private void ChangeInspectorLock(bool locked)
 {
     foreach (InspectorWindow allInspectorWindow in InspectorWindow.GetAllInspectorWindows())
     {
         foreach (UnityEngine.Object activeEditor in allInspectorWindow.GetTracker().activeEditors)
         {
             if (activeEditor == (UnityEngine.Object) this)
             {
                 this.m_InspectorLocked      = allInspectorWindow.isLocked;
                 allInspectorWindow.isLocked = locked;
             }
         }
     }
 }
        void OnBecameVisible()
        {
            if (m_IsVisible)
            {
                return;
            }

            m_IsVisible = true;

            InitEffectUI();

            SceneView.RepaintAll();
            InspectorWindow.RepaintAllInspectors();
        }
Example #11
0
        private void HandleBrushPicking()
        {
            Event current = Event.current;

            if (current.type == EventType.MouseDown && this.IsPickingEvent(current) && !this.isHotControl)
            {
                this.m_ModeBeforePicking = EditMode.SceneViewEditMode.GridPainting;
                if (this.inEditMode && EditMode.editMode != EditMode.SceneViewEditMode.GridPicking)
                {
                    this.m_ModeBeforePicking = EditMode.editMode;
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridPicking, ScriptableSingleton <GridPaintingState> .instance);
                }
                this.m_MarqueeStart = new Vector2Int?(this.mouseGridPosition);
                this.m_MarqueeType  = PaintableGrid.MarqueeType.Pick;
                PaintableGrid.s_LastActivePaintableGrid = this;
                Event.current.Use();
                GUI.changed           = true;
                GUIUtility.hotControl = this.m_PermanentControlID;
                this.OnBrushPickStarted();
            }
            if (current.type == EventType.MouseDrag && this.isHotControl && this.m_MarqueeStart.HasValue && this.m_MarqueeType == PaintableGrid.MarqueeType.Pick && this.IsPickingEvent(current))
            {
                RectInt marqueeRect = GridEditorUtility.GetMarqueeRect(this.m_MarqueeStart.Value, this.mouseGridPosition);
                this.OnBrushPickDragged(new BoundsInt(new Vector3Int(marqueeRect.xMin, marqueeRect.yMin, 0), new Vector3Int(marqueeRect.size.x, marqueeRect.size.y, 1)));
                Event.current.Use();
                GUI.changed = true;
            }
            if (current.type == EventType.MouseUp && this.m_MarqueeStart.HasValue && this.m_MarqueeType == PaintableGrid.MarqueeType.Pick && this.IsPickingEvent(current))
            {
                RectInt marqueeRect2 = GridEditorUtility.GetMarqueeRect(this.m_MarqueeStart.Value, this.mouseGridPosition);
                if (this.isHotControl)
                {
                    Vector2Int marqueePivot = this.GetMarqueePivot(this.m_MarqueeStart.Value, this.mouseGridPosition);
                    this.PickBrush(new BoundsInt(new Vector3Int(marqueeRect2.xMin, marqueeRect2.yMin, 0), new Vector3Int(marqueeRect2.size.x, marqueeRect2.size.y, 1)), new Vector3Int(marqueePivot.x, marqueePivot.y, 0));
                    if (this.inEditMode && EditMode.editMode != this.m_ModeBeforePicking)
                    {
                        EditMode.ChangeEditMode(this.m_ModeBeforePicking, ScriptableSingleton <GridPaintingState> .instance);
                    }
                    GridPaletteBrushes.ActiveGridBrushAssetChanged();
                    PaintableGrid.s_LastActivePaintableGrid = this;
                    InspectorWindow.RepaintAllInspectors();
                    Event.current.Use();
                    GUI.changed           = true;
                    GUIUtility.hotControl = 0;
                }
                this.m_MarqueeType  = PaintableGrid.MarqueeType.None;
                this.m_MarqueeStart = null;
            }
        }
        public override void OnPreviewSettings()
        {
            if (AudioClipInspector.s_DefaultIcon == null)
            {
                AudioClipInspector.Init();
            }
            AudioClip audioClip = base.target as AudioClip;

            using (new EditorGUI.DisabledScope(AudioUtil.IsMovieAudio(audioClip)))
            {
                bool flag = base.targets.Length > 1;
                using (new EditorGUI.DisabledScope(flag))
                {
                    bool flag2 = !flag && AudioClipInspector.m_bAutoPlay;
                    bool flag3 = PreviewGUI.CycleButton((!flag2) ? 0 : 1, AudioClipInspector.s_AutoPlayIcons) != 0;
                    if (flag2 != flag3)
                    {
                        AudioClipInspector.m_bAutoPlay = flag3;
                        InspectorWindow.RepaintAllInspectors();
                    }
                    bool flag4 = !flag && AudioClipInspector.m_bLoop;
                    bool flag5 = PreviewGUI.CycleButton((!flag4) ? 0 : 1, AudioClipInspector.s_LoopIcons) != 0;
                    if (flag4 != flag5)
                    {
                        AudioClipInspector.m_bLoop = flag5;
                        if (AudioClipInspector.playing)
                        {
                            AudioUtil.LoopClip(audioClip, flag5);
                        }
                        InspectorWindow.RepaintAllInspectors();
                    }
                }
                using (new EditorGUI.DisabledScope(flag && !AudioClipInspector.playing && AudioClipInspector.m_PlayingInspector != this))
                {
                    bool flag6 = AudioClipInspector.m_PlayingInspector == this && AudioClipInspector.playing;
                    bool flag7 = PreviewGUI.CycleButton((!flag6) ? 0 : 1, AudioClipInspector.s_PlayIcons) != 0;
                    if (flag7 != flag6)
                    {
                        AudioUtil.StopAllClips();
                        if (flag7)
                        {
                            AudioUtil.PlayClip(audioClip, 0, AudioClipInspector.m_bLoop);
                            AudioClipInspector.m_PlayingClip      = audioClip;
                            AudioClipInspector.m_PlayingInspector = this;
                        }
                    }
                }
            }
        }
 private static InspectorWindow FirstInspectorWithGameObject()
 {
     using (List <InspectorWindow> .Enumerator enumerator = InspectorWindow.GetInspectors().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             InspectorWindow current = enumerator.Current;
             if (current.GetInspectedObject() is GameObject)
             {
                 return(current);
             }
         }
     }
     return((InspectorWindow)null);
 }
Example #14
0
 void ChangeInspectorLock(bool locked)
 {
     foreach (InspectorWindow i in InspectorWindow.GetAllInspectorWindows())
     {
         ActiveEditorTracker activeEditor = i.tracker;
         foreach (Editor e in activeEditor.activeEditors)
         {
             if (e == this)
             {
                 m_InspectorLocked = i.isLocked;
                 i.isLocked        = locked;
             }
         }
     }
 }
Example #15
0
 bool IsPartOfLockedInspector()
 {
     foreach (InspectorWindow i in InspectorWindow.GetAllInspectorWindows())
     {
         ActiveEditorTracker activeEditor = i.tracker;
         foreach (Editor e in activeEditor.activeEditors)
         {
             if (e == this && i.isLocked)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        private static InspectorWindow FirstInspectorWithGameObject()
        {
            InspectorWindow result;

            foreach (InspectorWindow current in InspectorWindow.GetInspectors())
            {
                if (current.GetInspectedObject() is GameObject)
                {
                    result = current;
                    return(result);
                }
            }
            result = null;
            return(result);
        }
Example #17
0
 private void OnGUI()
 {
     LightModeUtil.Get().Load();
     EditorGUIUtility.labelWidth = 130f;
     EditorGUILayout.Space();
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(this.toolbarPadding);
     this.ModeToggle();
     GUILayout.FlexibleSpace();
     this.DrawHelpGUI();
     if (this.m_Mode == LightingWindow.Mode.LightingSettings)
     {
         this.DrawSettingsGUI();
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.Space();
     LightingWindow.Mode mode = this.m_Mode;
     if (mode != LightingWindow.Mode.LightingSettings)
     {
         if (mode != LightingWindow.Mode.OutputMaps)
         {
             if (mode != LightingWindow.Mode.ObjectSettings)
             {
             }
         }
         else
         {
             this.m_ScrollPositionOutputMaps = EditorGUILayout.BeginScrollView(this.m_ScrollPositionOutputMaps, new GUILayoutOption[0]);
             this.m_LightmapPreviewTab.Maps();
             EditorGUILayout.EndScrollView();
             EditorGUILayout.Space();
         }
     }
     else
     {
         this.m_ScrollPositionLighting = EditorGUILayout.BeginScrollView(this.m_ScrollPositionLighting, new GUILayoutOption[0]);
         this.m_LightingTab.OnGUI();
         EditorGUILayout.EndScrollView();
         EditorGUILayout.Space();
     }
     this.Buttons();
     this.Summary();
     this.PreviewSection();
     if (LightModeUtil.Get().Flush())
     {
         InspectorWindow.RepaintAllInspectors();
     }
 }
Example #18
0
        private void Buttons()
        {
            bool flag = Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.Iterative;

            if (flag)
            {
                EditorGUILayout.HelpBox("Baking of lightmaps is automatic because the workflow mode is set to 'Auto'. The lightmap data is stored in the GI cache.", MessageType.Info);
            }
            if (Lightmapping.lightingDataAsset && !Lightmapping.lightingDataAsset.isValid)
            {
                EditorGUILayout.HelpBox(Lightmapping.lightingDataAsset.validityErrorMessage, MessageType.Error);
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            EditorGUI.BeginChangeCheck();
            flag = GUILayout.Toggle(flag, LightingWindow.styles.ContinuousBakeLabel, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                Lightmapping.giWorkflowMode = ((!flag) ? Lightmapping.GIWorkflowMode.OnDemand : Lightmapping.GIWorkflowMode.Iterative);
                InspectorWindow.RepaintAllInspectors();
            }
            using (new EditorGUI.DisabledScope(flag))
            {
                bool flag2 = flag || !Lightmapping.isRunning;
                if (flag2)
                {
                    if (EditorGUI.ButtonWithDropdownList(LightingWindow.styles.BuildLabel, LightingWindow.s_BakeModeOptions, new GenericMenu.MenuFunction2(this.BakeDropDownCallback), new GUILayoutOption[]
                    {
                        GUILayout.Width(180f)
                    }))
                    {
                        this.DoBake();
                        GUIUtility.ExitGUI();
                    }
                }
                else if (GUILayout.Button("Cancel", new GUILayoutOption[]
                {
                    GUILayout.Width(this.kButtonWidth)
                }))
                {
                    Lightmapping.Cancel();
                    UsabilityAnalytics.Track("/LightMapper/Cancel");
                }
            }
            GUILayout.EndHorizontal();
        }
        private void HandleSelectTool()
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && evt.button == 0 && !evt.alt &&
                (EditMode.editMode == EditMode.SceneViewEditMode.GridSelect || (EditMode.editMode == EditMode.SceneViewEditMode.GridMove && evt.control)))
            {
                if (EditMode.editMode == EditMode.SceneViewEditMode.GridMove && evt.control)
                {
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridSelect, GridPaintingState.instance);
                }

                m_PreviousMove = null;
                m_MarqueeStart = mouseGridPosition;
                m_MarqueeType  = MarqueeType.Select;

                s_LastActivePaintableGrid = this;
                GUIUtility.hotControl     = m_PermanentControlID;
                Event.current.Use();
            }
            if (evt.rawType == EventType.MouseUp && evt.button == 0 && !evt.alt && m_MarqueeStart.HasValue && isHotControl && EditMode.editMode == EditMode.SceneViewEditMode.GridSelect)
            {
                // Check if event only occurred in the PaintableGrid window as evt.type will filter for this
                if (evt.type == EventType.MouseUp && m_MarqueeType == MarqueeType.Select)
                {
                    RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                    Select(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, 0), new Vector3Int(rect.size.x, rect.size.y, 1)));
                    Event.current.Use();
                }
                if (evt.control)
                {
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridMove, GridPaintingState.instance);
                }
                m_MarqueeStart = null;
                m_MarqueeType  = MarqueeType.None;
                InspectorWindow.RepaintAllInspectors();
                GUIUtility.hotControl = 0;
            }
            if (evt.type == EventType.KeyDown && evt.keyCode == KeyCode.Escape && !m_MarqueeStart.HasValue && !m_PreviousMove.HasValue)
            {
                ClearGridSelection();
                Event.current.Use();
            }
        }
Example #20
0
 private void ChangeInspectorLock(bool locked)
 {
     InspectorWindow[] allInspectorWindows = InspectorWindow.GetAllInspectorWindows();
     for (int i = 0; i < allInspectorWindows.Length; i++)
     {
         InspectorWindow     inspectorWindow = allInspectorWindows[i];
         ActiveEditorTracker tracker         = inspectorWindow.tracker;
         Editor[]            activeEditors   = tracker.activeEditors;
         for (int j = 0; j < activeEditors.Length; j++)
         {
             Editor x = activeEditors[j];
             if (x == this)
             {
                 this.m_InspectorLocked   = inspectorWindow.isLocked;
                 inspectorWindow.isLocked = locked;
             }
         }
     }
 }
Example #21
0
        void ShowOption(BuildPlatform bp, GUIContent title, GUIStyle background)
        {
            Rect r = GUILayoutUtility.GetRect(50, 36);

            r.x += 1;
            r.y += 1;
            bool valid = BuildPipeline.LicenseCheck(bp.defaultTarget);

            GUI.contentColor = new Color(1, 1, 1, valid ? 1 : .7f);
            bool enabled = EditorUserBuildSettings.selectedBuildTargetGroup == bp.targetGroup;

            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(r, GUIContent.none, false, false, enabled, false);
                GUI.Label(new Rect(r.x + 3, r.y + 3, 32, 32), title.image, GUIStyle.none);

                if (EditorUserBuildSettings.activeBuildTargetGroup == bp.targetGroup)
                {
                    GUI.Label(new Rect(r.xMax - styles.activePlatformIcon.width - 8, r.y + 3 + (32 - styles.activePlatformIcon.height) / 2,
                                       styles.activePlatformIcon.width, styles.activePlatformIcon.height),
                              styles.activePlatformIcon, GUIStyle.none);
                }
            }

            if (GUI.Toggle(r, enabled, title.text, styles.platformSelector))
            {
                if (EditorUserBuildSettings.selectedBuildTargetGroup != bp.targetGroup)
                {
                    EditorUserBuildSettings.selectedBuildTargetGroup = bp.targetGroup;

                    // Repaint inspectors, as they may be showing platform target specific things.
                    Object[] inspectors = Resources.FindObjectsOfTypeAll(typeof(InspectorWindow));
                    for (int i = 0; i < inspectors.Length; i++)
                    {
                        InspectorWindow inspector = inspectors[i] as InspectorWindow;
                        if (inspector != null)
                        {
                            inspector.Repaint();
                        }
                    }
                }
            }
        }
Example #22
0
        private void Buttons()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            EditorGUI.BeginChangeCheck();
            bool flag = Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.Iterative;

            flag = GUILayout.Toggle(flag, LightingWindow.styles.ContinuousBakeLabel, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                Lightmapping.giWorkflowMode = ((!flag) ? Lightmapping.GIWorkflowMode.OnDemand : Lightmapping.GIWorkflowMode.Iterative);
                InspectorWindow.RepaintAllInspectors();
            }
            EditorGUI.BeginDisabledGroup(flag);
            bool flag2 = flag || !Lightmapping.isRunning;

            if (flag2)
            {
                if (EditorGUI.ButtonWithDropdownList(LightingWindow.styles.BuildLabel, LightingWindow.s_BakeModeOptions, new GenericMenu.MenuFunction2(this.BakeDropDownCallback), new GUILayoutOption[]
                {
                    GUILayout.Width(180f)
                }))
                {
                    this.DoBake();
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                if (GUILayout.Button("Cancel", new GUILayoutOption[]
                {
                    GUILayout.Width(this.kButtonWidth)
                }))
                {
                    Lightmapping.Cancel();
                    Analytics.Track("/LightMapper/Cancel");
                }
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
        }
Example #23
0
        private void HandleSelectTool()
        {
            Event current = Event.current;

            if (current.type == EventType.MouseDown && current.button == 0 && !current.alt && (EditMode.editMode == EditMode.SceneViewEditMode.GridSelect || (EditMode.editMode == EditMode.SceneViewEditMode.GridMove && current.control)))
            {
                if (EditMode.editMode == EditMode.SceneViewEditMode.GridMove && current.control)
                {
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridSelect, ScriptableSingleton <GridPaintingState> .instance);
                }
                this.m_PreviousMove = null;
                this.m_MarqueeStart = new Vector2Int?(this.mouseGridPosition);
                this.m_MarqueeType  = PaintableGrid.MarqueeType.Select;
                PaintableGrid.s_LastActivePaintableGrid = this;
                GUIUtility.hotControl = this.m_PermanentControlID;
                Event.current.Use();
            }
            if (current.type == EventType.MouseUp && current.button == 0 && !current.alt && this.m_MarqueeStart.HasValue && GUIUtility.hotControl == this.m_PermanentControlID && EditMode.editMode == EditMode.SceneViewEditMode.GridSelect)
            {
                if (this.m_MarqueeStart.HasValue && this.m_MarqueeType == PaintableGrid.MarqueeType.Select)
                {
                    RectInt marqueeRect = GridEditorUtility.GetMarqueeRect(this.m_MarqueeStart.Value, this.mouseGridPosition);
                    this.Select(new BoundsInt(new Vector3Int(marqueeRect.xMin, marqueeRect.yMin, 0), new Vector3Int(marqueeRect.size.x, marqueeRect.size.y, 1)));
                    this.m_MarqueeStart = null;
                    this.m_MarqueeType  = PaintableGrid.MarqueeType.None;
                    InspectorWindow.RepaintAllInspectors();
                }
                if (current.control)
                {
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridMove, ScriptableSingleton <GridPaintingState> .instance);
                }
                GUIUtility.hotControl = 0;
                Event.current.Use();
            }
            if (current.type == EventType.KeyDown && current.keyCode == KeyCode.Escape && !this.m_MarqueeStart.HasValue && !this.m_PreviousMove.HasValue)
            {
                this.ClearGridSelection();
                Event.current.Use();
            }
        }
Example #24
0
        void CreateNewPresetButton(Rect buttonRect, object newPresetObject, PresetLibrary lib, bool isOpenForEdit)
        {
            using (new EditorGUI.DisabledScope(!isOpenForEdit))
            {
                if (GUI.Button(buttonRect, isOpenForEdit ? s_Styles.plusButtonText : s_Styles.plusButtonTextNotCheckedOut))
                {
                    int newIndex = CreateNewPreset(newPresetObject, "");
                    if (drawLabels)
                    {
                        BeginRenaming("", newIndex, 0f);
                    }
                    InspectorWindow.RepaintAllInspectors(); // If inspecting a preset libarary we want to show the new preset there as well
                }

                if (Event.current.type == EventType.Repaint)
                {
                    Rect rect2 = new RectOffset(-3, -3, -3, -3).Add(buttonRect);
                    lib.Draw(rect2, newPresetObject);

                    if (buttonRect.width > 30)
                    {
                        LabelWithOutline(buttonRect, s_Styles.newPreset, new Color(0.1f, 0.1f, 0.1f), s_Styles.newPresetStyle);
                    }
                    else
                    {
                        if (lib.Count() == 0 && isOpenForEdit)
                        {
                            buttonRect.x      = buttonRect.xMax + 5f;
                            buttonRect.width  = 200;
                            buttonRect.height = EditorGUI.kSingleLineHeight;
                            using (new EditorGUI.DisabledScope(true))
                            {
                                GUI.Label(buttonRect, "Click to add new preset");
                            }
                        }
                    }
                }
            }
        }
Example #25
0
        private void Buttons()
        {
            bool flag = Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.Iterative;

            if (flag)
            {
                EditorGUILayout.HelpBox("Baking of lightmaps is automatic because the workflow mode is set to 'Auto'. The lightmap data is stored in the GI cache.", MessageType.Info);
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            EditorGUI.BeginChangeCheck();
            flag = GUILayout.Toggle(flag, styles.ContinuousBakeLabel, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                Lightmapping.giWorkflowMode = !flag ? Lightmapping.GIWorkflowMode.OnDemand : Lightmapping.GIWorkflowMode.Iterative;
                InspectorWindow.RepaintAllInspectors();
            }
            EditorGUI.BeginDisabledGroup(flag);
            if (flag || !Lightmapping.isRunning)
            {
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(180f) };
                if (EditorGUI.ButtonWithDropdownList(styles.BuildLabel, s_BakeModeOptions, new GenericMenu.MenuFunction2(this.BakeDropDownCallback), options))
                {
                    this.DoBake();
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(this.kButtonWidth) };
                if (GUILayout.Button("Cancel", optionArray2))
                {
                    Lightmapping.Cancel();
                    Analytics.Track("/LightMapper/Cancel");
                }
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
        }
		protected virtual void OnGUI()
		{
			Profiler.BeginSample("InspectorWindow.OnGUI");
			this.CreateTracker();
			this.CreatePreviewables();
			this.ResetKeyboardControl();
			this.m_ScrollPosition = EditorGUILayout.BeginVerticalScrollView(this.m_ScrollPosition, new GUILayoutOption[0]);
			if (Event.current.type == EventType.Repaint)
			{
				this.m_Tracker.ClearDirty();
			}
			InspectorWindow.s_CurrentInspectorWindow = this;
			Editor[] activeEditors = this.m_Tracker.activeEditors;
			this.AssignAssetEditor(activeEditors);
			Profiler.BeginSample("InspectorWindow.DrawEditors()");
			this.DrawEditors(activeEditors);
			Profiler.EndSample();
			if (this.m_Tracker.hasComponentsWhichCannotBeMultiEdited)
			{
				if (activeEditors.Length == 0 && !this.m_Tracker.isLocked && Selection.objects.Length > 0)
				{
					this.DrawSelectionPickerList();
				}
				else
				{
					Rect rect = GUILayoutUtility.GetRect(10f, 4f, EditorStyles.inspectorTitlebar);
					if (Event.current.type == EventType.Repaint)
					{
						this.DrawSplitLine(rect.y);
					}
					GUILayout.Label("Components that are only on some of the selected objects cannot be multi-edited.", EditorStyles.helpBox, new GUILayoutOption[0]);
					GUILayout.Space(4f);
				}
			}
			InspectorWindow.s_CurrentInspectorWindow = null;
			EditorGUI.indentLevel = 0;
			this.AddComponentButton(this.m_Tracker.activeEditors);
			GUI.enabled = true;
			this.CheckDragAndDrop(this.m_Tracker.activeEditors);
			this.MoveFocusOnKeyPress();
			GUILayout.EndScrollView();
			Profiler.BeginSample("InspectorWindow.DrawPreviewAndLabels");
			this.DrawPreviewAndLabels();
			Profiler.EndSample();
			if (this.m_Tracker.activeEditors.Length > 0)
			{
				this.DrawVCSShortInfo();
			}
			Profiler.EndSample();
		}
 internal static void RemoveInspectorWindow(InspectorWindow window)
 {
     m_AllInspectors.Remove(window);
 }
 public void SetParentInspector(InspectorWindow inspector)
 {
     this.m_ParentInspectorWindow = inspector;
     this.CreateTracker();
 }
Example #29
0
 internal static void RepaintAllToolViews()
 {
     Toolbar.RepaintToolbar();
     SceneView.RepaintAll();
     InspectorWindow.RepaintAllInspectors();
 }
 public void SetParentInspector(InspectorWindow inspector)
 {
   this.m_ParentInspectorWindow = inspector;
 }
Example #31
0
 public static void RepaintAudioMixerAndInspectors()
 {
     InspectorWindow.RepaintAllInspectors();
     AudioMixerWindow.RepaintAudioMixerWindow();
 }
 void PresetsWasReordered()
 {
     InspectorWindow.RepaintAllInspectors();
 }
Example #33
0
 // Repaint any inspectors that shows this editor.
 public void Repaint()
 {
     InspectorWindow.RepaintAllInspectors();
 }