mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
from openpype.lib import PreLaunchHook
|
|
|
|
from openpype.pipeline.colorspace import (
|
|
get_imageio_config,
|
|
is_host_use_ocio_config_activated
|
|
)
|
|
from openpype.pipeline.template_data import get_template_data_with_names
|
|
|
|
|
|
class OCIOEnvHook(PreLaunchHook):
|
|
"""Set OCIO environment variable for hosts that use OpenColorIO."""
|
|
|
|
order = 0
|
|
app_groups = [
|
|
"fusion",
|
|
"blender",
|
|
"aftereffects",
|
|
"3dsmax",
|
|
"houdini",
|
|
"maya",
|
|
"nuke",
|
|
"nukex",
|
|
"nukeassist",
|
|
"nukestudio",
|
|
"hiero"
|
|
]
|
|
|
|
def execute(self):
|
|
"""Hook entry method."""
|
|
|
|
template_data = get_template_data_with_names(
|
|
project_name=self.data["project_name"],
|
|
asset_name=self.data["asset_name"],
|
|
task_name=self.data["task_name"],
|
|
host_name=self.host_name,
|
|
system_settings=self.data["system_settings"]
|
|
)
|
|
|
|
config_data = get_imageio_config(
|
|
project_name=self.data["project_name"],
|
|
host_name=self.host_name,
|
|
project_settings=self.data["project_settings"],
|
|
anatomy_data=template_data,
|
|
anatomy=self.data["anatomy"]
|
|
)
|
|
|
|
if config_data:
|
|
use_config_path = is_host_use_ocio_config_activated(
|
|
project_name=self.data["project_name"],
|
|
host_name=self.host_name,
|
|
project_settings=self.data["project_settings"]
|
|
)
|
|
if not use_config_path:
|
|
self.log.info("Using of OCIO config path was not activated...")
|
|
return
|
|
|
|
ocio_path = config_data["path"]
|
|
|
|
self.log.info(f"Setting OCIO config path: {ocio_path}")
|
|
self.launch_context.env["OCIO"] = ocio_path
|