void OnGUI() { trafficMgr = EditorUtility.InstanceIDToObject(_trafficMgrId) as TrafficManager; area = EditorUtility.InstanceIDToObject(_areaInstanceId) as Transform; // Header GUILayout.Label("Vissim Files", EditorStyles.boldLabel); string sep = EditorGUILayout.TextField("Column Separator", columnSeparator.ToString()); columnSeparator = (string.IsNullOrEmpty(sep))? ';' : sep[0]; sep = EditorGUILayout.TextField("Vector Separator", vectorSeparator.ToString()); vectorSeparator = (string.IsNullOrEmpty(sep)) ? ' ' : sep[0]; GUILayout.BeginHorizontal(); GUILayout.Space(EditorGUIUtility.labelWidth); if (GUILayout.Button("Convert to Binary \u2026")) { string file = EditorUtility.OpenFilePanel("Select traffic data", trafficFilePath, TrafficIO.VISSIM_VEHICLES_EXTENSION + "," + TrafficIO.VISSIM_PEDESTRIANS_EXTENSION); if (!string.IsNullOrEmpty(file)) { trafficFilePath = Path.GetDirectoryName(file); ConvertToBinary(CleanupFilename(file, projectPath)); } } GUILayout.EndHorizontal(); EditorGUILayout.Space(); // Header GUILayout.Label("Heatmap", EditorStyles.boldLabel); // Offset trafficMgr = EditorGUILayout.ObjectField("Traffic Manager", trafficMgr, typeof(TrafficManager), true) as TrafficManager; _trafficMgrId = trafficMgr ? trafficMgr.GetInstanceID() : 0; // Resolution int res = EditorGUILayout.IntField("Resolution", resolution); if (res < 1) { res = 1; } resolution = res; // Point Size int _pointSize = EditorGUILayout.IntField("Point Size", pointSize); if (_pointSize < 1) { _pointSize = 1; } pointSize = _pointSize; // Logarithmic logarithmic = EditorGUILayout.Toggle("Logarithmic", logarithmic); // Area area = EditorGUILayout.ObjectField("Area", area, typeof(Transform), true) as Transform; _areaInstanceId = area ? area.GetInstanceID() : 0; // Generate button GUILayout.BeginHorizontal(); GUILayout.Space(EditorGUIUtility.labelWidth); if (GUILayout.Button("Generate \u2026")) { string path = EditorUtility.OpenFolderPanel("Load traffic data", trafficFilePath, ""); if (Directory.Exists(path)) { trafficFilePath = path; string[] files = Directory.GetFiles(path); foreach (string file in files) { GenerateHeatmap(CleanupFilename(file, projectPath)); } } } GUILayout.EndHorizontal(); EditorGUILayout.Space(); // Header GUILayout.Label("Elevation Adjustsment", EditorStyles.boldLabel); EditorGUILayout.PropertyField(geometryObjectsProp, true); EditorGUILayout.PropertyField(managerProp, true); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Path to traffic data", trimmedAdjFilePath, GUILayout.MinWidth(EditorGUIUtility.currentViewWidth - 30)); if (GUILayout.Button("\u2026")) { string path = EditorUtility.OpenFilePanel("Load traffic data", adjustmentFilePath, ""); if (File.Exists(path) && (path.EndsWith(TrafficIO.VISSIM_PEDESTRIANS_EXTENSION) || path.EndsWith(TrafficIO.VISSIM_VEHICLES_EXTENSION))) { adjustmentFilePath = path; trimmedAdjFilePath = Path.GetFileName(path); } else { adjustmentFilePath = ""; trimmedAdjFilePath = ""; } } GUILayout.EndHorizontal(); sep = EditorGUILayout.TextField("Column Separator", adjColumnSeparator.ToString()); adjColumnSeparator = (string.IsNullOrEmpty(sep)) ? ';' : sep[0]; sep = EditorGUILayout.TextField("Vector Separator", adjVectorSeperator.ToString()); adjVectorSeperator = (string.IsNullOrEmpty(sep)) ? ';' : sep[0]; adjHeightOffset = EditorGUILayout.FloatField("Height offset", adjHeightOffset); GUILayout.BeginHorizontal(); GUILayout.Space(EditorGUIUtility.labelWidth); if (GUILayout.Button("Adjust Elevation \u2026")) { if (adjustmentFilePath != "" && geometryObjectsProp != null && managerProp != null) { if (EnableCollison(true)) { AdjustHeight(); } EnableCollison(false); Repaint(); } else { Debug.LogError("Missing elevation data"); } } GUILayout.EndHorizontal(); EditorGUILayout.Space(); //if (GUILayout.Button("Enable collision \u2026")) //{ // EnableCollison(true); //} //if (GUILayout.Button("Disable collision \u2026")) //{ // EnableCollison(false); //} if (GUI.changed) { so.ApplyModifiedProperties(); } }