How can we add multiple media representations via Python in RV please?
The docs state that addSourceMediaRep or an overload for addSourcesVerbose could be used
The overload of addSourcesVerbose directly taken from the example docs
rv.commands.addSourcesVerbose([“image_sequence.195-215#.jpg”, “+mediaRepName”, “Frames”, “+mediaRepSource”, “last”])
leads to this error
ERROR: Traceback (most recent call last):
ERROR: File “C:\Program Files\Autodesk\RV-2024.1.0\src\sgtk\baked\plugin\bundle_cache\app_store\tk-multi-pythonconsole\v1.4.0\python\app\input_widget.py”, line 246, in execute
ERROR: exec(python_code, self._locals, self._locals)
ERROR: File “python input”, line 8, in
ERROR: TypeError: Bad argument (0) to function commands.addSourcesVerbose: expecting dynamic array
Using [] instead doesn’t lead to an error:
rv.commands.addSourcesVerbose([[“image_sequence.195-215#.jpg”, “+mediaRepName”, “Frames”, “+mediaRepSource”, “last”]])
but leads to the same result as using
rv.commands.addSourceMediaRep(“last”, “Frames”, [“image_sequence.195-215#.jpg”])
ie that 2 separate sources are created (see attached screenshot)
The result we expect instead is that there is one source with multiple represenations that can be switched between.
Here example code to reproduce the issue in RV Python Console
import rv
src1 = "https://assets.mixkit.co/videos/preview/mixkit-very-close-shot-of-the-leaves-of-a-tree-wet-18310-small.mp4"
src2 = "https://assets.mixkit.co/videos/preview/mixkit-very-close-shot-of-the-leaves-of-a-tree-wet-18310-large.mp4"
src1_node = rv.commands.addSourceVerbose([src1])
rv.commands.addSourceMediaRep("last", "Streaming", [src2])
# rv.commands.addSourcesVerbose([[src2, "+mediaRepName", "Streaming", "+mediaRepSource", "last"]])
# rv.commands.addSourcesVerbose(["image_sequence.195-215#.jpg", "+mediaRepName", "Frames", "+mediaRepSource", "last"])
# rv.commands.addSourcesVerbose([["image_sequence.195-215#.jpg", "+mediaRepName", "Frames", "+mediaRepSource", "last"]])
# rv.commands.addSourceMediaRep("last", "Frames", ["image_sequence.195-215#.jpg"])
(the example uses two streaming sources but the results were the same with streaming/frames etc and it makes for an easier example to be able to use URLs)
Thanks