Пример #1
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;
        }
Пример #2
0
 public override void OnEnable()
 {
     base.OnEnable();
     m_ImguiContainer = new IMGUIContainer(OnIMGUI);
     m_TableContentsPanel.Add(m_ImguiContainer);
     m_ImguiContainer.StretchToParentSize();
 }
        public override VisualElement CreateInspectorGUI()
        {
            if (m_Root == null)
            {
                m_Root = Resources.GetTemplate("StringTableEditor");
                m_Root.Bind(serializedObject);

                m_Root.Q <PropertyField>("m_TableName").Q <TextField>().RegisterCallback <ChangeEvent <string> >(TableNameChanged);
                m_Root.Q <PropertyField>("m_TableName").Q <TextField>().isDelayed = true; // Prevent an undo for every char changed.
                var tableContainer = m_Root.Q("tableContainer");
                m_ImguiContainer = new IMGUIContainer(OnIMGUI);

                // Workaround for IMGUI resize bug https://unity.slack.com/archives/C3414V4UV/p1533657274000148
                m_ImguiContainer.style.overflow = Overflow.Visible;

                tableContainer.Add(m_ImguiContainer);
                m_ImguiContainer.StretchToParentSize();
                m_DetailedPanel          = m_Root.Q("detailedPanel");
                m_DetailedPanelContainer = m_Root.Q("detailedPanelContainer");

                m_PluralModeToggle = m_DetailedPanelContainer.Q <Toggle>("pluralModeToggle");
                m_PluralModeToggle.RegisterCallback <ChangeEvent <bool> >(evt => RefreshEditPanel());
            }
            return(m_Root);
        }
Пример #4
0
        public override void OnCreate(IWindowModel model)
        {
            try
            {
                base.OnCreate(model);

                m_PlayModeDarkenColor = UIElementsUtility.editorPlayModeTintColor =
                    EditorApplication.isPlayingOrWillChangePlaymode ? editorWindowModel.playModeTintColor : Color.white;

                EditorApplication.playModeStateChanged  += PlayModeStateChangedCallback;
                AnimationMode.onAnimationRecordingStart += RefreshStylesAfterExternalEvent;
                AnimationMode.onAnimationRecordingStop  += RefreshStylesAfterExternalEvent;

                m_NotificationContainer = new IMGUIContainer();
                m_NotificationContainer.StretchToParentSize();
                m_NotificationContainer.pickingMode = PickingMode.Ignore;

                RegisterImguiContainerGUICallbacks();

                // Window is non-null when set by deserialization; it's usually null when OnCreate is called.
                if (editorWindowModel.window != null)
                {
                    RegisterWindow();
                }
            }
            catch (Exception e)
            {
                // Log error to easily diagnose issues with panel initialization and then rethrow it.
                Debug.LogException(e);
                throw;
            }
        }
        public override void OnCreate(IWindowModel model)
        {
            base.OnCreate(model);

            m_PlayModeDarkenColor = UIElementsUtility.editorPlayModeTintColor = EditorApplication.isPlayingOrWillChangePlaymode ? editorWindowModel.playModeTintColor : Color.white;

            EditorApplication.playModeStateChanged  += PlayModeStateChangedCallback;
            AnimationMode.onAnimationRecordingStart += RefreshStylesAfterExternalEvent;
            AnimationMode.onAnimationRecordingStop  += RefreshStylesAfterExternalEvent;

            m_NotificationContainer = new IMGUIContainer();
            m_NotificationContainer.StretchToParentSize();
            m_NotificationContainer.pickingMode = PickingMode.Ignore;

            editorWindowModel.notificationVisibilityChanged = NotificationVisibilityChanged;
            editorWindowModel.blurred = Blured;
            editorWindowModel.focused = Focused;
            editorWindowModel.playModeTintColorChanged = PlayModeTintColorChanged;

            if (editorWindowModel.window != null)
            {
                OnRegisterWindow();
                ViewMarginsChanged();
            }

            editorWindowModel.onRegisterWindow         = OnRegisterWindow;
            editorWindowModel.onUnegisterWindow        = OnUnegisterWindow;
            editorWindowModel.onDisplayWindowMenu      = AddUIElementsDebuggerToMenu;
            editorWindowModel.viewMarginsChanged       = ViewMarginsChanged;
            editorWindowModel.rootVisualElementCreated = RootVisualElementCreated;
        }
Пример #6
0
 public override void OnEnable()
 {
     InitializeRootView();
     InitializeGraph();
     iMGUIContainer = new IMGUIContainer(OnGUI);
     iMGUIContainer.StretchToParentSize();
     iMGUIContainer.pickingMode = PickingMode.Ignore;
     rootView.Add(iMGUIContainer);
 }
Пример #7
0
 protected virtual void OnEnable()
 {
     imguiContainer = new IMGUIContainer(OldOnGUI)
     {
         useOwnerObjectGUIState = true
     };
     imguiContainer.StretchToParentSize();
     imguiContainer.persistenceKey = "Dockarea";
     visualTree.Insert(0, imguiContainer);
 }
Пример #8
0
 protected override void OnEnable()
 {
     m_PlayModeDarkenColor = UIElementsUtility.editorPlayModeTintColor = EditorApplication.isPlayingOrWillChangePlaymode ? kPlayModeDarken.Color : Color.white;
     EditorApplication.playModeStateChanged += PlayModeStateChangedCallback;
     EditorPrefs.onValueWasUpdated          += PlayModeTintColorChangedCallback;
     base.OnEnable();
     background = null;
     m_NotificationContainer = new IMGUIContainer();
     m_NotificationContainer.StretchToParentSize();
     m_NotificationContainer.pickingMode = PickingMode.Ignore;
     RegisterSelectedPane(sendEvents: true);
 }
Пример #9
0
 public override void OnEnable()
 {
     base.OnEnable();
     m_ImguiContainer = new IMGUIContainer(OnIMGUI);
     m_TableContentsPanel.Add(m_ImguiContainer);
     m_ImguiContainer.StretchToParentSize();
     RegisterCallback <DetachFromPanelEvent>(evt =>
     {
         m_StringTableListView?.Dispose();
         m_StringTableListView = null;
     });
 }
Пример #10
0
        public override VisualElement CreateInspectorGUI()
        {
            m_Root = UI.Resources.GetTemplate("LocalizedAssetTableEditor");
            m_Root.Bind(serializedObject);

            m_Root.Q <PropertyField>("m_TableName").Q <TextField>().RegisterCallback <ChangeEvent <string> >(TableNameChanged);
            m_Root.Q <PropertyField>("m_TableName").Q <TextField>().isDelayed = true; // Prevent an undo per char change.
            var tableContainer = m_Root.Q("tableContainer");

            m_IMGUIContainer = new IMGUIContainer(OnIMGUI);
            tableContainer.Add(m_IMGUIContainer);
            m_IMGUIContainer.StretchToParentSize();
            return(m_Root);
        }
 void IEditorWindowBackend.NotificationVisibilityChanged()
 {
     if (editorWindowModel.notificationVisible)
     {
         if (m_NotificationContainer.parent == null)
         {
             m_Panel.visualTree.Add(m_NotificationContainer);
             m_NotificationContainer.StretchToParentSize();
         }
     }
     else
     {
         m_NotificationContainer.RemoveFromHierarchy();
     }
 }
Пример #12
0
 private void OverlayChanged()
 {
     if (m_OverlayGUIHandler != null)
     {
         if (m_OverlayContainer.parent == null)
         {
             m_Panel.visualTree.Add(m_OverlayContainer);
             m_OverlayContainer.StretchToParentSize();
         }
     }
     else
     {
         m_OverlayContainer.RemoveFromHierarchy();
     }
 }
        public TimelineElement(RefreshScheduler scheduler, VisualElement extraViewer)
        {
            name = "timeline";

            var timeArea = new VisualElement();

            timeArea.name = "timeArea";
            Add(timeArea);

            var timeAreaGUI    = new TimeAreaGUI();
            var imguiContainer = new IMGUIContainer(() =>
            {
                timeAreaGUI.OnGUI(timeArea.layout);
            });

            imguiContainer.name = "timeAreaGUI";
            timeArea.Add(imguiContainer);
            imguiContainer.StretchToParentSize();

            var timeProvider = new TimeConverter(timeAreaGUI);
            var playhead     = new PlayheadElement(timeProvider);

            playhead.name = "playhead";
            Add(playhead);

            imguiContainer.AddManipulator(new PlayheadDragManipulator(playhead));
            playhead.AddManipulator(new PlayheadDragManipulator(playhead));
            imguiContainer.AddManipulator(new TimeAreaCallbackManipulator(timeAreaGUI, playhead));
            imguiContainer.AddManipulator(new TimeAreaResizeManipulator(playhead));

            var trackContainer = new TrackContainer(timeProvider, scheduler, extraViewer);

            Add(trackContainer);

            //playhead needs to be on top of the tracks
            playhead.BringToFront();

            scheduler.Refresh += () =>
            {
                if (!GameDebuggerRecorder.isPlaying)
                {
                    return;
                }
                var frame = GameDebuggerRecorder.currentFrame;
                var time  = GameDebuggerDatabase.GetRecords(frame).time;
                playhead.SetTime(time);
            };
        }
    static void SetRoot()
    {
        IMGUIContainer container = new IMGUIContainer();

        root.Add(container);

        container.name = "VoxelToolWindow";

        container.StretchToParentSize();
        container.AddToClassList("unity-imgui-container");

        rect = EditorWindow.focusedWindow.rootVisualElement.layout;

        Action GUIHandler = newGUI;

        container.onGUIHandler = GUIHandler;
    }
Пример #15
0
        protected void CheckNotificationStatus()
        {
            if (m_ActualView != null && m_ActualView.m_FadeoutTime != 0)
            {
                if (m_NotificationContainer.parent == null)
                {
                    m_NotificationContainer.onGUIHandler = m_ActualView.DrawNotification;
                    visualTree.Add(m_NotificationContainer);

                    m_NotificationContainer.StretchToParentSize();
                }
            }
            else
            {
                m_NotificationContainer.onGUIHandler = null;
                m_NotificationContainer.RemoveFromHierarchy();
            }
        }
Пример #16
0
        protected virtual void OnEnable()
        {
            {
                imguiContainer = new IMGUIContainer(OldOnGUI)
                {
                    useOwnerObjectGUIState = true
                };
                imguiContainer.StretchToParentSize();
                imguiContainer.viewDataKey = "Dockarea";

                if (m_Panel != null)
                {
                    m_Panel.visualTree.Insert(0, imguiContainer);
                }
            }

            Panel.BeforeUpdaterChange += OnBeforeUpdaterChange;
            Panel.AfterUpdaterChange  += OnAfterUpdaterChange;
        }