Cleanup: Replace WM_operator_name_call by WM_operator_name_call_ptr where possible.

This avoids one lookup in optypes list...
This commit is contained in:
2014-11-16 11:09:51 +01:00
parent 10813996e8
commit f36785c26c
4 changed files with 8 additions and 12 deletions

View File

@@ -2243,19 +2243,18 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
void ui_but_default_set(bContext *C, const bool all, const bool use_afterfunc)
{
const char *opstring = "UI_OT_reset_default_button";
wmOperatorType *ot = WM_operatortype_find("UI_OT_reset_default_button", true);
if (use_afterfunc) {
PointerRNA *ptr;
wmOperatorType *ot = WM_operatortype_find(opstring, 0);
ptr = ui_handle_afterfunc_add_operator(ot, WM_OP_EXEC_DEFAULT, true);
RNA_boolean_set(ptr, "all", all);
}
else {
PointerRNA ptr;
WM_operator_properties_create(&ptr, opstring);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_boolean_set(&ptr, "all", all);
WM_operator_name_call(C, opstring, WM_OP_EXEC_DEFAULT, &ptr);
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &ptr);
WM_operator_properties_free(&ptr);
}
}