From dc2baf29069afddad2c1c3a9acff64c85b7d8968 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 4 Jan 2023 14:56:40 +0800 Subject: [PATCH] check whether the ocio config enabled in maya for colorspace in maya --- .../hosts/maya/plugins/publish/extract_look.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/extract_look.py b/openpype/hosts/maya/plugins/publish/extract_look.py index df07a674dc..efe6c3c062 100644 --- a/openpype/hosts/maya/plugins/publish/extract_look.py +++ b/openpype/hosts/maya/plugins/publish/extract_look.py @@ -367,10 +367,19 @@ class ExtractLook(publish.Extractor): for filepath in files_metadata: linearize = False - if do_maketx and files_metadata[filepath]["color_space"].lower() == "srgb": # noqa: E501 - linearize = True - # set its file node to 'raw' as tx will be linearized - files_metadata[filepath]["color_space"] = "Raw" + # if OCIO color management enabled + # it wont take the condition of the files_metadata + + # TODO: if do_maketx: linearize=False + ocio_maya = cmds.colorManagementPrefs(q=True, + cmConfigFileEnabled=True, + cmEnabled=True) + + if do_maketx and not ocio_maya: + if files_metadata[filepath]["color_space"].lower() == "srgb": # noqa: E501 + linearize = True + # set its file node to 'raw' as tx will be linearized + files_metadata[filepath]["color_space"] = "Raw" # if do_maketx: # color_space = "Raw" @@ -421,6 +430,7 @@ class ExtractLook(publish.Extractor): color_space_attr = resource["node"] + ".colorSpace" try: color_space = cmds.getAttr(color_space_attr) + self.log.info("current colorspace: {0}".format(color_space)) except ValueError: # node doesn't have color space attribute color_space = "Raw"