diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-07-11 09:07:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-07-11 09:07:55 +0400 |
commit | d419e2e90cc3bb3fd6aa89baab8b4f4caa2001e1 (patch) | |
tree | be24f0e46feb17e37569f260c21dad4561a91a5b /source/blender/editors/interface | |
parent | dd9a33dc83f912c89947a149a76e374ee3bba13e (diff) |
WM: add WM_operator_properties_create_ptr
Call operator types directly and avoid a lookup when their known.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e04fef329b1..d37660a0611 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -633,7 +633,7 @@ static void ui_apply_but_funcs_after(bContext *C) } if (after.optype) - WM_operator_name_call(C, after.optype->idname, after.opcontext, (after.opptr) ? &opptr : NULL); + WM_operator_name_call_ptr(C, after.optype, after.opcontext, (after.opptr) ? &opptr : NULL); if (after.opptr) WM_operator_properties_free(&opptr); @@ -8476,7 +8476,7 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata) if (temp.popup_func) temp.popup_func(C, temp.popup_arg, temp.retvalue); if (temp.optype) - WM_operator_name_call(C, temp.optype->idname, temp.opcontext, NULL); + WM_operator_name_call_ptr(C, temp.optype, temp.opcontext, NULL); } else if (temp.cancel_func) temp.cancel_func(C, temp.popup_arg); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 316a4d34881..877a993e0ac 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -693,6 +693,7 @@ static int edittranslation_exec(bContext *C, wmOperator *op) int ret = OPERATOR_CANCELLED; if (but) { + wmOperatorType *ot; PointerRNA ptr; char popath[FILE_MAX]; const char *root = U.i18ndir; @@ -714,7 +715,8 @@ static int edittranslation_exec(bContext *C, wmOperator *op) "Directory' path to a valid directory"); return OPERATOR_CANCELLED; } - if (!WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0)) { + ot = WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0); + if (ot == NULL) { BKE_reportf(op->reports, RPT_ERROR, "Could not find operator '%s'! Please enable ui_translate addon " "in the User Preferences", EDTSRC_I18N_OP_NAME); return OPERATOR_CANCELLED; @@ -730,7 +732,7 @@ static int edittranslation_exec(bContext *C, wmOperator *op) uiButGetStrInfo(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip, &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL); - WM_operator_properties_create(&ptr, EDTSRC_I18N_OP_NAME); + WM_operator_properties_create_ptr(&ptr, ot); RNA_string_set(&ptr, "lang", uilng); RNA_string_set(&ptr, "po_file", popath); RNA_string_set(&ptr, "but_label", but_label.strinfo); @@ -743,7 +745,7 @@ static int edittranslation_exec(bContext *C, wmOperator *op) RNA_string_set(&ptr, "rna_prop", rna_prop.strinfo); RNA_string_set(&ptr, "rna_enum", rna_enum.strinfo); RNA_string_set(&ptr, "rna_ctxt", rna_ctxt.strinfo); - ret = WM_operator_name_call(C, EDTSRC_I18N_OP_NAME, WM_OP_INVOKE_DEFAULT, &ptr); + ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr); /* Clean up */ if (but_label.strinfo) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 243aa452f17..7e0aad0024e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -3188,7 +3188,7 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2) wmOperatorType *ot = arg2; if (ot) - WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, NULL); } static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) |