451
451
openexr_header_compression(&header, compress);
452
452
/* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */
454
header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.43"));
454
header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.43 and newer"));
456
456
data->ofile = new OutputFile(filename, header);
853
853
printf("OpenEXR-load: Found channel %s of type %d\n", i.name(), channel.type);
857
/* for non-multilayer, map R G B A channel names to something that's in this file */
858
static const char *exr_rgba_channelname(InputFile *file, const char *chan)
860
const ChannelList &channels = file->header().channels();
862
for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
864
const Channel &channel = i.channel();
865
const char *str= i.name();
866
int len= strlen(str);
868
if(BLI_strcasecmp(chan, str+len-1)==0) {
858
878
static int exr_has_zbuffer(InputFile *file)
896
916
//printf("OpenEXR-load: image data window %d %d %d %d\n",
897
917
// dw.min.x, dw.min.y, dw.max.x, dw.max.y);
899
// exr_print_filecontents(file);
920
exr_print_filecontents(file);
901
922
is_multi= exr_is_renderresult(file);
935
956
/* but, since we read y-flipped (negative y stride) we move to last scanline */
936
957
first+= 4*(height-1)*width;
938
frameBuffer.insert ("R", Slice (FLOAT, (char *) first, xstride, ystride));
939
frameBuffer.insert ("G", Slice (FLOAT, (char *) (first+1), xstride, ystride));
940
frameBuffer.insert ("B", Slice (FLOAT, (char *) (first+2), xstride, ystride));
941
/* 1.0 is fill value */
942
frameBuffer.insert ("A", Slice (FLOAT, (char *) (first+3), xstride, ystride, 1, 1, 1.0f));
959
frameBuffer.insert ( exr_rgba_channelname(file, "R"),
960
Slice (FLOAT, (char *) first, xstride, ystride));
961
frameBuffer.insert ( exr_rgba_channelname(file, "G"),
962
Slice (FLOAT, (char *) (first+1), xstride, ystride));
963
frameBuffer.insert ( exr_rgba_channelname(file, "B"),
964
Slice (FLOAT, (char *) (first+2), xstride, ystride));
966
frameBuffer.insert ( exr_rgba_channelname(file, "A"),
967
Slice (FLOAT, (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); /* 1.0 is fill value */
944
969
if(exr_has_zbuffer(file))