Cleanup: remove hack that set operator id in the wmEvent
This can be replaced by passing an argument.
This commit is contained in:
@@ -548,9 +548,6 @@ typedef struct wmEvent {
|
||||
char check_drag;
|
||||
char is_motion_absolute;
|
||||
|
||||
/** Keymap item, set by handler (weak?). */
|
||||
const char *keymap_idname;
|
||||
|
||||
/** Tablet info, only use when the tablet is active. */
|
||||
const struct wmTabletData *tablet_data;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ void WM_event_print(const wmEvent *event)
|
||||
printf(
|
||||
"wmEvent type:%d / %s, val:%d / %s,\n"
|
||||
" shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d,\n"
|
||||
" mouse:(%d,%d), ascii:'%c', utf8:'%.*s', keymap_idname:%s, pointer:%p\n",
|
||||
" mouse:(%d,%d), ascii:'%c', utf8:'%.*s', pointer:%p\n",
|
||||
event->type,
|
||||
type_id,
|
||||
event->val,
|
||||
@@ -83,7 +83,6 @@ void WM_event_print(const wmEvent *event)
|
||||
event->ascii,
|
||||
BLI_str_utf8_size(event->utf8_buf),
|
||||
event->utf8_buf,
|
||||
event->keymap_idname,
|
||||
(const void *)event);
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
|
||||
@@ -1966,7 +1966,8 @@ static int wm_handler_operator_call(bContext *C,
|
||||
ListBase *handlers,
|
||||
wmEventHandler *handler_base,
|
||||
wmEvent *event,
|
||||
PointerRNA *properties)
|
||||
PointerRNA *properties,
|
||||
const char *kmi_idname)
|
||||
{
|
||||
int retval = OPERATOR_PASS_THROUGH;
|
||||
|
||||
@@ -2068,7 +2069,7 @@ static int wm_handler_operator_call(bContext *C,
|
||||
}
|
||||
}
|
||||
else {
|
||||
wmOperatorType *ot = WM_operatortype_find(event->keymap_idname, 0);
|
||||
wmOperatorType *ot = WM_operatortype_find(kmi_idname, 0);
|
||||
|
||||
if (ot && wm_operator_check_locked_interface(C, ot)) {
|
||||
bool use_last_properties = true;
|
||||
@@ -2406,10 +2407,8 @@ static int wm_handlers_do_keymap_with_keymap_handler(
|
||||
|
||||
PRINT("%s: item matched '%s'\n", __func__, kmi->idname);
|
||||
|
||||
/* weak, but allows interactive callback to not use rawkey */
|
||||
event->keymap_idname = kmi->idname;
|
||||
|
||||
action |= wm_handler_operator_call(C, handlers, &handler->head, event, kmi->ptr);
|
||||
action |= wm_handler_operator_call(
|
||||
C, handlers, &handler->head, event, kmi->ptr, kmi->idname);
|
||||
|
||||
if (action & WM_HANDLER_BREAK) {
|
||||
/* not always_pass here, it denotes removed handler_base */
|
||||
@@ -2463,13 +2462,11 @@ static int wm_handlers_do_keymap_with_gizmo_handler(
|
||||
if (wm_eventmatch(event, kmi)) {
|
||||
PRINT("%s: item matched '%s'\n", __func__, kmi->idname);
|
||||
|
||||
/* weak, but allows interactive callback to not use rawkey */
|
||||
event->keymap_idname = kmi->idname;
|
||||
|
||||
CTX_wm_gizmo_group_set(C, gzgroup);
|
||||
|
||||
/* handler->op is called later, we want keymap op to be triggered here */
|
||||
action |= wm_handler_operator_call(C, handlers, &handler->head, event, kmi->ptr);
|
||||
action |= wm_handler_operator_call(
|
||||
C, handlers, &handler->head, event, kmi->ptr, kmi->idname);
|
||||
|
||||
CTX_wm_gizmo_group_set(C, NULL);
|
||||
|
||||
@@ -2760,7 +2757,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
||||
}
|
||||
}
|
||||
else {
|
||||
action |= wm_handler_operator_call(C, handlers, handler_base, event, NULL);
|
||||
action |= wm_handler_operator_call(C, handlers, handler_base, event, NULL, NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user