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 (
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.