Revision: 26692
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26692
Author:   aligorith
Date:     2010-02-08 00:39:44 +0100 (Mon, 08 Feb 2010)

Log Message:
-----------
Operator Execution Contexts Bugfix:

This commit adds a few more execution contexts for operators, given the 
increasing tendency for some special regiontypes to exist within areas that 
must have their own set of special operators. 

Examples of these include the "channel" operators in the Animation Editors 
(i.e. those in the 'Channels' menu), and the "Fit to Preview Window" operator 
for the Sequencer.

Previously, operators such as these would not function when clicked on from the 
menus, and they would not show the hotkeys they were mapped to.


Also, fixed a few operator definitions in the Animation Editors which were 
missing ot->prop defines. This meant that some hotkeys (mainly selection) were 
shown incorrectly in the menus.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_dopesheet.py
    trunk/blender/release/scripts/ui/space_graph.py
    trunk/blender/release/scripts/ui/space_sequencer.py
    trunk/blender/source/blender/blenkernel/BKE_screen.h
    trunk/blender/source/blender/blenkernel/intern/screen.c
    trunk/blender/source/blender/editors/animation/anim_channels_edit.c
    trunk/blender/source/blender/editors/space_action/action_edit.c
    trunk/blender/source/blender/editors/space_action/action_select.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c
    trunk/blender/source/blender/editors/space_graph/graph_select.c
    trunk/blender/source/blender/makesrna/intern/rna_ui.c
    trunk/blender/source/blender/windowmanager/WM_types.h
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
    trunk/blender/source/blender/windowmanager/intern/wm_keymap.c

Modified: trunk/blender/release/scripts/ui/space_dopesheet.py
===================================================================
--- trunk/blender/release/scripts/ui/space_dopesheet.py 2010-02-07 22:26:37 UTC 
(rev 26691)
+++ trunk/blender/release/scripts/ui/space_dopesheet.py 2010-02-07 23:39:44 UTC 
(rev 26692)
@@ -130,6 +130,8 @@
     def draw(self, context):
         layout = self.layout
 
+        layout.operator_context = 'INVOKE_REGION_CHANNELS'
+
         layout.column()
         layout.operator("anim.channels_setting_toggle")
         layout.operator("anim.channels_setting_enable")

Modified: trunk/blender/release/scripts/ui/space_graph.py
===================================================================
--- trunk/blender/release/scripts/ui/space_graph.py     2010-02-07 22:26:37 UTC 
(rev 26691)
+++ trunk/blender/release/scripts/ui/space_graph.py     2010-02-07 23:39:44 UTC 
(rev 26692)
@@ -133,6 +133,8 @@
     def draw(self, context):
         layout = self.layout
 
+        layout.operator_context = 'INVOKE_REGION_CHANNELS'
+
         layout.column()
         layout.operator("anim.channels_setting_toggle")
         layout.operator("anim.channels_setting_enable")

Modified: trunk/blender/release/scripts/ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/ui/space_sequencer.py 2010-02-07 22:26:37 UTC 
(rev 26691)
+++ trunk/blender/release/scripts/ui/space_sequencer.py 2010-02-07 23:39:44 UTC 
(rev 26692)
@@ -123,7 +123,9 @@
         if (st.view_type == 'SEQUENCER') or (st.view_type == 
'SEQUENCER_PREVIEW'):
             layout.operator("sequencer.view_all", text='View all Sequences')
         if (st.view_type == 'PREVIEW') or (st.view_type == 
'SEQUENCER_PREVIEW'):
+            layout.operator_context = 'INVOKE_REGION_PREVIEW'
             layout.operator("sequencer.view_all_preview", text='Fit preview in 
window')
+            layout.operator_context = 'INVOKE_DEFAULT'
         layout.operator("sequencer.view_selected")
 
         layout.prop(st, "draw_frames")

Modified: trunk/blender/source/blender/blenkernel/BKE_screen.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_screen.h        2010-02-07 
22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/blenkernel/BKE_screen.h        2010-02-07 
23:39:44 UTC (rev 26692)
@@ -234,6 +234,8 @@
 void   BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
 void   BKE_screen_area_free(struct ScrArea *sa);
 
+struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type);
+
 /* screen */
 void free_screen(struct bScreen *sc); 
 unsigned int BKE_screen_visible_layers(struct bScreen *screen, struct Scene 
*scene);

Modified: trunk/blender/source/blender/blenkernel/intern/screen.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/screen.c     2010-02-07 
22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/blenkernel/intern/screen.c     2010-02-07 
23:39:44 UTC (rev 26692)
@@ -336,3 +336,19 @@
        return layer;
 }
 
+/* ***************** Utilities ********************** */
+
+/* Find a region of the specified type from the given area */
+ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
+{
+       if (sa) {
+               ARegion *ar;
+               
+               for (ar=sa->regionbase.first; ar; ar= ar->next) {
+                       if (ar->regiontype == type)
+                               return ar;
+               }
+       }
+       return NULL;
+}
+

Modified: trunk/blender/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_edit.c 
2010-02-07 22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/editors/animation/anim_channels_edit.c 
2010-02-07 23:39:44 UTC (rev 26692)
@@ -1385,7 +1385,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* props */
-       RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not 
just selected ones)");
+       ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all 
channels (not just selected ones)");
 }
 
 /* ********************** Collapse Channels Operator *********************** */
@@ -1427,7 +1427,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* props */
-       RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not 
just selected ones)");
+       ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all 
channels (not just selected ones)");
 }
 
 /* ********************** Select All Operator *********************** */
@@ -1467,7 +1467,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* props */
-       RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+       ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
 }
 
 /* ******************** Borderselect Operator *********************** */

Modified: trunk/blender/source/blender/editors/space_action/action_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_edit.c     
2010-02-07 22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/editors/space_action/action_edit.c     
2010-02-07 23:39:44 UTC (rev 26692)
@@ -733,7 +733,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, 
"Threshold", "", 0.0f, 1000.0f);
+       ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, 
"Threshold", "", 0.0f, 1000.0f);
 }
 
 /* ******************** Sample Keyframes Operator *********************** */

Modified: trunk/blender/source/blender/editors/space_action/action_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_select.c   
2010-02-07 22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/editors/space_action/action_select.c   
2010-02-07 23:39:44 UTC (rev 26692)
@@ -196,7 +196,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* props */
-       RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+       ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
 }
 
 /* ******************** Border Select Operator **************************** */
@@ -362,7 +362,7 @@
        /* rna */
        WM_operator_properties_gesture_border(ot, FALSE);
        
-       RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+       ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
 }
 
 /* ******************** Column Select Operator **************************** */
@@ -571,7 +571,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* props */
-       RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+       ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, 
"Mode", "");
 }
 
 /* ******************** Select More/Less Operators *********************** */

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_edit.c       
2010-02-07 22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/editors/space_graph/graph_edit.c       
2010-02-07 23:39:44 UTC (rev 26692)
@@ -924,7 +924,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, 
"Threshold", "", 0.0f, 1000.0f);
+       ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, 
"Threshold", "", 0.0f, 1000.0f);
 }
 
 /* ******************** Bake F-Curve Operator *********************** */
@@ -2013,7 +2013,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
+       ot->prop= RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, 
"Type", "");
        RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add 
F-Modifier to active F-Curve.");
 }
 

Modified: trunk/blender/source/blender/editors/space_graph/graph_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_select.c     
2010-02-07 22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/editors/space_graph/graph_select.c     
2010-02-07 23:39:44 UTC (rev 26692)
@@ -199,7 +199,7 @@
        ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
        
        /* props */
-       RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+       ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
 }
 
 /* ******************** Border Select Operator **************************** */
@@ -361,7 +361,7 @@
        /* rna */
        WM_operator_properties_gesture_border(ot, FALSE);
        
-       RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+       ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
 }
 
 /* ******************** Column Select Operator **************************** */
@@ -546,7 +546,7 @@
        ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
        
        /* props */
-       RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+       ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, 
"Mode", "");
 }
 
 /* ******************** Select More/Less Operators *********************** */

Modified: trunk/blender/source/blender/makesrna/intern/rna_ui.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ui.c       2010-02-07 
22:26:37 UTC (rev 26691)
+++ trunk/blender/source/blender/makesrna/intern/rna_ui.c       2010-02-07 
23:39:44 UTC (rev 26692)
@@ -522,10 +522,14 @@
        static EnumPropertyItem operator_context_items[] = {
                {WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", 
""},
                {WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke 
Region Window", ""},
+               {WM_OP_INVOKE_REGION_CHANNELS, "INVOKE_REGION_CHANNELS", 0, 
"Invoke Region Channels", ""},
+               {WM_OP_INVOKE_REGION_PREVIEW, "INVOKE_REGION_PREVIEW", 0, 
"Invoke Region Preview", ""},
                {WM_OP_INVOKE_AREA, "INVOKE_AREA", 0, "Invoke Area", ""},
                {WM_OP_INVOKE_SCREEN, "INVOKE_SCREEN", 0, "Invoke Screen", ""},
                {WM_OP_EXEC_DEFAULT, "EXEC_DEFAULT", 0, "Exec Default", ""},
                {WM_OP_EXEC_REGION_WIN, "EXEC_REGION_WIN", 0, "Exec Region 
Window", ""},
+               {WM_OP_EXEC_REGION_CHANNELS, "EXEC_REGION_CHANNELS", 0, "Exec 
Region Channels", ""},
+               {WM_OP_EXEC_REGION_PREVIEW, "EXEC_REGION_PREVIEW", 0, "Exec 
Region Preview", ""},
                {WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""},
                {WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""},
                {0, NULL, 0, NULL, NULL}};


@@ Diff output truncated at 10240 characters. @@

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

Reply via email to