Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/presets/keyconfig/blender.py22
-rw-r--r--release/scripts/presets/keyconfig/blender_27x.py57
-rw-r--r--release/scripts/startup/bl_operators/wm.py11
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py5
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/BKE_keyconfig.h10
-rw-r--r--source/blender/blenkernel/intern/blender.c2
-rw-r--r--source/blender/blenkernel/intern/keyconfig.c32
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c15
-rw-r--r--source/blender/blenloader/intern/writefile.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c14
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h13
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c31
-rw-r--r--source/blender/makesrna/intern/rna_wm.c20
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c7
17 files changed, 148 insertions, 103 deletions
diff --git a/release/scripts/presets/keyconfig/blender.py b/release/scripts/presets/keyconfig/blender.py
index 060eabe8275..c6d106d5806 100644
--- a/release/scripts/presets/keyconfig/blender.py
+++ b/release/scripts/presets/keyconfig/blender.py
@@ -5,8 +5,6 @@ from bpy.props import (
EnumProperty,
)
-userpref = bpy.context.user_preferences
-
idname = os.path.splitext(os.path.basename(__file__))[0]
def update(_self, _context):
@@ -16,6 +14,18 @@ def update(_self, _context):
class Prefs(bpy.types.KeyConfigPreferences):
bl_idname = idname
+ select_mouse: EnumProperty(
+ name="Spacebar",
+ items=(
+ ('LEFT', "Left", "Use left Mouse Button for selection"),
+ ('RIGHT', "Right", "Use Right Mouse Button for selection"),
+ ),
+ description=(
+ "Mouse button used for selection"
+ ),
+ default='RIGHT',
+ update=update,
+ )
spacebar_action: EnumProperty(
name="Spacebar",
items=(
@@ -46,8 +56,13 @@ class Prefs(bpy.types.KeyConfigPreferences):
def draw(self, layout):
col = layout.column(align=True)
+ col.label(text="Select With:")
+ col.row().prop(self, "select_mouse", expand=True)
+
+ col = layout.column(align=True)
col.label(text="Spacebar Action:")
col.row().prop(self, "spacebar_action", expand=True)
+
layout.prop(self, "use_select_all_toggle")
@@ -64,13 +79,12 @@ def _load():
keyconfig_data = mod.generate_keymaps(
mod.KeymapParams(
- select_mouse=userpref.inputs.select_mouse,
+ select_mouse=kc_prefs.select_mouse,
spacebar_action=kc_prefs.spacebar_action,
use_select_all_toggle=kc_prefs.use_select_all_toggle,
),
)
keyconfig_init_from_data(kc, keyconfig_data)
- kc.has_select_mouse = True # Support switching select mouse
if __name__ == "__main__":
diff --git a/release/scripts/presets/keyconfig/blender_27x.py b/release/scripts/presets/keyconfig/blender_27x.py
index 857480b404e..15888b68e50 100644
--- a/release/scripts/presets/keyconfig/blender_27x.py
+++ b/release/scripts/presets/keyconfig/blender_27x.py
@@ -1,23 +1,56 @@
import os
import bpy
+from bpy.props import (
+ EnumProperty,
+)
+
+idname = os.path.splitext(os.path.basename(__file__))[0]
+
+def update(_self, _context):
+ _load()
+
+
+class Prefs(bpy.types.KeyConfigPreferences):
+ bl_idname = idname
-userpref = bpy.context.user_preferences
+ select_mouse: EnumProperty(
+ name="Spacebar",
+ items=(
+ ('LEFT', "Left", "Use left Mouse Button for selection"),
+ ('RIGHT', "Right", "Use Right Mouse Button for selection"),
+ ),
+ description=(
+ "Mouse button used for selection"
+ ),
+ default='RIGHT',
+ update=update,
+ )
+
+ def draw(self, layout):
+ col = layout.column(align=True)
+ col.label(text="Select With:")
+ col.row().prop(self, "select_mouse", expand=True)
from bpy_extras.keyconfig_utils import (
- keyconfig_import_from_data,
+ keyconfig_init_from_data,
keyconfig_module_from_preset,
)
-_mod = keyconfig_module_from_preset(os.path.join("keymap_data", "blender_default"), __file__)
-keyconfig_data = _mod.generate_keymaps(
- _mod.KeymapParams(
- legacy=True,
- select_mouse=userpref.inputs.select_mouse,
- ),
-)
+mod = keyconfig_module_from_preset(os.path.join("keymap_data", "blender_default"), __file__)
+
+def _load():
+ kc = bpy.context.window_manager.keyconfigs.new(idname)
+ kc_prefs = kc.preferences
+
+ keyconfig_data = mod.generate_keymaps(
+ mod.KeymapParams(
+ select_mouse=kc_prefs.select_mouse,
+ legacy=True,
+ ),
+ )
+ keyconfig_init_from_data(kc, keyconfig_data)
-idname = os.path.splitext(os.path.basename(__file__))[0]
if __name__ == "__main__":
- kc = keyconfig_import_from_data(idname, keyconfig_data)
- kc.has_select_mouse = True # Support switching select mouse
+ bpy.utils.register_class(Prefs)
+ _load()
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index c770746666d..81183dd3fd6 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2591,12 +2591,17 @@ class WM_MT_splash(Menu):
text = "Blender"
sub.menu("USERPREF_MT_keyconfigs", text=text)
- if wm.keyconfigs.active.has_select_mouse:
+ kc = wm.keyconfigs.active
+ kc_prefs = kc.preferences
+ has_select_mouse = hasattr(kc_prefs, "select_mouse")
+ if has_select_mouse:
sub = col.split(factor=0.35)
row = sub.row()
row.alignment = 'RIGHT'
row.label(text="Select With")
- sub.row().prop(userpref.inputs, 'select_mouse', expand=True)
+ sub.row().prop(kc_prefs, 'select_mouse', expand=True)
+ has_select_mouse = True
+
col.separator()
@@ -2618,7 +2623,7 @@ class WM_MT_splash(Menu):
#sub.prop(userpref.system, "language", text="")
# Keep height constant
- if not wm.keyconfigs.active.has_select_mouse:
+ if not has_select_mouse:
col.label()
layout.label()
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 5a71f98d8f8..ace2d1b17d1 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1103,11 +1103,6 @@ class USERPREF_PT_input(Panel):
sub.prop(inputs, "drag_threshold")
sub.prop(inputs, "tweak_threshold")
- wm = bpy.context.window_manager
- if wm.keyconfigs.active.has_select_mouse:
- sub.label(text="Select With:")
- sub.row().prop(inputs, "select_mouse", expand=True)
-
sub = layout.column()
sub.label(text="Double Click:")
sub.prop(inputs, "mouse_double_click_time", text="Speed")
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 34a486dd66f..781dd3f9826 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 31
+#define BLENDER_SUBVERSION 32
/* 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 bef6aab2d82..a086930fe34 100644
--- a/source/blender/blenkernel/BKE_keyconfig.h
+++ b/source/blender/blenkernel/BKE_keyconfig.h
@@ -26,7 +26,10 @@
/** Based on #BKE_addon_pref_type_init and friends */
-/** Actual data is stored in #wmKeyConfigPrefType. */
+struct UserDef;
+struct wmKeyConfigPref;
+
+/** Actual data is stored in #wmKeyConfigPref. */
#if defined(__RNA_TYPES_H__)
typedef struct wmKeyConfigPrefType_Runtime {
char idname[64];
@@ -39,7 +42,10 @@ typedef struct wmKeyConfigPrefType_Runtime {
typedef struct wmKeyConfigPrefType_Runtime wmKeyConfigPrefType_Runtime;
#endif
-/* KeyConfig preferenes. */
+/* KeyConfig preferenes (UserDef). */
+struct wmKeyConfigPref *BKE_keyconfig_pref_ensure(struct UserDef *userdef, const char *kc_idname);
+
+/* KeyConfig preferenes (RNA). */
struct wmKeyConfigPrefType_Runtime *BKE_keyconfig_pref_type_find(const char *idname, bool quiet);
void BKE_keyconfig_pref_type_add(struct wmKeyConfigPrefType_Runtime *kpt_rt);
void BKE_keyconfig_pref_type_remove(const struct wmKeyConfigPrefType_Runtime *kpt_rt);
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index b90d4fd3948..f1b1aa548d2 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -210,7 +210,7 @@ static void userdef_free_keymaps(UserDef *userdef)
static void userdef_free_keyconfig_prefs(UserDef *userdef)
{
- for (wmKeyConfigPrefType *kpt = userdef->user_keyconfig_prefs.first, *kpt_next; kpt; kpt = kpt_next) {
+ for (wmKeyConfigPref *kpt = userdef->user_keyconfig_prefs.first, *kpt_next; kpt; kpt = kpt_next) {
kpt_next = kpt->next;
IDP_FreeProperty(kpt->prop);
MEM_freeN(kpt->prop);
diff --git a/source/blender/blenkernel/intern/keyconfig.c b/source/blender/blenkernel/intern/keyconfig.c
index 46b82569f47..755c9e1582d 100644
--- a/source/blender/blenkernel/intern/keyconfig.c
+++ b/source/blender/blenkernel/intern/keyconfig.c
@@ -29,15 +29,45 @@
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
#include "DNA_listBase.h"
+#include "DNA_userdef_types.h"
+#include "DNA_windowmanager_types.h"
#include "BKE_keyconfig.h" /* own include */
+#include "BKE_idprop.h"
#include "MEM_guardedalloc.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Key-Config Preference (UserDef) API
+ *
+ * \see #BKE_addon_pref_type_init for logic this is bases on.
+ * \{ */
+
+wmKeyConfigPref *BKE_keyconfig_pref_ensure(UserDef *userdef, const char *kc_idname)
+{
+ wmKeyConfigPref *kpt = BLI_findstring(
+ &userdef->user_keyconfig_prefs, kc_idname, offsetof(wmKeyConfigPref, idname));
+ if (kpt == NULL) {
+ kpt = MEM_callocN(sizeof(*kpt), __func__);
+ STRNCPY(kpt->idname, kc_idname);
+ BLI_addtail(&userdef->user_keyconfig_prefs, kpt);
+ }
+ if (kpt->prop == NULL) {
+ IDPropertyTemplate val = {0};
+ kpt->prop = IDP_New(IDP_GROUP, &val, kc_idname); /* name is unimportant */
+ }
+ return kpt;
+}
+
+/** \} */
+
/* -------------------------------------------------------------------- */
-/** \name Key-Config Preference API
+/** \name Key-Config Preference (RNA Type) API
*
* \see #BKE_addon_pref_type_init for logic this is bases on.
* \{ */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 90deb0f37ea..9596df58170 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8941,7 +8941,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
direct_link_keymapitem(fd, kmi);
}
- for (wmKeyConfigPrefType *kpt = user->user_keyconfig_prefs.first; kpt; kpt = kpt->next) {
+ for (wmKeyConfigPref *kpt = user->user_keyconfig_prefs.first; kpt; kpt = kpt->next) {
kpt->prop = newdataadr(fd, kpt->prop);
IDP_DirectLinkGroup_OrFree(&kpt->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
}
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 2cf117067c2..8d8369bc2ef 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -36,7 +36,9 @@
#include "BKE_addon.h"
#include "BKE_colorband.h"
+#include "BKE_idprop.h"
#include "BKE_main.h"
+#include "BKE_keyconfig.h"
#include "BLO_readfile.h" /* Own include. */
@@ -94,6 +96,9 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
#undef USER_VERSION_ATLEAST
}
+/* UserDef.flag */
+#define USER_LMOUSESELECT (1 << 14) /* deprecated */
+
static void do_version_select_mouse(UserDef *userdef, wmKeyMapItem *kmi)
{
/* Remove select/action mouse from user defined keymaps. */
@@ -393,6 +398,14 @@ 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, "blender");
+ IDP_AddToGroup(kpt->prop, IDP_New(IDP_INT, &(IDPropertyTemplate){ .i = 0, }, "select_mouse"));
+ }
+ }
+
/**
* Include next version bump.
*/
@@ -415,3 +428,5 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
#undef USER_VERSION_ATLEAST
}
+
+#undef USER_LMOUSESELECT
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 3d4edc2e4da..99cd9b805bf 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1248,8 +1248,8 @@ static void write_userdef(WriteData *wd, const UserDef *userdef)
}
}
- for (const wmKeyConfigPrefType *kpt = userdef->user_keyconfig_prefs.first; kpt; kpt = kpt->next) {
- writestruct(wd, DATA, wmKeyConfigPrefType, 1, kpt);
+ for (const wmKeyConfigPref *kpt = userdef->user_keyconfig_prefs.first; kpt; kpt = kpt->next) {
+ writestruct(wd, DATA, wmKeyConfigPref, 1, kpt);
if (kpt->prop) {
IDP_WriteProperty(kpt->prop, wd);
}
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index c358cffa0b4..ffdd371dfdb 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -2549,18 +2549,6 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
case LEFTMOUSE:
- if (event->shift && (U.flag & USER_LMOUSESELECT)) {
- if (event->val == KM_PRESS) {
- StitchState *selected_state = stitch_select(C, scene, event, ssc);
-
- if (selected_state && !stitch_process_data(ssc, selected_state, scene, false)) {
- stitch_cancel(C, op);
- return OPERATOR_CANCELLED;
- }
- }
- break;
- }
- ATTR_FALLTHROUGH;
case PADENTER:
case RETKEY:
if (event->val == KM_PRESS) {
@@ -2658,7 +2646,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
stitch_cancel(C, op);
return OPERATOR_CANCELLED;
}
- if (event->val == KM_PRESS && !(U.flag & USER_LMOUSESELECT)) {
+ if (event->val == KM_PRESS) {
StitchState *selected_state = stitch_select(C, scene, event, ssc);
if (selected_state && !stitch_process_data(ssc, selected_state, scene, false)) {
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 79a3397b752..58beb729892 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -569,7 +569,7 @@ typedef struct UserDef {
struct ListBase uifonts;
struct ListBase uistyles;
struct ListBase user_keymaps;
- struct ListBase user_keyconfig_prefs; /* wmKeyConfigPrefType. */
+ struct ListBase user_keyconfig_prefs; /* wmKeyConfigPref. */
struct ListBase addons;
struct ListBase autoexec_paths;
struct ListBase user_menus; /* bUserMenu */
@@ -700,7 +700,7 @@ typedef enum eUserPref_Flag {
USER_TOOLTIPS = (1 << 11),
USER_TWOBUTTONMOUSE = (1 << 12),
USER_NONUMPAD = (1 << 13),
- USER_LMOUSESELECT = (1 << 14),
+ USER_FLAG_DEPRECATED_14 = (1 << 14), /* cleared */
USER_FILECOMPRESS = (1 << 15),
USER_SAVE_PREVIEWS = (1 << 16),
USER_CUSTOM_RANGE = (1 << 17),
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 88974750ffb..193c34e3d11 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -352,14 +352,14 @@ enum {
* This is similar to addon-preferences,
* however unlike add-ons key-config's aren't saved to disk.
*
- * #wmKeyConfigPrefType is written to DNA,
+ * #wmKeyConfigPref is written to DNA,
* #wmKeyConfigPrefType_Runtime has the RNA type.
*/
-typedef struct wmKeyConfigPrefType {
- struct wmKeyConfigPrefType *next, *prev;
+typedef struct wmKeyConfigPref {
+ struct wmKeyConfigPref *next, *prev;
char idname[64]; /* unique name */
IDProperty *prop;
-} wmKeyConfigPrefType;
+} wmKeyConfigPref;
typedef struct wmKeyConfig {
struct wmKeyConfig *next, *prev;
@@ -370,10 +370,7 @@ typedef struct wmKeyConfig {
ListBase keymaps;
int actkeymap;
short flag;
-
- /* Supports select mouse switching? */
- char has_select_mouse; /* may remove in favor of custom properties. */
- char _pad0;
+ char _pad0[2];
} wmKeyConfig;
/* wmKeyConfig.flag */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 597d93c01e5..62479240b72 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -210,23 +210,6 @@ static void rna_userdef_undo_steps_set(PointerRNA *ptr, int value)
userdef->undosteps = (value == 1) ? 2 : value;
}
-static void rna_userdef_select_mouse_set(PointerRNA *ptr, int value)
-{
- UserDef *userdef = (UserDef *)ptr->data;
-
- if (value) {
- userdef->flag |= USER_LMOUSESELECT;
- userdef->flag &= ~USER_TWOBUTTONMOUSE;
- }
- else
- userdef->flag &= ~USER_LMOUSESELECT;
-}
-
-static void rna_userdef_select_mouse_update(bContext *C, Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
-{
- WM_keyconfig_reload(C);
-}
-
static int rna_userdef_autokeymode_get(PointerRNA *ptr)
{
UserDef *userdef = (UserDef *)ptr->data;
@@ -4500,12 +4483,6 @@ static void rna_def_userdef_input(BlenderRNA *brna)
PropertyRNA *prop;
StructRNA *srna;
- static const EnumPropertyItem select_mouse_items[] = {
- {USER_LMOUSESELECT, "LEFT", 0, "Left", "Use left Mouse Button for selection"},
- {0, "RIGHT", 0, "Right", "Use Right Mouse Button for selection"},
- {0, NULL, 0, NULL, NULL}
- };
-
static const EnumPropertyItem view_rotation_items[] = {
{0, "TURNTABLE", 0, "Turntable", "Use turntable style rotation in the viewport"},
{USER_TRACKBALL, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"},
@@ -4546,14 +4523,6 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
RNA_def_struct_ui_text(srna, "Input", "Settings for input devices");
- prop = RNA_def_property(srna, "select_mouse", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, select_mouse_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_select_mouse_set", NULL);
- RNA_def_property_ui_text(prop, "Select Mouse", "Mouse button used for selection");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_userdef_select_mouse_update");
-
prop = RNA_def_property(srna, "view_zoom_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "viewzoom");
RNA_def_property_enum_items(prop, view_zoom_styles);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 6ad5e365e03..ab06673fe71 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -996,17 +996,7 @@ static PointerRNA rna_wmKeyConfig_preferences_get(PointerRNA *ptr)
wmKeyConfig *kc = ptr->data;
wmKeyConfigPrefType_Runtime *kpt_rt = BKE_keyconfig_pref_type_find(kc->idname, true);
if (kpt_rt) {
- wmKeyConfigPrefType *kpt = BLI_findstring(
- &U.user_keyconfig_prefs, kc->idname, offsetof(wmKeyConfigPrefType, idname));
- if (kpt == NULL) {
- kpt = MEM_callocN(sizeof(*kpt), __func__);
- STRNCPY(kpt->idname, kc->idname);
- BLI_addtail(&U.user_keyconfig_prefs, kpt);
- }
- if (kpt->prop == NULL) {
- IDPropertyTemplate val = {0};
- kpt->prop = IDP_New(IDP_GROUP, &val, kc->idname); /* name is unimportant */
- }
+ wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(&U, kc->idname);
return rna_pointer_inherit_refine(ptr, kpt_rt->ext.srna, kpt->prop);
}
else {
@@ -1045,7 +1035,7 @@ static StructRNA *rna_wmKeyConfigPref_register(
StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
- wmKeyConfigPrefType dummy_kpt = {NULL};
+ wmKeyConfigPref dummy_kpt = {NULL};
PointerRNA dummy_ptr;
// int have_function[1];
@@ -2317,7 +2307,7 @@ static void rna_def_keyconfig_prefs(BlenderRNA *brna)
srna = RNA_def_struct(brna, "KeyConfigPreferences", NULL);
RNA_def_struct_ui_text(srna, "Key-Config Preferences", "");
- RNA_def_struct_sdna(srna, "wmKeyConfigPrefType"); /* WARNING: only a bAddon during registration */
+ RNA_def_struct_sdna(srna, "wmKeyConfigPref"); /* WARNING: only a bAddon during registration */
RNA_def_struct_refine_func(srna, "rna_wmKeyConfigPref_refine");
RNA_def_struct_register_funcs(srna, "rna_wmKeyConfigPref_register", "rna_wmKeyConfigPref_unregister", NULL);
@@ -2367,10 +2357,6 @@ static void rna_def_keyconfig(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "User Defined", "Indicates that a keyconfig was defined by the user");
- prop = RNA_def_property(srna, "has_select_mouse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "has_select_mouse", 1);
- RNA_def_property_ui_text(prop, "Has Select Mouse", "Configuration supports select mouse switching");
-
/* Collection active property */
prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyConfigPreferences");
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 5cafbaf6b03..517f92491f0 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -693,9 +693,16 @@ wmKeyMap *WM_gizmogroup_keymap_common_select(
{
/* Use area and region id since we might have multiple gizmos with the same name in different areas/regions */
wmKeyMap *km = WM_keymap_ensure(config, gzgt->name, gzgt->gzmap_params.spaceid, gzgt->gzmap_params.regionid);
+ /* FIXME(campbell) */
+#if 0
const int select_mouse = (U.flag & USER_LMOUSESELECT) ? LEFTMOUSE : RIGHTMOUSE;
const int select_tweak = (U.flag & USER_LMOUSESELECT) ? EVT_TWEAK_L : EVT_TWEAK_R;
const int action_mouse = (U.flag & USER_LMOUSESELECT) ? RIGHTMOUSE : LEFTMOUSE;
+#else
+ const int select_mouse = RIGHTMOUSE;
+ const int select_tweak = EVT_TWEAK_R;
+ const int action_mouse = LEFTMOUSE;
+#endif
WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", action_mouse, KM_PRESS, KM_ANY, 0);
WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", select_tweak, KM_ANY, 0, 0);