Fix T44976: 3D View turns into an Image Editor after saving render
authorJulian Eisel <eiseljulian@gmail.com>
Mon, 8 Jun 2015 13:59:32 +0000 (15:59 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Mon, 8 Jun 2015 14:04:00 +0000 (16:04 +0200)
result

Was a case of two stacked temporary fullscreens, so a quite extreme
situation.

source/blender/editors/include/ED_screen.h
source/blender/editors/render/render_view.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/windowmanager/intern/wm_event_system.c

index 7f6679b827b5e707f8770df83ba56978d72398d4..441a9bdb1c14dd3e4528aa82a79bd4ef4cc5f13b 100644 (file)
@@ -109,7 +109,7 @@ void    ED_screen_animation_timer(struct bContext *C, int redraws, int refresh,
 void    ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh);
 void    ED_screen_restore_temp_type(struct bContext *C, ScrArea *sa);
 ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
-void    ED_screen_full_prevspace(struct bContext *C, ScrArea *sa);
+void    ED_screen_full_prevspace(struct bContext *C, ScrArea *sa, const bool was_prev_temp);
 void    ED_screen_full_restore(struct bContext *C, ScrArea *sa);
 struct ScrArea *ED_screen_state_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *sa, const short state);
 void    ED_screens_header_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg);
index f5260b8a5683a8a988e5845611d0503b7726516a..fc1338c5795c54d4c0a9af45157e3227952fed1d 100644 (file)
@@ -261,7 +261,7 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
 
                if (sima->flag & SI_FULLWINDOW) {
                        sima->flag &= ~SI_FULLWINDOW;
-                       ED_screen_full_prevspace(C, sa);
+                       ED_screen_full_prevspace(C, sa, false);
                }
                else {
                        ED_area_prevspace(C, sa);
@@ -326,7 +326,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), const wm
 
                                        if (sima->flag & SI_FULLWINDOW) {
                                                sima->flag &= ~SI_FULLWINDOW;
-                                               ED_screen_full_prevspace(C, sa);
+                                               ED_screen_full_prevspace(C, sa, false);
                                        }
                                        else if (sima->next) {
                                                /* workaround for case of double prevspace, render window
index d9bd9cc4f51cd9d8180bf7e717117cf5a2c8a336..0c40c833c0d850f1e6f939af6df66bdabddab20f 100644 (file)
@@ -1763,12 +1763,18 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
        return newsa;
 }
 
-void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
+/**
+ * \a was_prev_temp for the case previous space was a temporary fullscreen as well
+ */
+void ED_screen_full_prevspace(bContext *C, ScrArea *sa, const bool was_prev_temp)
 {
        if (sa->flag & AREA_FLAG_STACKED_FULLSCREEN) {
                /* stacked fullscreen -> only go back to previous screen and don't toggle out of fullscreen */
                ED_area_prevspace(C, sa);
-               sa->flag &= ~AREA_FLAG_TEMP_TYPE;
+               /* only clear if previous space wasn't a temp fullscreen as well */
+               if (!was_prev_temp) {
+                       sa->flag &= ~AREA_FLAG_TEMP_TYPE;
+               }
        }
        else {
                ED_screen_restore_temp_type(C, sa);
@@ -1803,7 +1809,7 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa)
        
        if (sl->next) {
                if (sa->flag & AREA_FLAG_TEMP_TYPE) {
-                       ED_screen_full_prevspace(C, sa);
+                       ED_screen_full_prevspace(C, sa, false);
                }
                else {
                        ED_screen_state_toggle(C, win, sa, state);
index 9745d01fc8928da14357ce26819d7a493c83d323..52eb14aab8db7a32c23cf304791f3be724df07b2 100644 (file)
@@ -3800,7 +3800,7 @@ static int fullscreen_back_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
-       ED_screen_full_prevspace(C, sa);
+       ED_screen_full_prevspace(C, sa, false);
 
        return OPERATOR_FINISHED;
 }
index 5177e85e82737a2a6e5bd5bfe8559f9fb24d1e22..889a36b69538eba8acd0c491dec44d304a77161b 100644 (file)
@@ -1793,7 +1793,11 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
                        BLI_remlink(handlers, handler);
 
                        if (val != EVT_FILESELECT_EXTERNAL_CANCEL) {
-                               ED_screen_full_prevspace(C, CTX_wm_area(C));
+                               ScrArea *sa = CTX_wm_area(C);
+                               const SpaceLink *sl = sa->spacedata.first;
+                               const bool was_prev_temp = (sl->next && sl->next->spacetype == SPACE_IMAGE);
+
+                               ED_screen_full_prevspace(C, sa, was_prev_temp);
                        }
 
                        wm_handler_op_context(C, handler, CTX_wm_window(C)->eventstate);