Fix T48552: Ctrl-D to add drivers shows disabled menu items
This commit is contained in:
parent
5186143d2c
commit
4f730b4708
Notes:
blender-bot
2023-02-14 07:51:29 +01:00
Referenced by issue #48552, the new driver operation(Ctrl+D) is disabled in the N panel on the day build version
|
@ -866,7 +866,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* Show menu or create drivers */
|
||||
static int add_driver_button_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int add_driver_button_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
|
@ -877,7 +877,8 @@ static int add_driver_button_invoke(bContext *C, wmOperator *op, const wmEvent *
|
|||
else {
|
||||
/* Show menu */
|
||||
// TODO: This should get filtered by the enum filter
|
||||
return WM_menu_invoke(C, op, event);
|
||||
/* important to execute in the region we're currently in */
|
||||
return WM_menu_invoke_ex(C, op, WM_OP_INVOKE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,6 +220,7 @@ void WM_event_timer_sleep(struct wmWindowManager *wm, struct wmWindow *wi
|
|||
/* invoke callback, uses enum property named "type" */
|
||||
void WM_operator_view3d_unit_defaults(struct bContext *C, struct wmOperator *op);
|
||||
int WM_operator_smooth_viewtx_get(const struct wmOperator *op);
|
||||
int WM_menu_invoke_ex(struct bContext *C, struct wmOperator *op, int opcontext);
|
||||
int WM_menu_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||
int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||
/* invoke callback, confirm menu + exec */
|
||||
|
|
|
@ -1068,7 +1068,7 @@ int WM_operator_smooth_viewtx_get(const wmOperator *op)
|
|||
}
|
||||
|
||||
/* invoke callback, uses enum property named "type" */
|
||||
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
int WM_menu_invoke_ex(bContext *C, wmOperator *op, int opcontext)
|
||||
{
|
||||
PropertyRNA *prop = op->type->prop;
|
||||
uiPopupMenu *pup;
|
||||
|
@ -1090,8 +1090,8 @@ int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
|||
pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
|
||||
layout = UI_popup_menu_layout(pup);
|
||||
/* set this so the default execution context is the same as submenus */
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
|
||||
uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
|
||||
uiLayoutSetOperatorContext(layout, opcontext);
|
||||
uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, opcontext, 0);
|
||||
UI_popup_menu_end(C, pup);
|
||||
return OPERATOR_INTERFACE;
|
||||
}
|
||||
|
@ -1099,6 +1099,11 @@ int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
return WM_menu_invoke_ex(C, op, WM_OP_INVOKE_REGION_WIN);
|
||||
}
|
||||
|
||||
|
||||
/* generic enum search invoke popup */
|
||||
static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
|
||||
|
|
Loading…
Reference in New Issue