0

Run Maya w/ Shotgun Environment & Setup

Hello, 

I'm wondering how to replicate the exact same environment and setup that is initialized when launching Maya from the Shotgun project site, without having to do so from the web page.

I have to admit I haven't done much digging in the documentation, and am hoping you can either give me an easy answer, or point me in the right direction, documentation wise.

 

THanks very much,

-Matt

2 comments

  • 0
    Avatar
    Permanently deleted user

    Hi!

    Here's two options:

    1. You can either go to your project's shotgun root folder and run something like

    tank Shot MyAwesomeShot launch_maya

    2. Have a shelf button which loads the shotgun toolkit.

    You'll need to setup your PYTHONPATH environment var so it  includes the shotgun python module (e.g. /path/to/shotgun/studio/install/core/python)

    Then you can do the following in a python script from the shelf button (where project_path is the root of your actual project)

    import sgtk

    tk  = sgtk.sgtk_from_path(project_path)
    ctx = tk.context_from_path(project_path)
    sgtk.platform.start_engine('tk-maya', tk, ctx)

    You could also add a GUI which pulls projects from shotgun and let's the user select which one they want to be in...

     

     

     

  • 0
    Avatar
    Ryan Mayeda

    Thanks for beating me to the answer Sebastian!  :)

    One quick extra thing to add - if you want to dive in deeper, we share the source to the launch app on Github:

    https://github.com/shotgunsoftware/tk-multi-launchapp

    This could help if you're trying to build out your own launcher that preps all the Toolkit stuff the same way our launcher does.  In particular, you can see what happens at launch time here:

    https://github.com/shotgunsoftware/tk-multi-launchapp/blob/master/app.py#L142

    Hope this helps!

    Ryan.

     

Please sign in to leave a comment.