diff options
author | Ton Roosendaal <ton@blender.org> | 2006-07-07 21:08:04 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-07-07 21:08:04 +0400 |
commit | 46110ec06b8fe5b5b0c242d5dd48cfb6a3ff7236 (patch) | |
tree | 24ebd0318f67714b4d49dea2fadf9ba94a3fcbc6 /source/blender/src/butspace.c | |
parent | ace48877ea8ab8f24e7e10bae45050cbbe2773bc (diff) |
Bugfix: (own todo)
When you rename a generated image, like "Render Result" or "Composite"
the float buffer in this image had to be copied, otherwise a next render
will make the renamed Image buffer invalid.
Note that renaming will not mean the images get packed or saved! So on
reloading .blend they're gone.
Diffstat (limited to 'source/blender/src/butspace.c')
-rw-r--r-- | source/blender/src/butspace.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c index 2d293966e79..cabb916c9a1 100644 --- a/source/blender/src/butspace.c +++ b/source/blender/src/butspace.c @@ -42,6 +42,7 @@ #include "MEM_guardedalloc.h" #include "DNA_color_types.h" +#include "DNA_image_types.h" #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -76,6 +77,9 @@ #include "BIF_glutil.h" #include "BIF_resources.h" +#include "IMB_imbuf_types.h" +#include "IMB_imbuf.h" + #include "mydevice.h" #include "butspace.h" // own module @@ -93,10 +97,32 @@ char texstr[20][12]= {"None" , "Clouds" , "Wood", "Marble", "Magic" , "Blend", "Voronoi", "DistNoise", "", "", "", "", "", ""}; /* ---------------------------------------------------------------------- */ -void test_idbutton_cb(void *namev, void *arg2_unused) +void test_idbutton_cb(void *namev, void *arg2) { char *name= namev; test_idbutton(name+2); + + /* temporal! image rename for procedural Image has issues */ + if(arg2 && GS(name)==ID_IM) { + /* when name changed */ + if(strcmp(name+2, (char *)arg2)) { + ID *id= NULL; + if(strcmp((char *)arg2, "Render Result")==0) + id= find_id(name, name+2); + else if(strcmp((char *)arg2, "Compositor")==0) + id= find_id(name, name+2); + if(id) { + Image *ima= (Image *)id; + if(ima->ibuf) { + /* ibuf rect or rect_float is possibly not allocated but borrowed */ + ImBuf *ibuf= IMB_dupImBuf(ima->ibuf); + IMB_freeImBuf(ima->ibuf); + ima->ibuf= ibuf; + printf("changed ima %s\n", name); + } + } + } + } } |