diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-04-11 20:38:45 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-04-11 21:10:42 +0300 |
commit | c65b022e6207865702357d07d19b5d576dbfb136 (patch) | |
tree | 543297567690b1bea37e0a124f54c3d6a515a25e /intern/opencolorio/ocio_impl.cc | |
parent | a99639792b1628493139eb9943ae4befbdc6b613 (diff) |
Fix OpenColorIO error with configs using <USE_DISPLAY_NAME>
* Don't assume the display colorspace name fully defines the transform
to display space, this is not true in OpenColorIO 2 where view transforms
may be defined in more complexs ways than just specifying a colorspace.
* In places where we need to store the display colorspace name, resolve
<USE_DISPLAY_NAME> token manually.
Ref T96590
Diffstat (limited to 'intern/opencolorio/ocio_impl.cc')
-rw-r--r-- | intern/opencolorio/ocio_impl.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc index ca1b7cc42e1..8d9c5dd2d49 100644 --- a/intern/opencolorio/ocio_impl.cc +++ b/intern/opencolorio/ocio_impl.cc @@ -254,7 +254,12 @@ const char *OCIOImpl::configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *conf const char *view) { try { - return (*(ConstConfigRcPtr *)config)->getDisplayViewColorSpaceName(display, view); + const char *name = (*(ConstConfigRcPtr *)config)->getDisplayViewColorSpaceName(display, view); + /* OpenColorIO does not resolve this token for us, so do it ourselves. */ + if (strcasecmp(name, "<USE_DISPLAY_NAME>") == 0) { + return display; + } + return name; } catch (Exception &exception) { OCIO_reportException(exception); @@ -655,7 +660,8 @@ OCIO_ConstProcessorRcPtr *OCIOImpl::createDisplayProcessor(OCIO_ConstConfigRcPtr const char *display, const char *look, const float scale, - const float exponent) + const float exponent, + const bool inverse) { ConstConfigRcPtr config = *(ConstConfigRcPtr *)config_; @@ -718,6 +724,10 @@ OCIO_ConstProcessorRcPtr *OCIOImpl::createDisplayProcessor(OCIO_ConstConfigRcPtr group->appendTransform(et); } + if (inverse) { + group->setDirection(TRANSFORM_DIR_INVERSE); + } + /* Create processor from transform. This is the moment were OCIO validates * the entire transform, no need to check for the validity of inputs above. */ ConstProcessorRcPtr *p = MEM_new<ConstProcessorRcPtr>(__func__); |