Search code examples
pythonmayamaya-api

How to add an material to the maya scene?


Hi everyone I am trying to write some script to automate my work in Maya.

Right now I am looking for the way to add materials to the hypershade.

I can't see anything on console (Script editor) so I can't se what python api I should use.

I know that maya treat materials as sets, and to assign a material to polygon I need to put it in this set, but I don't know how to create a new set.

So my question is: How I add a material to the scene using python maya-api?


Solution

  • you have to use createNode :

    node = cmds.createNode('blinn', name='yipikai')