Пример #1
0
        protected override void OnEnable()
        {
            if (m_Panes != null)
            {
                if (m_Panes.Count == 0)
                {
                    m_Selected = 0;
                }
                else
                {
                    // before fix for case 840151, it is possible that out of range selected index was serialized (e.g., case 846859)
                    m_Selected = Math.Min(m_Selected, m_Panes.Count - 1);
                    actualView = m_Panes[m_Selected];
                }
            }

            base.OnEnable();

            if (imguiContainer != null)
            {
                imguiContainer.name     = VisualElementUtils.GetUniqueName("Dockarea");
                imguiContainer.tabIndex = -1;
                imguiContainer.focusOnlyIfHasFocusableControls = false;
            }
        }
Пример #2
0
        public virtual void OnCreate(IWindowModel model)
        {
            m_Model = model;
            m_Panel = EditorPanel.FindOrCreate(model as ScriptableObject);

            m_Panel.visualTree.SetSize(m_Model.size);
            m_Panel.IMGUIEventInterests = m_Model.eventInterests;

            imguiContainer = new IMGUIContainer(m_Model.onGUIHandler)
            {
                useOwnerObjectGUIState = true
            };
            imguiContainer.StretchToParentSize();
            imguiContainer.viewDataKey = "Dockarea";
            imguiContainer.name        = VisualElementUtils.GetUniqueName("Dockarea");
            imguiContainer.tabIndex    = -1;
            imguiContainer.focusOnlyIfHasFocusableControls = false;

            m_Panel.visualTree.Insert(0, imguiContainer);
            Assert.IsNull(m_Panel.rootIMGUIContainer);
            m_Panel.rootIMGUIContainer = imguiContainer;

            m_Model.sizeChanged           = OnSizeChanged;
            m_Model.eventInterestsChanged = OnEventsInterestsChanged;
        }
        private VisualElement CreateRoot <TMode>() where TMode : EditorMode
        {
            var type        = typeof(TMode);
            var namePostfix = type == typeof(DefaultEditorMode) ? "" : "-" + type.Name;
            var name        = "rootVisualContainer" + namePostfix;
            var root        = new VisualElement()
            {
                name           = VisualElementUtils.GetUniqueName(name),
                pickingMode    = PickingMode.Ignore, // do not eat events so IMGUI gets them
                persistenceKey = name
            };

            UIElementsEditorUtility.AddDefaultEditorStyleSheets(root);
            return(root);
        }
Пример #4
0
        static VisualElement CreateRoot()
        {
            var name = VisualElement.k_RootVisualContainerName;
            var root = new VisualElement()
            {
                name        = VisualElementUtils.GetUniqueName(name),
                pickingMode = PickingMode.Ignore, // do not eat events so IMGUI gets them
                viewDataKey = name,
                renderHints = RenderHints.ClipWithScissors
            };

            root.pseudoStates |= PseudoStates.Root;
            EditorUIService.instance.AddDefaultEditorStyleSheets(root);
            root.style.overflow = Overflow.Hidden;
            return(root);
        }
Пример #5
0
        private VisualElement CreateRoot()
        {
            var name = "rootVisualContainer";
            var root = new VisualElement()
            {
                name        = VisualElementUtils.GetUniqueName(name),
                pickingMode = PickingMode.Ignore, // do not eat events so IMGUI gets them
                viewDataKey = name,
                renderHints = RenderHints.ClipWithScissors
            };

            root.pseudoStates |= PseudoStates.Root;
            UIElements.UIElementsEditorUtility.AddDefaultEditorStyleSheets(root);
            root.style.overflow = UnityEngine.UIElements.Overflow.Hidden;
            return(root);
        }
Пример #6
0
 protected override void OnEnable()
 {
     if (this.m_Panes != null)
     {
         if (this.m_Panes.Count == 0)
         {
             this.m_Selected = 0;
         }
         else
         {
             this.m_Selected = Math.Min(this.m_Selected, this.m_Panes.Count - 1);
             base.actualView = this.m_Panes[this.m_Selected];
         }
     }
     base.OnEnable();
     base.imguiContainer.name = VisualElementUtils.GetUniqueName("Dockarea");
 }
Пример #7
0
 public new void OnEnable()
 {
     if (this.m_Panes != null)
     {
         if (this.m_Panes.Count == 0)
         {
             this.m_Selected = 0;
         }
         else
         {
             this.m_Selected = Math.Min(this.m_Selected, this.m_Panes.Count - 1);
             base.actualView = this.m_Panes[this.m_Selected];
         }
     }
     base.OnEnable();
     this.m_DAOnGUIContainer = new IMGUIContainer(new Action(this.OldOnGUI))
     {
         name = VisualElementUtils.GetUniqueName("Dockarea")
     };
     this.m_DAOnGUIContainer.StretchToParentSize();
     base.visualTree.InsertChild(0, this.m_DAOnGUIContainer);
 }