public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { SerializedProperty enabled = prop.FindPropertyRelative("enabled"); SerializedProperty outputFolder = prop.FindPropertyRelative("outputFolder"); SerializedProperty rate = prop.FindPropertyRelative("rate"); SerializedProperty captureProcessedImage = prop.FindPropertyRelative("captureProcessedImage"); SerializedProperty stopTime = prop.FindPropertyRelative("stopTime"); float lineHeight = MyRoutines.GetEditorGUIStandardLineHeight(); EditorGUI.PropertyField(new Rect(pos.x, pos.y, pos.width, lineHeight), enabled, new GUIContent("Eye Test", enabled.tooltip)); if (enabled.boolValue) { EditorGUI.indentLevel++; string tooltip = MyRoutines.GetTooltip(typeof(EyeTest), "outputFolder"); float ypos = MyRoutines.GetEditorGUINextControlYPos(pos.y); EditorGUI.PropertyField(new Rect(pos.x, ypos, pos.width, lineHeight), captureProcessedImage); ypos = MyRoutines.GetEditorGUINextControlYPos(ypos); Rect controlRect = new Rect(pos.x, ypos, pos.width, lineHeight); //lineheight //MyRoutines.CreateScreenRecordingControl (outputFolder.displayName, tooltip, controlRect, outputFolder, rate, "EyeTestData"); MyRoutines.CreateOutputPathControl(outputFolder.displayName, tooltip, controlRect, outputFolder, false, string.Empty, string.Empty); if (string.IsNullOrEmpty(outputFolder.stringValue) == false) { ypos = MyRoutines.GetEditorGUINextControlYPos(ypos); controlRect = new Rect(pos.x, ypos, pos.width, lineHeight * 2); EditorGUI.HelpBox(controlRect, "The contents of the selected folder will be overwritten.", MessageType.Warning); ypos = MyRoutines.GetEditorGUINextControlYPos(ypos) + lineHeight; } else { ypos = MyRoutines.GetEditorGUINextControlYPos(ypos); } EditorGUI.PropertyField(new Rect(pos.x, ypos, pos.width, lineHeight), rate); ypos = MyRoutines.GetEditorGUINextControlYPos(ypos); EditorGUI.PropertyField(new Rect(pos.x, ypos, pos.width, lineHeight), stopTime); if (stopTime.floatValue <= 0) { stopTime.floatValue = Mathf.Infinity; } EditorGUI.indentLevel--; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { SerializedProperty outputPath = prop.FindPropertyRelative("outputPath"); SerializedProperty dataCaptureRate = prop.FindPropertyRelative("dataCaptureRate"); SerializedProperty stopTime = prop.FindPropertyRelative("stopTime"); float lineHeight = MyRoutines.GetEditorGUIStandardLineHeight(); DataOutputDetails outputDetails = fieldInfo.GetValue(prop.serializedObject.targetObject) as DataOutputDetails; bool isFile = outputDetails.isFile; string fileExtension = outputDetails.fileExtension; string defaultFileName = outputDetails.defaultFileName; string tooltip = MyRoutines.GetTooltip(typeof(DataOutputDetails), "outputPath"); //create the output path control MyRoutines.CreateOutputPathControl(outputPath.displayName, tooltip, pos, outputPath, isFile, fileExtension, defaultFileName); float ypos; if (string.IsNullOrEmpty(outputPath.stringValue) == false) { ypos = MyRoutines.GetEditorGUINextControlYPos(pos.y); Rect controlRect = new Rect(pos.x, ypos, pos.width, lineHeight * 2); EditorGUI.HelpBox(controlRect, "The contents of the selected folder will be overwritten.", MessageType.Warning); ypos = MyRoutines.GetEditorGUINextControlYPos(ypos) + lineHeight; } else { ypos = MyRoutines.GetEditorGUINextControlYPos(pos.y); } //create the datacapture rate field tooltip = MyRoutines.GetTooltip(typeof(DataOutputDetails), "dataCaptureRate"); string rateDisplayName = outputDetails.rateFieldLabel; EditorGUI.PropertyField(new Rect(pos.x, ypos, pos.width, lineHeight), dataCaptureRate, new GUIContent(rateDisplayName, tooltip)); //create the stopTime field ypos = MyRoutines.GetEditorGUINextControlYPos(ypos); EditorGUI.PropertyField(new Rect(pos.x, ypos, pos.width, lineHeight), stopTime); if (stopTime.floatValue <= 0) { stopTime.floatValue = Mathf.Infinity; } }