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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-08 22:40:03 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-08 22:40:03 +0400
commit3ebd58673fb9a8c5ef13048b2e8e8a4cb7bb3a4e (patch)
tree81031f2772990c6292eafce955d09897a8e40d6f /source/blender/editors/space_outliner
parente0c5e484732bb344fb845acc2678777e4bff1d5c (diff)
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note that editing one item in a keymap means the whole keymap is now defined by the user and will not be updated by Blender, an option for syncing might be added later. The outliner interface is still there, but I will probably remove it. There's actually 3 levels now: * Default builtin key configuration. * Key configuration loaded from .py file, for configs like Blender 2.4x or other 3D applications. * Keymaps edited by the user and saved in .B.blend. These can be saved to .py files as well to make creating distributable configurations easier. Also, user preferences sections were reorganized a bit, now there is: Interface, Editing, Input, Files and System. Implementation notes: * wmKeyConfig was added which represents a key configuration containing keymaps. * wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap. * Modal maps are not wrapped yet. * User preferences DNA file reading did not support newdataadr() yet, added this now for reading keymaps. * Key configuration related settings are now RNA wrapped. * is_property_set and is_property_hidden python methods were added.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner.c28
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h2
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c4
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c2
4 files changed, 17 insertions, 19 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 641137c010b..28fdc4708df 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1113,16 +1113,16 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
else if(type == TSE_KEYMAP) {
wmKeyMap *km= (wmKeyMap *)idv;
- wmKeymapItem *kmi;
+ wmKeyMapItem *kmi;
char opname[OP_MAX_TYPENAME];
te->directdata= idv;
- te->name= km->nameid;
+ te->name= km->idname;
if(!(tselem->flag & TSE_CLOSED)) {
a= 0;
- for (kmi= km->keymap.first; kmi; kmi= kmi->next, a++) {
+ for (kmi= km->items.first; kmi; kmi= kmi->next, a++) {
const char *key= WM_key_event_string(kmi->type);
if(key[0]) {
@@ -1408,7 +1408,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
wmWindowManager *wm= mainvar->wm.first;
wmKeyMap *km;
- for(km= wm->keymaps.first; km; km= km->next) {
+ for(km= wm->defaultconf->keymaps.first; km; km= km->next) {
ten= outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0);
}
}
@@ -2229,14 +2229,14 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme
static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
{
- wmKeymapItem *kmi= te->directdata;
+ wmKeyMapItem *kmi= te->directdata;
if(set==0) {
- if(kmi->inactive) return 0;
+ if(kmi->flag & KMI_INACTIVE) return 0;
return 1;
}
else {
- kmi->inactive= !kmi->inactive;
+ kmi->flag ^= KMI_INACTIVE;
}
return 0;
}
@@ -4957,7 +4957,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2)
{
wmOperatorType *ot= arg2;
- wmKeymapItem *kmi= arg_kmi;
+ wmKeyMapItem *kmi= arg_kmi;
if(ot)
BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME);
@@ -4987,7 +4987,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
static char search[OP_MAX_TYPENAME];
wmEvent event;
wmWindow *win= CTX_wm_window(C);
- wmKeymapItem *kmi= arg_kmi;
+ wmKeyMapItem *kmi= arg_kmi;
wmOperatorType *ot= WM_operatortype_find(kmi->idname, 0);
uiBlock *block;
uiBut *but;
@@ -5026,8 +5026,8 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
static short keymap_menu_type(short type)
{
if(ISKEYBOARD(type)) return OL_KM_KEYBOARD;
- if(WM_key_event_is_tweak(type)) return OL_KM_TWEAK;
- if(type >= LEFTMOUSE && type <= WHEELOUTMOUSE) return OL_KM_MOUSE;
+ if(ISTWEAK(type)) return OL_KM_TWEAK;
+ if(ISMOUSE(type)) return OL_KM_MOUSE;
// return OL_KM_SPECIALS;
return 0;
}
@@ -5083,8 +5083,6 @@ static char *keymap_tweak_menu(void)
str += sprintf(str, formatstr, "Left Mouse", EVT_TWEAK_L);
str += sprintf(str, formatstr, "Middle Mouse", EVT_TWEAK_M);
str += sprintf(str, formatstr, "Right Mouse", EVT_TWEAK_R);
- str += sprintf(str, formatstr, "Button4 Mouse ", BUTTON4MOUSE);
- str += sprintf(str, formatstr, "Button5 Mouse ", BUTTON5MOUSE);
str += sprintf(str, formatstr, "Action Mouse", EVT_TWEAK_A);
str += sprintf(str, formatstr, "Select Mouse", EVT_TWEAK_S);
@@ -5115,7 +5113,7 @@ static char *keymap_tweak_dir_menu(void)
static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v)
{
- wmKeymapItem *kmi= kmi_v;
+ wmKeyMapItem *kmi= kmi_v;
short maptype= keymap_menu_type(kmi->type);
if(maptype!=kmi->maptype) {
@@ -5158,7 +5156,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
int butw3= 43; /* modifiers */
if(tselem->type == TSE_KEYMAP_ITEM) {
- wmKeymapItem *kmi= te->directdata;
+ wmKeyMapItem *kmi= te->directdata;
/* modal map? */
if(kmi->propvalue);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 4f9a0f686b9..c71b5181d16 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -110,7 +110,7 @@ typedef struct TreeElement {
/* outliner_ops.c */
void outliner_operatortypes(void);
-void outliner_keymap(struct wmWindowManager *wm);
+void outliner_keymap(struct wmKeyConfig *keyconf);
/* outliner_header.c */
void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index a35b91249db..3cdd054fe0e 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -74,9 +74,9 @@ void outliner_operatortypes(void)
WM_operatortype_append(OUTLINER_OT_drivers_delete);
}
-void outliner_keymap(wmWindowManager *wm)
+void outliner_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(wm, "Outliner", SPACE_OUTLINER, 0);
+ wmKeyMap *keymap= WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "extend", 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index eb0e9dafbaa..fabe889ace6 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -77,7 +77,7 @@ static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm, "Outliner", SPACE_OUTLINER, 0);
+ keymap= WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}