2.5
funtion WM_keymap_add_item() now returns keymap-item, so you can use it to set default properties for operators with WM_keymap_property_set(). Brecht will fill in this function, requires rna magic! Example: an operator ED_OB_OT_add_primitive can be configured with keymap like this: WM_keymap_property_set(keymapitem, "Primitivetype", "Sphere"); Similar conventions we can use later for button/menu calls. This will make creating operators easier, allowing a developer to group tools functionality nicely.
This commit is contained in:
@@ -61,12 +61,13 @@ void WM_waitcursor (struct bContext *C, int val);
|
||||
void WM_timecursor (struct bContext *C, int nr);
|
||||
|
||||
/* keymap and handlers */
|
||||
void WM_keymap_set_item (ListBase *lb, char *idname, short type,
|
||||
wmKeymapItem *WM_keymap_set_item (ListBase *lb, char *idname, short type,
|
||||
short val, int modifier, short keymodifier);
|
||||
void WM_keymap_verify_item(ListBase *lb, char *idname, short type,
|
||||
wmKeymapItem *WM_keymap_verify_item(ListBase *lb, char *idname, short type,
|
||||
short val, int modifier, short keymodifier);
|
||||
void WM_keymap_add_item (ListBase *lb, char *idname, short type,
|
||||
wmKeymapItem *WM_keymap_add_item (ListBase *lb, char *idname, short type,
|
||||
short val, int modifier, short keymodifier);
|
||||
void WM_keymap_property_set(wmKeymapItem *km, const char *propname, const char *propval);
|
||||
ListBase *WM_keymap_listbase (wmWindowManager *wm, const char *nameid,
|
||||
int spaceid, int regionid);
|
||||
|
||||
|
||||
@@ -643,6 +643,7 @@ void wm_event_do_handlers(bContext *C)
|
||||
ARegion *ar;
|
||||
int doit= 0;
|
||||
|
||||
/* XXX to solve, here screen handlers? */
|
||||
ED_screen_set_subwinactive(win); /* state variables in screen */
|
||||
|
||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||
|
||||
@@ -72,7 +72,7 @@ static void keymap_set(wmKeymapItem *kmi, short type, short val, int modifier, s
|
||||
}
|
||||
|
||||
/* if item was added, then bail out */
|
||||
void WM_keymap_verify_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
|
||||
wmKeymapItem *WM_keymap_verify_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
|
||||
{
|
||||
wmKeymapItem *kmi;
|
||||
|
||||
@@ -87,11 +87,11 @@ void WM_keymap_verify_item(ListBase *lb, char *idname, short type, short val, in
|
||||
|
||||
keymap_set(kmi, type, val, modifier, keymodifier);
|
||||
}
|
||||
|
||||
return kmi;
|
||||
}
|
||||
|
||||
/* if item was added, then replace */
|
||||
void WM_keymap_set_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
|
||||
wmKeymapItem *WM_keymap_set_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
|
||||
{
|
||||
wmKeymapItem *kmi;
|
||||
|
||||
@@ -105,10 +105,11 @@ void WM_keymap_set_item(ListBase *lb, char *idname, short type, short val, int m
|
||||
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
|
||||
}
|
||||
keymap_set(kmi, type, val, modifier, keymodifier);
|
||||
return kmi;
|
||||
}
|
||||
|
||||
/* always add item */
|
||||
void WM_keymap_add_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
|
||||
wmKeymapItem *WM_keymap_add_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
|
||||
{
|
||||
wmKeymapItem *kmi= MEM_callocN(sizeof(wmKeymapItem), "keymap entry");
|
||||
|
||||
@@ -116,6 +117,12 @@ void WM_keymap_add_item(ListBase *lb, char *idname, short type, short val, int m
|
||||
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
|
||||
|
||||
keymap_set(kmi, type, val, modifier, keymodifier);
|
||||
return kmi;
|
||||
}
|
||||
|
||||
void WM_keymap_property_set(wmKeymapItem *km, const char *propname, const char *propval)
|
||||
{
|
||||
/* todo */
|
||||
}
|
||||
|
||||
/* ****************** storage in WM ************ */
|
||||
|
||||
Reference in New Issue
Block a user