public static void OpenFsmEditor() { FsmEditorWindow.OpenWindow(); if (EditorStartupPrefs.ShowWelcomeScreen) { PlayMakerWelcomeWindow.Open(); } }
/// <summary> /// Open the specified FSM in the Playmaker Editor /// </summary> public static void OpenInEditor(PlayMakerFSM fsmComponent) { if (FsmEditor.Instance == null) { FsmEditorWindow.OpenWindow(fsmComponent); } else { FsmEditor.SelectFsm(fsmComponent.FsmTemplate == null ? fsmComponent.Fsm : fsmComponent.FsmTemplate.fsm); } }
public override void OnInspectorGUI() { FsmEditorStyles.Init(); serializedObject.Update(); EditorGUI.BeginChangeCheck(); GUILayout.Label("Category - used in Template Browser and menus"); EditorGUILayout.PropertyField(categoryProperty, GUIContent.none); if (multiline == null) { multiline = new GUIStyle(EditorStyles.textField) { wordWrap = true }; } descriptionProperty.stringValue = EditorGUILayout.TextArea(descriptionProperty.stringValue, multiline, GUILayout.MinHeight(60)); FsmEditorGUILayout.DrawHintText(descriptionProperty.stringValue, "Description"); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); FsmTemplateSelector.Refresh(); } GUILayout.BeginHorizontal(); //GUILayout.FlexibleSpace(); if (GUILayout.Button(findInBrowser)) { FsmTemplateSelector.FindTemplateInBrowser((FsmTemplate)target); } if (GUILayout.Button(editButton)) { FsmEditorWindow.OpenWindow((FsmTemplate)target); } GUILayout.EndHorizontal(); EditorGUILayout.HelpBox(Strings.Hint_Exporting_Templates, MessageType.None); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(categoryProperty); descriptionProperty.stringValue = EditorGUILayout.TextArea(descriptionProperty.stringValue, GUILayout.MinHeight(60)); serializedObject.ApplyModifiedProperties(); if (GUILayout.Button(Strings.FsmTemplateEditor_Open_In_Editor)) { FsmEditorWindow.OpenWindow((FsmTemplate)target); } #if !UNITY_3_4 EditorGUILayout.HelpBox(Strings.Hint_Exporting_Templates, MessageType.None); #endif }
static void Init() { // If Playmaker is not initialised we get errors. Opening the editor solves that if (FsmEditorWindow.IsOpen() == false) { FsmEditorWindow.OpenWindow(); } // Get existing open window or if none, make a new one: PlayMakerCommsToolWindow window = (PlayMakerCommsToolWindow)EditorWindow.GetWindow(typeof(PlayMakerCommsToolWindow)); if (pmCommsTool == null) { pmCommsTool = FindObjectOfType(typeof(PlayMakerCommsTool)) as PlayMakerCommsTool; if (pmCommsTool == null) { GameObject gameObject = new GameObject("PlayMakerCommsTool"); pmCommsTool = gameObject.AddComponent <PlayMakerCommsTool>(); } } pmCommsTool.Rebuild(true); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(categoryProperty); if (multiline == null) { multiline = new GUIStyle(EditorStyles.textField) { wordWrap = true }; } descriptionProperty.stringValue = EditorGUILayout.TextArea(descriptionProperty.stringValue, multiline, GUILayout.MinHeight(60)); serializedObject.ApplyModifiedProperties(); if (GUILayout.Button(Strings.FsmTemplateEditor_Open_In_Editor)) { FsmEditorWindow.OpenWindow((FsmTemplate)target); } EditorGUILayout.HelpBox(Strings.Hint_Exporting_Templates, MessageType.None); }
public static void OpenFsmEditor() { FsmEditorWindow.OpenWindow(); }
public override void OnInspectorGUI() { if (textAreaStyle == null) { textAreaStyle = new GUIStyle(EditorStyles.textField); textAreaStyle.wordWrap = true; } EditorGUILayout.BeginHorizontal(); fsmComponent.FsmName = EditorGUILayout.TextField(fsmComponent.FsmName); if (GUILayout.Button(new GUIContent("Edit", "Edit in the PlayMaker FSM Editor"), GUILayout.MaxWidth(50))) { FsmEditorWindow.OpenWindow(); GUIUtility.ExitGUI(); } showInfo = GUILayout.Toggle(showInfo, new GUIContent("Info", "Show overview of States, Events and Variables"), "Button", GUILayout.MaxWidth(50)); EditorGUILayout.EndHorizontal(); fsmComponent.FsmDescription = EditorGUILayout.TextArea(fsmComponent.FsmDescription, textAreaStyle); //if (GUILayout.Button("Update Control Panel")) // BuildFsmVariableList(); // VARIABLES BuildFsmVariableList(); //GUILayout.Label("Variables"); foreach (var fsmVar in fsmVariables) { if (fsmVar.ShowInInspector) { fsmVar.DoValueGUI(new GUIContent(fsmVar.Name, fsmVar.Tooltip)); } } if (GUI.changed) { FsmEditor.RepaintAll(); } //INFO if (showInfo) { //GUILayout.Label("Description"); //fsmComponent.FsmDescription = EditorGUILayout.TextArea(fsmComponent.FsmDescription); GUILayout.Label("Summary"); showStates = EditorGUILayout.Foldout(showStates, "States [" + fsmComponent.FsmStates.Length + "]"); if (showStates) { string states = ""; if (fsmComponent.FsmStates.Length > 0) { foreach (var state in fsmComponent.FsmStates) { states += "\t\t" + state.Name + "\n"; } states = states.Substring(0, states.Length - 1); } else { states = "\t\t[none]"; } GUILayout.Label(states); } showEvents = EditorGUILayout.Foldout(showEvents, "Events [" + fsmComponent.FsmEvents.Length + "]"); if (showEvents) { string events = ""; if (fsmComponent.FsmEvents.Length > 0) { foreach (var fsmEvent in fsmComponent.FsmEvents) { events += "\t\t" + fsmEvent.Name + "\n"; } events = events.Substring(0, events.Length - 1); } else { events = "\t\t[none]"; } GUILayout.Label(events); } showVariables = EditorGUILayout.Foldout(showVariables, "Variables [" + fsmVariables.Count + "]"); if (showVariables) { string variables = ""; if (fsmVariables.Count > 0) { foreach (var fsmVar in fsmVariables) { variables += "\t\t" + fsmVar.Name + "\n"; } variables = variables.Substring(0, variables.Length - 1); } else { variables = "\t\t[none]"; } GUILayout.Label(variables); } } }
public override void OnInspectorGUI() { //EditorGUIUtility.LookLikeControls(); // can happen when playmaker is updated...? if (fsmComponent == null) { return; } if (!FsmEditorStyles.IsInitialized()) { FsmEditorStyles.Init(); } if (textAreaStyle == null) { textAreaStyle = new GUIStyle(EditorStyles.textField) { wordWrap = true }; } EditorGUILayout.BeginHorizontal(); fsmComponent.FsmName = EditorGUILayout.TextField(fsmComponent.FsmName); //fsmComponent.Fsm.ShowStateLabel = GUILayout.Toggle(fsmComponent.Fsm.ShowStateLabel, new GUIContent("i", "Show active state label in game view. NOTE: Requires PlayMakerGUI in scene"), "Button", GUILayout.MaxWidth(40)); if (GUILayout.Button(new GUIContent("Edit", "Edit in the PlayMaker FSM Editor"), GUILayout.MaxWidth(45))) { FsmEditorWindow.OpenWindow(fsmComponent); GUIUtility.ExitGUI(); } //showInfo = GUILayout.Toggle(showInfo, new GUIContent("Info","Show overview of States, Events and Variables"), "Button", GUILayout.MaxWidth(50)); EditorGUILayout.EndHorizontal(); fsmComponent.FsmDescription = EditorGUILayout.TextArea(fsmComponent.FsmDescription, textAreaStyle); fsmComponent.Fsm.ShowStateLabel = GUILayout.Toggle(fsmComponent.Fsm.ShowStateLabel, new GUIContent("Show State Label", "Show active state label in game view.\nNOTE: Requires PlayMakerGUI in scene")); // VARIABLES FsmEditorGUILayout.LightDivider(); showControls = EditorGUILayout.Foldout(showControls, new GUIContent("Controls", "FSM Variables and Events exposed in the Inspector."), FsmEditorStyles.CategoryFoldout); if (showControls) { //EditorGUIUtility.LookLikeInspector(); BuildFsmVariableList(); foreach (var fsmVar in fsmVariables) { if (fsmVar.ShowInInspector) { fsmVar.DoValueGUI(new GUIContent(fsmVar.Name, fsmVar.Name + (!string.IsNullOrEmpty(fsmVar.Tooltip) ? ":\n" + fsmVar.Tooltip : ""))); } } if (GUI.changed) { FsmEditor.RepaintAll(); } } // EVENTS //FsmEditorGUILayout.LightDivider(); //showExposedEvents = EditorGUILayout.Foldout(showExposedEvents, new GUIContent("Events", "To expose events here:\nIn PlayMaker Editor, Events tab, select an event and check Inspector."), FsmEditorStyles.CategoryFoldout); if (showControls) { EditorGUI.indentLevel = 1; //GUI.enabled = Application.isPlaying; foreach (var fsmEvent in fsmComponent.Fsm.ExposedEvents) { if (GUILayout.Button(fsmEvent.Name)) { fsmComponent.Fsm.Event(fsmEvent); } } if (GUI.changed) { FsmEditor.RepaintAll(); } } //GUI.enabled = true; //INFO EditorGUI.indentLevel = 0; FsmEditorGUILayout.LightDivider(); showInfo = EditorGUILayout.Foldout(showInfo, "Info", FsmEditorStyles.CategoryFoldout); if (showInfo) { EditorGUI.indentLevel = 1; //FsmEditorGUILayout.LightDivider(); //GUILayout.Label("Summary", EditorStyles.boldLabel); showStates = EditorGUILayout.Foldout(showStates, "States [" + fsmComponent.FsmStates.Length + "]"); if (showStates) { string states = ""; if (fsmComponent.FsmStates.Length > 0) { foreach (var state in fsmComponent.FsmStates) { states += "\t\t" + state.Name + "\n"; } states = states.Substring(0, states.Length - 1); } else { states = "\t\t[none]"; } GUILayout.Label(states); } showEvents = EditorGUILayout.Foldout(showEvents, "Events [" + fsmComponent.FsmEvents.Length + "]"); if (showEvents) { string events = ""; if (fsmComponent.FsmEvents.Length > 0) { foreach (var fsmEvent in fsmComponent.FsmEvents) { events += "\t\t" + fsmEvent.Name + "\n"; } events = events.Substring(0, events.Length - 1); } else { events = "\t\t[none]"; } GUILayout.Label(events); } showVariables = EditorGUILayout.Foldout(showVariables, "Variables [" + fsmVariables.Count + "]"); if (showVariables) { string variables = ""; if (fsmVariables.Count > 0) { foreach (var fsmVar in fsmVariables) { variables += "\t\t" + fsmVar.Name + "\n"; } variables = variables.Substring(0, variables.Length - 1); } else { variables = "\t\t[none]"; } GUILayout.Label(variables); } } }