Community
Arnold for 3ds Max
Rendering with Arnold in 3ds Max using the MaxtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MEL or Python script for automaticaly activated Arnold AOV`s

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
agapovpavel1992
5361 Views, 6 Replies

MEL or Python script for automaticaly activated Arnold AOV`s

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

Tags (4)
Labels (4)
6 REPLIES 6
Message 2 of 7

Why not use Render Setup to import/export the AOVs?



// Stephen Blair
// Arnold Renderer Support
Message 3 of 7

Because I'm using Maya 2016, and the Render Setup only appeared in 2017, if I'm wrong, correct me

Message 4 of 7

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' )


// Stephen Blair
// Arnold Renderer Support
Message 5 of 7

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");

Message 6 of 7

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.

----------------------------------------------------------------
https://linktr.ee/cg_oglu
Message 7 of 7

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')

----------------------------------------------------------------
https://linktr.ee/cg_oglu

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report