New to sgtk and shotgrid in general.
After successfully adding the camera exporter plugin to tk-multi-publish2 for Maya, I am trying to adapt it to export multiple file formats, in this case, FBX and alembic.
I have tried adding a plugin for each export/publish but tk-multi-publish2 appears to always use the second defined plugin. I assume I have missed something but can’t see what. Any thoughts would be greatly appreciated! Thank you
- name: Publish FBX Camera
Publish Template: maya_fbx_camera_publish
- name: Publish Alembic Camera
Publish Template: maya_alembic_camera_publish
# The location of published maya alembic cameras
# The location of published maya fbx cameras
I think there is a real issue with multiple plugins getting the settings from one of them.
Need to check further.
Can you test your template?
Create a dict with the fields from your context, and attempt to create a path from the template.
Can you share the publish hooks you’re referencing too?
The template appears to work, I can access it and create a path using it via sgtk.
If I create two separate items, maya.session.cameraABC and maya.session.cameraFBX, then each corresponding plugin is correctly picked up.
It looks like when using a single item (maya.session.camera) it is unable to accept multiple plugins.
Is this just not possible? Do I need an item per file format?
Yep I ran into this bug too.
I think if you change the class of your plugin it works, but not if the class is the same.
For example I had one item that needs multiple publish locations and a post_phase hook and indeed it would only keep one of the publish paths.
I hacked my way around it for now but it’s annoying.
Each Publish plugin, regardless of its class name should be an instance with its own isolated properties. It doesnt seem like that is the case.
For me I always get tripped up by setting properties in item.properties because those are global to the collected item and can affect other plugins processing that item. You’ll want to use item.local_properties whenever possible.
For example this affects other plugins using the collected item:
item.properties["publish_template"] = publish_template
This sets it only for the current plugin processing that item:
item.local_properties["publish_template"] = publish_template
Thats the problem,
it seems that even local properties are overriden when you use the same plugin multiple times on the same item.
As if each hook is not instantiated and isolated from itself if the class is the same.