public static void FocusProjectWindow() { ProjectBrowser prjBrowser = null; var focusedView = GUIView.focusedView as HostView; if (focusedView != null && focusedView.actualView is ProjectBrowser) { prjBrowser = (ProjectBrowser)focusedView.actualView; } if (prjBrowser == null) { var wins = Resources.FindObjectsOfTypeAll(typeof(ProjectBrowser)); if (wins.Length > 0) { prjBrowser = wins[0] as ProjectBrowser; } } if (prjBrowser != null) { prjBrowser.Focus(); // This line is to circumvent a limitation where a tabbed window can't be directly targeted by a command: only the focused tab can. var commandEvent = EditorGUIUtility.CommandEvent("FocusProjectWindow"); prjBrowser.SendEvent(commandEvent); } }
[RequiredByNativeCode] public static void FocusProjectWindow() { ProjectBrowser prjBrowser = null; var focusedView = GUIView.focusedView as HostView; if (focusedView != null && focusedView.actualView is ProjectBrowser) { prjBrowser = focusedView.actualView as ProjectBrowser; } if (prjBrowser == null) { UnityEngine.Object[] wins = Resources.FindObjectsOfTypeAll(typeof(ProjectBrowser)); if (wins.Length > 0) { prjBrowser = wins[0] as ProjectBrowser; } } if (prjBrowser != null) { prjBrowser.Focus(); var commandEvent = EditorGUIUtility.CommandEvent("FocusProjectWindow"); prjBrowser.SendEvent(commandEvent); } }
private void SendEvent(string eventName) { if (this.m_DelegateView) { Event e = EditorGUIUtility.CommandEvent(eventName); this.m_DelegateView.SendEvent(e); GUIUtility.ExitGUI(); } }
internal static void ExecuteAddComponentMenuItem() { InspectorWindow inspectorWindow = AddComponentWindow.FirstInspectorWithGameObject(); if (inspectorWindow != null) { inspectorWindow.SendEvent(EditorGUIUtility.CommandEvent("OpenAddComponentDropdown")); } }
internal static void ExecuteAddComponentMenuItem() { var insp = FirstInspectorWithGameObject(); if (insp != null) { insp.SendEvent(EditorGUIUtility.CommandEvent(OpenAddComponentDropdown)); } }
internal void SetMaskValueDelegate(object userData, string[] options, int selected) { int[] array = (int[])userData; this.m_NewMask = array[selected]; if (this.m_SourceView) { this.m_SourceView.SendEvent(EditorGUIUtility.CommandEvent("MaskMenuChanged")); } }
// Private API private static void Update() { Rect prevRect = activeRect; if (activeRect.width == 0 || s_View == null) { EditorApplication.update -= Update; Stop(); InternalEditorUtility.RepaintAllViews(); return; } else { Search(); } // Keep elapsed time explicitly rather than measuring time since highlight began. // This way all views use the same elapsed time even if some realtime elapsed // between redraws of the different views. if (activeVisible) { s_HighlightElapsedTime += Time.realtimeSinceStartup - s_LastTime; } s_LastTime = Time.realtimeSinceStartup; // Calculate repaint region Rect r = activeRect; if (prevRect.width > 0) { // If the highlight rect moved, make the repaint region include both the old and new rect. r.xMin = Mathf.Min(r.xMin, prevRect.xMin); r.xMax = Mathf.Max(r.xMax, prevRect.xMax); r.yMin = Mathf.Min(r.yMin, prevRect.yMin); r.yMax = Mathf.Max(r.yMax, prevRect.yMax); } r = highlightStyle.padding.Add(r); r = highlightStyle.overflow.Add(r); r = new RectOffset(kExpansionMovementSize + 2, kExpansionMovementSize + 2, kExpansionMovementSize + 2, kExpansionMovementSize + 2).Add(r); if (s_HighlightElapsedTime < kPopupDuration + 0.1f) { r = new RectOffset((int)r.width / 2, (int)r.width / 2, (int)r.height / 2, (int)r.height / 2).Add(r); } s_RepaintRegion = r; // Repaint all views regardless of success of search. // If control disappeared we still need a repaint to hide it. foreach (GUIView view in Resources.FindObjectsOfTypeAll(typeof(GUIView))) { // Only handle highlight in views in the same window as the view with the highlight is in. if (view.window == s_View.window) { view.SendEvent(EditorGUIUtility.CommandEvent("HandleControlHighlight")); } } }
public static void SendEvent() { if (instance == null) { Debug.LogError("Popup menu has no instance"); return; } instance.m_SourceView.SendEvent(EditorGUIUtility.CommandEvent(kPopupMenuChangedMessage)); }
internal void SetMaskValueDelegate(object userData, string[] options, int selected) { int[] optionMaskValues = (int[])userData; m_NewMask = optionMaskValues[selected]; if (m_SourceView) { m_SourceView.SendEvent(EditorGUIUtility.CommandEvent(kMaskMenuChangedMessage)); } }
internal static void ExecuteAddComponentMenuItem() { InspectorWindow inspectorWindow = AddComponentWindow.FirstInspectorWithGameObject(); if (!((UnityEngine.Object)inspectorWindow != (UnityEngine.Object)null)) { return; } inspectorWindow.SendEvent(EditorGUIUtility.CommandEvent("OpenAddComponentDropdown")); }
private void SendEvent(string eventName, bool exitGUI) { if (this.m_DelegateView != null) { Event e = EditorGUIUtility.CommandEvent(eventName); this.m_DelegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } }
void SendEvent(string eventName, bool exitGUI) { if (delegateView) { Event e = EditorGUIUtility.CommandEvent(eventName); Repaint(); delegateView.SendEvent(e); if (exitGUI) GUIUtility.ExitGUI(); } GUI.changed = true; }
private void SendEvent(string eventName, bool exitGUI) { if (!(bool)((Object)this.m_DelegateView)) { return; } this.m_DelegateView.SendEvent(EditorGUIUtility.CommandEvent(eventName)); if (!exitGUI) { return; } GUIUtility.ExitGUI(); }
private void SendEvent(bool exitGUI) { if (this.m_DelegateView) { Event e = EditorGUIUtility.CommandEvent("GradientPickerChanged"); base.Repaint(); this.m_DelegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } }
private static void Update() { Rect activeRect = Highlighter.activeRect; if (Highlighter.activeRect.width == 0f || Highlighter.s_View == null) { Delegate arg_51_0 = EditorApplication.update; if (Highlighter.< > f__mg$cache2 == null) { Highlighter.< > f__mg$cache2 = new EditorApplication.CallbackFunction(Highlighter.Update); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_51_0, Highlighter.< > f__mg$cache2); Highlighter.Stop(); InternalEditorUtility.RepaintAllViews(); } else { Highlighter.Search(); } if (Highlighter.activeVisible) { Highlighter.s_HighlightElapsedTime += Time.realtimeSinceStartup - Highlighter.s_LastTime; } Highlighter.s_LastTime = Time.realtimeSinceStartup; Rect rect = Highlighter.activeRect; if (activeRect.width > 0f) { rect.xMin = Mathf.Min(rect.xMin, activeRect.xMin); rect.xMax = Mathf.Max(rect.xMax, activeRect.xMax); rect.yMin = Mathf.Min(rect.yMin, activeRect.yMin); rect.yMax = Mathf.Max(rect.yMax, activeRect.yMax); } rect = Highlighter.highlightStyle.padding.Add(rect); rect = Highlighter.highlightStyle.overflow.Add(rect); rect = new RectOffset(7, 7, 7, 7).Add(rect); if (Highlighter.s_HighlightElapsedTime < 0.43f) { rect = new RectOffset((int)rect.width / 2, (int)rect.width / 2, (int)rect.height / 2, (int)rect.height / 2).Add(rect); } Highlighter.s_RepaintRegion = rect; UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(GUIView)); for (int i = 0; i < array.Length; i++) { GUIView gUIView = (GUIView)array[i]; if (gUIView.window == Highlighter.s_View.window) { gUIView.SendEvent(EditorGUIUtility.CommandEvent("HandleControlHighlight")); } } }
private void SendEvent(string eventName, bool exitGUI) { if ((bool)((UnityEngine.Object) this.delegateView)) { Event e = EditorGUIUtility.CommandEvent(eventName); this.Repaint(); this.delegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } GUI.changed = true; }
private void SendEvent(string eventName, bool exitGUI) { if (this.delegateView) { Event e = EditorGUIUtility.CommandEvent(eventName); base.Repaint(); this.delegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } GUI.changed = true; }
private void SendEvent(string eventName, bool exitGUI, bool focusOther = true) { if (this.m_DelegateView != null) { Event e = EditorGUIUtility.CommandEvent(eventName); if (focusOther) { this.m_DelegateView.Focus(); } this.m_DelegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } }
private void SendEvent(bool exitGUI) { if (this.m_DelegateView) { Event e = EditorGUIUtility.CommandEvent("ColorPickerChanged"); if (!this.m_IsOSColorPicker) { base.Repaint(); } this.m_DelegateView.SendEvent(e); if (!this.m_IsOSColorPicker && exitGUI) { GUIUtility.ExitGUI(); } } }
private void SendEvent(bool exitGUI) { if (!(bool)((UnityEngine.Object) this.m_DelegateView)) { return; } Event e = EditorGUIUtility.CommandEvent("GradientPickerChanged"); this.Repaint(); this.m_DelegateView.SendEvent(e); if (!exitGUI) { return; } GUIUtility.ExitGUI(); }
void SendEvent(bool exitGUI) { if (m_DelegateView) { Event e = EditorGUIUtility.CommandEvent(GradientPickerChangedCommand); Repaint(); m_DelegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } if (m_Delegate != null) { m_Delegate(gradient); } }
private void SendEvent(string eventName, bool exitGUI) { if (this.delegateView) { Event e = EditorGUIUtility.CommandEvent(eventName); base.Repaint(); this.delegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } if (this.m_OnCurveChanged != null) { this.m_OnCurveChanged(CurveEditorWindow.curve); } GUI.changed = true; }
private static void Update() { Rect activeRect = Highlighter.activeRect; if ((Highlighter.activeRect.width == 0f) || (s_View == null)) { EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(Highlighter.Update)); Stop(); InternalEditorUtility.RepaintAllViews(); } else { Search(); } if (activeVisible) { s_HighlightElapsedTime += Time.realtimeSinceStartup - s_LastTime; } s_LastTime = Time.realtimeSinceStartup; Rect rect = Highlighter.activeRect; if (activeRect.width > 0f) { rect.xMin = Mathf.Min(rect.xMin, activeRect.xMin); rect.xMax = Mathf.Max(rect.xMax, activeRect.xMax); rect.yMin = Mathf.Min(rect.yMin, activeRect.yMin); rect.yMax = Mathf.Max(rect.yMax, activeRect.yMax); } rect = highlightStyle.padding.Add(rect); rect = highlightStyle.overflow.Add(rect); rect = new RectOffset(7, 7, 7, 7).Add(rect); if (s_HighlightElapsedTime < 0.43f) { rect = new RectOffset(((int)rect.width) / 2, ((int)rect.width) / 2, ((int)rect.height) / 2, ((int)rect.height) / 2).Add(rect); } s_RepaintRegion = rect; foreach (GUIView view in Resources.FindObjectsOfTypeAll(typeof(GUIView))) { if (view.window == s_View.window) { view.SendEvent(EditorGUIUtility.CommandEvent("HandleControlHighlight")); } } }
private static void Update() { Rect activeRect = Highlighter.activeRect; if ((double)Highlighter.activeRect.width == 0.0 || (Object)Highlighter.s_View == (Object)null) { EditorApplication.update -= new EditorApplication.CallbackFunction(Highlighter.Update); Highlighter.Stop(); InternalEditorUtility.RepaintAllViews(); } else { Highlighter.Search(); } if (Highlighter.activeVisible) { Highlighter.s_HighlightElapsedTime += Time.realtimeSinceStartup - Highlighter.s_LastTime; } Highlighter.s_LastTime = Time.realtimeSinceStartup; Rect rect = Highlighter.activeRect; if ((double)activeRect.width > 0.0) { rect.xMin = Mathf.Min(rect.xMin, activeRect.xMin); rect.xMax = Mathf.Max(rect.xMax, activeRect.xMax); rect.yMin = Mathf.Min(rect.yMin, activeRect.yMin); rect.yMax = Mathf.Max(rect.yMax, activeRect.yMax); } rect = Highlighter.highlightStyle.padding.Add(rect); rect = Highlighter.highlightStyle.overflow.Add(rect); rect = new RectOffset(7, 7, 7, 7).Add(rect); if ((double)Highlighter.s_HighlightElapsedTime < 0.430000007152557) { rect = new RectOffset((int)rect.width / 2, (int)rect.width / 2, (int)rect.height / 2, (int)rect.height / 2).Add(rect); } Highlighter.s_RepaintRegion = rect; foreach (GUIView guiView in Resources.FindObjectsOfTypeAll(typeof(GUIView))) { if ((Object)guiView.window == (Object)Highlighter.s_View.window) { guiView.SendEvent(EditorGUIUtility.CommandEvent("HandleControlHighlight")); } } }
// send an event to the delegate view (the view that called us) void SendEvent(string eventName, bool exitGUI) { if (m_DelegateView) { Event e = EditorGUIUtility.CommandEvent(eventName); try { m_DelegateView.SendEvent(e); } finally { } if (exitGUI) { GUIUtility.ExitGUI(); } } }
void SendEvent(string eventName, bool exitGUI) { if (m_DelegateView) { Event e = EditorGUIUtility.CommandEvent(eventName); Repaint(); m_DelegateView.SendEvent(e); if (exitGUI) { GUIUtility.ExitGUI(); } } if (m_OnCurveChanged != null) { m_OnCurveChanged(curve); } GUI.changed = true; }
internal void SetMaskValueDelegate(object userData, string[] options, int selected) { switch (selected) { case 0: this.m_ClearAll = true; break; case 1: this.m_SetAll = true; break; default: this.m_Mask = ((int)1) << (selected - 2); break; } if (this.m_SourceView != null) { this.m_SourceView.SendEvent(EditorGUIUtility.CommandEvent("MaskMenuChanged")); } }
private void SendEvent(string eventName, bool exitGUI) { if (!(bool)((UnityEngine.Object) this.m_DelegateView)) { return; } Event e = EditorGUIUtility.CommandEvent(eventName); try { this.m_DelegateView.SendEvent(e); } finally { } if (!exitGUI) { return; } GUIUtility.ExitGUI(); }
internal void SetMaskValueDelegate(object userData, string[] options, int selected) { switch (selected) { case 0: this.m_ClearAll = true; break; case 1: this.m_SetAll = true; break; default: this.m_Mask = 1 << selected - 2; break; } if (!(bool)((Object)this.m_SourceView)) { return; } this.m_SourceView.SendEvent(EditorGUIUtility.CommandEvent("MaskMenuChanged")); }
internal void SetMaskValueDelegate(object userData, string[] options, int selected) { if (selected != 0) { if (selected != 1) { this.m_Mask = ((int[])userData)[selected - 2]; } else { this.m_SetAll = true; } } else { this.m_ClearAll = true; } if (this.m_SourceView) { this.m_SourceView.SendEvent(EditorGUIUtility.CommandEvent("MaskMenuChanged")); } }