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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
/* useful yet irritating feature, Shift+Click to open the file
|
||||
* Alt+Click to browse a folder in the OS's browser */
|
||||
if (event->shift || event->alt) {
|
||||
wmOperatorType *ot = WM_operatortype_find("WM_OT_path_open", true);
|
||||
PointerRNA props_ptr;
|
||||
|
||||
if (event->alt) {
|
||||
@@ -195,9 +196,9 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
|
||||
|
||||
WM_operator_properties_create(&props_ptr, "WM_OT_path_open");
|
||||
WM_operator_properties_create_ptr(&props_ptr, ot);
|
||||
RNA_string_set(&props_ptr, "filepath", str);
|
||||
WM_operator_name_call(C, "WM_OT_path_open", WM_OP_EXEC_DEFAULT, &props_ptr);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr);
|
||||
WM_operator_properties_free(&props_ptr);
|
||||
|
||||
MEM_freeN(str);
|
||||
|
||||
@@ -1850,7 +1850,6 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op)
|
||||
}
|
||||
RNA_boolean_set_array(op->ptr, "constraint_axis", constraint_axis);
|
||||
WM_operator_name_call(C, "TRANSFORM_OT_translate", WM_OP_INVOKE_DEFAULT, op->ptr);
|
||||
//wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_translate", 0), event, op->ptr, NULL, false);
|
||||
}
|
||||
else if (drawflags & MAN_SCALE_C) {
|
||||
switch (drawflags) {
|
||||
@@ -1881,7 +1880,6 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op)
|
||||
}
|
||||
RNA_boolean_set_array(op->ptr, "constraint_axis", constraint_axis);
|
||||
WM_operator_name_call(C, "TRANSFORM_OT_resize", WM_OP_INVOKE_DEFAULT, op->ptr);
|
||||
//wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_resize", 0), event, op->ptr, NULL, false);
|
||||
}
|
||||
else if (drawflags == MAN_ROT_T) { /* trackball need special case, init is different */
|
||||
/* Do not pass op->ptr!!! trackball has no "constraint" properties!
|
||||
@@ -1894,8 +1892,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op)
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "release_confirm")) && RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_boolean_set(&props_ptr, prop, RNA_property_boolean_get(op->ptr, prop));
|
||||
}
|
||||
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, &props_ptr);
|
||||
//wm_operator_invoke(C, WM_operatortype_find(ot->idname, 0), event, NULL, NULL, false);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
|
||||
WM_operator_properties_free(&props_ptr);
|
||||
}
|
||||
else if (drawflags & MAN_ROT_C) {
|
||||
@@ -1912,7 +1909,6 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op)
|
||||
}
|
||||
RNA_boolean_set_array(op->ptr, "constraint_axis", constraint_axis);
|
||||
WM_operator_name_call(C, "TRANSFORM_OT_rotate", WM_OP_INVOKE_DEFAULT, op->ptr);
|
||||
//wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_rotate", 0), event, op->ptr, NULL, false);
|
||||
}
|
||||
}
|
||||
/* after transform, restore drawflags */
|
||||
|
||||
@@ -1955,7 +1955,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
||||
event->customdata = NULL;
|
||||
event->custom = 0;
|
||||
|
||||
WM_operator_name_call(C, drop->ot->idname, drop->opcontext, drop->ptr);
|
||||
WM_operator_name_call_ptr(C, drop->ot, drop->opcontext, drop->ptr);
|
||||
action |= WM_HANDLER_BREAK;
|
||||
|
||||
/* XXX fileread case */
|
||||
|
||||
Reference in New Issue
Block a user