Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2009-06-11 21:21:27 +0400
committerTon Roosendaal <ton@blender.org>2009-06-11 21:21:27 +0400
commit4e66f6d11f3a45fbb1d7537542d50caf622d0688 (patch)
tree003748ac595cc1830cbd3bd5e11f5d15619b9b93 /source/blender/editors/preview
parent2c8fae1f8b0b791a82fd3dcc698e5b1ce69f5041 (diff)
2.5
Added search-browse to the Python ID template. Also added icon/button for 'Add new'. (Note, we need icon for it). Also fixed bug in search menu closing too quick on mouse-release, when mouse was close to bottom of menu button. And removed annoying warning if ID pointer was zero.
Diffstat (limited to 'source/blender/editors/preview')
-rw-r--r--source/blender/editors/preview/previewrender.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/source/blender/editors/preview/previewrender.c b/source/blender/editors/preview/previewrender.c
index 3ed4fa6bd0f..1435ca7290b 100644
--- a/source/blender/editors/preview/previewrender.c
+++ b/source/blender/editors/preview/previewrender.c
@@ -633,41 +633,42 @@ void BIF_previewrender_buts(Scene *scene, SpaceButs *sbuts)
/* uses ROUNDBOX button in block to get the rect */
void ED_preview_draw(const bContext *C, void *idp, rcti *rect)
{
- ScrArea *sa= CTX_wm_area(C);
- SpaceButs *sbuts= sa->spacedata.first;
- RenderResult rres;
- int newx= rect->xmax-rect->xmin, newy= rect->ymax-rect->ymin;
- int ok= 0;
- char name[32];
-
- sprintf(name, "Preview %p", sa);
- BLI_lock_malloc_thread();
- RE_GetResultImage(RE_GetRender(name), &rres);
-
- if(rres.rectf) {
-
- if( ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2 ) {
- /* correct size, then black outline matches */
- rect->xmax= rect->xmin + rres.rectx;
- rect->ymax= rect->ymin + rres.recty;
+ if(idp) {
+ ScrArea *sa= CTX_wm_area(C);
+ SpaceButs *sbuts= sa->spacedata.first;
+ RenderResult rres;
+ int newx= rect->xmax-rect->xmin, newy= rect->ymax-rect->ymin;
+ int ok= 0;
+ char name[32];
- glaDrawPixelsSafe(rect->xmin, rect->ymin, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_FLOAT, rres.rectf);
- ok= 1;
+ sprintf(name, "Preview %p", sa);
+ BLI_lock_malloc_thread();
+ RE_GetResultImage(RE_GetRender(name), &rres);
+
+ if(rres.rectf) {
+
+ if( ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2 ) {
+ /* correct size, then black outline matches */
+ rect->xmax= rect->xmin + rres.rectx;
+ rect->ymax= rect->ymin + rres.recty;
+
+ glaDrawPixelsSafe(rect->xmin, rect->ymin, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_FLOAT, rres.rectf);
+ ok= 1;
+ }
}
- }
- BLI_unlock_malloc_thread();
+ BLI_unlock_malloc_thread();
- /* check for spacetype... */
- if(sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
- sbuts->preview= 0;
- ok= 0;
- }
-
- if(ok==0) {
- printf("added shader job\n");
- ED_preview_shader_job(C, sa, idp, newx, newy);
- }
-
+ /* check for spacetype... */
+ if(sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
+ sbuts->preview= 0;
+ ok= 0;
+ }
+
+ if(ok==0) {
+ printf("added shader job\n");
+ ED_preview_shader_job(C, sa, idp, newx, newy);
+ }
+ }
}
/* *************************** Preview for 3d window *********************** */