Commit: f36785c26c14e00d3385a2f6ca0890eb8030439c
Author: Bastien Montagne
Date:   Sun Nov 16 11:09:51 2014 +0100
Branches: master
https://developer.blender.org/rBf36785c26c14e00d3385a2f6ca0890eb8030439c

Cleanup: Replace `WM_operator_name_call` by `WM_operator_name_call_ptr` where 
possible.

This avoids one lookup in optypes list...

===================================================================

M       source/blender/editors/interface/interface.c
M       source/blender/editors/space_buttons/buttons_ops.c
M       source/blender/editors/transform/transform_manipulator.c
M       source/blender/windowmanager/intern/wm_event_system.c

===================================================================

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index a64ec7f..93f5a8e 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -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);
        }
 }
diff --git a/source/blender/editors/space_buttons/buttons_ops.c 
b/source/blender/editors/space_buttons/buttons_ops.c
index c73dc04..0b643cd 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -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);
diff --git a/source/blender/editors/transform/transform_manipulator.c 
b/source/blender/editors/transform/transform_manipulator.c
index 37a6d50..f2869843 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -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 */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index f12177d..42cb5f3 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -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 */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to