How to override RV's default source_setup package?

Hi all,
I’ve got a bunch of artists who have RV installed on their local computers. They are all working from home but users can connect to a shared file server. We need to deviate from the default behavior provided by source_setup.py / source setup package . The source_setup package description says, “Its a good idea to override or augment this package for use in production environments.”

I can not easily augment the original package because it is on each artist’s local computer at their house and I have no ability to script actions on their computers.

Overriding a package seems interesting to me since I can make a new package in a shared file server location. However, I did not see any examples of how to go about overriding an existing package’s behaviors.

Any tips or tricks appreciated. Thanks, Adam

Ok I figured it out. I’ll post my methodology soon.

This is a thread with lots of useful information

On it you can also find our ocio package, which inherits form the built-in.

Thanks. I saw your ocio package and diving to that. OriginallyI just needed to override the RV Color/Image Management. As someone who was fairly new to RV it took me a bit to piece it all together so I decided to post a small summary of the process. Hopefully I got it correct or mostly :smile: , seems to work.

RV comes with a package called “RV Color/Image Management”. It is a hidden package so you only see it if you select “Show hidden Packages” option in the preference’s package tab. The package’s purpose is to set a newly added media source’s properties which control the Color menu’s File nonlinear to linear conversion value. The package also sets the View menu’s “Linear To Display Correction” settings once for each display node. In addition, the package also handles a few oddball cases which require media to be rotated/flipped or pixel aspect ratio defined. The package defines a mode called SourceSetupMode. You can see all the behavior in the source code located in the RV install. Reading the comments in the default package’s source code is a good way to learn more in depth. On Mac the code is located here: /Applications/RV.app/Contents/PlugIns/Python/source_setup.py

Originally, I thought overriding a package would be more along the lines of object oriented programming but it is not the case. This threw me off a bit. To override the default “RV Color/Image Management” package’s behavior I made a new package which defines a new mode bound to the same events as the default package’s mode. This happens within my new mode’s init method. I gave the mode a higher ordering value than the default mode’s value of 0. I also used “source_setup” as the key for my new mode (without this the overriding can not happen). This makes my new mode execute after the default mode’s.

I chose to use the existing source_setup.py as a basis for my package used for overriding the default package behavior. I gave my mode’s python file a different name than the original file. I changed the mode’s class name within my new python file and inherited the original SourceSetupMode class. I’ll probably remove the inheritance since I implemented all the base class methods. I also imported the groupMemberOfType function from source_setup.py rather than duplicate the code in my python file.

Example top level imports:

from source_setup import (
groupMemberOfType,
SourceSetupMode
)

Making The New Package Available

RV looks at the environment variable RV_SUPPORT_PATH for a value defining a directory to look in for additional packages and config files. I use Rez to define my OS environment prior to executing RV. It is possible use shell scripts or python’s Popen class to set the environment RV is executed within. To install your new package you’ll make use of the rvpkg command to add and then install the package. I use the command in a shell which already has the RV environment variables defined.