public void OnGUI() { bool guiEnabled = GUI.enabled; _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition); using (var vs = new EditorGUILayout.VerticalScope(GUI.skin.box)) { DrawSection(this, "GENERAL", this.DrawDetailsGeneral, ref _showGeneral); DrawSection(this, "ENVIRONMENT", this.DrawDetailsEnvironment, ref _showEnvironment); DrawSection(this, "COOKING", this.DrawDetailsCooking, ref _showCooking); DrawSection(this, "GEOMETRY", this.DrawDetailsGeometry, ref _showGeometry); DrawSection(this, "SESSION", this.DrawSessionSettings, ref _showSession); DrawSection(this, "TOOLS", this.DrawToolSettings, ref _showTools); DrawSection(this, "ADVANCED", this.DrawAdvancedSettings, ref _showAdvanced); float buttonHeight = 25; float buttonWidth = 200; GUIStyle yellowButtonStyle = new GUIStyle(GUI.skin.button); yellowButtonStyle.normal.textColor = HEU_EditorUI.GetUISafeTextColorYellow(); yellowButtonStyle.fontStyle = FontStyle.Bold; yellowButtonStyle.fontSize = 12; yellowButtonStyle.fixedHeight = buttonHeight; yellowButtonStyle.fixedWidth = buttonWidth; using (var hs = new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button(HEU_EditorStrings.RELOAD_SETTINGS, yellowButtonStyle)) { if (HEU_EditorUtility.DisplayDialog(HEU_EditorStrings.REVERT_SETTINGS + "?", "Are you sure you want to reload plugin settings from heu_settings.ini file?", "Yes", "No")) { HEU_PluginStorage.LoadFromSavedFile(); ResetStateAndRepaint(); } } GUILayout.Space(10); if (GUILayout.Button(HEU_EditorStrings.REVERT_SETTINGS, yellowButtonStyle)) { if (HEU_EditorUtility.DisplayDialog(HEU_EditorStrings.REVERT_SETTINGS + "?", "Are you sure you want to revert all " + HEU_Defines.HEU_PRODUCT_NAME + " plugin settings?", "Yes", "No")) { HEU_PluginStorage.ClearPluginData(); ResetStateAndRepaint(); } } GUILayout.FlexibleSpace(); } } EditorGUILayout.EndScrollView(); GUI.enabled = guiEnabled; }
private bool DrawAdvancedSettings() { bool bChanged = false; GUIStyle labelStyle = new GUIStyle(GUI.skin.label); labelStyle.normal.textColor = HEU_EditorUI.GetUISafeTextColorYellow(); EditorGUILayout.LabelField("Warning: Changing these values from default might result in HDAs not loading properly!", labelStyle, GUILayout.MinHeight(30)); HEU_EditorUI.DrawSeparator(); EditorGUIUtility.labelWidth = 250; { string oldValue = HEU_PluginSettings.HDAData_Name; string newValue = EditorGUILayout.DelayedTextField("HDA Data GameObject Name", oldValue); if (oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.HDAData_Name = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldValue = HEU_PluginSettings.EditorOnly_Tag; string newValue = EditorGUILayout.DelayedTextField("HDA Data GameObject Tag", oldValue); if (oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.EditorOnly_Tag = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldValue = HEU_PluginSettings.CollisionGroupName; string newValue = EditorGUILayout.DelayedTextField("Collision Group", oldValue); if(oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.CollisionGroupName = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldValue = HEU_PluginSettings.RenderedCollisionGroupName; string newValue = EditorGUILayout.DelayedTextField("Rendered Collision Group", oldValue); if (oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.RenderedCollisionGroupName = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldValue = HEU_PluginSettings.UnityMaterialAttribName; string newValue = EditorGUILayout.DelayedTextField("Unity Material Attribute", oldValue); if (oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.UnityMaterialAttribName = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldValue = HEU_PluginSettings.UnitySubMaterialAttribName; string newValue = EditorGUILayout.DelayedTextField("Unity Substance Material Attribute", oldValue); if (oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.UnitySubMaterialAttribName = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldValue = HEU_PluginSettings.UnityTagAttributeName; string newValue = EditorGUILayout.DelayedTextField("Unity Tag Attribute", oldValue); if (oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.UnityTagAttributeName = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldValue = HEU_PluginSettings.UnityScriptAttributeName; string newValue = EditorGUILayout.DelayedTextField("Unity Script Attribute", oldValue); if (oldValue != newValue && !string.IsNullOrEmpty(newValue)) { HEU_PluginSettings.UnityScriptAttributeName = newValue; bChanged = true; } } EditorGUIUtility.labelWidth = 0; return bChanged; }