From 6a06e87f851cbb17a4e4a083c00ceb2668b3b723 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Tue, 7 Jan 2025 18:58:27 +0100 Subject: [PATCH] Fix #120833: Align Reset to Default with Preferences Defaults This PR fixes a number of items in Preferences that "Reset to Default" to different values than the default preferences. For some items this is because they just have incorrect values, some have redundancies between the U_default struct and property default, and many others are caused by our code that reverses struct defaults for properties that are "negative SDNA", or don't struct defaults for enum_bitflag_sdna properly. Items include "show_splash", "anisotropic_filter", etc. Pull Request: https://projects.blender.org/blender/blender/pulls/132762 --- release/datafiles/userdef/userdef_default.c | 5 ++--- source/blender/makesrna/intern/rna_userdef.cc | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c index 0c4ac7f63d2..e02a3211a95 100644 --- a/release/datafiles/userdef/userdef_default.c +++ b/release/datafiles/userdef/userdef_default.c @@ -23,8 +23,7 @@ const UserDef U_default = { .versionfile = BLENDER_FILE_VERSION, .subversionfile = BLENDER_FILE_SUBVERSION, - .flag = (USER_AUTOSAVE | USER_TOOLTIPS | USER_RELPATHS | USER_RELEASECONFIRM | - USER_SCRIPT_AUTOEXEC_DISABLE | USER_NONEGFRAMES), + .flag = (USER_AUTOSAVE | USER_TOOLTIPS | USER_RELPATHS | USER_RELEASECONFIRM), .dupflag = USER_DUP_MESH | USER_DUP_CURVE | USER_DUP_SURF | USER_DUP_LATTICE | USER_DUP_FONT | USER_DUP_MBALL | USER_DUP_LAMP | USER_DUP_ARM | USER_DUP_CAMERA | USER_DUP_SPEAKER | USER_DUP_ACT | USER_DUP_LIGHTPROBE | USER_DUP_GPENCIL | USER_DUP_CURVES | @@ -53,7 +52,7 @@ const UserDef U_default = { .mini_axis_type = USER_MINI_AXIS_TYPE_GIZMO, .uiflag = (USER_FILTERFILEEXTS | USER_DRAWVIEWINFO | USER_PLAINMENUS | USER_LOCK_CURSOR_ADJUST | USER_DEPTH_CURSOR | USER_AUTOPERSP | - USER_NODE_AUTO_OFFSET | USER_GLOBALUNDO | USER_HIDE_DOT | USER_SHOW_GIZMO_NAVIGATE | + USER_NODE_AUTO_OFFSET | USER_GLOBALUNDO | USER_SHOW_GIZMO_NAVIGATE | USER_SHOW_VIEWPORTNAME | USER_SHOW_FPS | USER_CONTINUOUS_MOUSE | USER_SAVE_PROMPT), .uiflag2 = USER_REGION_OVERLAP, .gpu_flag = USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE | USER_GPU_FLAG_SUBDIVISION_EVALUATION, diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 44ef6e51f16..6c12653fb5a 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -5191,6 +5191,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop = RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "uiflag", USER_SPLASH_DISABLE); RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "uiflag", USER_SHOW_FPS); @@ -5496,6 +5497,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, nullptr, "text_render", USER_TEXT_DISABLE_AA); RNA_def_property_ui_text( prop, "Text Anti-Aliasing", "Smooth jagged edges of user interface text"); + RNA_def_property_boolean_default(prop, true); RNA_def_property_update(prop, 0, "rna_userdef_text_update"); prop = RNA_def_property(srna, "use_text_render_subpixelaa", PROP_BOOLEAN, PROP_NONE); @@ -5732,6 +5734,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop, "Show Auto Keying Warning", "Show warning indicators when transforming objects and bones if auto keying is enabled"); + RNA_def_property_boolean_default(prop, true); /* keyframing settings */ prop = RNA_def_property(srna, "key_insert_channels", PROP_ENUM, PROP_NONE); @@ -5741,6 +5744,10 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Default Key Channels", "Which channels to insert keys at when no keying set is active"); + RNA_def_property_enum_default(prop, + USER_ANIM_KEY_CHANNEL_LOCATION | USER_ANIM_KEY_CHANNEL_ROTATION | + USER_ANIM_KEY_CHANNEL_SCALE | + USER_ANIM_KEY_CHANNEL_CUSTOM_PROPERTIES); prop = RNA_def_property(srna, "use_auto_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", AUTOKEY_FLAG_INSERTNEEDED); @@ -5771,7 +5778,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop = RNA_def_property(srna, "use_anim_channel_group_colors", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna( prop, nullptr, "animation_flag", USER_ANIM_SHOW_CHANNEL_GROUP_COLORS); - RNA_def_property_boolean_default(prop, true); RNA_def_property_ui_text( prop, "Channel Group Colors", @@ -6255,6 +6261,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop, "Edit Mode Smooth Wires", "Enable edit mode edge smoothing, reducing aliasing (requires restart)"); + RNA_def_property_boolean_default(prop, true); RNA_def_property_update(prop, 0, "rna_userdef_gpu_update"); prop = RNA_def_property(srna, "use_region_overlap", PROP_BOOLEAN, PROP_NONE); @@ -6308,7 +6315,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, nullptr, "anisotropic_filter"); RNA_def_property_enum_items(prop, anisotropic_items); - RNA_def_property_enum_default(prop, 1); RNA_def_property_ui_text(prop, "Anisotropic Filtering", "Quality of anisotropic filtering"); RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update"); @@ -6361,6 +6367,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) "GPU Depth Picking", "When making a selection in 3D View, use the GPU depth buffer to " "ensure the frontmost object is selected first"); + RNA_def_property_boolean_default(prop, true); /* GPU subdivision evaluation. */ @@ -7251,11 +7258,13 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, nullptr, "uiflag", USER_HIDE_RECENT); RNA_def_property_ui_text( prop, "Show Recent Locations", "Show Recent locations list in the File Browser"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "show_system_bookmarks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "uiflag", USER_HIDE_SYSTEM_BOOKMARKS); RNA_def_property_ui_text( prop, "Show System Locations", "Show System locations list in the File Browser"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "use_relative_paths", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "flag", USER_RELPATHS); @@ -7272,6 +7281,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop = RNA_def_property(srna, "use_load_ui", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", USER_FILENOUI); RNA_def_property_ui_text(prop, "Load UI", "Load user interface setup when loading .blend files"); + RNA_def_property_boolean_default(prop, true); RNA_def_property_update(prop, 0, "rna_userdef_load_ui_update"); prop = RNA_def_property(srna, "use_scripts_auto_execute", PROP_BOOLEAN, PROP_NONE); @@ -7288,6 +7298,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop, "Tabs as Spaces", "Automatically convert all new tabs into spaces for new and loaded text files"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "use_extension_online_access_handled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna( @@ -7717,6 +7728,7 @@ void RNA_def_userdef(BlenderRNA *brna) prop = RNA_def_property(srna, "use_recent_searches", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", USER_FLAG_RECENT_SEARCHES_DISABLE); RNA_def_property_ui_text(prop, "Recent Searches", "Sort the recently searched items at the top"); + RNA_def_property_boolean_default(prop, true); /* nested structs */ prop = RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE);