add doc strings

This commit is contained in:
Mustafa-Zarkash 2023-07-20 13:54:46 +03:00
parent d90d45c56d
commit 2bb11d956c
3 changed files with 55 additions and 3 deletions

View file

@ -71,7 +71,7 @@ class ValidateReviewColorspace(pyblish.api.InstancePlugin):
"""
import hou
from openpype.pipeline.colorspace import get_display_view_colorspace_name
from openpype.pipeline.colorspace import get_display_view_colorspace_name #noqa
from openpype.hosts.houdini.api.lib import get_color_management_preferences #noqa
rop_node = hou.node(instance.data["instance_node"])

View file

@ -591,6 +591,16 @@ def _get_imageio_settings(project_settings, host_name):
return imageio_global, imageio_host
def get_display_view_colorspace_name(config_path, display, view):
"""get view colorspace name for the given display and view.
Args:
config_path (str): path string leading to config.ocio
display (str): display name e.g. "ACES"
view (str): view name e.g. "sRGB"
Returns:
view color space name (str) e.g. "Output - sRGB"
"""
if not compatibility_check():
# python environment is not compatible with PyOpenColorIO
@ -603,6 +613,18 @@ def get_display_view_colorspace_name(config_path, display, view):
return _get_display_view_colorspace_name(config_path, display, view)
def get_display_view_colorspace_subprocess(config_path, display, view):
"""get view colorspace name for the given display and view
via subprocess.
Args:
config_path (str): path string leading to config.ocio
display (str): display name e.g. "ACES"
view (str): view name e.g. "sRGB"
Returns:
view color space name (str) e.g. "Output - sRGB"
"""
with _make_temp_json_file() as tmp_json_path:
# Prepare subprocess arguments
args = [

View file

@ -174,6 +174,21 @@ def _get_views_data(config_path):
return data
def _get_display_view_colorspace_name(config_path, display, view):
"""get view colorspace name for the given display and view.
Args:
config_path (str): path string leading to config.ocio
display (str): display name e.g. "ACES"
view (str): view name e.g. "sRGB"
Raises:
IOError: Input config does not exist.
Returns:
view color space name (str) e.g. "Output - sRGB"
"""
config_path = Path(config_path)
if not config_path.is_file():
@ -199,13 +214,28 @@ def _get_display_view_colorspace_name(config_path, display, view):
help="path where to write output json file",
type=click.Path())
@click.option("--display", required=True,
help="display",
help="display name",
type=click.STRING)
@click.option("--view", required=True,
help="view",
help="view name",
type=click.STRING)
def get_display_view_colorspace_name(in_path, out_path,
display, view):
"""Aggregate view colorspace name to file.
Python 2 wrapped console command
Args:
in_path (str): config file path string
out_path (str): temp json file path string
display (str): display name e.g. "ACES"
view (str): view name e.g. "sRGB"
Example of use:
> pyton.exe ./ocio_wrapper.py config \
get_display_view_colorspace_name --in_path=<path> \
--out_path=<path> --display=<display> --view=<view>
"""
json_path = Path(out_path)