#680 - Toggle Ftrack upload in StandalonePublisher

Removed default_family in collect_context
This commit is contained in:
Petr Kalis 2021-06-15 11:08:36 +02:00
parent b5df50f4bc
commit 5692d570b7
4 changed files with 146 additions and 27 deletions

View file

@ -1,29 +1,57 @@
"""
Requires:
none
Provides:
instance -> families ([])
"""
import os
import pyblish.api
from openpype.lib.plugin_tools import filter_profiles
class CollectFtrackFamilies(pyblish.api.InstancePlugin):
"""Collect family for ftrack publishing
Add ftrack family to those instance that should be published to ftrack
class CollectFtrackFamily(pyblish.api.InstancePlugin):
"""
Adds explicitly 'ftrack' to families to upload instance to FTrack.
order = pyblish.api.CollectorOrder + 0.3
label = 'Add ftrack family'
families = ["model",
"setdress",
"model",
"animation",
"look",
"rig",
"camera"
]
hosts = ["maya"]
Uses selection by combination of hosts/families/tasks names via
profiles resolution.
Triggered everywhere, checks instance against configured
"""
label = "Collect Ftrack Family"
order = pyblish.api.CollectorOrder + 0.4999
profiles = None
def process(self, instance):
if self.profiles:
anatomy_data = instance.context.data["anatomyData"]
task_name = anatomy_data.get("task",
os.environ["AVALON_TASK"])
host_name = anatomy_data.get("app",
os.environ["AVALON_APP"])
family = instance.data["family"]
# make ftrack publishable
if instance.data.get('families'):
instance.data['families'].append('ftrack')
else:
instance.data['families'] = ['ftrack']
filtering_criteria = {
"hosts": host_name,
"families": family,
"tasks": task_name
}
profile = filter_profiles(self.profiles, filtering_criteria)
if profile:
families = instance.data.get("families")
if profile["add_ftrack_family"]:
self.log.debug("Adding ftrack family")
if families and "ftrack" not in families:
instance.data["families"].append("ftrack")
else:
instance.data["families"] = ["ftrack"]
else:
self.log.debug("Removing ftrack family if present")
if families and "ftrack" in families:
instance.data["families"].pop("ftrack")
self.log.debug("instance.data:: {}".format(instance.data))

View file

@ -200,6 +200,37 @@
}
},
"publish": {
"CollectFtrackFamily": {
"enabled": true,
"profiles": [
{
"families": [
"render",
"image"
],
"tasks": [],
"hosts": [
"standalonepublisher"
],
"add_ftrack_family": true
},
{
"families": [
"model",
"setdress",
"animation",
"look",
"rig",
"camera"
],
"tasks": [],
"hosts": [
"maya"
],
"add_ftrack_family": true
}
]
},
"IntegrateFtrackNote": {
"enabled": true,
"note_with_intent_template": "{intent}: {comment}",

View file

@ -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",

View file

@ -604,6 +604,59 @@
"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": "dict",
"collapsible": true,