diff options
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_outputFile.c')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_outputFile.c | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index fe23f7373fb..e8a650682c2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -225,183 +225,6 @@ static void update_output_file(bNodeTree *UNUSED(ntree), bNode *node) } } -#ifdef WITH_COMPOSITOR_LEGACY - -/* write input data into individual files */ -static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack **in) -{ - Main *bmain= G.main; /* TODO, have this passed along */ - NodeImageMultiFile *nimf= node->storage; - bNodeSocket *sock; - int i; - int has_preview = 0; - - for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) { - if (in[i]->data) { - NodeImageMultiFileSocket *sockdata = sock->storage; - ImageFormatData *format = (sockdata->use_node_format ? &nimf->format : &sockdata->format); - char path[FILE_MAX]; - char filename[FILE_MAX]; - CompBuf *cbuf = NULL; - ImBuf *ibuf; - - switch (format->planes) { - case R_IMF_PLANES_BW: - cbuf = typecheck_compbuf(in[i]->data, CB_VAL); - break; - case R_IMF_PLANES_RGB: - cbuf = typecheck_compbuf(in[i]->data, CB_VEC3); - break; - case R_IMF_PLANES_RGBA: - cbuf = typecheck_compbuf(in[i]->data, CB_RGBA); - break; - } - - ibuf = IMB_allocImBuf(cbuf->x, cbuf->y, format->planes, 0); - /* XXX have to set this explicitly it seems */ - switch (format->planes) { - case R_IMF_PLANES_BW: ibuf->channels = 1; break; - case R_IMF_PLANES_RGB: ibuf->channels = 3; break; - case R_IMF_PLANES_RGBA: ibuf->channels = 4; break; - } - ibuf->rect_float = cbuf->rect; - ibuf->dither = rd->dither_intensity; - - /* get full path */ - BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sockdata->path); - BKE_makepicstring(filename, path, bmain->name, rd->cfra, format, (rd->scemode & R_EXTENSION), TRUE); - - if (0 == BKE_imbuf_write(ibuf, filename, format)) - printf("Cannot save Node File Output to %s\n", filename); - else - printf("Saved: %s\n", filename); - - IMB_freeImBuf(ibuf); - - /* simply pick the first valid input for preview */ - if (!has_preview) { - generate_preview(rd, node, cbuf); - has_preview = 1; - } - - if (in[i]->data != cbuf) - free_compbuf(cbuf); - } - } -} - -/* write input data into layers */ -static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack **in) -{ - Main *bmain= G.main; /* TODO, have this passed along */ - NodeImageMultiFile *nimf= node->storage; - void *exrhandle= IMB_exr_get_handle(); - char filename[FILE_MAX]; - bNodeSocket *sock; - int i; - /* Must have consistent pixel size for exr file, simply take the first valid input size. */ - int rectx = -1; - int recty = -1; - int has_preview = 0; - - BKE_makepicstring_from_type(filename, nimf->base_path, bmain->name, rd->cfra, R_IMF_IMTYPE_MULTILAYER, (rd->scemode & R_EXTENSION), TRUE); - BLI_make_existing_file(filename); - - for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) { - if (in[i]->data) { - NodeImageMultiFileSocket *sockdata = sock->storage; - CompBuf *cbuf = in[i]->data; - char channelname[EXR_TOT_MAXNAME]; /* '.' and single character channel name is appended */ - char *channelname_ext; - - if (cbuf->rect_procedural) { - printf("Error writing multilayer EXR: Procedural buffer not supported\n"); - continue; - } - if (rectx < 0) { - rectx = cbuf->x; - recty = cbuf->y; - } - else if (cbuf->x != rectx || cbuf->y != recty) { - printf("Error: Multilayer EXR output node %s expects same resolution for all input buffers. Layer %s skipped.\n", node->name, sock->name); - continue; - } - - BLI_strncpy(channelname, sockdata->layer, sizeof(channelname)-2); - channelname_ext = channelname + strlen(channelname); - - /* create channels */ - switch (cbuf->type) { - case CB_VAL: - strcpy(channelname_ext, ".V"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 1, rectx, cbuf->rect); - break; - case CB_VEC2: - strcpy(channelname_ext, ".X"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 2, 2*rectx, cbuf->rect); - strcpy(channelname_ext, ".Y"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 2, 2*rectx, cbuf->rect+1); - break; - case CB_VEC3: - strcpy(channelname_ext, ".X"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 3, 3*rectx, cbuf->rect); - strcpy(channelname_ext, ".Y"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 3, 3*rectx, cbuf->rect+1); - strcpy(channelname_ext, ".Z"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 3, 3*rectx, cbuf->rect+2); - break; - case CB_RGBA: - strcpy(channelname_ext, ".R"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 4, 4*rectx, cbuf->rect); - strcpy(channelname_ext, ".G"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 4, 4*rectx, cbuf->rect+1); - strcpy(channelname_ext, ".B"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 4, 4*rectx, cbuf->rect+2); - strcpy(channelname_ext, ".A"); - IMB_exr_add_channel(exrhandle, NULL, channelname, 4, 4*rectx, cbuf->rect+3); - break; - } - - /* simply pick the first valid input for preview */ - if (!has_preview) { - generate_preview(rd, node, cbuf); - has_preview = 1; - } - } - } - - /* when the filename has no permissions, this can fail */ - if (IMB_exr_begin_write(exrhandle, filename, rectx, recty, nimf->format.exr_codec)) { - IMB_exr_write_channels(exrhandle); - } - else { - /* TODO, get the error from openexr's exception */ - /* XXX nice way to do report? */ - printf("Error Writing Render Result, see console\n"); - } - - IMB_exr_close(exrhandle); -} - -static void node_composit_exec_outputfile(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) -{ - RenderData *rd= data; - NodeImageMultiFile *nimf= node->storage; - - if (G.is_rendering == FALSE) { - /* only output files when rendering a sequence - - * otherwise, it overwrites the output files just - * scrubbing through the timeline when the compositor updates */ - return; - } - - if (nimf->format.imtype==R_IMF_IMTYPE_MULTILAYER) - exec_output_file_multilayer(rd, node, in); - else - exec_output_file_singlelayer(rd, node, in); -} -#endif /* WITH_COMPOSITOR_LEGACY */ - void register_node_type_cmp_output_file(bNodeTreeType *ttype) { static bNodeType ntype; @@ -412,9 +235,6 @@ void register_node_type_cmp_output_file(bNodeTreeType *ttype) node_type_init(&ntype, init_output_file); node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file); node_type_update(&ntype, update_output_file, NULL); -#ifdef WITH_COMPOSITOR_LEGACY - node_type_exec(&ntype, node_composit_exec_outputfile); -#endif nodeRegisterType(ttype, &ntype); } |