How to run old pre-publish hooks in DefCon2

Hi,
In the old SG config we used these pre/post publish hooks in tk-multi-publish:
primary_pre_publish.py
scan_scene_tk-maya.py
secondary_pre_publish_tk-maya.py
post_publish.py

We used them to run processes such as QC tools to check for errors before the file is published, or to export JSON files before and after publishing.

However, DefCon2 does not have any of pre/post publish hooks. How can we run pre/post processes in DefCon2?

Thanks for you answer in advance,

No idea what you mean by defcon2?

But tk-multi-publish2 has plugin hooks that attach themselves to items that have been collected by a “scan scene” hook.
Each of those plugins can have a accept and validation stage in which you can add QC logic.

1 Like

It also has a post phase hook that can run at the end. Here is the app documentation on the hooks.

Hi Shervin –

A little more detail here: there isn’t a one-to-one relationship between old and new publish hooks, but here’s some background for how you could port over the business logic from your old hooks:

  • There is a “collector” hook that processes the current session to collect publish items for display in the Publish app’s interface, analogous to scan_scene
  • Individual publish plugin hooks have the following phases:
    • accept: picking which of the collected publish items this hook will “accept” to run on, and validating them
    • publish
    • finalize
  • Then, as @philip.scadding mentioned, the post_phase hook has methods that run after each of the above phases has run for all publish items.

This diagram might be helpful to see how the pieces fit together.

And @Ricardo, DEFCON2 is just our shorthand for tk-config-default2 :blush:

3 Likes