converted more mixed tab/space indentations to tabs. only whitespace changes.
[blender.git] / source / blender / editors / screen / screen_ops.c
index afda6c5..56a27da 100644 (file)
@@ -49,6 +49,7 @@
 
 #include "BKE_context.h"
 #include "BKE_customdata.h"
+#include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_mesh.h"
 #include "BKE_report.h"
@@ -108,6 +109,16 @@ int ED_operator_screenactive(bContext *C)
        return 1;
 }
 
+/* XXX added this to prevent anim state to change during renders */
+int ED_operator_screenactive_norender(bContext *C)
+{
+       if(G.rendering) return 0;
+       if(CTX_wm_window(C)==NULL) return 0;
+       if(CTX_wm_screen(C)==NULL) return 0;
+       return 1;
+}
+
+
 static int screen_active_editable(bContext *C)
 {
        if(ED_operator_screenactive(C)) {
@@ -1716,7 +1727,7 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot)
        
        ot->exec= frame_offset_exec;
        
-       ot->poll= ED_operator_screenactive;
+       ot->poll= ED_operator_screenactive_norender;
        ot->flag= 0;
        
        /* rna */
@@ -1766,7 +1777,7 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot)
        
        ot->exec= frame_jump_exec;
        
-       ot->poll= ED_operator_screenactive;
+       ot->poll= ED_operator_screenactive_norender;
        ot->flag= OPTYPE_UNDO;
        
        /* rna */
@@ -1846,7 +1857,7 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
        
        ot->exec= keyframe_jump_exec;
        
-       ot->poll= ED_operator_screenactive;
+       ot->poll= ED_operator_screenactive_norender;
        ot->flag= OPTYPE_UNDO;
        
        /* rna */
@@ -1918,7 +1929,18 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot)
 /* function to be called outside UI context, or for redo */
 static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
 {
-       ED_screen_full_toggle(C, CTX_wm_window(C), CTX_wm_area(C));
+       bScreen *screen = CTX_wm_screen(C);
+       ScrArea *sa=NULL;
+       
+       /* search current screen for 'fullscreen' areas */
+       /* prevents restoring info header, when mouse is over it */
+       for (sa=screen->areabase.first; sa; sa=sa->next) {
+               if (sa->full) break;
+       }
+       
+       if(sa==NULL) sa= CTX_wm_area(C);
+       
+       ED_screen_full_toggle(C, CTX_wm_window(C), sa);
        return OPERATOR_FINISHED;
 }
 
@@ -2875,7 +2897,7 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke= screen_animation_step;
        
-       ot->poll= ED_operator_screenactive;
+       ot->poll= ED_operator_screenactive_norender;
        
 }
 
@@ -2932,7 +2954,7 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot)
        /* api callbacks */
        ot->exec= screen_animation_play_exec;
        
-       ot->poll= ED_operator_screenactive;
+       ot->poll= ED_operator_screenactive_norender;
        
        RNA_def_boolean(ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards");
        RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
@@ -3162,6 +3184,7 @@ static void SCREEN_OT_delete(wmOperatorType *ot)
 static int scene_new_exec(bContext *C, wmOperator *op)
 {
        Scene *newscene, *scene= CTX_data_scene(C);
+       bScreen *screen= CTX_wm_screen(C);
        Main *bmain= CTX_data_main(C);
        int type= RNA_enum_get(op->ptr, "type");
 
@@ -3180,8 +3203,12 @@ static int scene_new_exec(bContext *C, wmOperator *op)
                }
        }
        
+       /* this notifier calls ED_screen_set_scene, doing a lot of UI stuff, not for inside event loops */
        WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene);
        
+       if(screen)
+               screen->scene= newscene;
+       
        return OPERATOR_FINISHED;
 }
 
@@ -3319,7 +3346,7 @@ static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSE
 {
        if(drag->type==WM_DRAG_PATH) {
                if(drag->icon==ICON_FILE_BLEND)
-                  return 1;
+                       return 1;
        }
        return 0;
 }