Fix T42531: Setting 'Undo' steps to '1' causes weirdness.

Do not allow '1' value here, it's useless.

Thanks to Campbell for suggested solution here!
This commit is contained in:
Bastien Montagne 2014-11-07 10:24:11 +01:00
parent a8b9402c8f
commit 5604a3d31d
Notes: blender-bot 2023-02-14 09:50:44 +01:00
Referenced by issue #42563, Join tool crashes blender in certain case
Referenced by issue #42531, Setting 'Undo' steps to '1' causes weirdness.
1 changed files with 9 additions and 0 deletions

View File

@ -209,6 +209,14 @@ static void rna_userdef_gl_use_16bit_textures(Main *bmain, Scene *scene, Pointer
rna_userdef_update(bmain, scene, ptr);
}
static void rna_userdef_undo_steps_set(PointerRNA *ptr, int value)
{
UserDef *userdef = (UserDef *)ptr->data;
/* Do not allow 1 undo steps, useless and breaks undo/redo process (see T42531). */
userdef->undosteps = (value == 1) ? 2 : value;
}
static void rna_userdef_select_mouse_set(PointerRNA *ptr, int value)
{
UserDef *userdef = (UserDef *)ptr->data;
@ -3465,6 +3473,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "undosteps");
RNA_def_property_range(prop, 0, 64);
RNA_def_property_int_funcs(prop, NULL, "rna_userdef_undo_steps_set", NULL);
RNA_def_property_ui_text(prop, "Undo Steps", "Number of undo steps available (smaller values conserve memory)");
prop = RNA_def_property(srna, "undo_memory_limit", PROP_INT, PROP_NONE);