diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2014-05-07 02:12:31 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2014-05-07 02:30:54 +0400 |
commit | d653c70ee65856d74aaa1712b52b51b62e7c527c (patch) | |
tree | 596a7d898b17bc238f474fc9518f0e01bda371ae /source/blender/editors/object/object_bake_api.c | |
parent | 2c4ea2a11ed7e9724b7b5c736ed5ff5db1681662 (diff) |
Bake API: force opengl reload and mipmap recalc (fix T40055)
Diffstat (limited to 'source/blender/editors/object/object_bake_api.c')
-rw-r--r-- | source/blender/editors/object/object_bake_api.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 17f323b2452..72adc6c1589 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -69,6 +69,7 @@ #include "ED_screen.h" #include "ED_uvedit.h" +#include "GPU_draw.h" #include "object_intern.h" @@ -175,6 +176,12 @@ static bool write_internal_bake_pixels( if (ibuf->rect_float) ibuf->userflags |= IB_RECT_INVALID; + /* force mipmap recalc */ + if (ibuf->mipmap[0]) { + ibuf->userflags |= IB_MIPMAP_INVALID; + imb_freemipmapImBuf(ibuf); + } + BKE_image_release_ibuf(image, ibuf, NULL); if (mask_buffer) @@ -183,6 +190,18 @@ static bool write_internal_bake_pixels( return true; } +/* force OpenGL reload */ +static void reset_images_gpu(BakeImages *bake_images) +{ + int i; + for (i = 0; i < bake_images->size; i++) { + Image *ima = bake_images->data[i].image; + if (ima->ok == IMA_OK_LOADED) { + GPU_free_image(ima); + } + } +} + static bool write_external_bake_pixels( const char *filepath, BakePixel pixel_array[], float *buffer, const int width, const int height, const int margin, @@ -793,6 +812,8 @@ static int bake( } } + if (is_save_internal) + reset_images_gpu(&bake_images); cleanup: |