Merge remote-tracking branch 'origin/temp/intent_merge_cherrypicked' into master-testing

This commit is contained in:
jakub@orbi.tools 2020-01-08 15:31:08 +01:00
commit acd1ae66b5
2 changed files with 27 additions and 2 deletions

View file

@ -144,8 +144,11 @@ class IntegrateFtrackApi(pyblish.api.InstancePlugin):
"version": 0,
"asset": asset_entity,
}
assetversion_data.update(data.get("assetversion_data", {}))
_assetversion_data = data.get("assetversion_data", {})
assetversion_cust_attrs = _assetversion_data.pop(
"custom_attributes", {}
)
assetversion_data.update(_assetversion_data)
assetversion_entity = session.query(
self.query("AssetVersion", assetversion_data)
@ -182,6 +185,18 @@ class IntegrateFtrackApi(pyblish.api.InstancePlugin):
existing_assetversion_metadata.update(assetversion_metadata)
assetversion_entity["metadata"] = existing_assetversion_metadata
# Adding Custom Attributes
for attr, val in assetversion_cust_attrs.items():
if attr in assetversion_entity["custom_attributes"]:
assetversion_entity["custom_attributes"][attr] = val
continue
self.log.warning((
"Custom Attrubute \"{0}\""
" is not available for AssetVersion."
" Can't set it's value to: \"{1}\""
).format(attr, str(val)))
# Have to commit the version and asset, because location can't
# determine the final location without.
try:

View file

@ -125,6 +125,16 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
"thumbnail": comp['thumbnail']
}
# Add custom attributes for AssetVersion
assetversion_cust_attrs = {}
intent_val = instance.context.data.get("intent")
if intent_val:
assetversion_cust_attrs["intent"] = intent_val
component_item["assetversion_data"]["custom_attributes"] = (
assetversion_cust_attrs
)
componentList.append(component_item)
# Create copy with ftrack.unmanaged location if thumb or prev
if comp.get('thumbnail') or comp.get('preview') \