Get and Set parameters with Python
What to do when you need to set and get a parameter
Once you have access to an element and want to change one of it’s parameters using the usual print(dir(myLayer)) method or use Oil.docMe() to get a view of the possibilities. Here are a few properties of interest.
- For example we can set the label of the element, the code below will rename the first layer in the Elements Tree :
myLayer = script.parentElement.layers[0]
myLayer.label = "myLayer"
- The code below will deactivate the layer :
myLayer = script.parentElement.layers[0]
myLayer.activation.set(False)
- The first layer named “myLayer” could also be retrieved with :
myLayer = script.rootElement.layers["myLayer"]