0

Invoke an app from another app.

I want to perform automatic snapshot when a tk-multi-workfile 'save as' operation occurs.I have a maya hook defined and ready to perform the necessary code to call the snapshot functions, but I don't know how best to call them.

 

Thanks,

 -derick

2 comments

  • 0
    Avatar
    Alan Dann

    Hi Derick,

    You can perform a headless snapshot through the API by doing the following:

    import sgtk
    eng = sgtk.platform.current_engine()
    snapshot_app = eng.apps.get("tk-multi-snapshot")
    if snapshot_app and snapshot_app.can_snapshot():
        comment = "Automatic snapshot taken before a Shotgun Save-As"
        thumbnail = None # needs to be a QtGui.QPixmap()
        snapshot_app.snapshot(comment, thumbnail)

    Will that do what you need?

    Generally, we try to expose the apps commands through it's API in this way.  If you find that an app is missing an API that you need then please send in a support request and we'll see if we can add it.

    Thanks

    Alan

  • 0
    Avatar
    Derick Dressel

    Brilliant!

    Thanks again, Alan :)

Please sign in to leave a comment.