diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/image_save.cc | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 29 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_multi.h | 7 | ||||
-rw-r--r-- | source/blender/render/RE_pipeline.h | 7 | ||||
-rw-r--r-- | source/blender/render/intern/render_result.c | 43 |
5 files changed, 47 insertions, 43 deletions
diff --git a/source/blender/blenkernel/intern/image_save.cc b/source/blender/blenkernel/intern/image_save.cc index ecf01e1f912..3e7bc8a954a 100644 --- a/source/blender/blenkernel/intern/image_save.cc +++ b/source/blender/blenkernel/intern/image_save.cc @@ -510,7 +510,7 @@ bool BKE_image_render_write_exr(ReportList *reports, const char *chan_id = "RGBA"; if (multi_layer) { - IMB_exr_channel_name(passname, nullptr, "Combined", nullptr, chan_id, a); + RE_render_result_full_channel_name(passname, nullptr, "Combined", nullptr, chan_id, a); BLI_strncpy(layname, "Composite", sizeof(layname)); } else { @@ -568,7 +568,7 @@ bool BKE_image_render_write_exr(ReportList *reports, char layname[EXR_PASS_MAXNAME]; if (multi_layer) { - IMB_exr_channel_name(passname, nullptr, rp->name, nullptr, rp->chan_id, a); + RE_render_result_full_channel_name(passname, nullptr, rp->name, nullptr, rp->chan_id, a); BLI_strncpy(layname, rl->name, sizeof(layname)); } else { diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 09d567c7827..d9b623cb765 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1492,35 +1492,6 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa return 1; } -void IMB_exr_channel_name(char *fullname, - const char *layname, - const char *passname, - const char *viewname, - const char *chan_id, - const int channel) -{ - const char *strings[4]; - int strings_len = 0; - - if (layname && layname[0]) { - strings[strings_len++] = layname; - } - if (passname && passname[0]) { - strings[strings_len++] = passname; - } - if (viewname && viewname[0]) { - strings[strings_len++] = viewname; - } - - char token[2]; - if (channel >= 0) { - ARRAY_SET_ITEMS(token, chan_id[channel], '\0'); - strings[strings_len++] = token; - } - - BLI_string_join_array_by_sep_char(fullname, EXR_PASS_MAXNAME, '.', strings, strings_len); -} - static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname) { ExrLayer *lay = (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name)); diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index 32a06a50c12..f5a2f983b18 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -105,13 +105,6 @@ void IMB_exr_add_view(void *handle, const char *name); bool IMB_exr_has_multilayer(void *handle); -void IMB_exr_channel_name(char *fullname, - const char *layname, - const char *passname, - const char *viewname, - const char *chan_id, - const int channel); - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/source/blender/render/RE_pipeline.h b/source/blender/render/RE_pipeline.h index f093f1f6e15..ed370d89dc2 100644 --- a/source/blender/render/RE_pipeline.h +++ b/source/blender/render/RE_pipeline.h @@ -242,6 +242,13 @@ void RE_AcquiredResultGet32(struct Render *re, unsigned int *rect, int view_id); +void RE_render_result_full_channel_name(char *fullname, + const char *layname, + const char *passname, + const char *viewname, + const char *chan_id, + const int channel); + struct ImBuf *RE_render_result_rect_to_ibuf(struct RenderResult *rr, const struct ImageFormatData *imf, const float dither, diff --git a/source/blender/render/intern/render_result.c b/source/blender/render/intern/render_result.c index d938c15e35e..212df1e1c00 100644 --- a/source/blender/render/intern/render_result.c +++ b/source/blender/render/intern/render_result.c @@ -208,13 +208,14 @@ RenderPass *render_layer_add_pass(RenderResult *rr, BLI_strncpy(rpass->name, name, sizeof(rpass->name)); BLI_strncpy(rpass->chan_id, chan_id, sizeof(rpass->chan_id)); BLI_strncpy(rpass->view, viewname, sizeof(rpass->view)); - IMB_exr_channel_name(rpass->fullname, NULL, rpass->name, rpass->view, rpass->chan_id, -1); + RE_render_result_full_channel_name( + rpass->fullname, NULL, rpass->name, rpass->view, rpass->chan_id, -1); if (rl->exrhandle) { int a; for (a = 0; a < channels; a++) { char passname[EXR_PASS_MAXNAME]; - IMB_exr_channel_name(passname, NULL, rpass->name, NULL, rpass->chan_id, a); + RE_render_result_full_channel_name(passname, NULL, rpass->name, NULL, rpass->chan_id, a); IMB_exr_add_channel(rl->exrhandle, rl->name, passname, viewname, 0, 0, NULL, false); } } @@ -508,6 +509,36 @@ void RE_create_render_pass(RenderResult *rr, } } +void RE_render_result_full_channel_name(char *fullname, + const char *layname, + const char *passname, + const char *viewname, + const char *chan_id, + const int channel) +{ + /* OpenEXR compatible full channel name. */ + const char *strings[4]; + int strings_len = 0; + + if (layname && layname[0]) { + strings[strings_len++] = layname; + } + if (passname && passname[0]) { + strings[strings_len++] = passname; + } + if (viewname && viewname[0]) { + strings[strings_len++] = viewname; + } + + char token[2]; + if (channel >= 0) { + ARRAY_SET_ITEMS(token, chan_id[channel], '\0'); + strings[strings_len++] = token; + } + + BLI_string_join_array_by_sep_char(fullname, EXR_PASS_MAXNAME, '.', strings, strings_len); +} + static int passtype_from_name(const char *name) { const char delim[] = {'.', '\0'}; @@ -584,7 +615,7 @@ static void ml_addpass_cb(void *base, rpass->rect = rect; BLI_strncpy(rpass->name, name, EXR_PASS_MAXNAME); BLI_strncpy(rpass->view, view, sizeof(rpass->view)); - IMB_exr_channel_name(rpass->fullname, NULL, name, view, rpass->chan_id, -1); + RE_render_result_full_channel_name(rpass->fullname, NULL, name, view, rpass->chan_id, -1); if (view[0] != '\0') { rpass->view_id = BLI_findstringindex(&rr->views, view, offsetof(RenderView, name)); @@ -899,12 +930,14 @@ int render_result_exr_file_read_path(RenderResult *rr, char fullname[EXR_PASS_MAXNAME]; for (a = 0; a < xstride; a++) { - IMB_exr_channel_name(fullname, NULL, rpass->name, rpass->view, rpass->chan_id, a); + RE_render_result_full_channel_name( + fullname, NULL, rpass->name, rpass->view, rpass->chan_id, a); IMB_exr_set_channel( exrhandle, rl->name, fullname, xstride, xstride * rectx, rpass->rect + a); } - IMB_exr_channel_name(rpass->fullname, NULL, rpass->name, rpass->view, rpass->chan_id, -1); + RE_render_result_full_channel_name( + rpass->fullname, NULL, rpass->name, rpass->view, rpass->chan_id, -1); } } |