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.
This commit is contained in:
parent
d4cdae29c1
commit
bf352df27a
Notes:
blender-bot
2023-02-14 06:17:17 +01:00
Referenced by issue #98310, Alembic export is duplicating a frame every two frames when exporting fluid sims at high starting frame
|
@ -54,6 +54,7 @@ bool IMB_colormanagement_space_is_scene_linear(struct ColorSpace *colorspace);
|
|||
bool IMB_colormanagement_space_is_srgb(struct ColorSpace *colorspace);
|
||||
bool IMB_colormanagement_space_name_is_data(const char *name);
|
||||
bool IMB_colormanagement_space_name_is_scene_linear(const char *name);
|
||||
bool IMB_colormanagement_space_name_is_srgb(const char *name);
|
||||
|
||||
/**
|
||||
* Convert a float RGB triplet to the correct luminance weighted average.
|
||||
|
|
|
@ -1412,6 +1412,12 @@ bool IMB_colormanagement_space_name_is_scene_linear(const char *name)
|
|||
return (colorspace && IMB_colormanagement_space_is_scene_linear(colorspace));
|
||||
}
|
||||
|
||||
bool IMB_colormanagement_space_name_is_srgb(const char *name)
|
||||
{
|
||||
ColorSpace *colorspace = colormanage_colorspace_get_named(name);
|
||||
return (colorspace && IMB_colormanagement_space_is_srgb(colorspace));
|
||||
}
|
||||
|
||||
const float *IMB_colormanagement_get_xyz_to_rgb()
|
||||
{
|
||||
return &imbuf_xyz_to_rgb[0][0];
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
@ -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) {
|
||||
if (IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name)) {
|
||||
return usdtokens::raw;
|
||||
}
|
||||
if (strcmp(ima->colorspace_settings.name, "Non-Color") == 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue