How to optimize the activation of Arnold Aovs using MEL or Python script? Not to do it manually every time? PS: I apologize for my English, this is my non-native language
Solved! Go to Solution.
Solved by agapovpavel1992. Go to Solution.
Why not use Render Setup to import/export the AOVs?
Because I'm using Maya 2016, and the Render Setup only appeared in 2017, if I'm wrong, correct me
Here's something to get you started. But be warned, there's no API. This is just using the code that MtoA uses to build the AOV user interface.
import maya.cmds as cmds import mtoa.aovs as aovs aovs.AOVInterface().addAOV('beauty' )
I make this:
global proc add_aov(int $number, string $passname, int $data, string $filter)
{
createNode aiAOVFilter -n "aiAOVFilter1";
setAttr ".ai_translator" -type "string" $filter;
createNode aiAOV -n ("aiAOV_"+$passname);
setAttr ".aovn" -type "string" $passname;
setAttr ".aovt" $data;
connectAttr defaultArnoldDriver.message ("aiAOV_"+$passname+".outputs[0].driver");
connectAttr aiAOVFilter1.message ("aiAOV_"+$passname+".outputs[0].filter");
connectAttr ("aiAOV_"+$passname+".message") defaultArnoldRenderOptions.aovList[$number];
};
//calling
add_aov(0, "direct_diffuse", 5, "gaussian");
Thats a good starting point.
Id like to create a custom AOV with code like you created the beauty above.
In the end it should be a one click ID pass.
Not that elegant but it works.
import maya.cmds as cmds import mtoa.aovs as aovs aovs.AOVInterface().addAOV("Object_ID") UtiD = cmds.createNode("aiUtility" , name="aiUtility_ID") <br> cmds.setAttr('aiUtility_ID.shadeMode' , 2) cmds.setAttr('aiUtility_ID.colorMode' , 21) cmds.connectAttr('aiUtility_ID.outColor' , 'aiAOV_Object_ID.defaultValue')