python script that adds Arnold node - hypershade not updating

python script that adds Arnold node - hypershade not updating

Anonymous
Not applicable
4,318 Views
3 Replies
Message 1 of 4

python script that adds Arnold node - hypershade not updating

Anonymous
Not applicable

When executing this simple script that adds an Arnold standard surface node:

________

for item in selection:

     cmds.createNode( 'aiStandardSurface', n=item )

_______

 

Hypershade does not update the "Materials" tab to indicate the material is there. It shows up in the in the outliner with (DAG objects only = FALSE).

 

How do I add the shader to Materials tab???

 

Thanks.

0 Likes
Accepted solutions (1)
4,319 Views
3 Replies
Replies (3)
Message 2 of 4

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

How are you using this script?

 

I just made a new scene with a basic object and tried running the script but only get syntax errors.

 

 

0 Likes
Message 3 of 4

mspeer
Consultant
Consultant
Accepted solution

Hi!

 

Just creating this one node is not enough.

If you use the UI to create a material there is a lot more going on like creating additional nodes and make connections to other nodes.

These nodes and connections to these nodes are needed:

- ShaderGroup

- materialInfo

- renderPartition

- lightLinker

- defaultShaderList

 

If you want to work with single nodes, use the Node Editor.

 

Edit:

If you only need the visibility in Hypershade use command shadingNode, this creates a connection to defaultShaderList:

https://help.autodesk.com/cloudhelp/2015/CHS/Maya-Tech-Docs/CommandsPython/shadingNode.html

Message 4 of 4

Anonymous
Not applicable

Awesome! This saves a line of python. Instead of creating the node and doing a connectAttr to the appropriate list, I can just create and connect in one line. Thank you!