# How do I write my first package in RV?

RV can be nearly infinitely customizable but it can be difficult finding documentation for where to begin developing your own plugins.
There are a couple of things that you should know.

RV offers a couple of ways to write plugins: Mu, Python, PySide and GLSL.

The best way to start with RV scripting is to use Python. Unfortunately, Python is not native to RV and most of “Python” commands that you will find in RV are bindings on top of Mu. However, this means that you can use nearly all commands that are available in Mu in Python.

Mu is the native scripting language and kind of looks like Perl. Most of the RV documentation that is historically available is written in Mu. Unfortunately, this is a difficult way for someone to get started scripting, so I won’t go too deep into it in this post, except for bindings from Python <-> Mu. If you have plenty of time and would like to understand how Mu works, you can find it by going to RV -> Help -> Mu User's Manual.

A simple package for RV contains 2 files, a .mu or .py plugin and a text PACKAGE file. PACKAGE file is a description file that RV’s package system will use to determine how to load your package. Syntax for PACKAGE file is in YAML.

Copy paste this into an Example_Package_MyStuffMode.py file:

from rv import commands, rvtypes

class Example_Package_MyStuffMode(rvtypes.MinorMode):

def __init__(self):
rvtypes.MinorMode.__init__(self)

globalBindings = None #[("Event-Name", self.eventCallback, "DescriptionOfBinding")]
localBindings = None

("Example", [
("Run Example", self.runExample, None, lambda: NeutralMenuState),
])
]

def runExample(self, event):
print "DEBUG: Example Ran."

def createMode():
return Example_Package_MyStuffMode()


Paste this into a PACKAGE file:

package: MyStuff
author: Alexa Zalipyatskikh
organization: Autodesk
contact: support@shotgunsoftware.com
version: 1.0
requires: ''
rv: 7.3.1

modes:
- file: MyStuffMode

description: |
<p>Description of package here.</p>

1. Now zip up the Example_Package_MyStuffMode.py and PACKAGE file into a Example_Package_MyStuff-1.0.rvpkg file. NOTE: You need to specify the version of the RV Package in the file name as well as the PACKAGE file itself. Otherwise RV won’t load the package.

2. Launch RV and navigate to RV -> Preferences... -> Packages -> Add Packages... Then navigate to your Example_Package_MyStuff-1.0.rvpkg file. RV will ask you where you would like to install the package. This is your RV_SUPPORT_PATH area.

3. Make sure that both of the checkmarks are ON next to the package, then restart RV.

4. Open up Window -> Console and leave it where you can see it. You should now have an Example -> Run Example menu in RV. Click on Run Example. You should get a “Example ran” show up in the Console.

5. You can modify your plugin in RV_SUPPORT_PATH (where you installed plugin) under RV_SUPPORT_PATH/Python/Example_Package_MyStuffMode.py. You will need to restart RV every time you modify the python file there, but you WON’T have to reload the package. If you’re modifying your Python outside of the RV_SUPPORT_PATH/Python/Example_Package_MyStuffMode.py, you will need to re-install the package every time.

6. Congrats, you have installed your first package!

6 Likes

The Mu Programming Language manual is now available online also.

3 Likes

hi @alexaz,
I new users RV, Thank you an example. I follow your example write the package. But i use rvpkg.exe to install the packages, have error can’t install. So my question is i select .py and PACKAGE file add the .zip file and I rename to .rvpkg, i don’t know is this step not correct?

This is my command to install packages by cmds

C:\Program Files\Shotgun\RV-7.6.1\bin>rvpkg -add c:\Users\td_sum\AppData\Roaming\RV\Packages -install D:\sum\script\RV\myStuff\Example_Package_MyStuffMode-1.0.rvpkg
WARNING: missing doc directory in bundle
WARNING: missing html directory in bundle
c:/Users/td_sum/AppData/Roaming/RV/Packages/Packages/Example_Package_MyStuffMode-1.0.rvpkg
No matching packages foundPreformatted text

Thank you

I find out the problem is i use zip to .7z format is not work, but zip to .zip format is ok.

As anyone ever found a workaround for this?

• Can RV be forced to reload all scripts?