Fix #28404: certain keyboard shortcuts not shown in menus, e.g. move operators
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 5 Sep 2011 17:57:04 +0000 (17:57 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 5 Sep 2011 17:57:04 +0000 (17:57 +0000)
in graph editor > channel menu. Problem was these did not inherit operator
execution context correctly.

Fix found by Sergey, also needed to fix logic operators which were not working
when invoked instead of executed.

source/blender/editors/interface/interface_layout.c
source/blender/editors/space_logic/logic_ops.c
source/blender/windowmanager/intern/wm_event_system.c

index a2e65f5e4ece5c71718608d130d31237a9d473b6..803da55cea6b1a9f46b6caf8e331ab5176a49f7f 100644 (file)
@@ -1526,7 +1526,7 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo
 {
        MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
 
-       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
+       uiLayoutSetOperatorContext(layout, lvl->opcontext);
        uiItemsEnumO(layout, lvl->opname, lvl->propname);
 }
 
index 638bfe576084613be7b3c91d096a73bd74ef9036..60e9595b77a0faad969b69d5d7eb5d33369406b0 100644 (file)
@@ -322,7 +322,7 @@ static void LOGIC_OT_sensor_add(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
+       ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
        RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
        RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the Sensor to add");
        RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Sensor to");
@@ -437,7 +437,7 @@ static void LOGIC_OT_controller_add(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_enum(ot->srna, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
+       ot->prop= RNA_def_enum(ot->srna, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
        RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the Controller to add");
        RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Controller to");
 }
@@ -539,7 +539,7 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
+       ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
        RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
        RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the Actuator to add");
        RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Actuator to");
index 5711ec899bfb7ba8f6e8e1b9c6be254c1c818fe4..8861f128c4b2a8e21690dc13fe6e2abbdc73bb0d 100644 (file)
@@ -886,8 +886,8 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
                                CTX_wm_region_set(C, NULL);
                                CTX_wm_area_set(C, NULL);
                                retval= wm_operator_invoke(C, ot, event, properties, reports, poll_only);
-                               CTX_wm_region_set(C, ar);
                                CTX_wm_area_set(C, area);
+                               CTX_wm_region_set(C, ar);
 
                                return retval;
                        }