Stereo Pair mode using Python

Hello, i am trying to build a simple tools in RV to find all playblast in our projects, using Pyside and list it to our cusotm window.
so far it’s good, i can add to source media and play it, also i can compare playblast version. but i didnt find a function to change from Mono to Side by Side mode in Mu Documentation.
the previous version of our tools are build standalone and call RV command line using -stereo pair. it work but we want to integrate it to RV User interface.

thank you! hope this community have more post about python development in RV

2 Likes

Hi, and welcome to the community!

Me too! :smile:.

If you check out the rvui module, there is a method called setStereo that takes a string name of the stereo type. While rvui is a runtime module and is not automatically bound to python, you can export symbols or eval.

But taking a look at the setStereo signature in the Mu API Browser, you can see it is not just a plain function it is a function generator. These are used to create callbacks for menus where only the parameter changes (in this case, the stereo mode).

setStereo ((void;Event); string type)

Because the return type is (void; Event) we know the return type is a callable with a return of void and a single parameter input Event.

This means we need to call the result of that function (not just call the function).

In Python, it would look like this (note the extra (nil) which is us calling the result of the function and giving a nil value for Event).

import rv
rv.runtime.eval(""“setStereo(“pair”)(nil);”"", [“rvui”])

You can wrap that up in a function to squirrel away that you had to think about Mu, and just pass in the stereo mode. If you check out the rvui.mu menu definition you can see the stereo mode strings that are called for various menu options:

5706         {"Stereo", Menu {
5707             {"Stereo Viewing Mode", nil, nil, inactiveState},
5708             {"   Off", setStereo("off"), nil, isStereo("off")},
5709             {"   Anaglyph", setStereo("anaglyph"), nil, isStereo("anaglyph")},
5710             {"   Luminance Anaglyph", setStereo("lumanaglyph"), nil, isStereo("lumanaglyph")},
5711             {"   Side-by-Side", setStereo("pair"), nil, isStereo("pair")},
5712             {"   Mirror Side-by-Side", setStereo("mirror"), nil, isStereo("mirror")},
5713             //{"   Horizontal Squeezed", setStereo("hsqueezed"), nil, isStereo("hsqueezed")},
5714             //{"   Vertical Squeezed", setStereo("vsqueezed"), nil, isStereo("vsqueezed")},
5715             {"   DLP Checker", setStereo("checker"), nil, isStereo("checker")},
5716             {"   Scanline", setStereo("scanline"), nil, isStereo("scanline")},
5717             {"   Left Eye Only", setStereo("left"), nil, isStereo("left")},
5718             {"   Right Eye Only", setStereo("right"), nil, isStereo("right")},
5719             {"   Shutter Glasses", setStereo("hardware"), nil, isStereo("hardware")},

Cheers!
-Kessler

2 Likes

it’s work! thank you so much for your time and your explanation!
also thank you for the hint!
will try to dig into .mu files and see what i can learn from it.

3 Likes