Documentation on some key RV python functions

Hi everyone!

I would like to know how some key python functions behave, what their input parameters do and what their return values are.

from rv import commands

commands.setIntProperty(node + '.' + prop, [value], True)
commands.getIntProperty(node + '.' + prop, 0, 1)[0]
commands.setFloatProperty(node + '.' + prop, [value], True)
commands.getFloatProperty(node + '.' + prop, 0, 1)[0]
commands.setStringProperty(node + '.' + prop, [value], True)
commands.getStringProperty(node + '.' + prop, 0, 1)[0]

Here are my questions:

  1. How are the 2 additional parameters in the “getter” functions defined? What do they do? What is their type?
  2. Do the “getter” functions always return lists?
  3. Do the values always have to be given as a list in the “setter” functions?
  4. What does the 3rd parameter mean in the “setter” functions?
  5. Are there any additional parameters to these functions?
  6. Are there any resources online to learn more about the RV python libraries?

Thanks in advance!

Cheers,
Fabian

1 Like

Hi Fabian!

A resource that has proven invaluable for learning and discovering the underlying API of RV has been the Mu Command API Browser available in the help menu. For example any functions in rv.commands that you have questions about can be searched for by name and their signature & documentation returned.

As for you questions:

The second and third argument to the getter functions are start and num, respectively. They act similarly to slicing a python list returning a subset of values from the property’s value-list.

Yes, property getters always return a value of type list.

Yes, property setters always require a value of type list.

The third parameter of a setter function is a bool controlling whether the property can resize when set with a value-list of different length than currently set. (The “width” of the value-list is set when a new property is created with commands.newProperty.)

You’ve got them all! For prosperity, here are the signature for the string property getter and setter:

setStringProperty (void; 
                   string propertyName,
                   string[] value,
                   bool allowResize = false)

getStringProperty (string[]; 
                   string propertyName,
                   int start = 0,
                   int num = 2147483647)

Unfortunately there are few online resources for learning about the Python API. The best resources I’ve found so far are the Mu Command API Browser in RV’s help menu and the source of the native plugins supplied with RV.

Let me know if you have any other questions, cheers!

4 Likes

Thanks @collinbanko, for the very detailed response! The Mu Command API Browser is a great tip!