0

RV Shotgun Connection Details

Hi there!

I've was looking at the forum to see if there is a way to get the current Shotgun connection data that is used by the RV Shotgun plugin and saw this post "https://support.shotgunsoftware.com/hc/en-us/community/posts/209495568-How-to-access-the-current-Shotgun-connection-parameters-" which results very useful but I've realized that if you have more than one connection detail, the code from the above post always returns the same serverURL, even if you don't have any connection yet!

So for instance, I have two connections (one for a production server an one for a development one), in the menu Shotgun > Shotgun Connection Details I can see the two connection options but it does not matter what is checked because the code MuSymbol('shotgun_mode.theMode')()['_shotgunState']['_serverURL'] always returns me the production one.

Is there a way to get the current/checked connection from the menu? from where am I getting the default URL that RV puts on the Shotgun URL field?

Thank you so much.
Raúl.

2 条评论

  • Avatar
    (Michael) Kessler 正式评论

    Hi Raúl,

     

    You can use the following little snippet to grab your shotgun connection.  It would be recommended to add a fall back case in the case where you don't have any connection.

     

    from pymu import MuSymbol
    sessionData = MuSymbol("slutils.retrieveSessionsData")
    getServerUrl = MuSymbol("slutils.getServerUrlFromSession")

    # Ask for current session data, get the first one which is the active one, then extract the server url.
    print getServerUrl(sessionData()[0])

    Thanks,

    -Kessler

  • 0
    Avatar
    Raul Catalina

    It works like a charm! that's exactly what I was looking for.

     

    Thanks a lot,

    Raúl

请先登录再写评论。