Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1708 from pypeclub/feature/680-StandalonePublishe…
Browse files Browse the repository at this point in the history
…r-toggle-ftrack

Toggle Ftrack upload in StandalonePublisher
  • Loading branch information
kalisp authored Jun 23, 2021
2 parents c852168 + 4b707d4 commit cfdd04a
Show file tree
Hide file tree
Showing 11 changed files with 279 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class CollectContextDataSAPublish(pyblish.api.ContextPlugin):

# presets
batch_extensions = ["edl", "xml", "psd"]
default_families = ["ftrack"]

def process(self, context):
# get json paths from os and load them
Expand Down Expand Up @@ -213,10 +212,6 @@ def create_instance(self, context, in_data):
subset = in_data["subset"]
# If instance data already contain families then use it
instance_families = in_data.get("families") or []
# Make sure default families are in instance
for default_family in self.default_families or []:
if default_family not in instance_families:
instance_families.append(default_family)

instance = context.create_instance(subset)
instance.data.update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class CollectInstances(pyblish.api.InstancePlugin):
subsets = {
"referenceMain": {
"family": "review",
"families": ["clip", "ftrack"],
"families": ["clip"],
"extensions": [".mp4"]
},
"audioMain": {
"family": "audio",
"families": ["clip", "ftrack"],
"families": ["clip"],
"extensions": [".wav"],
},
"shotMain": {
Expand Down

This file was deleted.

116 changes: 97 additions & 19 deletions openpype/modules/ftrack/plugins/publish/collect_ftrack_family.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,107 @@
"""
Requires:
none
Provides:
instance -> families ([])
"""
import pyblish.api
import avalon.api

from openpype.lib.plugin_tools import filter_profiles


class CollectFtrackFamily(pyblish.api.InstancePlugin):
"""
Adds explicitly 'ftrack' to families to upload instance to FTrack.
Uses selection by combination of hosts/families/tasks names via
profiles resolution.
class CollectFtrackFamilies(pyblish.api.InstancePlugin):
"""Collect family for ftrack publishing
Add ftrack family to those instance that should be published to ftrack
Triggered everywhere, checks instance against configured.
Checks advanced filtering which works on 'families' not on main
'family', as some variants dynamically resolves addition of ftrack
based on 'families' (editorial drives it by presence of 'review')
"""
label = "Collect Ftrack Family"
order = pyblish.api.CollectorOrder + 0.4998

order = pyblish.api.CollectorOrder + 0.3
label = 'Add ftrack family'
families = ["model",
"setdress",
"model",
"animation",
"look",
"rig",
"camera"
]
hosts = ["maya"]
profiles = None

def process(self, instance):
if not self.profiles:
self.log.warning("No profiles present for adding Ftrack family")
return

task_name = instance.data.get("task",
avalon.api.Session["AVALON_TASK"])
host_name = avalon.api.Session["AVALON_APP"]
family = instance.data["family"]

filtering_criteria = {
"hosts": host_name,
"families": family,
"tasks": task_name
}
profile = filter_profiles(self.profiles, filtering_criteria,
logger=self.log)

if profile:
families = instance.data.get("families")
add_ftrack_family = profile["add_ftrack_family"]

# make ftrack publishable
if instance.data.get('families'):
instance.data['families'].append('ftrack')
additional_filters = profile.get("additional_filters")
if additional_filters:
add_ftrack_family = self._get_add_ftrack_f_from_addit_filters(
additional_filters,
families,
add_ftrack_family
)

if add_ftrack_family:
self.log.debug("Adding ftrack family for '{}'".
format(instance.data.get("family")))

if families and "ftrack" not in families:
instance.data["families"].append("ftrack")
else:
instance.data["families"] = ["ftrack"]
else:
instance.data['families'] = ['ftrack']
self.log.debug("Instance '{}' doesn't match any profile".format(
instance.data.get("family")))

def _get_add_ftrack_f_from_addit_filters(self,
additional_filters,
families,
add_ftrack_family):
"""
Compares additional filters - working on instance's families.
Triggered for more detailed filtering when main family matches,
but content of 'families' actually matter.
(For example 'review' in 'families' should result in adding to
Ftrack)
Args:
additional_filters (dict) - from Setting
families (list) - subfamilies
add_ftrack_family (bool) - add ftrack to families if True
"""
override_filter = None
override_filter_value = -1
for additional_filter in additional_filters:
filter_families = set(additional_filter["families"])
valid = filter_families <= set(families) # issubset
if not valid:
continue

value = len(filter_families)
if value > override_filter_value:
override_filter = additional_filter
override_filter_value = value

if override_filter:
add_ftrack_family = override_filter["add_ftrack_family"]

return add_ftrack_family
62 changes: 62 additions & 0 deletions openpype/settings/defaults/project_settings/ftrack.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,68 @@
}
},
"publish": {
"CollectFtrackFamily": {
"enabled": true,
"profiles": [
{
"hosts": [
"standalonepublisher"
],
"families": [],
"tasks": [],
"add_ftrack_family": true,
"advanced_filtering": []
},
{
"hosts": [
"standalonepublisher"
],
"families": [
"matchmove",
"shot"
],
"tasks": [],
"add_ftrack_family": false,
"advanced_filtering": []
},
{
"hosts": [
"standalonepublisher"
],
"families": [
"review",
"plate"
],
"tasks": [],
"add_ftrack_family": false,
"advanced_filtering": [
{
"families": [
"clip",
"review"
],
"add_ftrack_family": true
}
]
},
{
"hosts": [
"maya"
],
"families": [
"model",
"setdress",
"animation",
"look",
"rig",
"camera"
],
"tasks": [],
"add_ftrack_family": true,
"advanced_filtering": []
}
]
},
"IntegrateFtrackNote": {
"enabled": true,
"note_with_intent_template": "{intent}: {comment}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,23 @@
"label": "Render",
"family": "render",
"icon": "image",
"defaults": ["Animation", "Lighting", "Lookdev", "Compositing"],
"defaults": [
"Animation",
"Lighting",
"Lookdev",
"Compositing"
],
"help": "Rendered images or video files"
},
"create_mov_batch": {
"name": "mov_batch",
"label": "Batch Mov",
"family": "render_mov_batch",
"icon": "image",
"defaults": ["Main"],
"help": "Process multiple Mov files and publish them for layout and comp."
"name": "mov_batch",
"label": "Batch Mov",
"family": "render_mov_batch",
"icon": "image",
"defaults": [
"Main"
],
"help": "Process multiple Mov files and publish them for layout and comp."
},
"__dynamic_keys_labels__": {
"create_workfile": "Workfile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,82 @@
"key": "publish",
"label": "Publish plugins",
"children": [
{
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"key": "CollectFtrackFamily",
"label": "Collect Ftrack Family",
"is_group": true,
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "list",
"collapsible": true,
"key": "profiles",
"label": "Profiles",
"use_label_wrap": true,
"object_type": {
"type": "dict",
"children": [
{
"key": "hosts",
"label": "Host names",
"type": "list",
"object_type": "text"
},
{
"key": "families",
"label": "Families",
"type": "list",
"object_type": "text"
},
{
"key": "tasks",
"label": "Task names",
"type": "list",
"object_type": "text"
},
{
"type": "separator"
},
{
"key": "add_ftrack_family",
"label": "Add Ftrack Family",
"type": "boolean"
},
{
"type": "list",
"collapsible": true,
"key": "advanced_filtering",
"label": "Advanced adding if additional families present",
"use_label_wrap": true,
"object_type": {
"type": "dict",
"children": [
{
"key": "families",
"label": "Additional Families",
"type": "list",
"object_type": "text"
},
{
"key": "add_ftrack_family",
"label": "Add Ftrack Family",
"type": "boolean"
}
]
}
}
]
}
}
]
},
{
"type": "dict",
"collapsible": true,
Expand Down
2 changes: 1 addition & 1 deletion website/docs/admin_hosts_aftereffects.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All of them are Project based, eg. each project could have different configurati

Location: Settings > Project > AfterEffects

![Harmony Project Settings](assets/admin_hosts_aftereffects_settings.png)
![AfterEffects Project Settings](assets/admin_hosts_aftereffects_settings.png)

## Publish plugins

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cfdd04a

Please sign in to comment.