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));
        }
Beispiel #2
0
 /// <summary> Initializes the PowerInspector instance. </summary>
 /// <param name="inspector"> The inspector. </param>
 /// <param name="preferences"> inspector preferences. </param>
 /// <param name="drawer"> The drawer. </param>
 /// <param name="inspected"> The inspected targets. </param>
 /// <param name="scrollPos"> The viewport scroll position. </param>
 /// <param name="viewIsLocked"> True if view is locked. </param>
 public static void Setup(PowerInspector inspector, InspectorPreferences preferences, IInspectorDrawer drawer, Object[] inspected, Vector2 scrollPos, bool viewIsLocked)
 {
     inspector.Setup(drawer, preferences, inspected, scrollPos, viewIsLocked);
 }