"Save Buffers" fix: when you ESC from rendering, it now saves empty

tiles in the file, that read back fast as black. This also solves
crashes on partial written files, when trying to read them.
This commit is contained in:
Ton Roosendaal 2006-12-21 19:37:53 +00:00
parent 67769dc080
commit ac37a15675
3 changed files with 25 additions and 2 deletions

View 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)
{

View 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),

View 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 */