From 8666e3dd751f6202d39da644443ac5d15c9be9dd Mon Sep 17 00:00:00 2001 From: rebeccaLinx Date: Thu, 20 Jul 2023 13:00:10 +0800 Subject: [PATCH] fix nuke open file issue in ocio --- avalon/nuke/workio.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/avalon/nuke/workio.py b/avalon/nuke/workio.py index 273f9350d..37e658084 100644 --- a/avalon/nuke/workio.py +++ b/avalon/nuke/workio.py @@ -14,11 +14,23 @@ def has_unsaved_changes(): def save_file(filepath): path = filepath.replace("\\", "/") + if os.getenv("OCIO"): + nuke.knob("root.colorManagement", "OCIO") + nuke.knob("root.customOCIOConfigPath", os.environ['OCIO'].replace('\\', '/')) + + viewer = nuke.activeViewer() + if viewer: + v_node = viewer.node() + if 'sRGB (ACES)' in v_node['viewerProcess'].values(): + v_node['viewerProcess'].setValue('sRGB') + nuke.scriptSaveAs(path) nuke.Root()["name"].setValue(path) nuke.Root()["project_directory"].setValue(os.path.dirname(path)) nuke.Root().setModified(False) + _set_color_management() + def open_file(filepath): from reveries.common import get_frame_range