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; }
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; }
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; } }
static IWindowBackend GetDefault(IWindowModel model) { if (model is IEditorWindowModel) { return(new DefaultEditorWindowBackend()); } else { return(new DefaultWindowBackend()); } }
internal static IWindowBackend GetBackend(IWindowModel model) { //Last registered system has higherpriority for (int i = sRegisteredSystems.Count - 1; i >= 0; --i) { var backend = sRegisteredSystems[i].GetBackendForWindow(model); if (backend != null) { return(backend); } } return(GetDefault(model)); }
public override void OnDestroy(IWindowModel model) { EditorApplication.playModeStateChanged -= PlayModeStateChangedCallback; AnimationMode.onAnimationRecordingStart -= RefreshStylesAfterExternalEvent; AnimationMode.onAnimationRecordingStop -= RefreshStylesAfterExternalEvent; m_NotificationContainer.onGUIHandler = null; m_NotificationContainer.RemoveFromHierarchy(); UnregisterImguiContainerGUICallbacks(); UnregisterWindow(); base.OnDestroy(model); }
public virtual void OnDestroy(IWindowModel model) { if (imguiContainer != null) { if (imguiContainer.HasMouseCapture()) { imguiContainer.ReleaseMouse(); } imguiContainer.RemoveFromHierarchy(); Assert.AreEqual(imguiContainer, m_Panel.rootIMGUIContainer); m_Panel.rootIMGUIContainer = null; imguiContainer = null; } // Here we assume m_Model == model. We should probably make the ignored OnDestroy argument obsolete. m_Model = null; m_Panel.Dispose(); }
internal static bool IsBackendCompatible(IWindowBackend backend, IWindowModel model) { if (backend == null) { return(false); } bool isCompatible = false; //Last registered system has higherpriority for (int i = sRegisteredSystems.Count - 1; i >= 0; --i) { if (sRegisteredSystems[i].ValidateBackendCompatibility(backend, model, ref isCompatible)) { return(isCompatible); } } return(true); }
public override void OnDestroy(IWindowModel model) { EditorApplication.playModeStateChanged -= PlayModeStateChangedCallback; AnimationMode.onAnimationRecordingStart -= RefreshStylesAfterExternalEvent; AnimationMode.onAnimationRecordingStop -= RefreshStylesAfterExternalEvent; editorWindowModel.notificationVisibilityChanged = null; editorWindowModel.blurred = null; editorWindowModel.focused = null; editorWindowModel.playModeTintColorChanged = null; editorWindowModel.onRegisterWindow = null; editorWindowModel.onUnegisterWindow = null; editorWindowModel.onDisplayWindowMenu = null; editorWindowModel.viewMarginsChanged = null; m_NotificationContainer.onGUIHandler = null; m_NotificationContainer.RemoveFromHierarchy(); base.OnDestroy(model); }
public virtual void OnDestroy(IWindowModel model) { if (imguiContainer != null) { if (imguiContainer.HasMouseCapture()) { imguiContainer.ReleaseMouse(); } imguiContainer.RemoveFromHierarchy(); imguiContainer = null; } if (m_Model != null) { m_Model.sizeChanged = OnSizeChanged; m_Model.eventInterestsChanged = OnEventsInterestsChanged; m_Model = null; } m_Panel.Dispose(); }
public virtual void OnDestroy(IWindowModel model) { if (imguiContainer != null) { if (imguiContainer.HasMouseCapture()) { imguiContainer.ReleaseMouse(); } imguiContainer.RemoveFromHierarchy(); Assert.AreEqual(imguiContainer, m_Panel.rootIMGUIContainer); m_Panel.rootIMGUIContainer = null; imguiContainer = null; } if (m_Model != null) { m_Model.sizeChanged = null; m_Model.eventInterestsChanged = null; m_Model = null; } m_Panel.Dispose(); }
public IWindowBackend GetDefaultWindowBackend(IWindowModel model) => model is IEditorWindowModel ? new DefaultEditorWindowBackend() : new DefaultWindowBackend();
public AsyncLoaderModel(WindowFactory windowFactory, IWindowModel windowModel) { this.windowFactory = windowFactory; this.windowModel = windowModel; }
public WindowFactoryData(Window window, IWindowModel windowModel) { this.window = window; this.windowModel = windowModel; }