diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index c920d7127ae..28fca2c29a6 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -256,7 +256,7 @@ int BLI_exist(char *name); void BLI_recurdir_fileops(char *dirname); int BLI_link(char *file, char *to); int BLI_backup(char *file, char *from, char *to); - +int BLI_is_writable(char *filename); /** * @attention Do not confuse with BLI_exist diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 9a4ffca4844..232546b89ca 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -125,6 +125,21 @@ int BLI_gzip(char *from, char *to) { return 0; } +/* return 1 when file can be written */ +int BLI_is_writable(char *filename) +{ + int file; + + file = open(filename, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666); + + if (file < 0) + return 0; + else { + close(file); + return 1; + } +} + #ifdef WIN32 static char str[MAXPATHLEN+12]; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 89aeea6a464..28e3b73dc2d 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1102,9 +1102,10 @@ static void threaded_tile_processor(Render *re) if(rr->exrhandle) { char str[FILE_MAXDIR+FILE_MAXFILE]; - render_unique_exr_name(re, str); - printf("write exr tmp file, %dx%d, %s\n", rr->rectx, rr->recty, str); + render_unique_exr_name(re, str); + + printf("write exr tmp file, %dx%d, %s\n", rr->rectx, rr->recty, str); IMB_exrtile_begin_write(rr->exrhandle, str, rr->rectx, rr->recty, rr->rectx/re->xparts, rr->recty/re->yparts); } @@ -1721,6 +1722,18 @@ static int is_rendering_allowed(Render *re) } } + if(re->r.scemode & R_EXR_TILE_FILE) { + char str[FILE_MAXDIR+FILE_MAXFILE]; + + render_unique_exr_name(re, str); + + if (BLI_is_writable(str)==0) { + re->error("Can not save render buffers, check the temp default path"); + return 0; + } + + } + if(re->r.scemode & R_DOCOMP) { if(re->scene->use_nodes) { bNodeTree *ntree= re->scene->nodetree;