Create a new shader (shader connected to shadingEngine, which has to be connected to the renderparition again), and assign it to mesh polygon components.
First I tried to create all the nodes (lambert, shadingEngine) manually, and connecting them accodingly, but that wouldn`t work. Maya was not willing to thread this construct as a shader :(.
Okay then, so I took the MFnSet and wanted to use the
.create(MSelectionList&, MFnSet::kRenderableOnly, MStatus) method.
The problem was: It always gave back an invalid MObject which was supposed to be my handle to the newly created shadingEngine/shaderSet.
The status I received was MS::kSuccess ....
I initialized the selection List , which was supposed to hold the initial set members, with no Object, or with a mesh, or with a meshPath and the components, but all that failed.
(the mesh had no shaderassignments at all since it was newly created)
I also tried to use no setLimits at all (MFnSet::kNone), but that didn`t work too.
Finally I decided to use MEL to create a shadingengine, and then operate on it with the MFnSet, which fortunately worked fine.
Does anyone have an idea what could have gone wrong, or is this a general known problem?
Thanks for reading,