public static bool LoadPreferences() { _gridColorX = (EditorPrefs.HasKey("gridColorX")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorX")) : GRID_COLOR_X; _gridColorY = (EditorPrefs.HasKey("gridColorY")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorY")) : GRID_COLOR_Y; _gridColorZ = (EditorPrefs.HasKey("gridColorZ")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorZ")) : GRID_COLOR_Z; _alphaBump = (EditorPrefs.HasKey("pg_alphaBump")) ? EditorPrefs.GetFloat("pg_alphaBump") : ALPHA_BUMP; _snapMethod = System.Convert.ToInt32( (EditorPrefs.HasKey(pg_Constant.UseAxisConstraints)) ? EditorPrefs.GetBool(pg_Constant.UseAxisConstraints) : USE_AXIS_CONSTRAINTS ); _BracketIncreaseValue = EditorPrefs.HasKey(pg_Constant.BracketIncreaseValue) ? EditorPrefs.GetFloat(pg_Constant.BracketIncreaseValue) : .25f; _GridUnits = (pg_Editor.SnapUnit)(EditorPrefs.HasKey(pg_Constant.GridUnit) ? EditorPrefs.GetInt(pg_Constant.GridUnit) : 0); return true; }
public static bool LoadPreferences() { _gridColorX = (EditorPrefs.HasKey("gridColorX")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorX")) : GRID_COLOR_X; _gridColorY = (EditorPrefs.HasKey("gridColorY")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorY")) : GRID_COLOR_Y; _gridColorZ = (EditorPrefs.HasKey("gridColorZ")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorZ")) : GRID_COLOR_Z; _alphaBump = (EditorPrefs.HasKey("pg_alphaBump")) ? EditorPrefs.GetFloat("pg_alphaBump") : ALPHA_BUMP; _snapMethod = System.Convert.ToInt32( (EditorPrefs.HasKey(pg_Constant.UseAxisConstraints)) ? EditorPrefs.GetBool(pg_Constant.UseAxisConstraints) : USE_AXIS_CONSTRAINTS ); _BracketIncreaseValue = EditorPrefs.HasKey(pg_Constant.BracketIncreaseValue) ? EditorPrefs.GetFloat(pg_Constant.BracketIncreaseValue) : .25f; _GridUnits = (pg_Editor.SnapUnit)(EditorPrefs.HasKey(pg_Constant.GridUnit) ? EditorPrefs.GetInt(pg_Constant.GridUnit) : 0); return(true); }
public static void PreferencesGUI() { if (!prefsLoaded) { prefsLoaded = LoadPreferences(); OnWindowResize(); } // EditorGUILayout.HelpBox("Changes will take effect on the next ProGrids open.", MessageType.Info); GUILayout.Label("Grid Colors per Axis", EditorStyles.boldLabel); _gridColorX = EditorGUILayout.ColorField("X Axis", _gridColorX); _gridColorY = EditorGUILayout.ColorField("Y Axis", _gridColorY); _gridColorZ = EditorGUILayout.ColorField("Z Axis", _gridColorZ); _alphaBump = EditorGUILayout.Slider(new GUIContent("Tenth Line Alpha", "Every 10th line will have it's alpha value bumped by this amount."), _alphaBump, 0f, 1f); // not used // _BracketIncreaseValue = EditorGUILayout.FloatField(new GUIContent("Grid Increment Value", "Affects the amount by which the bracket keys will increment or decrement that snap value."), _BracketIncreaseValue); _GridUnits = (pg_Editor.SnapUnit)EditorGUILayout.EnumPopup("Grid Units", _GridUnits); _scaleSnapEnabled = EditorGUILayout.Toggle("Snap On Scale", _scaleSnapEnabled); // GUILayout.BeginHorizontal(); // EditorGUILayout.PrefixLabel(new GUIContent("Axis Constraints", "If toggled, objects will be automatically grid aligned on all axes when moving.")); _snapMethod = EditorGUILayout.IntPopup("Snap Method", _snapMethod, SnapMethod, SnapVals); // GUILayout.EndHorizontal(); if (GUI.Button(resetRect, "Reset")) { if (EditorUtility.DisplayDialog("Delete ProGrids editor preferences?", "Are you sure you want to delete these?, this action cannot be undone.", "Yes", "No")) { ResetPrefs(); } } if (GUI.changed) { SetPreferences(); } }
public static void PreferencesGUI() { if(!prefsLoaded) { prefsLoaded = LoadPreferences(); OnWindowResize(); } // EditorGUILayout.HelpBox("Changes will take effect on the next ProGrids open.", MessageType.Info); GUILayout.Label("Grid Colors per Axis", EditorStyles.boldLabel); _gridColorX = EditorGUILayout.ColorField("X Axis", _gridColorX); _gridColorY = EditorGUILayout.ColorField("Y Axis", _gridColorY); _gridColorZ = EditorGUILayout.ColorField("Z Axis", _gridColorZ); _alphaBump = EditorGUILayout.Slider(new GUIContent("Tenth Line Alpha", "Every 10th line will have it's alpha value bumped by this amount."), _alphaBump, 0f, 1f); // not used // _BracketIncreaseValue = EditorGUILayout.FloatField(new GUIContent("Grid Increment Value", "Affects the amount by which the bracket keys will increment or decrement that snap value."), _BracketIncreaseValue); _GridUnits = (pg_Editor.SnapUnit)EditorGUILayout.EnumPopup("Grid Units", _GridUnits); // GUILayout.BeginHorizontal(); // EditorGUILayout.PrefixLabel(new GUIContent("Axis Constraints", "If toggled, objects will be automatically grid aligned on all axes when moving.")); _snapMethod = EditorGUILayout.IntPopup("Snap Method", _snapMethod, SnapMethod, SnapVals); // GUILayout.EndHorizontal(); if(GUI.Button(resetRect, "Reset")) { if(EditorUtility.DisplayDialog("Delete ProGrids editor preferences?", "Are you sure you want to delete these?, this action cannot be undone.", "Yes", "No")) ResetPrefs(); } if(GUI.changed) SetPreferences(); }