Hello there!
I added a custom publisher to the tk-publish, which has a class that can publish specific files. These create published file entities in the system just right. I can set their name and published_file_type etc. However I’d like to set some tags for the published file entity too.
In my class’ publish function:
HookBaseClass = sgtk.get_hook_baseclass()
class MyCustomPublishPlugin(HookBaseClass):
(...)
def publish(self, settings, item):
(...)
item.properties['published_file_type'] = 'XYZ File' # works fine
item.properties['name'] = 'some_name' # works fine
item.properties['tags'] = ['Render'] # not the right solution...
super(MyCustomPublishPlugin, self).publish(settings, item)
I checked the BasicFilePublishPlugin
for more information about it’s publish
function to check how it requires the tags to be passed to, just to find tags are not handled specifically:
publish_data = {
"tk": publisher.sgtk,
"context": item.context,
"comment": item.description,
"path": publish_path,
"name": publish_name,
"created_by": publish_user,
"version_number": publish_version,
"thumbnail_path": item.get_thumbnail_as_path(),
"published_file_type": publish_type,
"dependency_paths": publish_dependencies_paths,
"dependency_ids": publish_dependencies_ids,
"sg_fields": publish_fields,
}
# add extra kwargs
publish_data.update(publish_kwargs)
Maybe I need to use the publish_fields
or publish_kwargs
somehow? It’s not very clear how should I use them if one of them is even the solution for the tags here.
Any help is appreciated!