private static void OnNotifySelection <TValue>(TValue value) { s_ActiveControlNewValue = value; var valueChangedEvent = EditorGUIUtility.CommandEvent(s_CommandNameValueChanged); s_ActiveControlWindow.SendEvent(valueChangedEvent); }
private static void OnSelectedTypeName(object userData) { selectedReference = SystemType.GetReference(userData as Type); var typeReferenceUpdatedEvent = EditorGUIUtility.CommandEvent("TypeReferenceUpdated"); EditorWindow.focusedWindow.SendEvent(typeReferenceUpdatedEvent); }
//On Windows, shift key down does not send its own KeyDown event, so we need to listen to this event to workaround that. void OnModifiersMightHaveChanged() { if (focusedWindow == this) { SendEvent(EditorGUIUtility.CommandEvent(EventCommandNames.ModifierKeysChanged)); } }
// When rect selecting, we update the selected objects based on which modifier keys are currently held down, // so the window needs to repaint. internal void SendCommandsOnModifierKeys() { var window = SceneView.currentDrawingSceneView; var @event = EditorGUIUtility.CommandEvent("ModifierKeysChanged"); window.SendEvent(@event); }
void OnGUI() { if (GUI.Button(new Rect(10.0f, 10.0f, 100.0f, 30.0f), "Send Event")) { EditorWindow win = GetWindow <receiveEvent>(); win.SendEvent(EditorGUIUtility.CommandEvent("Paste")); } EditorGUI.DrawRect(new Rect(10, 10, 160, 60), new Color(0.5f, 0.5f, 0.85f)); EditorGUI.DrawRect(new Rect(20, 20, 140, 40), new Color(0.9f, 0.9f, 0.9f)); EditorGUIUtility.AddCursorRect(new Rect(20, 20, 140, 40), MouseCursor.Zoom); //ObjectPickerを開く if (GUILayout.Button("ShowObjectPicker")) { int controlID = EditorGUIUtility.GetControlID(FocusType.Passive); //CameraのコンポーネントをタッチしているGameObjectを選択する EditorGUIUtility.ShowObjectPicker <Camera> (null, true, "", controlID); } string commandName = Event.current.commandName; if (commandName == "ObjectSelectorUpdated") { currentObject = EditorGUIUtility.GetObjectPickerObject(); //ObjectPickerを開いている間はEditorWindowの再描画が行われないのでRepaintを呼びだす Repaint(); } else if (commandName == "ObjectSelectorClosed") { selectedObject = EditorGUIUtility.GetObjectPickerObject(); } EditorGUILayout.ObjectField(currentObject, typeof(Object), true); EditorGUILayout.ObjectField(selectedObject, typeof(Object), true); }
private void OnSelectedScriptableObject(object userData) { _selectedScriptableObject = userData as ScriptableObject; var scriptableObjectReferenceUpdatedEvent = EditorGUIUtility.CommandEvent("ScriptableObjectReferenceUpdated"); EditorWindow.focusedWindow.SendEvent(scriptableObjectReferenceUpdatedEvent); }
private void OnSelectedGameLoopManager(object userData) { _selectedPuzzleManager = userData as PuzzleManager; var scriptableObjectReferenceUpdatedEvent = EditorGUIUtility.CommandEvent("GameLoopManagerReferenceUpdated"); EditorWindow.focusedWindow.SendEvent(scriptableObjectReferenceUpdatedEvent); }
void OnSelectionChange() { var editorEvent = EditorGUIUtility.CommandEvent("ChangeActiveObject"); editorEvent.type = EventType.Used; SendEvent(editorEvent); }
private void OnGUI() { if (GUI.Button(new Rect(10f, 10f, 100f, 30f), "SendEvent")) { GetWindow <receiveEvent>().SendEvent(EditorGUIUtility.CommandEvent("Paste")); } }
void OnGUI() { this.Focus(); GUILayout.Space(10); GUILayout.BeginHorizontal("box"); GUILayout.FlexibleSpace(); GUILayout.Label("Deseja limpar as informações"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUIContent sName = new GUIContent(); sName.text = "Confirmar"; if (GUILayout.Button(sName, GUILayout.Height(30))) { var popup = GetWindow <SongEditor>(); popup.SendEvent(EditorGUIUtility.CommandEvent("Confirmar")); this.Close(); } sName.text = "Cancelar"; if (GUILayout.Button(sName, GUILayout.Height(30))) { this.Close(); } GUILayout.EndHorizontal(); }
public static void DisplayDropDown(Rect position, IEnumerable <Type> types, Type selectedType, TypeGrouping grouping) { var menu = new GenericMenu(); menu.AddItem(new GUIContent(None), selectedType == null, OnSelectedTypeName, null); menu.AddSeparator(string.Empty); foreach (var type in types) { var menuLabel = FormatGroupedTypeName(type, grouping); if (string.IsNullOrEmpty(menuLabel)) { continue; } var content = new GUIContent(menuLabel); menu.AddItem(content, type == selectedType, OnSelectedTypeName, type); } menu.DropDown(position); void OnSelectedTypeName(object typeRef) { SelectedType = typeRef as Type; SelectedReference = SystemType.GetReference(SelectedType); EditorWindow.focusedWindow.SendEvent(EditorGUIUtility.CommandEvent(TypeReferenceUpdated)); } }
static void DupObjectNew() { SceneView.lastActiveSceneView.Focus(); if (Selection.activeGameObject) { MegaModifyObject[] oldmods = (MegaModifyObject[])Selection.activeGameObject.GetComponentsInChildren <MegaModifyObject>(); bool[] enabled = new bool[oldmods.Length]; for (int i = 0; i < oldmods.Length; i++) { enabled[i] = oldmods[i].enabled; oldmods[i].enabled = false; oldmods[i].ResetMeshInfo(); } EditorWindow.focusedWindow.SendEvent(EditorGUIUtility.CommandEvent("Duplicate")); GameObject go = Selection.activeGameObject; MegaModifyObject[] mods = (MegaModifyObject[])go.GetComponentsInChildren <MegaModifyObject>(); for (int i = 0; i < mods.Length; i++) { mods[i].enabled = enabled[i]; mods[i].MeshUpdated(); oldmods[i].enabled = enabled[i]; } } }
private void OnSelectedScriptableObject(object userData) { if (userData == null) { _selectedScriptableObjects.Clear(); } else if (userData.GetType().IsArray) { _selectedScriptableObjects = (userData as ScriptableObject[]).ToList(); } else { ScriptableObject scriptableObject = userData as ScriptableObject; if (!ResolveSelectedScriptableObject(scriptableObject)) { _selectedScriptableObjects.Add(scriptableObject); } else { _selectedScriptableObjects.Remove(scriptableObject); } } var scriptableObjectReferenceUpdatedEvent = EditorGUIUtility.CommandEvent("ScriptableObjectReferenceUpdated"); EditorWindow.focusedWindow.SendEvent(scriptableObjectReferenceUpdatedEvent); }
private bool DrawRecordTestButton(IEditorImguiTest test) { EditorGUILayout.BeginHorizontal(); { if (EditorWindowTestRecorder.IsRecording && recordedTest == test) { if (GUILayout.Button("Save the record")) { recorder.SendEvent(EditorGUIUtility.CommandEvent("SaveAndTerminate")); return(true); } if (GUILayout.Button("Abort", GUILayout.Width(60f))) { recorder.SendEvent(EditorGUIUtility.CommandEvent("Abort")); return(true); } } else { EditorGUI.BeginDisabledGroup(IsUiDisabled); { if (GUILayout.Button("Record")) { testMetadatas[test].State = TestState.Normal; StartRecording(test); return(true); } } EditorGUI.EndDisabledGroup(); } } EditorGUILayout.EndHorizontal(); return(false); }
private void OnTypeSelected() { if (owner != null) { Event selected = EditorGUIUtility.CommandEvent(ITEM_SELECTED_COMMAND); owner.SendEvent(selected); } MethodInfo method = null; Type type = Type.GetType(m_MethodAssemblyQualifiedName.value); if (type != null) { method = type.GetMethod(m_MethodName.value, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); } if (method != null) { method.Invoke(m_Target, new object[] { m_Types[m_SelectedItem.value] }); } else { //We lost our callback so we have to close Debug.Log("Jiffy | Scripts were recompiled and the callback was lost. Closing Jiffy."); this.Close(); } }
private static void OnSelected(object userData) { selectedItem = userData as string; var selectionUpdatedEvent = EditorGUIUtility.CommandEvent(SELECTION_UPDATED_COMMAND_NAME); EditorWindow.focusedWindow.SendEvent(selectionUpdatedEvent); }
private void Update() { if (System.Math.Abs(_prevPosition.width - position.width) > Mathf.Epsilon) { SendEvent(EditorGUIUtility.CommandEvent("Resize")); } _prevPosition = new Rect(position); }
private void ShowUploadSucessfull() { EditorUtility.DisplayDialog("Upload successful!", "The package content has been successfully uploaded. To finish the submission, visit the Publisher Portal and confirm that all information about your package is accurate.", "Ok"); this.ClearLocalState(); AssetStoreManager assetStoreManager = (AssetStoreManager)EditorWindow.GetWindow(typeof(AssetStoreManager), false, "Package Upload"); assetStoreManager.SendEvent(EditorGUIUtility.CommandEvent("refresh")); }
private void OnCrudCompleted() { m_EnvController.currentLoadingState = RemoteConfigEnvironmentWindowController.EnvironmentWindowState.None; var currentRCWindow = GetWindow <RemoteConfigWindow>(); currentRCWindow.SendEvent(EditorGUIUtility.CommandEvent("EnvWindowForcePull")); Close(); }
internal void SetEnumValueDelegate(object userData, string[] options, int selected) { m_SelectedIndex = selected; if (m_SourceView) { m_SourceView.SendEvent(EditorGUIUtility.CommandEvent(kPopupMenuChangedMessage)); } }
private static void OnSelectedTypeName(object userData) { var selectedType = userData as Type; s_SelectedClassRef = ClassTypeReference.GetClassRef(selectedType); var typeReferenceUpdatedEvent = EditorGUIUtility.CommandEvent("TypeReferenceUpdated"); EditorWindow.focusedWindow.SendEvent(typeReferenceUpdatedEvent); }
internal void SetMaskValueDelegate(object userData, string[] options, int selected) { selectedIndex = selected; if (view != null) { method.Invoke(view, new object[] { EditorGUIUtility.CommandEvent(kMaskMenuChangedMessage) }); } }
private static void OnSelectedTypeName(object userData) { var selectedType = userData as Type; SelectedTypeNameAndAssembly = TypeReference.GetTypeNameAndAssembly(selectedType); Event typeReferenceUpdated = EditorGUIUtility.CommandEvent(ReferenceUpdatedCommandName); EditorWindow.focusedWindow.SendEvent(typeReferenceUpdated); }
private void UpdateBrushSelection(Brush brush) { if (s_RestoreFocusWindow != null) { var commandEvent = EditorGUIUtility.CommandEvent("Rotorz.TileSystem.BrushPickerUpdated"); s_RestoreFocusWindow.SendEvent(commandEvent); } this.Repaint(); }
protected void SendUpdate(string key) { var evt = EditorGUIUtility.CommandEvent(key); if (windowToUpdate != null) { windowToUpdate.SendEvent(evt); } }
private void ContextMenuClick(object userData, string[] options, int selected) { if (selected < 0) { return; } GraphGUI.ContextMenuData contextMenuData = (GraphGUI.ContextMenuData)userData; string text = contextMenuData.items[selected].text; string text2 = text; if (text2 != null) { if (GraphGUI.< > f__switch$map3 == null) { GraphGUI.< > f__switch$map3 = new Dictionary <string, int>(5) { { "Cut", 0 }, { "Copy", 0 }, { "Duplicate", 0 }, { "Delete", 0 }, { "Paste", 1 } }; } int num; if (GraphGUI.< > f__switch$map3.TryGetValue(text2, out num)) { if (num != 0) { if (num == 1) { this.m_contextMenuMouseDownPosition = new Vector2?(contextMenuData.mousePosition); this.m_Host.SendEvent(EditorGUIUtility.CommandEvent(text)); } } else { this.m_Host.SendEvent(EditorGUIUtility.CommandEvent(text)); } } } }
internal static void ExecuteAddComponentMenuItem() { var insp = FirstInspectorWithGameObject(); if (insp != null) { insp.ShowTab(); insp.SendEvent(EditorGUIUtility.CommandEvent(OpenAddComponentDropdown)); } }
public static void SendEvent() { if (instance == null) { Debug.LogError("Popup menu has no instance"); return; } instance.m_SourceView.SendEvent(EditorGUIUtility.CommandEvent(kPopupMenuChangedMessage)); }
void SendEditorCommand(string cmd) { #if UNITY_EDITOR EditorWindow w = EditorWindow.GetWindow <EditorWindow>("CoTrackerWindow"); if (w.GetType().Name == "CoTrackerWindow") { w.SendEvent(EditorGUIUtility.CommandEvent(cmd)); } #endif }
private float timeleft; // Left time for current interval void Start() { _usmooth = new UsMain(); #if UNITY_EDITOR EditorWindow w = EditorWindow.GetWindow <EditorWindow>("VarTracerWindow", false); if (w.GetType().Name == "VarTracerWindow") { w.SendEvent(EditorGUIUtility.CommandEvent("AppStarted")); } #endif }