[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35112] trunk/blender/source/blender/ editors/render/render_internal.c: Bugfix #26188

Ton Roosendaal ton at blender.org
Wed Feb 23 16:52:05 CET 2011


Revision: 35112
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35112
Author:   ton
Date:     2011-02-23 15:52:05 +0000 (Wed, 23 Feb 2011)
Log Message:
-----------
Bugfix #26188

Having 2 or more windows open, a render in another window made the
other (active) window fail badly on F11 key (show render).

Now things should go smoothly. If a render is being shown in 
inactive windows, they get popped to the front nicely.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/render/render_internal.c

Modified: trunk/blender/source/blender/editors/render/render_internal.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_internal.c	2011-02-23 15:05:25 UTC (rev 35111)
+++ trunk/blender/source/blender/editors/render/render_internal.c	2011-02-23 15:52:05 UTC (rev 35112)
@@ -68,7 +68,7 @@
 
 static ScrArea *biggest_area(bContext *C);
 static ScrArea *biggest_non_image_area(bContext *C);
-static ScrArea *find_area_showing_r_result(bContext *C);
+static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win);
 static ScrArea *find_area_image_empty(bContext *C);
 
 /* called inside thread! */
@@ -232,9 +232,13 @@
 	}
 
 	if(!sa) {
-		sa= find_area_showing_r_result(C);
+		sa= find_area_showing_r_result(C, &win); 
 		if(sa==NULL)
 			sa= find_area_image_empty(C);
+		
+		/* if area found in other window, we make that one show in front */
+		if(win && win!=CTX_wm_window(C))
+			wm_window_raise(win);
 
 		if(sa==NULL) {
 			/* find largest open non-image area */
@@ -336,16 +340,15 @@
 }
 
 
-static ScrArea *find_area_showing_r_result(bContext *C)
+static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
 {
 	wmWindowManager *wm= CTX_wm_manager(C);
-	wmWindow *win;
 	ScrArea *sa = NULL;
 	SpaceImage *sima;
 
 	/* find an imagewindow showing render result */
-	for(win=wm->windows.first; win; win=win->next) {
-		for(sa=win->screen->areabase.first; sa; sa= sa->next) {
+	for(*win=wm->windows.first; *win; *win= (*win)->next) {
+		for(sa= (*win)->screen->areabase.first; sa; sa= sa->next) {
 			if(sa->spacetype==SPACE_IMAGE) {
 				sima= sa->spacedata.first;
 				if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
@@ -355,7 +358,7 @@
 		if(sa)
 			break;
 	}
-
+	
 	return sa;
 }
 
@@ -862,18 +865,19 @@
 
 static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEvent *event)
 {
-	ScrArea *sa= find_area_showing_r_result(C);
-
-	/* test if we have a temp screen active */
-	if(CTX_wm_window(C)->screen->temp) {
-		wm_window_lower(CTX_wm_window(C));
+	wmWindow *wincur = CTX_wm_window(C);
+	
+	/* test if we have currently a temp screen active */
+	if(wincur->screen->temp) {
+		wm_window_lower(wincur);
 	}
 	else { 
-		/* is there another window? */
-		wmWindow *win;
+		wmWindow *win, *winshow;
+		ScrArea *sa= find_area_showing_r_result(C, &winshow);
 		
+		/* is there another window showing result? */
 		for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
-			if(win->screen->temp) {
+			if(win->screen->temp || (win==winshow && winshow!=wincur)) {
 				wm_window_raise(win);
 				return OPERATOR_FINISHED;
 			}




More information about the Bf-blender-cvs mailing list