Cleanup (UI): Add/use type for operator context enum
Adds a `wmOperatorCallContext` typedef for the existing `WM_OP_XXX` operator context enum. This adds type safety, allows the compiler to produce better warnings and helps understanding what a variable is for. Differential Revision: https://developer.blender.org/D13113 Reviewed by: Campbell Barton
This commit is contained in:
@@ -28,6 +28,7 @@ set(INC
|
|||||||
../imbuf
|
../imbuf
|
||||||
../makesdna
|
../makesdna
|
||||||
../makesrna
|
../makesrna
|
||||||
|
../windowmanager
|
||||||
../../../intern/glew-mx
|
../../../intern/glew-mx
|
||||||
../../../intern/guardedalloc
|
../../../intern/guardedalloc
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include "DNA_object_enums.h"
|
#include "DNA_object_enums.h"
|
||||||
|
|
||||||
|
#include "WM_types.h"
|
||||||
|
|
||||||
#include "BLI_compiler_attrs.h"
|
#include "BLI_compiler_attrs.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -380,7 +382,7 @@ struct bUserMenu *ED_screen_user_menu_ensure(struct bContext *C);
|
|||||||
struct bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(struct ListBase *lb,
|
struct bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(struct ListBase *lb,
|
||||||
const struct wmOperatorType *ot,
|
const struct wmOperatorType *ot,
|
||||||
struct IDProperty *prop,
|
struct IDProperty *prop,
|
||||||
short opcontext);
|
wmOperatorCallContext opcontext);
|
||||||
struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu(struct ListBase *lb,
|
struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu(struct ListBase *lb,
|
||||||
const struct MenuType *mt);
|
const struct MenuType *mt);
|
||||||
struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop(struct ListBase *lb,
|
struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop(struct ListBase *lb,
|
||||||
@@ -392,7 +394,7 @@ void ED_screen_user_menu_item_add_operator(struct ListBase *lb,
|
|||||||
const char *ui_name,
|
const char *ui_name,
|
||||||
const struct wmOperatorType *ot,
|
const struct wmOperatorType *ot,
|
||||||
const struct IDProperty *prop,
|
const struct IDProperty *prop,
|
||||||
short opcontext);
|
wmOperatorCallContext opcontext);
|
||||||
void ED_screen_user_menu_item_add_menu(struct ListBase *lb,
|
void ED_screen_user_menu_item_add_menu(struct ListBase *lb,
|
||||||
const char *ui_name,
|
const char *ui_name,
|
||||||
const struct MenuType *mt);
|
const struct MenuType *mt);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "BLI_sys_types.h" /* size_t */
|
#include "BLI_sys_types.h" /* size_t */
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "UI_interface_icons.h"
|
#include "UI_interface_icons.h"
|
||||||
|
#include "WM_types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -691,7 +692,7 @@ void UI_popup_block_ex(struct bContext *C,
|
|||||||
void uiPupBlockOperator(struct bContext *C,
|
void uiPupBlockOperator(struct bContext *C,
|
||||||
uiBlockCreateFunc func,
|
uiBlockCreateFunc func,
|
||||||
struct wmOperator *op,
|
struct wmOperator *op,
|
||||||
int opcontext);
|
wmOperatorCallContext opcontext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block);
|
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block);
|
||||||
@@ -1002,7 +1003,7 @@ uiBut *uiDefButR_prop(uiBlock *block,
|
|||||||
uiBut *uiDefButO(uiBlock *block,
|
uiBut *uiDefButO(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -1012,7 +1013,7 @@ uiBut *uiDefButO(uiBlock *block,
|
|||||||
uiBut *uiDefButO_ptr(uiBlock *block,
|
uiBut *uiDefButO_ptr(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
struct wmOperatorType *ot,
|
struct wmOperatorType *ot,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -1185,7 +1186,7 @@ uiBut *uiDefIconButR_prop(uiBlock *block,
|
|||||||
uiBut *uiDefIconButO(uiBlock *block,
|
uiBut *uiDefIconButO(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -1195,7 +1196,7 @@ uiBut *uiDefIconButO(uiBlock *block,
|
|||||||
uiBut *uiDefIconButO_ptr(uiBlock *block,
|
uiBut *uiDefIconButO_ptr(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
struct wmOperatorType *ot,
|
struct wmOperatorType *ot,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -1381,7 +1382,7 @@ uiBut *uiDefIconTextButR_prop(uiBlock *block,
|
|||||||
uiBut *uiDefIconTextButO(uiBlock *block,
|
uiBut *uiDefIconTextButO(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
@@ -1392,7 +1393,7 @@ uiBut *uiDefIconTextButO(uiBlock *block,
|
|||||||
uiBut *uiDefIconTextButO_ptr(uiBlock *block,
|
uiBut *uiDefIconTextButO_ptr(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
struct wmOperatorType *ot,
|
struct wmOperatorType *ot,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
@@ -1723,7 +1724,7 @@ void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const v
|
|||||||
|
|
||||||
struct PointerRNA *UI_but_extra_operator_icon_add(uiBut *but,
|
struct PointerRNA *UI_but_extra_operator_icon_add(uiBut *but,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
short opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon);
|
int icon);
|
||||||
struct wmOperatorType *UI_but_extra_operator_icon_optype_get(struct uiButExtraOpIcon *extra_icon);
|
struct wmOperatorType *UI_but_extra_operator_icon_optype_get(struct uiButExtraOpIcon *extra_icon);
|
||||||
struct PointerRNA *UI_but_extra_operator_icon_opptr_get(struct uiButExtraOpIcon *extra_icon);
|
struct PointerRNA *UI_but_extra_operator_icon_opptr_get(struct uiButExtraOpIcon *extra_icon);
|
||||||
@@ -1963,7 +1964,7 @@ void UI_paneltype_draw(struct bContext *C, struct PanelType *pt, struct uiLayout
|
|||||||
/* Only for convenience. */
|
/* Only for convenience. */
|
||||||
void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but);
|
void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but);
|
||||||
|
|
||||||
void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
|
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext);
|
||||||
void uiLayoutSetActive(uiLayout *layout, bool active);
|
void uiLayoutSetActive(uiLayout *layout, bool active);
|
||||||
void uiLayoutSetActiveDefault(uiLayout *layout, bool active_default);
|
void uiLayoutSetActiveDefault(uiLayout *layout, bool active_default);
|
||||||
void uiLayoutSetActivateInit(uiLayout *layout, bool activate_init);
|
void uiLayoutSetActivateInit(uiLayout *layout, bool activate_init);
|
||||||
@@ -2391,7 +2392,7 @@ void uiItemFullO_ptr(uiLayout *layout,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int icon,
|
int icon,
|
||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
struct PointerRNA *r_opptr);
|
struct PointerRNA *r_opptr);
|
||||||
void uiItemFullO(uiLayout *layout,
|
void uiItemFullO(uiLayout *layout,
|
||||||
@@ -2399,7 +2400,7 @@ void uiItemFullO(uiLayout *layout,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int icon,
|
int icon,
|
||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
struct PointerRNA *r_opptr);
|
struct PointerRNA *r_opptr);
|
||||||
void uiItemFullOMenuHold_ptr(uiLayout *layout,
|
void uiItemFullOMenuHold_ptr(uiLayout *layout,
|
||||||
@@ -2407,7 +2408,7 @@ void uiItemFullOMenuHold_ptr(uiLayout *layout,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int icon,
|
int icon,
|
||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
const char *menu_id, /* extra menu arg. */
|
const char *menu_id, /* extra menu arg. */
|
||||||
struct PointerRNA *r_opptr);
|
struct PointerRNA *r_opptr);
|
||||||
@@ -2487,14 +2488,14 @@ void uiItemsFullEnumO(uiLayout *layout,
|
|||||||
const char *opname,
|
const char *opname,
|
||||||
const char *propname,
|
const char *propname,
|
||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag);
|
int flag);
|
||||||
void uiItemsFullEnumO_items(uiLayout *layout,
|
void uiItemsFullEnumO_items(uiLayout *layout,
|
||||||
struct wmOperatorType *ot,
|
struct wmOperatorType *ot,
|
||||||
struct PointerRNA ptr,
|
struct PointerRNA ptr,
|
||||||
struct PropertyRNA *prop,
|
struct PropertyRNA *prop,
|
||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
const struct EnumPropertyItem *item_array,
|
const struct EnumPropertyItem *item_array,
|
||||||
int totitem);
|
int totitem);
|
||||||
|
|||||||
@@ -1638,7 +1638,7 @@ typedef enum PredefinedExtraOpIconType {
|
|||||||
|
|
||||||
static PointerRNA *ui_but_extra_operator_icon_add_ptr(uiBut *but,
|
static PointerRNA *ui_but_extra_operator_icon_add_ptr(uiBut *but,
|
||||||
wmOperatorType *optype,
|
wmOperatorType *optype,
|
||||||
short opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon)
|
int icon)
|
||||||
{
|
{
|
||||||
uiButExtraOpIcon *extra_op_icon = MEM_mallocN(sizeof(*extra_op_icon), __func__);
|
uiButExtraOpIcon *extra_op_icon = MEM_mallocN(sizeof(*extra_op_icon), __func__);
|
||||||
@@ -1678,7 +1678,7 @@ void ui_but_extra_operator_icons_free(uiBut *but)
|
|||||||
|
|
||||||
PointerRNA *UI_but_extra_operator_icon_add(uiBut *but,
|
PointerRNA *UI_but_extra_operator_icon_add(uiBut *but,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
short opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon)
|
int icon)
|
||||||
{
|
{
|
||||||
wmOperatorType *optype = WM_operatortype_find(opname, false);
|
wmOperatorType *optype = WM_operatortype_find(opname, false);
|
||||||
@@ -1881,7 +1881,7 @@ bool ui_but_context_poll_operator_ex(bContext *C,
|
|||||||
|
|
||||||
bool ui_but_context_poll_operator(bContext *C, wmOperatorType *ot, const uiBut *but)
|
bool ui_but_context_poll_operator(bContext *C, wmOperatorType *ot, const uiBut *but)
|
||||||
{
|
{
|
||||||
const int opcontext = but ? but->opcontext : WM_OP_INVOKE_DEFAULT;
|
const wmOperatorCallContext opcontext = but ? but->opcontext : WM_OP_INVOKE_DEFAULT;
|
||||||
return ui_but_context_poll_operator_ex(
|
return ui_but_context_poll_operator_ex(
|
||||||
C, but, &(wmOperatorCallParams){.optype = ot, .opcontext = opcontext});
|
C, but, &(wmOperatorCallParams){.optype = ot, .opcontext = opcontext});
|
||||||
}
|
}
|
||||||
@@ -4742,7 +4742,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block,
|
|||||||
static uiBut *ui_def_but_operator_ptr(uiBlock *block,
|
static uiBut *ui_def_but_operator_ptr(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -5280,7 +5280,7 @@ uiBut *uiDefButR_prop(uiBlock *block,
|
|||||||
uiBut *uiDefButO_ptr(uiBlock *block,
|
uiBut *uiDefButO_ptr(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -5295,7 +5295,7 @@ uiBut *uiDefButO_ptr(uiBlock *block,
|
|||||||
uiBut *uiDefButO(uiBlock *block,
|
uiBut *uiDefButO(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -5663,7 +5663,7 @@ uiBut *uiDefIconButR_prop(uiBlock *block,
|
|||||||
uiBut *uiDefIconButO_ptr(uiBlock *block,
|
uiBut *uiDefIconButO_ptr(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -5678,7 +5678,7 @@ uiBut *uiDefIconButO_ptr(uiBlock *block,
|
|||||||
uiBut *uiDefIconButO(uiBlock *block,
|
uiBut *uiDefIconButO(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
@@ -6066,7 +6066,7 @@ uiBut *uiDefIconTextButR_prop(uiBlock *block,
|
|||||||
uiBut *uiDefIconTextButO_ptr(uiBlock *block,
|
uiBut *uiDefIconTextButO_ptr(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
@@ -6083,7 +6083,7 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block,
|
|||||||
uiBut *uiDefIconTextButO(uiBlock *block,
|
uiBut *uiDefIconTextButO(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
int icon,
|
int icon,
|
||||||
const char *str,
|
const char *str,
|
||||||
int x,
|
int x,
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ typedef struct uiAfterFunc {
|
|||||||
|
|
||||||
wmOperator *popup_op;
|
wmOperator *popup_op;
|
||||||
wmOperatorType *optype;
|
wmOperatorType *optype;
|
||||||
int opcontext;
|
wmOperatorCallContext opcontext;
|
||||||
PointerRNA *opptr;
|
PointerRNA *opptr;
|
||||||
|
|
||||||
PointerRNA rnapoin;
|
PointerRNA rnapoin;
|
||||||
@@ -775,7 +775,7 @@ static uiAfterFunc *ui_afterfunc_new(void)
|
|||||||
*/
|
*/
|
||||||
static void ui_handle_afterfunc_add_operator_ex(wmOperatorType *ot,
|
static void ui_handle_afterfunc_add_operator_ex(wmOperatorType *ot,
|
||||||
PointerRNA **properties,
|
PointerRNA **properties,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
const uiBut *context_but)
|
const uiBut *context_but)
|
||||||
{
|
{
|
||||||
uiAfterFunc *after = ui_afterfunc_new();
|
uiAfterFunc *after = ui_afterfunc_new();
|
||||||
@@ -796,7 +796,7 @@ static void ui_handle_afterfunc_add_operator_ex(wmOperatorType *ot,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_handle_afterfunc_add_operator(wmOperatorType *ot, int opcontext)
|
void ui_handle_afterfunc_add_operator(wmOperatorType *ot, wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
ui_handle_afterfunc_add_operator_ex(ot, NULL, opcontext, NULL);
|
ui_handle_afterfunc_add_operator_ex(ot, NULL, opcontext, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ struct uiBut {
|
|||||||
/* Operator data */
|
/* Operator data */
|
||||||
struct wmOperatorType *optype;
|
struct wmOperatorType *optype;
|
||||||
struct PointerRNA *opptr;
|
struct PointerRNA *opptr;
|
||||||
short opcontext;
|
wmOperatorCallContext opcontext;
|
||||||
|
|
||||||
/** When non-zero, this is the key used to activate a menu items (`a-z` always lower case). */
|
/** When non-zero, this is the key used to activate a menu items (`a-z` always lower case). */
|
||||||
uchar menu_key;
|
uchar menu_key;
|
||||||
@@ -882,7 +882,7 @@ void ui_pie_menu_level_create(uiBlock *block,
|
|||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
const EnumPropertyItem *items,
|
const EnumPropertyItem *items,
|
||||||
int totitem,
|
int totitem,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag);
|
int flag);
|
||||||
|
|
||||||
/* interface_region_popup.c */
|
/* interface_region_popup.c */
|
||||||
@@ -960,7 +960,8 @@ const char *ui_textedit_undo(struct uiUndoStack_Text *undo_stack,
|
|||||||
int *r_cursor_index);
|
int *r_cursor_index);
|
||||||
|
|
||||||
/* interface_handlers.c */
|
/* interface_handlers.c */
|
||||||
extern void ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, int opcontext);
|
extern void ui_handle_afterfunc_add_operator(struct wmOperatorType *ot,
|
||||||
|
wmOperatorCallContext opcontext);
|
||||||
extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val);
|
extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val);
|
||||||
extern void ui_but_activate_event(struct bContext *C, struct ARegion *region, uiBut *but);
|
extern void ui_but_activate_event(struct bContext *C, struct ARegion *region, uiBut *but);
|
||||||
extern void ui_but_activate_over(struct bContext *C, struct ARegion *region, uiBut *but);
|
extern void ui_but_activate_over(struct bContext *C, struct ARegion *region, uiBut *but);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ typedef struct uiLayoutRoot {
|
|||||||
struct uiLayoutRoot *next, *prev;
|
struct uiLayoutRoot *next, *prev;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
int opcontext;
|
wmOperatorCallContext opcontext;
|
||||||
|
|
||||||
int emw, emh;
|
int emw, emh;
|
||||||
int padding;
|
int padding;
|
||||||
@@ -1218,7 +1218,7 @@ static uiBut *uiItemFullO_ptr_ex(uiLayout *layout,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int icon,
|
int icon,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
PointerRNA *r_opptr)
|
PointerRNA *r_opptr)
|
||||||
{
|
{
|
||||||
@@ -1350,7 +1350,7 @@ void uiItemFullO_ptr(uiLayout *layout,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int icon,
|
int icon,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
PointerRNA *r_opptr)
|
PointerRNA *r_opptr)
|
||||||
{
|
{
|
||||||
@@ -1362,7 +1362,7 @@ void uiItemFullOMenuHold_ptr(uiLayout *layout,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int icon,
|
int icon,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
const char *menu_id,
|
const char *menu_id,
|
||||||
PointerRNA *r_opptr)
|
PointerRNA *r_opptr)
|
||||||
@@ -1376,7 +1376,7 @@ void uiItemFullO(uiLayout *layout,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int icon,
|
int icon,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
PointerRNA *r_opptr)
|
PointerRNA *r_opptr)
|
||||||
{
|
{
|
||||||
@@ -1474,7 +1474,7 @@ void uiItemsFullEnumO_items(uiLayout *layout,
|
|||||||
PointerRNA ptr,
|
PointerRNA ptr,
|
||||||
PropertyRNA *prop,
|
PropertyRNA *prop,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag,
|
int flag,
|
||||||
const EnumPropertyItem *item_array,
|
const EnumPropertyItem *item_array,
|
||||||
int totitem)
|
int totitem)
|
||||||
@@ -1623,7 +1623,7 @@ void uiItemsFullEnumO(uiLayout *layout,
|
|||||||
const char *opname,
|
const char *opname,
|
||||||
const char *propname,
|
const char *propname,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag)
|
int flag)
|
||||||
{
|
{
|
||||||
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
|
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
|
||||||
@@ -3433,7 +3433,7 @@ void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct MenuItemLevel {
|
typedef struct MenuItemLevel {
|
||||||
int opcontext;
|
wmOperatorCallContext opcontext;
|
||||||
/* don't use pointers to the strings because python can dynamically
|
/* don't use pointers to the strings because python can dynamically
|
||||||
* allocate strings and free before the menu draws, see T27304. */
|
* allocate strings and free before the menu draws, see T27304. */
|
||||||
char opname[OP_MAX_TYPENAME];
|
char opname[OP_MAX_TYPENAME];
|
||||||
@@ -5672,7 +5672,7 @@ bool uiLayoutGetFixedSize(uiLayout *layout)
|
|||||||
return (layout->item.flag & UI_ITEM_FIXED_SIZE) != 0;
|
return (layout->item.flag & UI_ITEM_FIXED_SIZE) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext)
|
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
layout->root->opcontext = opcontext;
|
layout->root->opcontext = opcontext;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ typedef struct PieMenuLevelData {
|
|||||||
wmOperatorType *ot;
|
wmOperatorType *ot;
|
||||||
const char *propname;
|
const char *propname;
|
||||||
IDProperty *properties;
|
IDProperty *properties;
|
||||||
int context, flag;
|
wmOperatorCallContext context, flag;
|
||||||
} PieMenuLevelData;
|
} PieMenuLevelData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -381,7 +381,7 @@ void ui_pie_menu_level_create(uiBlock *block,
|
|||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
const EnumPropertyItem *items,
|
const EnumPropertyItem *items,
|
||||||
int totitem,
|
int totitem,
|
||||||
int context,
|
wmOperatorCallContext context,
|
||||||
int flag)
|
int flag)
|
||||||
{
|
{
|
||||||
const int totitem_parent = PIE_MAX_ITEMS - 1;
|
const int totitem_parent = PIE_MAX_ITEMS - 1;
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ void UI_popup_block_ex(bContext *C,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* UNUSED */
|
#if 0 /* UNUSED */
|
||||||
void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int opcontext)
|
void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
wmWindow *window = CTX_wm_window(C);
|
wmWindow *window = CTX_wm_window(C);
|
||||||
uiPopupBlockHandle *handle;
|
uiPopupBlockHandle *handle;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ struct uiPopover {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ui_popover_create_block(bContext *C, uiPopover *pup, int opcontext)
|
static void ui_popover_create_block(bContext *C, uiPopover *pup, wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
BLI_assert(pup->ui_size_x != 0);
|
BLI_assert(pup->ui_size_x != 0);
|
||||||
|
|
||||||
|
|||||||
@@ -960,7 +960,8 @@ static uiTooltipData *ui_tooltip_data_from_button_or_extra_icon(bContext *C,
|
|||||||
|
|
||||||
/* if operator poll check failed, it can give pretty precise info why */
|
/* if operator poll check failed, it can give pretty precise info why */
|
||||||
if (optype) {
|
if (optype) {
|
||||||
const int opcontext = extra_icon ? extra_icon->optype_params->opcontext : but->opcontext;
|
const wmOperatorCallContext opcontext = extra_icon ? extra_icon->optype_params->opcontext :
|
||||||
|
but->opcontext;
|
||||||
CTX_wm_operator_poll_msg_clear(C);
|
CTX_wm_operator_poll_msg_clear(C);
|
||||||
ui_but_context_poll_operator_ex(
|
ui_but_context_poll_operator_ex(
|
||||||
C, but, &(wmOperatorCallParams){.optype = optype, .opcontext = opcontext});
|
C, but, &(wmOperatorCallParams){.optype = optype, .opcontext = opcontext});
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ struct MenuSearch_Item {
|
|||||||
struct {
|
struct {
|
||||||
wmOperatorType *type;
|
wmOperatorType *type;
|
||||||
PointerRNA *opptr;
|
PointerRNA *opptr;
|
||||||
short opcontext;
|
wmOperatorCallContext opcontext;
|
||||||
bContextStore *context;
|
bContextStore *context;
|
||||||
} op;
|
} op;
|
||||||
|
|
||||||
|
|||||||
@@ -1741,7 +1741,7 @@ static void template_search_add_button_name(uiBlock *block,
|
|||||||
|
|
||||||
static void template_search_add_button_operator(uiBlock *block,
|
static void template_search_add_button_operator(uiBlock *block,
|
||||||
const char *const operator_name,
|
const char *const operator_name,
|
||||||
const int opcontext,
|
const wmOperatorCallContext opcontext,
|
||||||
const int icon,
|
const int icon,
|
||||||
const bool editable)
|
const bool editable)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ bUserMenu *ED_screen_user_menu_ensure(bContext *C)
|
|||||||
bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(ListBase *lb,
|
bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(ListBase *lb,
|
||||||
const wmOperatorType *ot,
|
const wmOperatorType *ot,
|
||||||
IDProperty *prop,
|
IDProperty *prop,
|
||||||
short opcontext)
|
wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
LISTBASE_FOREACH (bUserMenuItem *, umi, lb) {
|
LISTBASE_FOREACH (bUserMenuItem *, umi, lb) {
|
||||||
if (umi->type == USER_MENU_TYPE_OPERATOR) {
|
if (umi->type == USER_MENU_TYPE_OPERATOR) {
|
||||||
@@ -160,7 +160,7 @@ void ED_screen_user_menu_item_add_operator(ListBase *lb,
|
|||||||
const char *ui_name,
|
const char *ui_name,
|
||||||
const wmOperatorType *ot,
|
const wmOperatorType *ot,
|
||||||
const IDProperty *prop,
|
const IDProperty *prop,
|
||||||
short opcontext)
|
wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)BKE_blender_user_menu_item_add(
|
bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)BKE_blender_user_menu_item_add(
|
||||||
lb, USER_MENU_TYPE_OPERATOR);
|
lb, USER_MENU_TYPE_OPERATOR);
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ void DatasetRegionDrawer::draw_dataset_row(const int indentation,
|
|||||||
uiBut *bt = uiDefIconTextButO(&block,
|
uiBut *bt = uiDefIconTextButO(&block,
|
||||||
UI_BTYPE_DATASETROW,
|
UI_BTYPE_DATASETROW,
|
||||||
"SPREADSHEET_OT_change_spreadsheet_data_source",
|
"SPREADSHEET_OT_change_spreadsheet_data_source",
|
||||||
0,
|
WM_OP_INVOKE_DEFAULT,
|
||||||
icon,
|
icon,
|
||||||
label,
|
label,
|
||||||
rect.xmin,
|
rect.xmin,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ set(INC
|
|||||||
../imbuf
|
../imbuf
|
||||||
../makesdna
|
../makesdna
|
||||||
../makesrna
|
../makesrna
|
||||||
|
../windowmanager
|
||||||
|
|
||||||
../editors/include
|
../editors/include
|
||||||
|
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ typedef struct bUserMenuItem_Op {
|
|||||||
bUserMenuItem item;
|
bUserMenuItem item;
|
||||||
char op_idname[64];
|
char op_idname[64];
|
||||||
struct IDProperty *prop;
|
struct IDProperty *prop;
|
||||||
char opcontext;
|
char opcontext; /* #wmOperatorCallContext */
|
||||||
char _pad0[7];
|
char _pad0[7];
|
||||||
} bUserMenuItem_Op;
|
} bUserMenuItem_Op;
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ set(INC
|
|||||||
../makesdna
|
../makesdna
|
||||||
../makesrna
|
../makesrna
|
||||||
../render
|
../render
|
||||||
|
../windowmanager
|
||||||
../../../intern/glew-mx
|
../../../intern/glew-mx
|
||||||
../../../intern/guardedalloc
|
../../../intern/guardedalloc
|
||||||
../../../intern/sky/include
|
../../../intern/sky/include
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
|
|||||||
const char *context_str = NULL;
|
const char *context_str = NULL;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
int context = WM_OP_EXEC_DEFAULT;
|
wmOperatorCallContext context = WM_OP_EXEC_DEFAULT;
|
||||||
|
|
||||||
/* XXX TODO: work out a better solution for passing on context,
|
/* XXX TODO: work out a better solution for passing on context,
|
||||||
* could make a tuple from self and pack the name and Context into it. */
|
* could make a tuple from self and pack the name and Context into it. */
|
||||||
@@ -167,7 +167,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
|||||||
PyObject *context_dict = NULL; /* optional args */
|
PyObject *context_dict = NULL; /* optional args */
|
||||||
|
|
||||||
/* note that context is an int, python does the conversion in this case */
|
/* note that context is an int, python does the conversion in this case */
|
||||||
int context = WM_OP_EXEC_DEFAULT;
|
wmOperatorCallContext context = WM_OP_EXEC_DEFAULT;
|
||||||
int is_undo = false;
|
int is_undo = false;
|
||||||
|
|
||||||
/* XXX TODO: work out a better solution for passing on context,
|
/* XXX TODO: work out a better solution for passing on context,
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ int WM_generic_select_invoke(struct bContext *C,
|
|||||||
const struct wmEvent *event);
|
const struct wmEvent *event);
|
||||||
void WM_operator_view3d_unit_defaults(struct bContext *C, struct wmOperator *op);
|
void WM_operator_view3d_unit_defaults(struct bContext *C, struct wmOperator *op);
|
||||||
int WM_operator_smooth_viewtx_get(const 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_ex(struct bContext *C, struct wmOperator *op, wmOperatorCallContext opcontext);
|
||||||
int WM_menu_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
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);
|
void WM_menu_name_call(struct bContext *C, const char *menu_name, short context);
|
||||||
int WM_enum_search_invoke_previews(struct bContext *C,
|
int WM_enum_search_invoke_previews(struct bContext *C,
|
||||||
@@ -451,7 +451,7 @@ int WM_operator_confirm_message_ex(struct bContext *C,
|
|||||||
const char *title,
|
const char *title,
|
||||||
const int icon,
|
const int icon,
|
||||||
const char *message,
|
const char *message,
|
||||||
const short opcontext);
|
const wmOperatorCallContext opcontext);
|
||||||
int WM_operator_confirm_message(struct bContext *C, struct wmOperator *op, const char *message);
|
int WM_operator_confirm_message(struct bContext *C, struct wmOperator *op, const char *message);
|
||||||
|
|
||||||
/* operator api */
|
/* operator api */
|
||||||
@@ -472,26 +472,26 @@ bool WM_operator_repeat_check(const struct bContext *C, struct wmOperator *op);
|
|||||||
bool WM_operator_is_repeat(const struct bContext *C, const struct wmOperator *op);
|
bool WM_operator_is_repeat(const struct bContext *C, const struct wmOperator *op);
|
||||||
int WM_operator_name_call_ptr(struct bContext *C,
|
int WM_operator_name_call_ptr(struct bContext *C,
|
||||||
struct wmOperatorType *ot,
|
struct wmOperatorType *ot,
|
||||||
short context,
|
wmOperatorCallContext context,
|
||||||
struct PointerRNA *properties);
|
struct PointerRNA *properties);
|
||||||
int WM_operator_name_call(struct bContext *C,
|
int WM_operator_name_call(struct bContext *C,
|
||||||
const char *opstring,
|
const char *opstring,
|
||||||
short context,
|
wmOperatorCallContext context,
|
||||||
struct PointerRNA *properties);
|
struct PointerRNA *properties);
|
||||||
int WM_operator_name_call_with_properties(struct bContext *C,
|
int WM_operator_name_call_with_properties(struct bContext *C,
|
||||||
const char *opstring,
|
const char *opstring,
|
||||||
short context,
|
wmOperatorCallContext context,
|
||||||
struct IDProperty *properties);
|
struct IDProperty *properties);
|
||||||
int WM_operator_call_py(struct bContext *C,
|
int WM_operator_call_py(struct bContext *C,
|
||||||
struct wmOperatorType *ot,
|
struct wmOperatorType *ot,
|
||||||
short context,
|
wmOperatorCallContext context,
|
||||||
struct PointerRNA *properties,
|
struct PointerRNA *properties,
|
||||||
struct ReportList *reports,
|
struct ReportList *reports,
|
||||||
const bool is_undo);
|
const bool is_undo);
|
||||||
|
|
||||||
void WM_operator_name_call_ptr_with_depends_on_cursor(struct bContext *C,
|
void WM_operator_name_call_ptr_with_depends_on_cursor(struct bContext *C,
|
||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
short opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
PointerRNA *properties,
|
PointerRNA *properties,
|
||||||
const char *drawstr);
|
const char *drawstr);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
/* dna-savable wmStructs here */
|
/* dna-savable wmStructs here */
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "DNA_windowmanager_types.h"
|
#include "DNA_windowmanager_types.h"
|
||||||
|
#include "WM_types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -169,14 +170,14 @@ int WM_keymap_item_raw_to_string(const short shift,
|
|||||||
const int result_len);
|
const int result_len);
|
||||||
wmKeyMapItem *WM_key_event_operator(const struct bContext *C,
|
wmKeyMapItem *WM_key_event_operator(const struct bContext *C,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
const short include_mask,
|
const short include_mask,
|
||||||
const short exclude_mask,
|
const short exclude_mask,
|
||||||
struct wmKeyMap **r_keymap);
|
struct wmKeyMap **r_keymap);
|
||||||
char *WM_key_event_operator_string(const struct bContext *C,
|
char *WM_key_event_operator_string(const struct bContext *C,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
struct IDProperty *properties,
|
struct IDProperty *properties,
|
||||||
const bool is_strict,
|
const bool is_strict,
|
||||||
char *result,
|
char *result,
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ enum {
|
|||||||
* Context to call operator in for #WM_operator_name_call.
|
* Context to call operator in for #WM_operator_name_call.
|
||||||
* rna_ui.c contains EnumPropertyItem's of these, keep in sync.
|
* rna_ui.c contains EnumPropertyItem's of these, keep in sync.
|
||||||
*/
|
*/
|
||||||
enum {
|
typedef enum wmOperatorCallContext {
|
||||||
/* if there's invoke, call it, otherwise exec */
|
/* if there's invoke, call it, otherwise exec */
|
||||||
WM_OP_INVOKE_DEFAULT,
|
WM_OP_INVOKE_DEFAULT,
|
||||||
WM_OP_INVOKE_REGION_WIN,
|
WM_OP_INVOKE_REGION_WIN,
|
||||||
@@ -226,9 +226,11 @@ enum {
|
|||||||
WM_OP_EXEC_REGION_PREVIEW,
|
WM_OP_EXEC_REGION_PREVIEW,
|
||||||
WM_OP_EXEC_AREA,
|
WM_OP_EXEC_AREA,
|
||||||
WM_OP_EXEC_SCREEN,
|
WM_OP_EXEC_SCREEN,
|
||||||
};
|
} wmOperatorCallContext;
|
||||||
|
|
||||||
#define WM_OP_CONTEXT_HAS_AREA(type) (!ELEM(type, WM_OP_INVOKE_SCREEN, WM_OP_EXEC_SCREEN))
|
#define WM_OP_CONTEXT_HAS_AREA(type) \
|
||||||
|
(CHECK_TYPE_INLINE(type, wmOperatorCallContext), \
|
||||||
|
!ELEM(type, WM_OP_INVOKE_SCREEN, WM_OP_EXEC_SCREEN))
|
||||||
#define WM_OP_CONTEXT_HAS_REGION(type) \
|
#define WM_OP_CONTEXT_HAS_REGION(type) \
|
||||||
(WM_OP_CONTEXT_HAS_AREA(type) && !ELEM(type, WM_OP_INVOKE_AREA, WM_OP_EXEC_AREA))
|
(WM_OP_CONTEXT_HAS_AREA(type) && !ELEM(type, WM_OP_INVOKE_AREA, WM_OP_EXEC_AREA))
|
||||||
|
|
||||||
@@ -923,7 +925,7 @@ typedef struct wmOperatorType {
|
|||||||
typedef struct wmOperatorCallParams {
|
typedef struct wmOperatorCallParams {
|
||||||
struct wmOperatorType *optype;
|
struct wmOperatorType *optype;
|
||||||
struct PointerRNA *opptr;
|
struct PointerRNA *opptr;
|
||||||
short opcontext;
|
wmOperatorCallContext opcontext;
|
||||||
} wmOperatorCallParams;
|
} wmOperatorCallParams;
|
||||||
|
|
||||||
#ifdef WITH_INPUT_IME
|
#ifdef WITH_INPUT_IME
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ static wmDropBox *dropbox_active(bContext *C,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int opcontext = wm_drop_operator_context_get(drop);
|
const wmOperatorCallContext opcontext = wm_drop_operator_context_get(drop);
|
||||||
if (WM_operator_poll_context(C, drop->ot, opcontext)) {
|
if (WM_operator_poll_context(C, drop->ot, opcontext)) {
|
||||||
return drop;
|
return drop;
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,7 @@ static void wm_drop_update_active(bContext *C, wmDrag *drag, const wmEvent *even
|
|||||||
|
|
||||||
void wm_drop_prepare(bContext *C, wmDrag *drag, wmDropBox *drop)
|
void wm_drop_prepare(bContext *C, wmDrag *drag, wmDropBox *drop)
|
||||||
{
|
{
|
||||||
const int opcontext = wm_drop_operator_context_get(drop);
|
const wmOperatorCallContext opcontext = wm_drop_operator_context_get(drop);
|
||||||
/* Optionally copy drag information to operator properties. Don't call it if the
|
/* Optionally copy drag information to operator properties. Don't call it if the
|
||||||
* operator fails anyway, it might do more than just set properties (e.g.
|
* operator fails anyway, it might do more than just set properties (e.g.
|
||||||
* typically import an asset). */
|
* typically import an asset). */
|
||||||
@@ -429,7 +429,7 @@ void wm_drags_check_ops(bContext *C, const wmEvent *event)
|
|||||||
* coordinates. The dropbox poll should check the context area and region as needed.
|
* coordinates. The dropbox poll should check the context area and region as needed.
|
||||||
* So this always returns #WM_OP_INVOKE_DEFAULT.
|
* So this always returns #WM_OP_INVOKE_DEFAULT.
|
||||||
*/
|
*/
|
||||||
int wm_drop_operator_context_get(const wmDropBox *UNUSED(drop))
|
wmOperatorCallContext wm_drop_operator_context_get(const wmDropBox *UNUSED(drop))
|
||||||
{
|
{
|
||||||
return WM_OP_INVOKE_DEFAULT;
|
return WM_OP_INVOKE_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static int wm_operator_call_internal(bContext *C,
|
|||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
PointerRNA *properties,
|
PointerRNA *properties,
|
||||||
ReportList *reports,
|
ReportList *reports,
|
||||||
const short context,
|
const wmOperatorCallContext context,
|
||||||
const bool poll_only,
|
const bool poll_only,
|
||||||
wmEvent *event);
|
wmEvent *event);
|
||||||
|
|
||||||
@@ -1460,7 +1460,7 @@ static int wm_operator_call_internal(bContext *C,
|
|||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
PointerRNA *properties,
|
PointerRNA *properties,
|
||||||
ReportList *reports,
|
ReportList *reports,
|
||||||
const short context,
|
const wmOperatorCallContext context,
|
||||||
const bool poll_only,
|
const bool poll_only,
|
||||||
wmEvent *event)
|
wmEvent *event)
|
||||||
{
|
{
|
||||||
@@ -1595,13 +1595,16 @@ static int wm_operator_call_internal(bContext *C,
|
|||||||
/* Invokes operator in context. */
|
/* Invokes operator in context. */
|
||||||
int WM_operator_name_call_ptr(bContext *C,
|
int WM_operator_name_call_ptr(bContext *C,
|
||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
short context,
|
wmOperatorCallContext context,
|
||||||
PointerRNA *properties)
|
PointerRNA *properties)
|
||||||
{
|
{
|
||||||
BLI_assert(ot == WM_operatortype_find(ot->idname, true));
|
BLI_assert(ot == WM_operatortype_find(ot->idname, true));
|
||||||
return wm_operator_call_internal(C, ot, properties, NULL, context, false, NULL);
|
return wm_operator_call_internal(C, ot, properties, NULL, context, false, NULL);
|
||||||
}
|
}
|
||||||
int WM_operator_name_call(bContext *C, const char *opstring, short context, PointerRNA *properties)
|
int WM_operator_name_call(bContext *C,
|
||||||
|
const char *opstring,
|
||||||
|
wmOperatorCallContext context,
|
||||||
|
PointerRNA *properties)
|
||||||
{
|
{
|
||||||
wmOperatorType *ot = WM_operatortype_find(opstring, 0);
|
wmOperatorType *ot = WM_operatortype_find(opstring, 0);
|
||||||
if (ot) {
|
if (ot) {
|
||||||
@@ -1613,7 +1616,7 @@ int WM_operator_name_call(bContext *C, const char *opstring, short context, Poin
|
|||||||
|
|
||||||
int WM_operator_name_call_with_properties(struct bContext *C,
|
int WM_operator_name_call_with_properties(struct bContext *C,
|
||||||
const char *opstring,
|
const char *opstring,
|
||||||
short context,
|
wmOperatorCallContext context,
|
||||||
struct IDProperty *properties)
|
struct IDProperty *properties)
|
||||||
{
|
{
|
||||||
PointerRNA props_ptr;
|
PointerRNA props_ptr;
|
||||||
@@ -1644,7 +1647,7 @@ void WM_menu_name_call(bContext *C, const char *menu_name, short context)
|
|||||||
*/
|
*/
|
||||||
int WM_operator_call_py(bContext *C,
|
int WM_operator_call_py(bContext *C,
|
||||||
wmOperatorType *ot,
|
wmOperatorType *ot,
|
||||||
short context,
|
wmOperatorCallContext context,
|
||||||
PointerRNA *properties,
|
PointerRNA *properties,
|
||||||
ReportList *reports,
|
ReportList *reports,
|
||||||
const bool is_undo)
|
const bool is_undo)
|
||||||
@@ -1768,8 +1771,11 @@ static int ui_handler_wait_for_input(bContext *C, const wmEvent *event, void *us
|
|||||||
return WM_UI_HANDLER_CONTINUE;
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WM_operator_name_call_ptr_with_depends_on_cursor(
|
void WM_operator_name_call_ptr_with_depends_on_cursor(bContext *C,
|
||||||
bContext *C, wmOperatorType *ot, short opcontext, PointerRNA *properties, const char *drawstr)
|
wmOperatorType *ot,
|
||||||
|
wmOperatorCallContext opcontext,
|
||||||
|
PointerRNA *properties,
|
||||||
|
const char *drawstr)
|
||||||
{
|
{
|
||||||
int flag = ot->flag;
|
int flag = ot->flag;
|
||||||
|
|
||||||
@@ -3063,7 +3069,7 @@ static int wm_handlers_do_intern(bContext *C, wmWindow *win, wmEvent *event, Lis
|
|||||||
BLI_addtail(&single_lb, drag);
|
BLI_addtail(&single_lb, drag);
|
||||||
event->customdata = &single_lb;
|
event->customdata = &single_lb;
|
||||||
|
|
||||||
const int opcontext = wm_drop_operator_context_get(drop);
|
const wmOperatorCallContext opcontext = wm_drop_operator_context_get(drop);
|
||||||
int op_retval = wm_operator_call_internal(
|
int op_retval = wm_operator_call_internal(
|
||||||
C, drop->ot, drop->ptr, NULL, opcontext, false, event);
|
C, drop->ot, drop->ptr, NULL, opcontext, false, event);
|
||||||
OPERATOR_RETVAL_CHECK(op_retval);
|
OPERATOR_RETVAL_CHECK(op_retval);
|
||||||
|
|||||||
@@ -1394,7 +1394,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C,
|
|||||||
wmWindow *win,
|
wmWindow *win,
|
||||||
ListBase *handlers,
|
ListBase *handlers,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int UNUSED(opcontext),
|
wmOperatorCallContext UNUSED(opcontext),
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
const bool is_strict,
|
const bool is_strict,
|
||||||
const struct wmKeyMapItemFind_Params *params,
|
const struct wmKeyMapItemFind_Params *params,
|
||||||
@@ -1430,7 +1430,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C,
|
|||||||
|
|
||||||
static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C,
|
static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
const bool is_strict,
|
const bool is_strict,
|
||||||
const struct wmKeyMapItemFind_Params *params,
|
const struct wmKeyMapItemFind_Params *params,
|
||||||
@@ -1543,7 +1543,7 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C,
|
|||||||
|
|
||||||
static wmKeyMapItem *wm_keymap_item_find(const bContext *C,
|
static wmKeyMapItem *wm_keymap_item_find(const bContext *C,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
bool is_strict,
|
bool is_strict,
|
||||||
const struct wmKeyMapItemFind_Params *params,
|
const struct wmKeyMapItemFind_Params *params,
|
||||||
@@ -1642,7 +1642,7 @@ static bool kmi_filter_is_visible(const wmKeyMap *UNUSED(km),
|
|||||||
|
|
||||||
char *WM_key_event_operator_string(const bContext *C,
|
char *WM_key_event_operator_string(const bContext *C,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
const bool is_strict,
|
const bool is_strict,
|
||||||
char *result,
|
char *result,
|
||||||
@@ -1682,7 +1682,7 @@ static bool kmi_filter_is_visible_type_mask(const wmKeyMap *km,
|
|||||||
*/
|
*/
|
||||||
wmKeyMapItem *WM_key_event_operator(const bContext *C,
|
wmKeyMapItem *WM_key_event_operator(const bContext *C,
|
||||||
const char *opname,
|
const char *opname,
|
||||||
int opcontext,
|
wmOperatorCallContext opcontext,
|
||||||
IDProperty *properties,
|
IDProperty *properties,
|
||||||
const short include_mask,
|
const short include_mask,
|
||||||
const short exclude_mask,
|
const short exclude_mask,
|
||||||
|
|||||||
@@ -1064,7 +1064,7 @@ int WM_operator_smooth_viewtx_get(const wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* invoke callback, uses enum property named "type" */
|
/* invoke callback, uses enum property named "type" */
|
||||||
int WM_menu_invoke_ex(bContext *C, wmOperator *op, int opcontext)
|
int WM_menu_invoke_ex(bContext *C, wmOperator *op, wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop = op->type->prop;
|
PropertyRNA *prop = op->type->prop;
|
||||||
|
|
||||||
@@ -1216,7 +1216,7 @@ int WM_operator_confirm_message_ex(bContext *C,
|
|||||||
const char *title,
|
const char *title,
|
||||||
const int icon,
|
const int icon,
|
||||||
const char *message,
|
const char *message,
|
||||||
const short opcontext)
|
const wmOperatorCallContext opcontext)
|
||||||
{
|
{
|
||||||
IDProperty *properties = op->ptr->data;
|
IDProperty *properties = op->ptr->data;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
struct ARegion;
|
struct ARegion;
|
||||||
struct GHOST_TabletData;
|
struct GHOST_TabletData;
|
||||||
struct ScrArea;
|
struct ScrArea;
|
||||||
|
enum wmOperatorCallContext;
|
||||||
|
|
||||||
#ifdef WITH_XR_OPENXR
|
#ifdef WITH_XR_OPENXR
|
||||||
struct wmXrActionData;
|
struct wmXrActionData;
|
||||||
@@ -175,7 +176,7 @@ void wm_dropbox_free(void);
|
|||||||
void wm_drags_exit(wmWindowManager *wm, wmWindow *win);
|
void wm_drags_exit(wmWindowManager *wm, wmWindow *win);
|
||||||
void wm_drop_prepare(bContext *C, wmDrag *drag, wmDropBox *drop);
|
void wm_drop_prepare(bContext *C, wmDrag *drag, wmDropBox *drop);
|
||||||
void wm_drags_check_ops(bContext *C, const wmEvent *event);
|
void wm_drags_check_ops(bContext *C, const wmEvent *event);
|
||||||
int wm_drop_operator_context_get(const wmDropBox *drop);
|
wmOperatorCallContext wm_drop_operator_context_get(const wmDropBox *drop);
|
||||||
void wm_drags_draw(bContext *C, wmWindow *win);
|
void wm_drags_draw(bContext *C, wmWindow *win);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Reference in New Issue
Block a user