To expose parameters in the Tool, start the script with your variables declarations as follows (one per line): the name of the variable, followed by a colon, and the constructor of the object.
Here is a list of the most used parameters:
For instance, the following code will display a widget for an Integer and a selector of cameras of the project:
All variables exposed by the script are accessible as children properties of the
script
object. Following the previous example, the first exposed variable can be accessed by
script.myInt
. Beware: this is an instance of Oil.Integer, you need to call the get() method to retrieve a Python int.
For any object, you can access a variable by its name(
getVariableByName
), or iterate through them with the methods
getNumVariables
and
getVariable
(that takes the index as a parameter).
You can use Oil.createObject() to create any type of parameter you want that are not build-in the python implementation
Set default value of this variable you can add **kwargs to the createObject function that correspond to the created object, like below
You can create parameters that point to Object