Maahes
2007-03-28 02:14:26 UTC
Heya. I've just started writing a Maya exporter this week (so I'm a
total noob to Maya API and don't know any Mel script other than
loadPlugin and unloadPlugin) and I'm having trouble with something that
seems like it should be really simple.
I have a shaderEngine object and I'm trying to get the name of the
surface material object that is applied to it. (ie. the name that comes
up in the HyperShade window for each shader).
I've tried grabbing the surface Shader attribute but its name is
"surfaceShader"... so that was a dead end for me.
My code to this point looks like:
meshFn.getConnectedShaders(0, shaders, shaderPolygons);
for (u32 obj=0; obj<shaders.length(); obj++)
{
MObject shader = shaders[obj];
MFnSet shaderFn( shader, &status );
if (status == MS::kSuccess)
{
// so shaderFn is a shader engine node. (tested this earlier)
// how do I get the name of the material surface it is using?
// ???
}
}
Can anyone help, or point me to some resources that can help me.
I can't find anything in the Maya help that tells me where to go from here.
total noob to Maya API and don't know any Mel script other than
loadPlugin and unloadPlugin) and I'm having trouble with something that
seems like it should be really simple.
I have a shaderEngine object and I'm trying to get the name of the
surface material object that is applied to it. (ie. the name that comes
up in the HyperShade window for each shader).
I've tried grabbing the surface Shader attribute but its name is
"surfaceShader"... so that was a dead end for me.
My code to this point looks like:
meshFn.getConnectedShaders(0, shaders, shaderPolygons);
for (u32 obj=0; obj<shaders.length(); obj++)
{
MObject shader = shaders[obj];
MFnSet shaderFn( shader, &status );
if (status == MS::kSuccess)
{
// so shaderFn is a shader engine node. (tested this earlier)
// how do I get the name of the material surface it is using?
// ???
}
}
Can anyone help, or point me to some resources that can help me.
I can't find anything in the Maya help that tells me where to go from here.