RV Screening Room read version data

Hi

Is there an easy way to read shotgun version data from sources loaded into a timeline in RV Screening Room?

I have setup an RV package that will just add an overlay to each source played in RV when using RV Screening Room (cut view).
This is basically to overlay the shotgun version name for all sources played in the timeline.

Right now the only missing bit for me is to read the shotgun version name (the file path is not good for me).
So I was wondering if the data is added somehow to the sources by RV Screening room and available via commands in python.

Or if there is a better way to do this?

Many thanks

Jacob

2 Likes

Hi Jacob,

If you are using Shotgun’s Screening Room for RV extension, then there is option called the Shotgun Info Widget that can help with this. I’m attaching a guide below that explains how this works

The widget can be configured to display custom fields from your version entity (such as the version name)

To configure the fields in the Shotgun Info Widget you need to edit your shotgun_fields_config_custom.mu file and add the fields you want to see in the fieldDescriptors area and then set the displayOrder. The displayOrder will show and define the order of fields in the info box while the configs in the fieldDescriptors section will configure the data loading from Shotgun.

Let me know if you have any other questions and I’ll be happy to help.

Cheers,
Andrew

2 Likes

Thanks Andrew

Editing the fields in the Shotgun Widget it’s great. I will really make use of that.

But I was hoping to use the custom overlay I build for displaying the version name only.
The use case would be:

  • Timeline plays with the version name only as overlay (I will default to this when playing the timeline).
  • Our configured Shotgun Widget will display all info when using Shif+I, on demand since it takes over the image to display a fair bit of info.

I could also set the Shotgun Widget to display only the version name and have it on by default, but we would then lose the opportunity to see all of the other info we wish to show on demand for a version.

Hence I was hoping I could access the shotgun version used by the SG widget from my custom overlay package.
I need to figure how to find the version name ( efficiently) or delve into the Shotgun Info widget code to find out, but it was getting a bit tricky so I thought I’d ask.

Thanks a lot for the tips on customizing the Shotgun Widget though.

Thanks

Jacob

1 Like

Hi Jacob,

I think if I’m getting it right, you are really just looking for the metadata on each version. It is stored in a tracking.info variable on the FileSource node.
It is populated asynchronously so beware trying to find it after the source-group-complete event. You are really looking for the graph-state-change event that contains the tracking.info in the event.contents().

In practical terms, this means, some time after you load a Shotgun source (through Shotgun Integration or Screening Room, not SG Review), you can start using some of the shotgun_mode methods.

To do this from Python, you can use rv.runtime.eval.

Here is a bare minimum (ie, no error handling) way of getting the version name.

import rv
rv.runtime.eval("""

shotgun_mode.theMode().versionNameFromSource("%s");

""" % rv.commands.sourcesAtFrame(rv.commands.frame())[0], ["shotgun_mode"])

The shotgun_mode mu module has a function called theMode() which will return the singleton ShotgunMode object. That object has a method called versionNameFromSource where it looks up tracking info on that fileSource to get the version name.

You can dig into plugins/Mu/shotgun_mode.mu for other methods you can call.

Alternatively you can get at the tracking.info yourself, but given the shotgun_* modules likely do everything you want, you can just re-use the shotgun integration/screening room functions.

I hope that helps you build what you are looking to build!

-Kessler

1 Like

Hey Michael

Thanks a lot for the reply.

I ended up figuring a solution which has worked really well:

def _get_source_shotgun_data(source):
    """
    Get the shotgun data from a source.

    Args:
        source (str): rv source name.

    Returns:
        dict: shotgun data as a dictionary.

    """
    try:
        source_data = rv.commands.getStringProperty(
            "{}.tracking.info".format(source)
            )

        data_list = ast.literal_eval(str(source_data))
    except:
        return {}

    return {k: v for k, v in zip(data_list, data_list[1:])}

Then I saw your post today about this which is extremely useful. I will definitely be digging more into the shotgun_mode.

Loving getting into doing work with RV and SG Screening Room.

Thanks

Jacob

4 Likes