Custom hook for app tk-multi-setframerange

Hi,

I want to start using the app tk-multi-framerange but I would like it to also set the framerate.
For all other apps, I of course edit this through hooks.

But in this specific app, even if I see a hooks folder, ‘install/app_store/tk-multi-setframerange/v0.4.0/hooks/’ I can’t find the hook definition to point to my custom hook.

All I have in my pipeline configuration for this app is in app_locations.yml:

apps.tk-multi-setframerange.location:
type: app_store
name: tk-multi-setframerange
version: v0.4.0

Any idea where this custom hook can be defined?

Cheers,
Kevin

2 Likes

Hi Kevin!

A few things to note here:

  • First off, the tk-multi-setframerange app actually didn’t have any hooks until the most recent version, v0.4.0, so make sure you have the latest.
  • Secondly, the Default Config is a sparse configuration, meaning that, in order to keep things concise, settings that aren’t different from the default value are not explicitly included in the config. This section of the Environment Configuration Reference tells you how to discover the settings for a given app, and specifically for tk-multi-setframerange, you can see in the app’s manifest that the setting you want is hook_frame_operation.
  • Having said all that, there’s one more bit of nuance here: In the Default Config, we typically have a file for every app engine in config/env/includes/settings/, and include a block from that file into every environment where it’s defined. In the case of setframerange, we’ve taken a shortcut, since its settings were so simple, and are bringing in the location descriptor for the app from config/env/includes/app_locations.yml (as you discovered).
  • To keep things consistent, what you’d probably want to do is:
    • Create a config/env/includes/settings/tk-multi-setframerange.yml, using another app’s analogous file as a model (tk-multi-breakdown is a good one to use – it’s similarly very simple)
    • Include the hook setting, pointing to your custom hook, in that file
    • Change references to tk-multi-setframerange throughout your environment configuration to point to this file instead of app_locations.yml.

If you’re new to the organization of config/env/* or need more explanation of concepts like manifest, descriptor, includes, sparse config, the Environment Configuration Reference explains all of these.

If you’re still stuck, let me know – I can give more specifics. =)

3 Likes

Hey Kevin,

I forked that app with the same (and more reasons) and am making it into a complete “Set Settings” app so that various software settings can be set.
Feel free to clone and add pull requests :slight_smile:

6 Likes

So awesome! Thanks for sharing, @Ricardo_Musch. :slight_smile:

1 Like

Hi @tannaz ,

Thank you a lot for this helpful answer. I did follow exactly your answer and it’s working.
I, so far, only used already referenced hooks. I will take more time to check additional settings next time.

Cheers,
Kevin

2 Likes

Hi @Ricardo_Musch,

Really nice of you to share your code. That’s basically what I want to achieve.
I’ll clone it right now!

Thanks,
Kevin

1 Like

Cheers!
Feel free to push request and messgae me to collaborate :slightly_smiling_face:

I did break the original QT code from the setFrameRange app as my QT experience is limited.
So I opted to use Houdini and Nuke’s own panel codes to provide a yes/no box to applythe changes.
In the future I would like to rebuild that back into a QT window :slight_smile:

Also, Houdini 17 seems to have a bug that doesn’t visibly change the playbar range until you change something else in the GUI. 17.5 doesnt have this problem

3 Likes

Since the hooks are software specific it’s probably fine to use the integrated pop up box, but if you did want to do it in QT, you could do something like this:

from sgtk.platform.qt import QtGui

r = QtGui.QMessageBox.question(None,
                               '',
                               "Would you like to copy the shaders?",
                               QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)

if r == QtGui.QMessageBox.Yes:
    print "Copying shaders..."
2 Likes

Lol, that’s not hard at all… :open_mouth:

Thanks! Will add that back then!

2 Likes