Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIIO Transcode: Simplify Extract OIIO transcode settings #853

Merged
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
fe9cef1
Easier settings for ExtractOIIOTranscode
MustafaJafar Aug 22, 2024
00d7f6c
adopt to the new settings
MustafaJafar Aug 22, 2024
d1e009d
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Aug 27, 2024
6b07c8c
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Sep 3, 2024
d903100
refactor settings names
MustafaJafar Sep 3, 2024
894fb2a
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Sep 3, 2024
d1363a8
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Sep 10, 2024
e29ade4
Add tool tips for `ExtractOIIOTranscode` settings
MustafaJafar Sep 11, 2024
e7f6870
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Sep 16, 2024
3c5603c
fix line lengths
MustafaJafar Sep 16, 2024
dddc9dc
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Sep 19, 2024
98918b1
Add `ExtractOIIOTranscode` settings override
MustafaJafar Sep 19, 2024
451d5e7
exit _convert_oiio_transcode_0_4_5 if there are no profiles
MustafaJafar Sep 23, 2024
d5929ce
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
jakubjezek001 Sep 25, 2024
8575251
optimize `_convert_oiio_transcode_0_4_5`
MustafaJafar Sep 26, 2024
4f1202e
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Sep 26, 2024
6f2e69c
fix code linting
MustafaJafar Sep 26, 2024
fa54805
enhance a condition in `_convert_oiio_transcode_0_4_5`
MustafaJafar Sep 26, 2024
8bbd03d
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode…
MustafaJafar Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions client/ayon_core/plugins/publish/extract_color_transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,22 @@ def process(self, instance):
transcoding_type = output_def["transcoding_type"]

target_colorspace = view = display = None
# NOTE: we use colorspace_data as the fallback values for
# the target colorspace.
if transcoding_type == "colorspace":
# TODO: Should we fallback to the colorspace
# (which used as source above) ?
# or should we compute the target colorspace from
# current view and display ?
target_colorspace = (output_def["colorspace"] or
colorspace_data.get("colorspace"))
else:
view = output_def["view"] or colorspace_data.get("view")
display = (output_def["display"] or
colorspace_data.get("display"))
elif transcoding_type == "display_view":
display_view = output_def["display_view"]
view = display_view["view"] or colorspace_data.get("view")
display = (
display_view["display"]
or colorspace_data.get("display")
)

# both could be already collected by DCC,
# but could be overwritten when transcoding
Expand Down Expand Up @@ -192,7 +201,7 @@ def process(self, instance):
new_repre["files"] = new_repre["files"][0]

# If the source representation has "review" tag, but its not
# part of the output defintion tags, then both the
# part of the output definition tags, then both the
# representations will be transcoded in ExtractReview and
# their outputs will clash in integration.
if "review" in repre.get("tags", []):
Expand Down
32 changes: 32 additions & 0 deletions server/settings/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,42 @@ def _convert_validate_version_0_3_3(publish_overrides):
validate_version["plugin_state_profiles"] = [profile]


def _convert_oiio_transcode_0_4_5(publish_overrides):
"""ExtractOIIOTranscode plugin changed in 0.4.5."""
if "ExtractOIIOTranscode" not in publish_overrides:
return

transcode_profiles = publish_overrides["ExtractOIIOTranscode"].get("profiles")
if not transcode_profiles:
return

for profile in transcode_profiles:
outputs = profile.get("outputs")
if outputs is None:
return

for output in outputs :
# Already new settings
if "display" not in output and "view" not in output:
MustafaJafar marked this conversation as resolved.
Show resolved Hide resolved
break

# Fix 'display' -> 'display_view' in 'transcoding_type'
transcode_type = output.get("transcoding_type")
if transcode_type == "display":
output["transcoding_type"] = "display_view"

# Convert 'display' and 'view' to new values
output["display_view"] = {
"display": output.pop("display", ""),
"view": output.pop("view", ""),
}


def _conver_publish_plugins(overrides):
if "publish" not in overrides:
return
_convert_validate_version_0_3_3(overrides["publish"])
_convert_oiio_transcode_0_4_5(overrides["publish"])


def convert_settings_overrides(
Expand Down
92 changes: 78 additions & 14 deletions server/settings/publish_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,36 @@ class ExtractThumbnailModel(BaseSettingsModel):
def _extract_oiio_transcoding_type():
return [
{"value": "colorspace", "label": "Use Colorspace"},
{"value": "display", "label": "Use Display&View"}
{"value": "display_view", "label": "Use Display&View"}
]


class OIIOToolArgumentsModel(BaseSettingsModel):
additional_command_args: list[str] = SettingsField(
default_factory=list, title="Arguments")
default_factory=list,
title="Arguments",
description="Additional command line arguments for *oiiotool*."
)


class UseDisplayViewModel(BaseSettingsModel):
_layout = "expanded"
display: str = SettingsField(
"",
title="Target Display",
description=(
"Display of the target transform. If left empty, the"
" source Display value will be used."
)
)
view: str = SettingsField(
"",
title="Target View",
description=(
"View of the target transform. If left empty, the"
" source View value will be used."
)
)


class ExtractOIIOTranscodeOutputModel(BaseSettingsModel):
Expand All @@ -285,22 +308,57 @@ class ExtractOIIOTranscodeOutputModel(BaseSettingsModel):
description="Output name (no space)",
regex=r"[a-zA-Z0-9_]([a-zA-Z0-9_\.\-]*[a-zA-Z0-9_])?$",
)
extension: str = SettingsField("", title="Extension")
extension: str = SettingsField(
"",
title="Extension",
description=(
"Target extension. If left empty, original"
" extension is used."
),
)
transcoding_type: str = SettingsField(
"colorspace",
title="Transcoding type",
enum_resolver=_extract_oiio_transcoding_type
enum_resolver=_extract_oiio_transcoding_type,
conditionalEnum=True,
description=(
"Select the transcoding type for your output, choosing either "
"*Colorspace* or *Display&View* transform."
" Only one option can be applied per output definition."
),
)
colorspace: str = SettingsField(
"",
title="Target Colorspace",
description=(
"Choose the desired target colorspace, confirming its availability"
" in the active OCIO config. If left empty, the"
" source colorspace value will be used, resulting in no"
" colorspace conversion."
)
)
display_view: UseDisplayViewModel = SettingsField(
title="Use Display&View",
default_factory=UseDisplayViewModel
)
colorspace: str = SettingsField("", title="Colorspace")
display: str = SettingsField("", title="Display")
view: str = SettingsField("", title="View")

oiiotool_args: OIIOToolArgumentsModel = SettingsField(
default_factory=OIIOToolArgumentsModel,
title="OIIOtool arguments")

tags: list[str] = SettingsField(default_factory=list, title="Tags")
tags: list[str] = SettingsField(
default_factory=list,
title="Tags",
description=(
"Additional tags that will be added to the created representation."
"\nAdd *review* tag to create review from the transcoded"
" representation instead of the original."
)
)
custom_tags: list[str] = SettingsField(
default_factory=list, title="Custom Tags"
default_factory=list,
title="Custom Tags",
description="Additional custom tags that will be added to the created representation."
)


Expand Down Expand Up @@ -328,7 +386,13 @@ class ExtractOIIOTranscodeProfileModel(BaseSettingsModel):
)
delete_original: bool = SettingsField(
True,
title="Delete Original Representation"
title="Delete Original Representation",
description=(
"Choose to preserve or remove the original representation.\n"
"Keep in mind that if the transcoded representation includes"
" a `review` tag, it will take precedence over"
" the original for creating reviews."
),
)
outputs: list[ExtractOIIOTranscodeOutputModel] = SettingsField(
default_factory=list,
Expand Down Expand Up @@ -371,7 +435,7 @@ class ExtractReviewFFmpegModel(BaseSettingsModel):
def extract_review_filter_enum():
return [
{
"value": "everytime",
"value": "everytime", # codespell:ignore everytime
"label": "Always"
},
{
Expand All @@ -393,7 +457,7 @@ class ExtractReviewFilterModel(BaseSettingsModel):
default_factory=list, title="Custom Tags"
)
single_frame_filter: str = SettingsField(
"everytime",
"everytime", # codespell:ignore everytime
description=(
"Use output <b>always</b> / only if input <b>is 1 frame</b>"
" image / only if has <b>2+ frames</b> or <b>is video</b>"
Expand Down Expand Up @@ -791,7 +855,7 @@ class IntegrateHeroVersionModel(BaseSettingsModel):

class CleanUpModel(BaseSettingsModel):
_isGroup = True
paterns: list[str] = SettingsField(
paterns: list[str] = SettingsField( # codespell:ignore paterns
default_factory=list,
title="Patterns (regex)"
)
Expand Down Expand Up @@ -1225,7 +1289,7 @@ class PublishPuginsModel(BaseSettingsModel):
"use_hardlinks": False
},
"CleanUp": {
"paterns": [],
"paterns": [], # codespell:ignore paterns
"remove_temp_renders": False
},
"CleanUpFarm": {
Expand Down
Loading