Added possibility to configure of synchronization of workfile version with selected families

This commit is contained in:
Petr Kalis 2021-09-17 16:18:36 +02:00
parent 7aa879528a
commit 0a2ff39c4a
3 changed files with 38 additions and 10 deletions

View file

@ -13,7 +13,7 @@ class PreCollectNukeInstances(pyblish.api.ContextPlugin):
hosts = ["nuke", "nukeassist"]
# presets
sync_workfile_version = False
sync_workfile_version_on_families = []
def process(self, context):
asset_data = io.find_one({
@ -120,11 +120,12 @@ class PreCollectNukeInstances(pyblish.api.ContextPlugin):
# sync workfile version
_families_test = [family] + families
self.log.debug("__ _families_test: `{}`".format(_families_test))
if not next((f for f in _families_test
if "prerender" in f),
None) and self.sync_workfile_version:
# get version to instance for integration
instance.data['version'] = instance.context.data['version']
for family_test in _families_test:
if family_test in self.sync_workfile_version_on_families:
self.log.debug("Syncing version with workfile for '{}'"
.format(family_test))
# get version to instance for integration
instance.data['version'] = instance.context.data['version']
instance.data.update({
"subset": subset,

View file

@ -30,7 +30,13 @@
},
"publish": {
"PreCollectNukeInstances": {
"sync_workfile_version": true
"sync_workfile_version_on_families": [
"nukenodes",
"camera",
"gizmo",
"source",
"render"
]
},
"ValidateContainers": {
"enabled": true,

View file

@ -16,9 +16,30 @@
"is_group": true,
"children": [
{
"type": "boolean",
"key": "sync_workfile_version",
"label": "Sync Version from workfile"
"type": "enum",
"key": "sync_workfile_version_on_families",
"label": "Sync workfile version for families",
"multiselection": true,
"enum_items": [
{
"nukenodes": "nukenodes"
},
{
"camera": "camera"
},
{
"gizmo": "gizmo"
},
{
"source": "source"
},
{
"prerender": "prerender"
},
{
"render": "render"
}
]
}
]
},