diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-05-20 17:41:51 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-05-20 18:07:37 +0300 |
commit | bf352df27a6f85d73bc0d6417f50fd62958cfb6e (patch) | |
tree | 9b8c7b15cf0678b53cd0858f015fb9aa3a1f5d79 /source/blender/io/usd | |
parent | d4cdae29c10768ec23c13aa585978dfeaf55baa6 (diff) |
Fix wrong USD image color space export with non-default OpenColorIO config
The names of color spaces in OpenColorIO configs can be arbitrary, so don't
use hardcoded names from our default config.
Diffstat (limited to 'source/blender/io/usd')
-rw-r--r-- | source/blender/io/usd/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/io/usd/intern/usd_writer_material.cc | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt index e2e959814fa..594dbe5ddd1 100644 --- a/source/blender/io/usd/CMakeLists.txt +++ b/source/blender/io/usd/CMakeLists.txt @@ -43,6 +43,7 @@ set(INC ../../bmesh ../../depsgraph ../../editors/include + ../../imbuf ../../makesdna ../../makesrna ../../windowmanager @@ -112,6 +113,7 @@ set(SRC set(LIB bf_blenkernel bf_blenlib + bf_imbuf bf_io_common ) diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc index 1bfc0e50f69..dd795e4f922 100644 --- a/source/blender/io/usd/intern/usd_writer_material.cc +++ b/source/blender/io/usd/intern/usd_writer_material.cc @@ -10,6 +10,8 @@ #include "BKE_main.h" #include "BKE_node.h" +#include "IMB_colormanagement.h" + #include "BLI_fileops.h" #include "BLI_linklist.h" #include "BLI_listbase.h" @@ -414,13 +416,10 @@ static pxr::TfToken get_node_tex_image_color_space(bNode *node) Image *ima = reinterpret_cast<Image *>(node->id); - if (strcmp(ima->colorspace_settings.name, "Raw") == 0) { - return usdtokens::raw; - } - if (strcmp(ima->colorspace_settings.name, "Non-Color") == 0) { + if (IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name)) { return usdtokens::raw; } - if (strcmp(ima->colorspace_settings.name, "sRGB") == 0) { + if (IMB_colormanagement_space_name_is_srgb(ima->colorspace_settings.name)) { return usdtokens::sRGB; } |