/// <inheritdoc/> protected override void Setup() { filterDrawer = new FilterField(OpenFilteringMethodMenu); graphics = inspector.Preferences.graphics; inspector.OnFilterChanging += SyncFilterFromInspectorState; if (ClearButtonWidth <= 0f) { #if SAFE_MODE if (Event.current == null) { #if DEV_MODE Debug.LogWarning(GetType().Name + ".Setup called with Event.current null. This is dangerous because can't reference many GUI related methods."); #endif DrawGUI.OnNextBeginOnGUI(() => ClearButtonWidth = InspectorPreferences.Styles.ToolbarCancel.CalcSize(GUIContent.none).x, false); } else #endif { ClearButtonWidth = InspectorPreferences.Styles.ToolbarCancel.CalcSize(GUIContent.none).x; } } #if DEV_MODE && PI_ASSERTATIONS Debug.Assert(ClearButtonWidth > 0f, ClearButtonWidth); #endif }
private static void DelayedSetup() { if (!ApplicationUtility.IsReady()) { EditorApplication.delayCall += DelayedSetup; return; } DrawGUI.OnNextBeginOnGUI(Setup, false); }
private static void ApplyPreferencesWhenAssetDatabaseReady() { if (!ApplicationUtility.IsReady()) { EditorApplication.delayCall += ApplyPreferencesWhenAssetDatabaseReady; return; } DrawGUI.OnNextBeginOnGUI(ApplyContextMenuPreferences, false); }
private static void DoLaunchDelayedInEditMode(double waitDoneTime, [NotNull] Action action) { if (UnityEditor.EditorApplication.timeSinceStartup < waitDoneTime) { DrawGUI.OnNextBeginOnGUI(() => DoLaunchDelayedInEditMode(waitDoneTime, action), true); } else { action(); } }
private static void ApplySetKeyboardControlStep() { if (GUIUtility.hotControl == 0) { KeyboardControl = setKeyboardControl; } setKeyboardControlTimes--; if (setKeyboardControlTimes > 0) { DrawGUI.OnNextBeginOnGUI(ApplySetKeyboardControlStep, true); } else if (InspectorUtility.ActiveInspector != null) { InspectorUtility.ActiveInspector.RefreshView(); } }
/// <inheritdoc/> public void OnNextOnGUI(Action action, IInspectorDrawer changingInspectorDrawer = null) { #if DEV_MODE && PI_ASSERTATIONS Debug.Assert(action != null); #endif #if DEV_MODE && DEBUG_ON_NEXT_ONGUI Debug.Log("OnNextOnGUI(" + StringUtils.ToString(action) + ") with changingInspectorDrawer=" + StringUtils.ToString(changingInspectorDrawer), changingInspectorDrawer as Object); #endif DrawGUI.OnNextBeginOnGUI(action, false); if (changingInspectorDrawer != null) { changingInspectorDrawer.RefreshView(); } else { EnsureOnGUICallbacks(false); } }
public static PreferencesDrawer GetExistingOrCreateNewWindow() { var inspectorManager = InspectorUtility.ActiveManager; if (inspectorManager != null) { var preferencesInstance = (PowerInspectorPreferencesWindow)inspectorManager.GetLastSelectedInspectorDrawer(typeof(PowerInspectorPreferencesWindow)); if (preferencesInstance != null) { #if DEV_MODE && PI_ASSERTATIONS Debug.Assert((object)preferencesInstance != null); #endif #if DEV_MODE Debug.Log("Using existing preferences window: " + preferencesInstance); #endif preferencesInstance.FocusWindow(); return(GetPrefencesDrawer(preferencesInstance)); } } if (Event.current == null) { #if DEV_MODE Debug.LogWarning("Opening preferences window on next OnGUI. Returning null"); #endif DrawGUI.OnNextBeginOnGUI(Open, true); return(null); } #if DEV_MODE Debug.Log("Opening preferences window now!"); #endif var minSize = PreferencesDrawer.GetExpectedMinSize(); var created = (PowerInspectorPreferencesWindow)CreateNew(typeof(PowerInspectorPreferencesWindow), "Preferences", ArrayPool <Object> .CreateWithContent(PowerInspector.GetPreferences()), true, false, minSize, minSize); return(GetPrefencesDrawer(created)); }
private static void ShowInSplitView() { var selected = Selection.objects; #if DEV_MODE && PI_ASSERTATIONS Debug.Assert(selected.Length > 0); #endif var manager = InspectorUtility.ActiveManager; if (manager == null) { manager = InspectorManager.Instance(); if (!InspectorUtility.Preferences.SetupDone && Event.current == null) { DrawGUI.OnNextBeginOnGUI(ShowInSplitView, true); return; } } var inspector = manager.LastSelectedActiveOrDefaultInspector(selected[0].IsSceneObject() ? InspectorTargetingMode.Hierarchy : InspectorTargetingMode.Project, InspectorSplittability.IsSplittable); ISplittableInspectorDrawer splittableDrawer; if (inspector == null) { splittableDrawer = PowerInspectorWindow.CreateNew(selected, true, false); } else { splittableDrawer = (ISplittableInspectorDrawer)inspector.InspectorDrawer; splittableDrawer.ShowInSplitView(selected); #if DEV_MODE && PI_ASSERTATIONS Debug.Assert(splittableDrawer != null); Debug.Assert(selected[0].IsSceneObject() ? splittableDrawer.InspectorTargetingMode != InspectorTargetingMode.Hierarchy : splittableDrawer.InspectorTargetingMode != InspectorTargetingMode.Project); #endif } }
private static void RuntimeInitializeOnLoad() { DrawGUI.OnNextBeginOnGUI(Setup, false); }
private void GetUniqueCustomStyles() { DrawGUI.OnNextBeginOnGUI(GetUniqueCustomStylesNow, true); }