Skip to content

Commit 50fcaec

Browse files
authored
Merge pull request #301 from jhery-rdo/fix/ocio-empty-display-view-clobber
OCIO: don't discard resolved view when pipeline instance has no display (thumbnails / offscreen renders)
2 parents 0e4ecb0 + 934cd08 commit 50fcaec

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

src/plugin/colour_pipeline/ocio/src/ocio_engine.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,19 @@ thumbnail::ThumbnailBufferPtr OCIOEngine::process_thumbnail(
144144

145145
std::string _display = display;
146146
std::string _view = view;
147-
if (display.empty() or view.empty()) {
147+
// Fill display and view INDEPENDENTLY. The dedicated 'thumbnail_processor'
148+
// OCIO instance is never attached to a viewport/media source, so its Display
149+
// attribute is empty; the old combined `display.empty() or view.empty()`
150+
// check then reset _view to the config default view (e.g. Client-look),
151+
// double-grading raw / display-referred media in thumbnails. Only fill in a
152+
// value that is actually empty so a valid caller-supplied view survives.
153+
if (_display.empty())
148154
_display = ocio_config->getDefaultDisplay();
149-
_view = ocio_config->getDefaultView(_display.c_str());
150-
}
155+
if (_view.empty())
156+
_view = ocio_config->getDefaultView(_display.c_str());
151157

152158
auto to_lin_group =
153-
make_to_lin_processor(src_colour_mgmt_metadata, view, untonemapped_mode, false)
159+
make_to_lin_processor(src_colour_mgmt_metadata, _view, untonemapped_mode, false)
154160
->createGroupTransform();
155161
auto to_display_group =
156162
make_display_processor(src_colour_mgmt_metadata, _display, _view, false)
@@ -588,10 +594,16 @@ OCIO::TransformRcPtr OCIOEngine::display_transform(
588594
if (!bypass) {
589595
std::string _display = display;
590596
std::string _view = view;
591-
if (display.empty() or view.empty()) {
597+
// Fill display and view INDEPENDENTLY (same fix as process_thumbnail):
598+
// offscreen/snapshot viewport pipeline instances are never attached to
599+
// a physical display so their Display attribute is empty; the combined
600+
// `display.empty() or view.empty()` check then discarded a valid
601+
// caller-supplied view (e.g. 'raw' for un-tone-mapped media) and
602+
// double-graded offscreen renders such as annotation exports.
603+
if (_display.empty())
592604
_display = ocio_config->getDefaultDisplay();
593-
_view = ocio_config->getDefaultView(_display.c_str());
594-
}
605+
if (_view.empty())
606+
_view = ocio_config->getDefaultView(_display.c_str());
595607

596608
OCIO::DisplayViewTransformRcPtr dt = OCIO::DisplayViewTransform::Create();
597609
dt->setSrc(working_space(src_colour_mgmt_metadata).c_str());

0 commit comments

Comments
 (0)