public static void ShowObjectiveValueManagerWindow() { // Get existing open window or if none, make a new one: (docked to EvaluationParameterManager Window) ObjectiveValueManager window = GetWindow <ObjectiveValueManager>(new Type[] { typeof(EvaluationParameterManager) }); window.Show(); }
public static void ResetManager() { EvaluationParameterManager.assets.Clear(); EvaluationParameterManager.objStrings.Clear(); EvaluationParameterManager.parameterList.Clear(); EvaluationParameterManager.parametersSaved = false; ObjectiveValueManager.assets.Clear(); ObjectiveValueManager.objStrings.Clear(); ObjectiveValueManager.parameterList.Clear(); ObjectiveValueManager.objectiveValuesSaved = false; ObjectiveValueManager window = GetWindow <ObjectiveValueManager>(); window.Close(); }
private void OnGUI() { // font styles largeLabelStyle.fontSize = 14; largeLabelStyle.fontStyle = FontStyle.Bold; smallLabelStyle.fontSize = 12; variableLabelStyle.fontSize = 11; variableLabelStyle.fixedWidth = 1; bool ableToAddParam = objStrings.Count == 0 || (objStrings.Count > 0 && objStrings[objStrings.Count - 1] != "Empty"); EditorGUILayout.LabelField("Evaluation Framework: ROS Parameter Manager", largeLabelStyle); EditorGUILayout.Space(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUI.BeginDisabledGroup(!ableToAddParam); if (GUILayout.Button(ableToAddParam ? "Add ROS Parameter Value" : "Fill Object First")) { if (objStrings.Count == 0) { CreateMyAsset(); objStrings.Add("Empty"); parameterList.Add(null); } else if (objStrings[objStrings.Count - 1] != null) { CreateMyAsset(); objStrings.Add("Empty"); parameterList.Add(null); } } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); for (var i = 0; i < objStrings.Count; i++) { EditorGUILayout.LabelField(string.Format("{0}. ROS Parameter", i + 1), largeLabelStyle); if (GUILayout.Button(removeParameter)) { AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(assets[i])); assets.RemoveAt(i); objStrings.RemoveAt(i); parameterList.RemoveAt(i); i--; continue; } EditorGUI.indentLevel++; EditorGUILayout.LabelField(objStrings[i], smallLabelStyle); EditorGUILayout.Space(); if (objStrings[i] != "Empty") { EditorGUI.indentLevel++; EditorGUILayout.LabelField("ROS Parameter Information", largeLabelStyle); EditorGUI.indentLevel++; EditorGUILayout.LabelField("GameObject: " + parameterList[i].selectedGameObject, smallLabelStyle); EditorGUILayout.LabelField("Component: " + parameterList[i].selectedComponent.GetType(), smallLabelStyle); EditorGUILayout.LabelField("Variable: " + parameterList[i].selectedVariable, smallLabelStyle); EditorGUI.indentLevel = 0; EditorGUILayout.Space(); } } EditorGUILayout.Space(); EditorGUILayout.Space(); if (objStrings.Count != 0 && objStrings[objStrings.Count - 1] != "Empty") { if (GUILayout.Button(finishedChoosingROSParameters)) { rosParametersSaved = true; CreateROSParameterStorage(); SaveParametersIntoJson(); ObjectiveValueManager.ShowObjectiveValueManagerWindow(); GetWindow(typeof(ROSParameterManager)).Close(); } } EditorGUILayout.EndScrollView(); }
private void OnGUI() { // font styles largeLabelStyle.fontSize = 14; largeLabelStyle.fontStyle = FontStyle.Bold; smallLabelStyle.fontSize = 12; smallLabelStyleCenter.fontSize = 12; smallLabelStyleCenter.alignment = TextAnchor.MiddleCenter; smallLabelStyleCenter.normal.background = Texture2D.whiteTexture; variableLabelStyle.fontSize = 11; variableLabelStyle.fixedWidth = 1; bool ableToAddParam = objStrings.Count == 0 || (objStrings.Count > 0 && objStrings[objStrings.Count - 1] != "Empty"); EditorGUILayout.LabelField("Evaluation Framework: Parameter Manager", largeLabelStyle); EditorGUILayout.Space(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUI.BeginDisabledGroup(parametersSaved); useROS = EditorGUILayout.Toggle("Use ROS Communication", useROS); EditorGUI.BeginDisabledGroup(!ableToAddParam); if (GUILayout.Button(ableToAddParam ? "Add Parameter" : "Fill Parameter Object First")) { if (objStrings.Count == 0) { CreateMyAsset(); objStrings.Add("Empty"); parameterList.Add(null); } else if (objStrings[objStrings.Count - 1] != null) { CreateMyAsset(); objStrings.Add("Empty"); parameterList.Add(null); } } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); for (var i = 0; i < objStrings.Count; i++) { EditorGUILayout.LabelField(string.Format("{0}. Evaluation Parameter", i + 1), largeLabelStyle); if (GUILayout.Button(removeParameter)) { AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(assets[i])); assets.RemoveAt(i); objStrings.RemoveAt(i); parameterList.RemoveAt(i); i--; continue; } EditorGUI.indentLevel++; EditorGUILayout.LabelField(objStrings[i], smallLabelStyle); EditorGUILayout.Space(); if (objStrings[i] != "Empty") { EditorGUI.indentLevel++; EditorGUILayout.LabelField("Parameter Information", largeLabelStyle); EditorGUI.indentLevel++; EditorGUILayout.LabelField("GameObject: " + parameterList[i].selectedGameObject, smallLabelStyle); EditorGUILayout.LabelField("Component: " + parameterList[i].selectedComponent.GetType(), smallLabelStyle); EditorGUILayout.LabelField("Variable: " + parameterList[i].selectedVariable, smallLabelStyle); EditorGUILayout.LabelField("Variable Settings:", smallLabelStyle); EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); DisplayVariableSettings(i); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel = 0; EditorGUILayout.Space(); } } EditorGUILayout.Space(); EditorGUILayout.Space(); if (objStrings.Count != 0 && objStrings[objStrings.Count - 1] != "Empty") { if (GUILayout.Button(selectBaseFolderButton)) { frameworkBaseFolder = EditorUtility.OpenFolderPanel("Specify Path to Framework Base Folder", "", ""); EditorGUILayout.Space(); EditorGUILayout.Space(); folderSelected = true; } if (folderSelected) { EditorGUILayout.LabelField("Enter Name of Current Evaluation", largeLabelStyle); evaluationName = EditorGUILayout.TextField(evaluationName, smallLabelStyleCenter); EditorGUILayout.Space(); if (GUILayout.Button(saveParameterButton)) { parametersSaved = true; CreateEvaluationParameterStorage(); SaveParametersIntoJson(); if (useROS) { ROSParameterManager.ShowROSParameterManagerWindow(); } else { ObjectiveValueManager.ShowObjectiveValueManagerWindow(); } EditorGUILayout.Space(); } } EditorGUI.EndDisabledGroup(); if (parametersSaved) { EditorGUI.BeginDisabledGroup(executableBuilt || !ObjectiveValueManager.objectiveValuesSaved || (useROS && !ROSParameterManager.rosParametersSaved)); if (GUILayout.Button(ObjectiveValueManager.objectiveValuesSaved ? startBuildProcessButton : "Choose Objective Values First")) { StartBuildProcess(); EditorGUILayout.Space(); } EditorGUI.EndDisabledGroup(); } if (executableBuilt) { if (GUILayout.Button(finishSelectionProcess)) { FinishSelectionProcess(); } } } EditorGUILayout.EndScrollView(); }