Hi,
I’m new to RV. As the topic name says I’m trying replace all the source (movie files) and the layers (movie files) loaded in a RV player with their respective image sequences. I figured out how to replace a source but I’m still struggling with how to get all the source and the layers with Python.
Thanks.
Hi,
there are several methods for getting the sources in a session.
Do you know about the Mu Command API Browser? Most of the commands (rv.commands, rv.extra_commands) are also available in Python.
The RV command API technical documentation can be browsed from Help->Mu Command API Browser.
I am not sure what you mean with replacing the “layers” a movie file doesn’t have a layer like an exr would have?
However you can access the media file (and replace it) using the property <sourcenode>.media.movie
(I think there is also a command: commands.setSourceMedia()
but not to sure about it right now.)
So an example would be:
from rv import commands
sources = commands.sourcesAtFrame(commands.frame()) # gets all sources at current frame
for source in sources or []:
movie_file = commands.getStringProperty(f"{source}.media.movie")
img_seq = <get_sequence_from_movie>(movie_file) # path like: path/to/file.%04d.exr
commands.setStringProperty(f"{source}.media.movie", [img_seq])
(untested but something similar to this should work)
Cheers, Mirco