Python AOV's shaders

Python AOV's shaders

fabriceQ224F
Explorer Explorer
2,575 Views
8 Replies
Message 1 of 9

Python AOV's shaders

fabriceQ224F
Explorer
Explorer

Hi,

Is there a way to extract shader name from the AOV node with Python? I'd like to get 'cryptomatte' when I know AOV's node name ('crypto_asset' for example). I tried a listAttr on that AOV's node name but couldn't find any one related to the shader name.

Thank you!


0 Likes
2,576 Views
8 Replies
Replies (8)
Message 2 of 9

Stephen.Blair
Community Manager
Community Manager

MtoA automatically adds the cryptomatte aov shader when it sees the cryptomatte node (because the cryptomatte node has the aov_shader TRUE metadata in plug-ins\mtoa.mtd)

The shader name is automatically generated.



// Stephen Blair
// Arnold Renderer Support
0 Likes
Message 3 of 9

fabriceQ224F
Explorer
Explorer

Thank you Stephen. But what I'm trying to do is to find the name of the shader connected to an AOV (and, BTW, not especially cryptomattes). So, I have a node's name ('crypto_asset') and I'd like to find the shader called 'cryptomatte' that is connected to it...

0 Likes
Message 4 of 9

Stephen.Blair
Community Manager
Community Manager


For other AOVs, MtoA inserts an aov write node.

So for example, if you create an AOV named "ao" and assign an aiAmbientOcclusion shader to it, then when MtoA translates the scene, MtoA inserts an aov_write_rgba node.

The node is named defaultArnoldRenderOptions/aov_write_rgba_ao

So if you know the type and name of the AOV, you could build the shader name.





// Stephen Blair
// Arnold Renderer Support
0 Likes
Message 5 of 9

fabriceQ224F
Explorer
Explorer
Sorry, I made a simple scene with a sphere, an area light and an AO AOV node, but I can't find that aov_write_rgba_ao node... Can we find this in the Outliner? Is it only created during render time and then deleted?
0 Likes
Message 6 of 9

Stephen.Blair
Community Manager
Community Manager

That node never exists in Maya. It exists only in the data that MtoA sends to Arnold.



// Stephen Blair
// Arnold Renderer Support
0 Likes
Message 7 of 9

fabriceQ224F
Explorer
Explorer

Ok. Sorry Stephen but I'm a bit lost then, there's no real documentation about Python commands for managing MtoA... How can we concretely ask aov_write_rgba node to give us its shader's name thanks to Python?

0 Likes
Message 8 of 9

Stephen.Blair
Community Manager
Community Manager
You cannot get the name from the Maya scene, or from MtoA. MtoA creates the node and names it when MtoA translates the Maya scene to an Arnold scene. And there's no hooks/callbacks for the translation process that would give you the new node names.


// Stephen Blair
// Arnold Renderer Support
0 Likes
Message 9 of 9

fabriceQ224F
Explorer
Explorer
Well... Ok thank you, I'll do it the dirty way then... List source connections to aov's defaultValue attribute, this should give me the shader node's name.
0 Likes