Switch node doesn't load the right media when using repName

Hey,

I am on RV 2024.2.1. I use rvSession.py to generate .rv files which I then load in RV.

I need to set repName to “Movie” and “Frames” for the “Flow Production Tracking > Sawp Media > Swap to…” menu options to work.

However, when I build a session file this way, on loading it, it seems like RV loads every media representation, not just the ones that are active. And it displays the last one to be loaded, even though I explicitely set it to “Movie”. I tried changing the order in which the inputs are added, but it doesn’t fix anything.

In the top left corener, I see “Loadind 1 of 1”, then the (lighter) mov appears, then “Loading 2 of 2” and the image sequence takes it place, even though I am wiewing the default sequence > switch node.

I then built a session from scracth in RV and I didn’t have this problem. The movie was the only media being loaded. I then compared both rv session files, and the problem occurs when I add the repName, which is an empty string in the session file built in RV. I cannot keep an empty string value as it breaks the “Flow Production Tracking > Sawp Media > Swap to…” menu options.

Using rvpush with rv.commands instead of rvSession is not an option either because

  • from my experience it is unstable, sometimes RV never launches.
  • we have some sessions with thousands of medias, each with two media representations. Imagine building that on a single line of python code.

Here is a snippet to reproduce the issue

import rvSession
from gto import STRING

session = rvSession.Session()
session.setFPS(24)
rv_sequence = session.newNode("Sequence", "Sequence 1")

movie_path = "<path to mov>/file.mov"
movie_node = session.newNode("Source", "movie node")
movie_node.setMedia(movie_path)
movie_node.setProperty("RVFileSource", "source", "media", "repName", STRING, "Movie")

frames_path = "<path to frames>/file.101-180#.exr"
frames_node = session.newNode("Source", "frames node")
frames_node.setMedia(frames_path)
frames_node.setProperty("RVFileSource", "source", "media", "repName", STRING, "Frames")

switch_node = session.newNode("Switch", "switch node")
switch_node.addInput(movie_node)
switch_node.addInput(frames_node)
switch_node.setProperty("RVSwitch", "switch", "output", "input", STRING, movie_node.name)

rv_sequence.addInput(switch_node)
session.setViewNode(rv_sequence)
session.write("%TEMP%/switch_node_test.rv)

Could there be a workaround ?

If it’s a bug, what should I do ? Try OpenRV, see if it’s fixed, otherwise create an issue on GitHub ?

Cheers,

Aurore from Fortiche

I can tell you why it’s always defaulting to the Frames instead of Movie even though you set the property:

from the sourcemediarep mode documentation:

# It currently implements the following standard ShotGrid logic in priority 
# order: 
#   1. Frames       - sg_path_to_frames 
#   2. Movie        - sg_path_to_movie 
#   3. Streaming    - transcoded streamable media from the ShotGrid server
# In other words, it will prioritize the ‘Frames’ source media
# representation if available, which represents an image sequence typically 
# at higher resolution. If this representation is not available, then the 
# 'Movie' media representation will be selected, and so on.

So I guess this is the default behaviour and is somewhat wanted. If you want to change this either make a ticket on the OpenRV github to maybe make this configurable or edit the mode locally and change:

self.sourceMediaRepsInPriorityOrder = [“Frames”, “Movie”, “Streaming”]


for loading both sources that is another issue, that can be fixed.
If you don’t want a media rep to be loaded on session start replace

frames_node.setMedia(frames_path)

with:

frames_node.setProperty("RVFileSource", "source", "media", "movie", STRING, frames_path)
frames_node.setProperty("RVFileSource", "source", "media", "active", INT, [0])

Note: It will still default to “Frames” and load the source in, so that unfortunately doesn’t fix the issue above.



For testing if it’s really the default order screwing up your setup try something like this:
(change “Movie” and “Frame” rep names)

import rvSession
from gto import STRING, INT

session = rvSession.Session()
session.setFPS(24)
rv_sequence = session.newNode("Sequence", "Sequence 1")

movie_path = "<path to mov>/file.mov"
movie_node = session.newNode("Source", "movie node")
movie_node.setMedia(movie_path)
movie_node.setProperty("RVFileSource", "source", "media", "repName", STRING, "_Movie")

frames_path = "<path to frames>/file.101-180#.exr"
frames_node = session.newNode("Source", "frames node")
frames_node.setProperty("RVFileSource", "source", "media", "movie", STRING, frames_path)
frames_node.setProperty("RVFileSource", "source", "media", "active", INT, [0])
frames_node.setProperty("RVFileSource", "source", "media", "repName", STRING, "_Frames")

switch_node = session.newNode("Switch", "switch node")
switch_node.addInput(movie_node)
switch_node.addInput(frames_node)
switch_node.setProperty("RVSwitch", "switch", "output", "input", STRING, movie_node.name)

rv_sequence.addInput(switch_node)
session.setViewNode(rv_sequence)
session.write("%TEMP%/switch_node_test.rv)

Cheers, Mirco

1 Like

Thanks a lot ! You have mad rvSession skills :grin:

I will go the “override multiple_source_media_rep” route as it is easiest for us. After doing that, I don’t notice any difference in loading time between using .setMedia() vs using .setProperty(). If I can avoid a hack I will take it.

Did you also deactivate the source by:

For me this works in conjunction with the setting of media.movie.
then the frames source will only be loaded after switching to this representation.

Cheers

I did but if there was a difference in load time, it was negligible. In both cases I briefly saw the “loading 2 of 2” bubble.

Yeah it shouldn’t be much difference in loading time at all with one source (two reps).
The loading 2 of 2 you’re seeing is the source group-nodes, so that will stay at 2
but if it’s loading the actual source media on startup or not is the difference.

Maybe it does make a difference with a lot of sources :person_shrugging:

Anyways glad I could help :slight_smile:

1 Like