diff --git a/src/deadline/nuke_submitter/assets.py b/src/deadline/nuke_submitter/assets.py index 4a4cd46..8c53261 100644 --- a/src/deadline/nuke_submitter/assets.py +++ b/src/deadline/nuke_submitter/assets.py @@ -95,27 +95,24 @@ def get_scene_asset_references() -> AssetReferences: for search_path in ocio_config_search_paths: asset_references.input_directories.add(search_path) else: - nuke.alert( - "OCIO config file specified(%s) is not an existing file." % ocio_config_path + raise DeadlineOperationError( + "OCIO config file specified(%s) is not an existing file. Please check and update the config file before proceeding." + % ocio_config_path ) return asset_references def get_ocio_config_path() -> Optional[str]: - ocio_config_path = None - # if using a custom OCIO environment variable if nuke_ocio.is_env_config_enabled(): - ocio_config_path = nuke_ocio.get_env_config_path() + return nuke_ocio.get_env_config_path() + elif nuke_ocio.is_custom_config_enabled(): + return nuke_ocio.get_custom_config_path() + elif nuke_ocio.is_stock_config_enabled(): + return nuke_ocio.get_stock_config_path() else: - print("here?") - # if using a custom OCIO config file - if nuke_ocio.is_custom_config_enabled(): - ocio_config_path = nuke_ocio.get_custom_config_path() - elif nuke_ocio.is_stock_config_enabled(): - ocio_config_path = nuke_ocio.get_stock_config_path() - return ocio_config_path + return None def find_all_write_nodes() -> set: diff --git a/src/deadline/nuke_submitter/deadline_submitter_for_nuke.py b/src/deadline/nuke_submitter/deadline_submitter_for_nuke.py index 8e1eac5..36b866e 100644 --- a/src/deadline/nuke_submitter/deadline_submitter_for_nuke.py +++ b/src/deadline/nuke_submitter/deadline_submitter_for_nuke.py @@ -128,19 +128,7 @@ def _add_ocio_path_to_job_template(job_template: dict[str, Any]) -> None: 0, { "name": "Add OCIO Path to Environment Variable", - "script": { - "actions": {"onEnter": {"command": "{{Env.File.Enter}}"}}, - "embeddedFiles": [ - { - "name": "Enter", - "type": "TEXT", - "runnable": True, - "data": """#!/bin/bash - echo 'openjd_env: OCIO={{Param.OCIOConfigPath}}' - """, - } - ], - }, + "variables": {"OCIO": "{{Param.OCIOConfigPath}}"}, }, ) @@ -289,8 +277,12 @@ def _get_parameter_values( # Set the OCIO config path value if nuke_ocio.is_OCIO_enabled(): ocio_config_path = get_ocio_config_path() - parameter_values.append({"name": "OCIOConfigPath", "value": ocio_config_path}) - + if ocio_config_path: + parameter_values.append({"name": "OCIOConfigPath", "value": ocio_config_path}) + else: + raise DeadlineOperationError( + "OCIO is enabled but OCIO config file is not specified. Please check and update the config file before proceeding." + ) if settings.include_adaptor_wheels: wheels_path = str(Path(__file__).parent.parent.parent.parent / "wheels") parameter_values.append({"name": "AdaptorWheels", "value": wheels_path}) diff --git a/src/deadline/nuke_util/ocio.py b/src/deadline/nuke_util/ocio.py index 96cbdbd..7c7ed54 100644 --- a/src/deadline/nuke_util/ocio.py +++ b/src/deadline/nuke_util/ocio.py @@ -21,7 +21,7 @@ def get_env_config_path() -> Optional[str]: def is_stock_config_enabled() -> bool: - """True if the script is using a custom OCIO config""" + """True if the script is using a default OCIO config""" return ( nuke.root().knob("colorManagement").value() == "OCIO" and nuke.root().knob("OCIO_config").value() != "custom" diff --git a/test/unit/deadline_submitter_for_nuke/test_ocio.py b/test/unit/deadline_submitter_for_nuke/test_ocio.py index 5c2c9f1..0478fd6 100644 --- a/test/unit/deadline_submitter_for_nuke/test_ocio.py +++ b/test/unit/deadline_submitter_for_nuke/test_ocio.py @@ -26,19 +26,7 @@ def test_add__dir_to_job_template(): expected_environment = { "name": "Add OCIO Path to Environment Variable", - "script": { - "actions": {"onEnter": {"command": "{{Env.File.Enter}}"}}, - "embeddedFiles": [ - { - "name": "Enter", - "type": "TEXT", - "runnable": True, - "data": """#!/bin/bash - echo 'openjd_env: OCIO={{Param.OCIOConfigPath}}' - """, - } - ], - }, + "variables": {"OCIO": "{{Param.OCIOConfigPath}}"}, } assert len(job_template["jobEnvironments"]) == 1