diff options
Diffstat (limited to 'source/blender/imbuf/intern/openexr/openexr_api.cpp')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 9fd6cd1c3fa..88f6508d356 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -76,18 +76,18 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void) #include <IlmImf/ImfStringAttribute.h> #include <Imath/ImathBox.h> #else -#include <OpenEXR/half.h> -#include <OpenEXR/ImfVersion.h> -#include <OpenEXR/ImathBox.h> -#include <OpenEXR/ImfArray.h> -#include <OpenEXR/ImfIO.h> -#include <OpenEXR/ImfChannelList.h> -#include <OpenEXR/ImfPixelType.h> -#include <OpenEXR/ImfInputFile.h> -#include <OpenEXR/ImfOutputFile.h> -#include <OpenEXR/ImfCompression.h> -#include <OpenEXR/ImfCompressionAttribute.h> -#include <OpenEXR/ImfStringAttribute.h> +#include <half.h> +#include <ImfVersion.h> +#include <ImathBox.h> +#include <ImfArray.h> +#include <ImfIO.h> +#include <ImfChannelList.h> +#include <ImfPixelType.h> +#include <ImfInputFile.h> +#include <ImfOutputFile.h> +#include <ImfCompression.h> +#include <ImfCompressionAttribute.h> +#include <ImfStringAttribute.h> #endif using namespace Imf; @@ -487,7 +487,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname } /* only used for writing temp. render results (not image files) */ -void IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress) +int IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress) { ExrHandle *data= (ExrHandle *)handle; Header header (width, height); @@ -504,8 +504,17 @@ void IMB_exr_begin_write(void *handle, const char *filename, int width, int heig /* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */ header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer")); - - data->ofile = new OutputFile(filename, header); + + /* avoid crash/abort when we dont have permission to write here */ + try { + data->ofile = new OutputFile(filename, header); + } + catch (const std::exception &exc) { + std::cerr << "IMB_exr_begin_write: ERROR: " << exc.what() << std::endl; + data->ofile = NULL; + } + + return (data->ofile != NULL); } void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) |