Composite preview in Image window didn't work OK when making a window
fullscreen. That because it depended too much on a composite editor to be
open, for refresh events.

Now you can use preview panels in a full-screen image window too.

It also works a bit different... noticable while dragging preview panel
around.
This commit is contained in:
Ton Roosendaal
2007-03-29 12:08:14 +00:00
parent 0b7d7e07c6
commit eafb84118a
2 changed files with 33 additions and 22 deletions

View File

@@ -1120,6 +1120,9 @@ static int image_curves_active(ScrArea *sa)
return 0;
}
/* 0: disable preview
otherwise refresh preview
*/
void image_preview_event(int event)
{
int exec= 0;
@@ -1129,24 +1132,31 @@ void image_preview_event(int event)
G.scene->r.scemode &= ~R_COMP_CROP;
exec= 1;
}
else if(event==2 || (G.scene->r.scemode & R_COMP_CROP)==0) {
if(image_preview_active(curarea, NULL, NULL)) {
G.scene->r.scemode |= R_COMP_CROP;
exec= 1;
}
else {
G.scene->r.scemode |= R_COMP_CROP;
exec= 1;
}
if(exec) {
ScrArea *sa;
if(exec && G.scene->nodetree) {
/* should work when no node editor in screen..., so we execute right away */
ntreeCompositTagGenerators(G.scene->nodetree);
for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
if(sa->spacetype==SPACE_NODE) {
addqueue(sa->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
break;
}
}
G.afbreek= 0;
G.scene->nodetree->timecursor= set_timecursor;
G.scene->nodetree->test_break= blender_test_break;
BIF_store_spare();
ntreeCompositExecTree(G.scene->nodetree, &G.scene->r, 1); /* 1 is do_previews */
G.scene->nodetree->timecursor= NULL;
G.scene->nodetree->test_break= NULL;
scrarea_do_windraw(curarea);
waitcursor(0);
allqueue(REDRAWNODE, 1);
}
}
@@ -1165,11 +1175,7 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
winy*= (G.scene->r.border.ymax - G.scene->r.border.ymin);
}
/* while dragging we don't update the rects */
if(block->panel->flag & PNL_SELECT)
return;
if(get_mbut() & M_MOUSE)
return;
/* while dragging we need to update the rects, otherwise it doesn't end with correct one */
BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx)-15.0f, 15.0f, (block->maxy - block->miny)-15.0f);
ui_graphics_to_window_rct(sa->win, &dispf, disprect);
@@ -1196,8 +1202,7 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
CLAMP(disprect->ymin, 0, winy);
CLAMP(disprect->ymax, 0, winy);
// printf("drawrct %d %d %d %d\n", disprect->xmin, disprect->ymin,disprect->xmax, disprect->ymax);
image_preview_event(1);
}
static int is_preview_allowed(ScrArea *cur)

View File

@@ -242,7 +242,13 @@ void toggle_blockhandler(ScrArea *sa, short eventcode, short val)
addnew= 0;
}
}
if(addnew) add_blockhandler(sa, eventcode, val);
if(addnew) {
add_blockhandler(sa, eventcode, val);
/* specific add new calls */
if(eventcode==IMAGE_HANDLER_PREVIEW)
image_preview_event(1);
}
}