diff options
author | Ton Roosendaal <ton@blender.org> | 2006-04-10 17:27:06 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-04-10 17:27:06 +0400 |
commit | 331406ea272eb15a3f2f3acdcb43ffc696ebc4b1 (patch) | |
tree | 76718e7b238b2a4e3287151ee4d60171a79ee797 | |
parent | 2c42d342d9700553476ed59f4890e819ade5427e (diff) |
Bugfix #3702
Background image in 3d window didn't react on "reload image" options in
UV WIndow or Buttons Window.
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 1 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 21 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 1 |
3 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 03c6aad6cf6..e793ce2495e 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -58,6 +58,7 @@ struct RenderInfo; typedef struct BGpic { struct Image *ima; + struct ImBuf *ibuf; struct Tex *tex; float xof, yof, size, zoom, blend; short xim, yim; diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 6bab751977b..b983fa828b9 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -338,7 +338,7 @@ static void draw_bgpic(void) float x1, y1, x2, y2, cx, cy; bgpic= G.vd->bgpic; - if(bgpic==0) return; + if(bgpic==NULL) return; if(bgpic->tex) { extern void init_render_texture(struct Render *re, Tex *tex); @@ -351,16 +351,16 @@ static void draw_bgpic(void) ima= bgpic->ima; } - if(ima==0) return; + if(ima==NULL) return; if(ima->ok==0) return; tag_image_time(ima); /* test for image */ - if(ima->ibuf==0) { + if(ima->ibuf==NULL) { if(bgpic->rect) MEM_freeN(bgpic->rect); - bgpic->rect= 0; + bgpic->rect= NULL; if(bgpic->tex) { ima_ibuf_is_nul(bgpic->tex, bgpic->tex->ima); @@ -370,13 +370,20 @@ static void draw_bgpic(void) load_image(ima, IB_rect, G.sce, G.scene->r.cfra); waitcursor(0); } - if(ima->ibuf==0) { + if(ima->ibuf==NULL) { ima->ok= 0; return; } } - - if(bgpic->rect==0) { + + /* this ensures that when ibuf changed (reloaded) the backbuf changes too */ + if(bgpic->ibuf!=ima->ibuf) { + if(bgpic->rect) MEM_freeN(bgpic->rect); + bgpic->rect= NULL; + } + bgpic->ibuf= ima->ibuf; + + if(bgpic->rect==NULL) { bgpic->rect= MEM_dupallocN(ima->ibuf->rect); bgpic->xim= ima->ibuf->x; diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 61456fb0c38..fd3e69ce929 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -749,6 +749,7 @@ static void do_image_imagemenu(void *arg, int event) } allqueue(REDRAWIMAGE, 0); allqueue(REDRAWVIEW3D, 0); + BIF_preview_changed(ID_TE); break; case 7: /* New Image */ { |