diff options
-rw-r--r-- | release/scripts/presets/keyconfig/blender.py | 8 | ||||
-rw-r--r-- | release/scripts/presets/keyconfig/blender_27x.py | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_keyconfig.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/keyconfig.c | 14 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_userdef.c | 17 |
7 files changed, 37 insertions, 16 deletions
diff --git a/release/scripts/presets/keyconfig/blender.py b/release/scripts/presets/keyconfig/blender.py index 6e9faa22762..bda19e075a3 100644 --- a/release/scripts/presets/keyconfig/blender.py +++ b/release/scripts/presets/keyconfig/blender.py @@ -20,15 +20,15 @@ class Prefs(bpy.types.KeyConfigPreferences): items=( ('LEFT', "Left", "Use left mouse button for selection. " - "The standard behavior that works well for all input devices"), + "The standard behavior that works well for mouse, trackpad and tablet devices"), ('RIGHT', "Right", - "Use right mouse button for selection." - "For efficiently working with keyboard and mouse"), + "Use right mouse button for selection, and left mouse button for actions. " + "This works well primarily for keyboard and mouse devices"), ), description=( "Mouse button used for selection" ), - default='RIGHT', + default='LEFT', update=update_fn, ) spacebar_action: EnumProperty( diff --git a/release/scripts/presets/keyconfig/blender_27x.py b/release/scripts/presets/keyconfig/blender_27x.py index 9233e226dc9..f0aae89d5bd 100644 --- a/release/scripts/presets/keyconfig/blender_27x.py +++ b/release/scripts/presets/keyconfig/blender_27x.py @@ -19,10 +19,10 @@ class Prefs(bpy.types.KeyConfigPreferences): items=( ('LEFT', "Left", "Use left mouse button for selection. " - "Standard behavior that works well for all input devices"), + "The standard behavior that works well for mouse, trackpad and tablet devices"), ('RIGHT', "Right", - "Use right mouse button for selection." - "For efficiently working with keyboard and mouse"), + "Use right mouse button for selection, and left mouse button for actions. " + "This works well primarily for keyboard and mouse devices"), ), description=( "Mouse button used for selection" diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index b34dc55ba44..64d06ca4de5 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -28,7 +28,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 280 -#define BLENDER_SUBVERSION 34 +#define BLENDER_SUBVERSION 35 /* Several breakages with 280, e.g. collections vs layers */ #define BLENDER_MINVERSION 280 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_keyconfig.h b/source/blender/blenkernel/BKE_keyconfig.h index a086930fe34..94d00b19d42 100644 --- a/source/blender/blenkernel/BKE_keyconfig.h +++ b/source/blender/blenkernel/BKE_keyconfig.h @@ -50,6 +50,8 @@ struct wmKeyConfigPrefType_Runtime *BKE_keyconfig_pref_type_find(const char *idn void BKE_keyconfig_pref_type_add(struct wmKeyConfigPrefType_Runtime *kpt_rt); void BKE_keyconfig_pref_type_remove(const struct wmKeyConfigPrefType_Runtime *kpt_rt); +void BKE_keyconfig_pref_set_select_mouse(struct UserDef *userdef, int value, bool override); + void BKE_keyconfig_pref_type_init(void); void BKE_keyconfig_pref_type_free(void); diff --git a/source/blender/blenkernel/intern/keyconfig.c b/source/blender/blenkernel/intern/keyconfig.c index 755c9e1582d..f2db375f3ec 100644 --- a/source/blender/blenkernel/intern/keyconfig.c +++ b/source/blender/blenkernel/intern/keyconfig.c @@ -120,4 +120,18 @@ void BKE_keyconfig_pref_type_free(void) global_keyconfigpreftype_hash = NULL; } +/* Set select mouse, for versioning code. */ +void BKE_keyconfig_pref_set_select_mouse(UserDef *userdef, int value, bool override) +{ + wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(userdef, WM_KEYCONFIG_STR_DEFAULT); + IDProperty *idprop = IDP_GetPropertyFromGroup(kpt->prop, "select_mouse"); + if (!idprop) { + IDPropertyTemplate tmp = { .i = value }; + IDP_AddToGroup(kpt->prop, IDP_New(IDP_INT, &tmp, "select_mouse")); + } + else if (override) { + IDP_Int(idprop) = value; + } +} + /** \} */ diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 953fb36bdc7..f9f9905be3c 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -44,6 +44,7 @@ #include "BKE_brush.h" #include "BKE_colortools.h" +#include "BKE_keyconfig.h" #include "BKE_layer.h" #include "BKE_library.h" #include "BKE_main.h" @@ -87,6 +88,9 @@ void BLO_update_defaults_userpref_blend(void) /* Only enable tooltips translation by default, without actually enabling translation itself, for now. */ U.transopts = USER_TR_TOOLTIPS; U.memcachelimit = 4096; + + /* Default to left click select. */ + BKE_keyconfig_pref_set_select_mouse(&U, 0, true); } /** diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 8f90711e41e..a65520c35fa 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -402,19 +402,20 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) } } - if (!USER_VERSION_ATLEAST(280, 32)) { - if ((userdef->flag & USER_LMOUSESELECT) ) { - userdef->flag &= ~USER_LMOUSESELECT; - wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(userdef, WM_KEYCONFIG_STR_DEFAULT); - IDP_AddToGroup(kpt->prop, IDP_New(IDP_INT, &(IDPropertyTemplate){ .i = 0, }, "select_mouse")); - } - } - if (!USER_VERSION_ATLEAST(280, 33)) { /* Enable GLTF addon by default. */ BKE_addon_ensure(&userdef->addons, "io_scene_gltf2"); } + if (!USER_VERSION_ATLEAST(280, 35)) { + /* Preserve RMB select setting after moving to Python and changing default value. */ + if (USER_VERSION_ATLEAST(280, 32) || !(userdef->flag & USER_LMOUSESELECT)) { + BKE_keyconfig_pref_set_select_mouse(userdef, 1, false); + } + + userdef->flag &= ~USER_LMOUSESELECT; + } + /** * Include next version bump. */ |