From ed81ff405fc6f0b459c368107343962502c99e37 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 30 Jan 2006 19:39:05 +0000 Subject: [PATCH] Fix: buttons previewrender was re-rendering on scrolling a lot, this due to rounding noise when trying to detect if previewsize changed. Made it use a threshold now. Fix: SHIFT+P in editmode is still push/pull, outside editmode it'll do the preview render. (Note; editmode changes are not updated anyway!) --- source/blender/src/buttons_scene.c | 37 ------------------------------ source/blender/src/previewrender.c | 6 ++++- source/blender/src/space.c | 14 ++++++----- 3 files changed, 13 insertions(+), 44 deletions(-) diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 63acf639913..e077fa952ee 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -812,7 +812,6 @@ void do_render_panels(unsigned short event) // } break; case B_SET_EDGE: - G.scene->r.mode &= ~R_ZBLUR; allqueue(REDRAWBUTSSCENE, 0); break; case B_SET_ZBLUR: @@ -1448,42 +1447,6 @@ static void render_panel_yafrayGlobal() } } -#if 0 -static void render_panel_sfx(void) -{ - uiBlock *block; - - block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_dof", UI_EMBOSS, UI_HELV, curarea->win); - uiNewPanelTabbed("Output", "Render"); - if(uiNewPanel(curarea, block, "Post Effects", "Render", 320, 0, 318, 204)==0) return; - - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, R_ZBLUR,B_SET_ZBLUR,"Zblur", 10,180,140,20,&G.scene->r.mode,0,0, 0, 0, "Apply blur based on depth values in z-buffer"); - uiDefButF(block, NUM,B_DIFF, "ZMin:", 10,160,140,20, &G.scene->r.zmin, 0.0, 1.0, 0, 0, "Specify the start distance with maximum blur"); - uiDefButF(block, NUM,B_DIFF, "Focus:", 10,140,140,20, &G.scene->r.focus, 0.0, 1.0, 0, 0, "Specify the focus distance (not blurred)"); - uiDefButF(block, NUM,B_DIFF, "Blur:", 10,120,140,20, &G.scene->r.zblur, 1.0, 100.0, 0, 0, "Specify the maximum blur radius"); - uiDefButF(block, NUM,B_DIFF, "Gamma:", 10,100,140,20, &G.scene->r.zgamma, 0.05, 2.0, 0, 0, "Use Gamma corrected addition of colors"); - uiDefButF(block, NUM,B_DIFF, "Sigma:", 10,80,140,20, &G.scene->r.zsigma, 1.0, 20.0, 0, 0, "Filter type control, higher value is stronger gaussian"); - - /* Toon shading buttons */ - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, R_EDGE, B_SET_EDGE, "Edge", 160, 180, 150, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon edge shading"); - uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 160, 160, 150, 20, "Display edge settings"); - - /* postprocess render buttons */ - uiBlockBeginAlign(block); - if(R.rectftot) - uiDefIconTextButI(block, TOG, R_FBUF, B_NOP, ICON_IMAGE_DEHLT," Fbuf", 160, 130, 150, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render; buffer available"); - else - uiDefButBitI(block, TOG, R_FBUF, 0,"Fbuf", 160, 130, 150, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render, no buffer available now"); - uiDefBlockBut(block, post_render_menu, NULL, "Post process", 160, 110, 150, 20, "Applies on RGBA floats while render or with Fbuf available"); - uiBlockEndAlign(block); - - /* Dither control */ - uiDefButF(block, NUM,B_DIFF, "Dither:", 160,80,150,20, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)"); - -} -#endif static void layer_copy_func(void *lay_v, void *lay_p) { diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c index 6335bf03ec3..00856b539f7 100644 --- a/source/blender/src/previewrender.c +++ b/source/blender/src/previewrender.c @@ -495,8 +495,12 @@ void BIF_previewdraw(ScrArea *sa, uiBlock *block) /* we now do scalable previews! */ set_previewrect(ri, sa->win); - if(oldx==ri->pr_rectx && oldy==ri->pr_recty) + if( ABS(oldx-ri->pr_rectx)<2 && ABS(oldy-ri->pr_recty)<2 ) { + /* restore old values for drawing! */ + ri->pr_rectx= oldx; + ri->pr_recty= oldy; glaDrawPixelsSafe(ri->disprect.xmin, ri->disprect.ymin, ri->pr_rectx, ri->pr_recty, ri->pr_rectx, GL_RGBA, GL_UNSIGNED_BYTE, ri->rect); + } else { MEM_freeN(ri->rect); ri->rect= NULL; diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 86fbacb567e..ec16fb89fa3 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1591,12 +1591,14 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) else if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) make_parent(); else if(G.qual==LR_SHIFTKEY) { - //initTransform(TFM_PUSHPULL, CTX_NONE); - //Transform(); - - //Ton: is this where is should go? - toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0); - doredraw= 1; + if(G.obedit) { + initTransform(TFM_PUSHPULL, CTX_NONE); + Transform(); + } + else { + toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0); + doredraw= 1; + } } else if(G.qual==LR_ALTKEY) clear_parent();