public bool Draw() { //Debug.Log("draw"); if (dirty) { RefreshView(); } return(drawer.Draw()); }
// public static Rect windowRect; //return true if draw tool along protected override void OnGUI() { if (!CheckDrawHeader()) { return; } //if (Selected.Count == 0){ // GUILayout.Label("Nothing selected"); //} Rect rectTop = GetTopPanelRect(); Rect rectBot = GetBotPanelRect(); RefDrawConfig config1 = null, config2 = null, config3 = null; var drawTool = false; var drawCount = 0; if (IsFocusingUses || IsFocusingSceneToAsset) { if (UsesDrawer.ElementCount() <= 0) { drawTool = GetDrawConfig(SceneUsesDrawer, SceneToAssetDrawer, out config1, out config2); } else { drawTool = GetDrawConfig(UsesDrawer, out config3); } } else if (IsFocusingSceneInScene || IsFocusingFindInScene || IsFocusingUsedBy) { if (RefSceneInScene.ElementCount() <= 0) { drawTool = GetDrawConfig(RefInScene, UsedByDrawer, out config1, out config2); } else { drawTool = GetDrawConfig(RefSceneInScene, out config3); } } else if (IsFocusingDuplicate) { drawTool = GetDrawConfig(Duplicated, out config1); } else if (IsFocusingGUIDs) { drawCount++; if (AnyToolInBot) { GUILayout.BeginArea(rectTop); DrawGUIDs(); GUILayout.EndArea(); drawTool = true; } else { DrawGUIDs(); drawTool = false; } } else if (IsFocusingUnused) { drawCount++; if (AnyToolInBot) { GUILayout.BeginArea(rectTop); RefUnUse.Draw(); GUILayout.EndArea(); drawTool = true; } else { RefUnUse.Draw(); drawTool = false; } } else if (IsFocusingUsedInBuild) { //Debug.Log("draw :" + IsFocusingUsedInBuild); //drawTool = GetDrawConfig(UsedInBuild, out config1); UsedInBuild.Draw(); } if (!IsFocusingGUIDs && !IsFocusingUnused) { drawCount += DrawConfig(config1, rectTop, rectBot, ref willRepaint); drawCount += DrawConfig(config2, rectTop, rectBot, ref willRepaint); drawCount += DrawConfig(config3, rectTop, rectBot, ref willRepaint); } if (drawTool) { drawCount++; GUILayout.BeginArea(rectBot); DrawTool(); GUILayout.EndArea(); } DrawFooter(); OnAfterGUI(drawCount); }
private void OnGUI() { if (window == null) { Initialize(); } if (EditorSettings.serializationMode != SerializationMode.ForceText) { EditorGUILayout.HelpBox("FR2 requires serialization mode set to FORCE TEXT!", MessageType.Warning); if (GUILayout.Button("FORCE TEXT")) { EditorSettings.serializationMode = SerializationMode.ForceText; } return; } if (!FR2_Cache.isReady) { if (!FR2_Cache.hasCache) { EditorGUILayout.HelpBox("FR2 cache not found!\nFirst scan may takes quite some time to finish but you would be able to work normally while the scan works in background...", MessageType.Warning); if (GUILayout.Button("Scan project")) { FR2_Cache.CreateCache(); } return; } if (!DrawEnable()) { return; } var api = FR2_Cache.Api; var text = "Refreshing ... " + (int)(api.progress * api.workCount) + " / " + api.workCount; var rect = GUILayoutUtility.GetRect(1f, Screen.width, 18f, 18f); EditorGUI.ProgressBar(rect, api.progress, text); Repaint(); return; } if (!DrawEnable()) { return; } var newTab = GUILayout.Toolbar(selectedTab, TOOLBARS); if (newTab != selectedTab) { selectedTab = newTab; // Check4Changes means delay calls to OnReady :: Refresh ! //if (FR2_Cache.Api.isReady) FR2_Cache.Api.Check4Changes(); OnReady(); } var willRepaint = Event.current.type == EventType.ScrollWheel; if (Selected == null) { Selected = new List <FR2_Asset>(); } //if (Selected.Count == 0){ // GUILayout.Label("Nothing selected"); //} if (IsFocusingUses) { //Uses.Draw(); UsesDrawer.Draw(); } else if (IsFocusingUsedBy) { //UsedBy.Draw(); UsedByDrawer.Draw(); } else if (IsFocusingDuplicate) { willRepaint = Duplicated.Draw() | willRepaint; } else if (IsFocusingUnused) { DrawUnused(); } else if (IsFocusingGUIDs) { DrawGUIDs(); } if (willRepaint) { Repaint(); } }