A question I have seen asked in support a few times is how can you have a publish plugin or item unchecked by default in the publish2 app?
The default check state of a plugin is set in the
accept method of the plugin:
You can take over the publish plugin hook, inherit from the base, and implement just the accept method:
Create a publish hook in your
import sgtk HookBaseClass = sgtk.get_hook_baseclass() class UploadVersionPlugin(HookBaseClass): def accept(self, settings, item): # get the base settings settings = super(UploadVersionPlugin, self).accept(settings, item) # set the default checked state settings["checked"] = False return settings
And then in your
.../config/env/includes/settings/tk-multi-publish2.yml you would set the plugin hook inheritance to be:
For a collected item, you need to set the PublishItem.checked at collection time.
Here is an example where I am by default setting the item collected by the standalone publisher to unchecked
import sgtk HookBaseClass = sgtk.get_hook_baseclass() class BasicSceneCollector(HookBaseClass): def process_file(self, settings, parent_item, path): item = super(BasicSceneCollector, self).process_file(settings, parent_item, path) item.checked = False return item
And the setting would then look like this, asuming I saved my hook to