New API function to call an existing menu
Thanks Campbell Barton for the help and review. This is for Blender 2.8, so we are not using this function yet.
This commit is contained in:
parent
e981a7de31
commit
ffb2c40176
|
@ -230,6 +230,7 @@ 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);
|
||||
void WM_menu_name_call(struct bContext *C, const char *menu_name, short context);
|
||||
int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||
/* invoke callback, confirm menu + exec */
|
||||
int WM_operator_confirm (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||
|
|
|
@ -1393,6 +1393,19 @@ int WM_operator_name_call(bContext *C, const char *opstring, short context, Poin
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call an existent menu. The menu can be created in C or Python.
|
||||
*/
|
||||
void WM_menu_name_call(bContext *C, const char *menu_name, short context)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find("WM_OT_call_menu", false);
|
||||
PointerRNA ptr;
|
||||
WM_operator_properties_create_ptr(&ptr, ot);
|
||||
RNA_string_set(&ptr, "name", menu_name);
|
||||
WM_operator_name_call_ptr(C, ot, context, &ptr);
|
||||
WM_operator_properties_free(&ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to #WM_operator_name_call called with #WM_OP_EXEC_DEFAULT context.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue