Keymap: move left click select to a preference
This commit is contained in:
parent
64920a8feb
commit
074cd53c19
|
@ -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=(
|
||||
|
@ -45,9 +55,14 @@ 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__":
|
||||
|
|
|
@ -1,23 +1,56 @@
|
|||
import os
|
||||
import bpy
|
||||
|
||||
userpref = bpy.context.user_preferences
|
||||
|
||||
from bpy_extras.keyconfig_utils import (
|
||||
keyconfig_import_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,
|
||||
),
|
||||
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
|
||||
|
||||
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_init_from_data,
|
||||
keyconfig_module_from_preset,
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
|
||||
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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 API
|
||||
/** \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 (RNA Type) API
|
||||
*
|
||||
* \see #BKE_addon_pref_type_init for logic this is bases on.
|
||||
* \{ */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue