///---------------------------------------------------------------------------------------------- //The connection's inspector public static void ShowConnectionInspectorGUI(Connection c) { UndoUtility.CheckUndo(c.graph, "Connection Inspector"); GUILayout.BeginHorizontal(); GUI.color = new Color(1, 1, 1, 0.5f); c.isActive = EditorGUILayout.ToggleLeft("Active", c.isActive, GUILayout.Width(150)); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", GUILayout.Width(20))) { GraphEditorUtility.PostGUI += () => { c.graph.RemoveConnection(c); }; } GUI.color = Color.white; GUILayout.EndHorizontal(); EditorUtils.BoldSeparator(); c.OnConnectionInspectorGUI(); c.sourceNode.OnConnectionInspectorGUI(c.sourceNode.outConnections.IndexOf(c)); UndoUtility.CheckDirty(c.graph); }
///---------------------------------------------------------------------------------------------- //Draw the task inspector GUI void ShowInspector(Action <Task> callback, bool showTitlebar = true) { if (task.ownerSystem == null) { GUILayout.Label("<b>Owner System is null! This should really not happen but it did!\nPlease report a bug. Thank you :)</b>"); return; } //make sure TaskAgent is not null in case task defines an AgentType if (task.agentIsOverride && agentParameterProp.value == null) { agentParameterProp.value = new TaskAgentParameter(); } if (task.obsolete != string.Empty) { EditorGUILayout.HelpBox(string.Format("This is an obsolete Task:\n\"{0}\"", task.obsolete), MessageType.Warning); } if (!showTitlebar || ShowTitlebar(callback) == true) { if (Prefs.showNodeInfo && !string.IsNullOrEmpty(task.description)) { EditorGUILayout.HelpBox(task.description, MessageType.None); } UndoUtility.CheckUndo(task.ownerSystem.contextObject, "Task Inspector"); SpecialCaseInspector(); ShowAgentField(); onTaskInspectorGUI.Invoke(); UndoUtility.CheckDirty(task.ownerSystem.contextObject); } }
public override void OnInspectorGUI() { UndoUtility.CheckUndo(this, "Graph Inspector"); ShowBasicGUI(); EditorUtils.EndOfInspector(); UndoUtility.CheckDirty(this); }
void OnGUI() { if (GraphEditor.current == null || GraphEditor.currentGraph == null) { GUILayout.Label("No graph is open in the Graph Editor"); return; } if (EditorApplication.isCompiling) { ShowNotification(new GUIContent("...Compiling Please Wait...")); return; } var currentSelection = GraphEditorUtility.activeElement; if (currentSelection == null) { GUILayout.Label("No selection in Graph Editor"); return; } UndoUtility.CheckUndo(currentSelection.graph, "Inspector Change"); scrollPos = GUILayout.BeginScrollView(scrollPos); { if (currentSelection is Node) { var node = (Node)currentSelection; Title(node.name); Node.ShowNodeInspectorGUI(node); } if (currentSelection is Connection) { Title("Connection"); Connection.ShowConnectionInspectorGUI(currentSelection as Connection); } } EditorUtils.EndOfInspector(); GUILayout.EndScrollView(); UndoUtility.CheckDirty(currentSelection.graph); if (GUI.changed) { GraphEditor.current.Repaint(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); var def = (SignalDefinition)target; if (GUILayout.Button("Add Parameter")) { EditorUtils.ShowPreferedTypesSelectionMenu(typeof(object), (t) => { UndoUtility.RecordObjectComplete(def, "Add Parameter"); def.AddParameter(t.FriendlyName(), t); UndoUtility.SetDirty(def); }); } UndoUtility.CheckUndo(def, "Definition"); var options = new EditorUtils.ReorderableListOptions(); options.allowRemove = true; options.unityObjectContext = def; EditorUtils.ReorderableList(def.parameters, options, (i, picked) => { var parameter = def.parameters[i]; GUILayout.BeginHorizontal(); parameter.name = UnityEditor.EditorGUILayout.DelayedTextField(parameter.name, GUILayout.Width(150), GUILayout.ExpandWidth(true)); EditorUtils.ButtonTypePopup("", parameter.type, (t) => { parameter.type = t; }); GUILayout.EndHorizontal(); }); UndoUtility.CheckDirty(def); EditorUtils.EndOfInspector(); if (Event.current.isMouse) { Repaint(); } }