"Save Buffers" fix: when you ESC from rendering, it now saves empty
authorTon Roosendaal <ton@blender.org>
Thu, 21 Dec 2006 19:37:53 +0000 (19:37 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 21 Dec 2006 19:37:53 +0000 (19:37 +0000)
tiles in the file, that read back fast as black. This also solves
crashes on partial written files, when trying to read them.

source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/openexr/openexr_multi.h
source/blender/render/intern/source/pipeline.c

index c035862c23ffc63c74cd98201c8929e04567610b..b39700e019cc8c68388bb9bbc8faca32df90fb92 100644 (file)
@@ -526,6 +526,11 @@ void IMB_exr_set_channel(void *handle, char *layname, char *passname, int xstrid
                printf("IMB_exrtile_set_channel error %s\n", name);
 }
 
+void IMB_exrtile_clear_channels(void *handle)
+{
+       ExrHandle *data= (ExrHandle *)handle;
+       BLI_freelistN(&data->channels);
+}
 
 void IMB_exrtile_write_channels(void *handle, int partx, int party)
 {
index b9aa81e81dac2db39a60f80a4137097d54a223d0..ca4f7405f44c293b40ae8822009f60a9244568da 100644 (file)
@@ -53,6 +53,7 @@ void  IMB_exr_set_channel                     (void *handle, char *layname, char *passname, int xst
 void   IMB_exr_read_channels           (void *handle);
 void   IMB_exr_write_channels          (void *handle);
 void   IMB_exrtile_write_channels      (void *handle, int partx, int party);
+void   IMB_exrtile_clear_channels      (void *handle);
 
 void    IMB_exr_multilayer_convert     (void *handle, void *base,  
                                                                         void * (*addlayer)(void *base, char *str), 
@@ -77,6 +78,7 @@ void  IMB_exr_set_channel                     (void *handle, char *layname, char *channame, int xst
 void   IMB_exr_read_channels           (void *handle) {}
 void   IMB_exr_write_channels          (void *handle) {}
 void   IMB_exrtile_write_channels      (void *handle, int partx, int party) {}
+void   IMB_exrtile_clear_channels      (void *handle) {}
 
 void    IMB_exr_multilayer_convert     (void *handle, void *base,  
                                                                         void * (*addlayer)(void *base, char *str), 
index f2015bcd4948ac8ea11f1b63753efb833a6a0777..84dcff1dd82181518aa0d0a66d2a55d00fbfd86d 100644 (file)
@@ -677,6 +677,22 @@ static void save_render_result_tile(Render *re, RenderPart *pa)
 
 }
 
+static void save_empty_result_tiles(Render *re)
+{
+       RenderPart *pa;
+       
+       IMB_exrtile_clear_channels(re->result->exrhandle);
+               
+       for(pa= re->parts.first; pa; pa= pa->next) {
+               if(pa->ready==0) {
+                       int party= pa->disprect.ymin - re->disprect.ymin + pa->crop;
+                       int partx= pa->disprect.xmin - re->disprect.xmin + pa->crop;
+                       IMB_exrtile_write_channels(re->result->exrhandle, partx, party);
+               }
+       }
+}
+
+
 /* for passes read from files, these have names stored */
 static char *make_pass_name(RenderPass *rpass, int chan)
 {
@@ -1429,10 +1445,10 @@ static void threaded_tile_processor(Render *re)
        }
        
        if(rr->exrhandle) {
+               save_empty_result_tiles(re);
                IMB_exr_close(rr->exrhandle);
                rr->exrhandle= NULL;
-               if(!re->test_break())
-                       read_render_result(re);
+               read_render_result(re);
        }
        
        /* unset threadsafety */