示例#1
0
        void CreateContents()
        {
            m_MainToolbarVisual = (MainToolbarVisual)Activator.CreateInstance(EditorUIService.instance.GetDefaultToolbarType());
            m_Root?.RemoveFromHierarchy();
            m_Root = CreateRoot();

            if (windowBackend?.visualTree is VisualElement visualTree)
            {
                visualTree.Add(m_Root);
                m_Root.Add(m_MainToolbarVisual.root);
            }

            RepaintToolbar();
        }
示例#2
0
        protected override void OnEnable()
        {
            base.OnEnable();

            EditorApplication.modifierKeysChanged += Repaint;

            get = this;

            m_MainToolbarVisual = (MainToolbarVisual)Activator.CreateInstance(EditorUIService.instance.GetDefaultToolbarType());

            m_Root = CreateRoot();
            if (windowBackend.visualTree is VisualElement visualTree)
            {
                visualTree.Add(m_Root);
                m_Root.Add(m_MainToolbarVisual.root);
            }

            m_EventInterests.wantsLessLayoutEvents = true;
            RepaintToolbar();
        }