Jump to content

Confused with Hook


Recommended Posts

Hi all,

I'm looking for a proper way to modify the default behavior of "ftrack.connect.publish.make-web-reviewable" event. According to the docuemnt, It looks like I can implement a custom hook to overwrite the default one (more implemetation details would be appreciated)

I tried to find some references before getting start and I noticed that there're some built-in hooks in "Program Files(x86)\ftrack-connect-package-1.1.2\resource\hook" folder. But I got a bit confused after looking into these examples. They're not quite similar, in fact, I can categorize 3 plugin styles revealed in this hook folder, they 're:

 1. Class with "__call__" method and a global "register" function. You can see examples like this in:
DiscoverApplicationsHook & LaunchApplicationHook in application.py
Resolver in resolver.py

2. No class defined, just have functions (looks like they all have "subscribe" & "register" functions), they're:

3. Class with "discover", "launch", "register" functions and a global "register" function.
All "ftrack_connect_[Application_Name]_hook.py" go in this way and I think this is the "standard" style of hook mentioned in document

So here'are my questions:
1. Are all the python files in "hook" folder used as hook ?  Is it possible to provide more details about why we have 3 different styles of hook ?
2. Which one should I use if I want to overwrite the response behavior of some system events (e.g. ftrack.connect.publish.make-web-reviewable, ftrack.connect.application.launch)
3. Do we have any example about overwrite system hook or cease some system hooks ?


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...