Hi
despite reading http://www.creativecrash.com/forums/api/topics/mfnmesh-initialgroupshading thread I am having difficulty creating and using a shading group in order to assign a material to a new mesh.
I have created a function set, with the KRenderableONly flag set;
MFnSet fnSet;
MSelectionList sel;
MObject oSet = fnSet.create(sel, MFnSet::kRenderableOnly, &status);
fnSet.addMember(oNewMesh);
At this point when I check for the surfaceShader plug it is already present!
MPlug ss = fnSet.findPlug("surfaceShader", &status);
(status = kSuccess)
I have a material object already present which I get a MFnDependencyNode of
MFnDependencyNode materialNode(materialObject);
The material node has a outColor plug
MPlug outColorPlug = materialNode.findPlug("outColor", &status);
(status = kSuccess)
I was really hoping i could connect these 2 together with a MDGModifier
MDGModifier mod;
mod.connect(outColorPlug, ss));
status = mod.doIt();
(status != kSuccess)
Any help/advice would be much appreciated!