This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1708 from pypeclub/feature/680-StandalonePublishe…
…r-toggle-ftrack Toggle Ftrack upload in StandalonePublisher
- Loading branch information
Showing
11 changed files
with
279 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
openpype/hosts/standalonepublisher/plugins/publish/collect_matchmove.py
This file was deleted.
Oops, something went wrong.
116 changes: 97 additions & 19 deletions
116
openpype/modules/ftrack/plugins/publish/collect_ftrack_family.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.