mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
Merge branch 'feature/OP-4643_color-v3-global-oiio-transcoder-exctractor-plugin' into enchancement/OP-2630_acescg_maya
This commit is contained in:
commit
3039bdb84e
6 changed files with 67 additions and 16 deletions
|
|
@ -1047,6 +1047,7 @@ def convert_colorspace(
|
|||
target_colorspace,
|
||||
view=None,
|
||||
display=None,
|
||||
additional_command_args=None,
|
||||
logger=None
|
||||
):
|
||||
"""Convert source file from one color space to another.
|
||||
|
|
@ -1066,6 +1067,8 @@ def convert_colorspace(
|
|||
view (str): name for viewer space (ocio valid)
|
||||
both 'view' and 'display' must be filled (if 'target_colorspace')
|
||||
display (str): name for display-referred reference space (ocio valid)
|
||||
additional_command_args (list): arguments for oiiotool (like binary
|
||||
depth for .dpx)
|
||||
logger (logging.Logger): Logger used for logging.
|
||||
Raises:
|
||||
ValueError: if misconfigured
|
||||
|
|
@ -1088,6 +1091,9 @@ def convert_colorspace(
|
|||
if not target_colorspace and not all([view, display]):
|
||||
raise ValueError("Both screen and display must be set.")
|
||||
|
||||
if additional_command_args:
|
||||
oiio_cmd.extend(split_cmd_args(additional_command_args))
|
||||
|
||||
if target_colorspace:
|
||||
oiio_cmd.extend(["--colorconvert",
|
||||
source_colorspace,
|
||||
|
|
@ -1100,3 +1106,21 @@ def convert_colorspace(
|
|||
|
||||
logger.debug("Conversion command: {}".format(" ".join(oiio_cmd)))
|
||||
run_subprocess(oiio_cmd, logger=logger)
|
||||
|
||||
|
||||
def split_cmd_args(in_args):
|
||||
"""Makes sure all entered arguments are separated in individual items.
|
||||
|
||||
Split each argument string with " -" to identify if string contains
|
||||
one or more arguments.
|
||||
Args:
|
||||
in_args (list): of arguments ['-n', '-d uint10']
|
||||
Returns
|
||||
(list): ['-n', '-d', 'unint10']
|
||||
"""
|
||||
splitted_args = []
|
||||
for arg in in_args:
|
||||
if not arg.strip():
|
||||
continue
|
||||
splitted_args.extend(arg.split(" "))
|
||||
return splitted_args
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ oauth_config:
|
|||
- chat:write.public
|
||||
- files:write
|
||||
- channels:read
|
||||
- users:read
|
||||
- usergroups:read
|
||||
settings:
|
||||
org_deploy_enabled: false
|
||||
socket_mode_enabled: false
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
if not profile:
|
||||
return
|
||||
|
||||
repres = instance.data.get("representations") or []
|
||||
new_representations = []
|
||||
repres = instance.data["representations"]
|
||||
for idx, repre in enumerate(list(repres)):
|
||||
self.log.debug("repre ({}): `{}`".format(idx + 1, repre["name"]))
|
||||
if not self._repre_is_valid(repre):
|
||||
|
|
@ -117,7 +118,8 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
output_name,
|
||||
output_extension)
|
||||
|
||||
target_colorspace = output_def["colorspace"]
|
||||
target_colorspace = (output_def["colorspace"] or
|
||||
colorspace_data.get("colorspace"))
|
||||
view = output_def["view"] or colorspace_data.get("view")
|
||||
display = (output_def["display"] or
|
||||
colorspace_data.get("display"))
|
||||
|
|
@ -128,6 +130,9 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
if display:
|
||||
new_repre["colorspaceData"]["display"] = display
|
||||
|
||||
additional_command_args = (output_def["oiiotool_args"]
|
||||
["additional_command_args"])
|
||||
|
||||
files_to_convert = self._translate_to_sequence(
|
||||
files_to_convert)
|
||||
for file_name in files_to_convert:
|
||||
|
|
@ -144,6 +149,7 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
target_colorspace,
|
||||
view,
|
||||
display,
|
||||
additional_command_args,
|
||||
self.log
|
||||
)
|
||||
|
||||
|
|
@ -156,12 +162,12 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
|
||||
custom_tags = output_def.get("custom_tags")
|
||||
if custom_tags:
|
||||
if not new_repre.get("custom_tags"):
|
||||
if new_repre.get("custom_tags") is None:
|
||||
new_repre["custom_tags"] = []
|
||||
new_repre["custom_tags"].extend(custom_tags)
|
||||
|
||||
# Add additional tags from output definition to representation
|
||||
if not new_repre.get("tags"):
|
||||
if new_repre.get("tags") is None:
|
||||
new_repre["tags"] = []
|
||||
for tag in output_def["tags"]:
|
||||
if tag not in new_repre["tags"]:
|
||||
|
|
@ -170,9 +176,7 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
if tag == "review":
|
||||
added_review = True
|
||||
|
||||
new_repre["tags"].append("newly_added")
|
||||
|
||||
instance.data["representations"].append(new_repre)
|
||||
new_representations.append(new_repre)
|
||||
added_representations = True
|
||||
|
||||
if added_representations:
|
||||
|
|
@ -181,15 +185,11 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
|
||||
for repre in tuple(instance.data["representations"]):
|
||||
tags = repre.get("tags") or []
|
||||
# TODO implement better way, for now do not delete new repre
|
||||
# new repre might have 'delete' tag to removed, but it first must
|
||||
# be there for review to be created
|
||||
if "newly_added" in tags:
|
||||
tags.remove("newly_added")
|
||||
continue
|
||||
if "delete" in tags and "thumbnail" not in tags:
|
||||
instance.data["representations"].remove(repre)
|
||||
|
||||
instance.data["representations"].extend(new_representations)
|
||||
|
||||
def _rename_in_representation(self, new_repre, files_to_convert,
|
||||
output_name, output_extension):
|
||||
"""Replace old extension with new one everywhere in representation.
|
||||
|
|
@ -274,7 +274,7 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
"families": family,
|
||||
"task_names": task_name,
|
||||
"task_types": task_type,
|
||||
"subset": subset
|
||||
"subsets": subset
|
||||
}
|
||||
profile = filter_profiles(self.profiles, filtering_criteria,
|
||||
logger=self.log)
|
||||
|
|
|
|||
|
|
@ -286,6 +286,20 @@
|
|||
"label": "View",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "oiiotool_args",
|
||||
"label": "OIIOtool arguments",
|
||||
"type": "dict",
|
||||
"highlight_content": true,
|
||||
"children": [
|
||||
{
|
||||
"key": "additional_command_args",
|
||||
"label": "Arguments",
|
||||
"type": "list",
|
||||
"object_type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "schema",
|
||||
"name": "schema_representation_tags"
|
||||
|
|
|
|||
BIN
website/docs/project_settings/assets/global_oiio_transcode.png
Normal file
BIN
website/docs/project_settings/assets/global_oiio_transcode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
|
|
@ -45,6 +45,21 @@ The _input pattern_ matching uses REGEX expression syntax (try [regexr.com](http
|
|||
The **colorspace name** value is a raw string input and no validation is run after saving project settings. We recommend to open the specified `config.ocio` file and copy pasting the exact colorspace names.
|
||||
:::
|
||||
|
||||
### Extract OIIO Transcode
|
||||
OIIOTools transcoder plugin with configurable output presets. Any incoming representation with `colorspaceData` is convertable to single or multiple representations with different target colorspaces or display and viewer names found in linked **config.ocio** file.
|
||||
|
||||
`oiiotool` is used for transcoding, eg. `oiiotool` must be present in `vendor/bin/oiio` or environment variable `OPENPYPE_OIIO_PATHS` must be provided for custom oiio installation.
|
||||
|
||||
Notable parameters:
|
||||
- **`Delete Original Representation`** - keep or remove original representation. If old representation is kept, but there is new transcoded representation with 'Create review' tag, original representation looses its 'review' tag if present.
|
||||
- **`Extension`** - target extension. If left empty, original extension is used.
|
||||
- **`Colorspace`** - target colorspace, which must be available in used color config.
|
||||
- **`Display & View`** - transcoding into colorspace or into display and viewer space could be used. Cannot use both `Colorspace` and `Display & View` at the same time.
|
||||
- **`Arguments`** - special additional command line arguments for `oiiotool`.
|
||||
|
||||
|
||||
Example here describes use case for creation of new color coded review of png image sequence. Original representation's files are kept intact, review is created from transcoded files, but these files are removed in cleanup process.
|
||||

|
||||
|
||||
## Profile filters
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue