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

Add profiles to 'CollectFramesFixDef' settings #839

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 19 additions & 4 deletions client/ayon_core/plugins/publish/collect_frames_fix.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pyblish.api
import ayon_api

from ayon_core.lib import filter_profiles
from ayon_core.pipeline import get_current_host_name
from ayon_core.lib.attribute_definitions import (
TextDef,
BoolDef
Expand All @@ -21,10 +23,23 @@ class CollectFramesFixDef(
order = pyblish.api.CollectorOrder + 0.495
label = "Collect Frames to Fix"
targets = ["local"]
hosts = ["nuke"]
families = ["render", "prerender"]

rewrite_version_enable = False
@classmethod
def apply_settings(cls, project_settings):

profiles = project_settings["core"]["publish"][cls.__name__]["profiles"]
host_name = get_current_host_name()
filtering_criteria = {
"hosts": host_name
}
profile = filter_profiles(
profiles,
filtering_criteria,
logger=cls.log
)

cls.families = profile["families"]
cls.rewrite_version_enable = profile["rewrite_version_enable"]

def process(self, instance):
attribute_values = self.get_attr_values_from_data(instance.data)
Expand Down Expand Up @@ -65,7 +80,7 @@ def process(self, instance):
product_type = repre_context.get("product", {}).get("type")
if not product_type:
product_type = repre_context.get("family")
if product_type not in self.families:
if "*" not in self.families and product_type not in self.families:
continue

for file_info in repre.get("files"):
Expand Down
41 changes: 33 additions & 8 deletions server/settings/publish_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,28 @@ class CollectCommentPIModel(BaseSettingsModel):
enabled: bool = SettingsField(True)
families: list[str] = SettingsField(default_factory=list, title="Families")

class CollectFramesFixDefProfilesModel(BaseSettingsModel):

class CollectFramesFixDefModel(BaseSettingsModel):
enabled: bool = SettingsField(True)
hosts: list[str] = SettingsField(
default_factory=list,
title="Host names"
)
families: list[str] = SettingsField(
default_factory=list,
title="Families"
)
rewrite_version_enable: bool = SettingsField(
True,
title="Show 'Rewrite latest version' toggle"
)



class CollectFramesFixDefModel(BaseSettingsModel):
enabled: bool = SettingsField(True)
profiles: list[CollectFramesFixDefProfilesModel] = SettingsField(
default_factory=list, title="profiles"
)


class ContributionLayersModel(BaseSettingsModel):
_layout = "compact"
Expand Down Expand Up @@ -360,7 +374,7 @@ class ExtractReviewFFmpegModel(BaseSettingsModel):
def extract_review_filter_enum():
return [
{
"value": "everytime",
"value": "everytime", # codespell:ignore everytime
"label": "Always"
},
{
Expand All @@ -382,7 +396,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 @@ -780,7 +794,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 @@ -911,7 +925,18 @@ class PublishPuginsModel(BaseSettingsModel):
},
"CollectFramesFixDef": {
"enabled": True,
"rewrite_version_enable": True
"profiles": [
{
"hosts": ["nuke"],
"families": ["render", "prerender"],
"rewrite_version_enable": False
},
{
"hosts": ["houdini"],
"families": ["*"],
"rewrite_version_enable": False
}
]
},
"CollectUSDLayerContributions": {
"enabled": True,
Expand Down Expand Up @@ -1200,7 +1225,7 @@ class PublishPuginsModel(BaseSettingsModel):
"use_hardlinks": False
},
"CleanUp": {
"paterns": [],
"paterns": [], # codespell:ignore paterns
MustafaJafar marked this conversation as resolved.
Show resolved Hide resolved
"remove_temp_renders": False
},
"CleanUpFarm": {
Expand Down