Manage AOVs with Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm currently studying 3D animation and I'm tasked with automating redundant tasks on the production of our short, end-of-studies film.
I have been working on a script that manage and set up render layers, render settings and aovs to help improve our workflow. I was able to use the Render Setup Python API for most of my script which works great.
I was however stuck with one problem. It seems that importing Cryptomatte AOVs from a .json config file doesn't work. If I understand correctly, it's a plugin and has to be 'initialized' for each scene.
Therefore, I tasked myself to implement at the end of my script a way to unload and reload the Cryptomatte's AOV.
There is no documentation. wtf.
The only easy way I found was posted 8 years ago on stackoverflow here.
Why on earth can't you have a coherent list of commands and methods to use the AOV Interface with python?
Why would you think that an anwser like 'just look for plugin information to see the available commands' is acceptable?
For anyone stumbling across this thread, I figured out how to do the 'unload-reaload' thing with python and a lot of tinkering. Here is so far a list of commands I used to make it work, feel free to had other commands so that together we can make the documentation that so far is lacking (Yay) :
#import the librairy managing the AOV Interface
import mtoa.aovs as aovs
#remove an AOV
aovs.AOVInterface().removeAOV('crypto_asset')
#add an AOV
aovs.AOVInterface().addAOV('crypto_asset',aovType='rgb')
"""note that the aovType parameter determine the 'data' column in the AOV Interface."""
"""Unfortunatly, I wasn't able to find the right parameters names to setup the driver and filter parameter."""
# List all AOVs with their names
print(aovs.AOVInterface().getAOVNodes(names=True))
Sorry for the long post and the rant, I just find it really infuriating to have to guess that the contrary to 'add' is 'remove' and not 'delete'.
Cheers,
Maxime