question

Павел Агапов avatar image
Павел Агапов asked ·

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

arnoldaovaovspython
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Павел Агапов avatar image
Павел Агапов answered ·

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

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Stephen Blair avatar image
Stephen Blair answered ·

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

1 comment Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

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

0 Likes 0 · ·
Stephen Blair avatar image
Stephen Blair answered ·

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' )
Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Christoph Schaedl avatar image
Christoph Schaedl answered ·

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.

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Christoph Schaedl avatar image
Christoph Schaedl answered ·

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

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.