#include "slopeShaderBehavior.h"
#include <maya/MGlobal.h>
#include <maya/MPlugArray.h>
#include <maya/MFnDagNode.h>
#include <maya/MObjectArray.h>
slopeShaderBehavior::slopeShaderBehavior()
{
}
slopeShaderBehavior::~slopeShaderBehavior()
{
}
void *slopeShaderBehavior::creator()
{
return new slopeShaderBehavior;
}
bool slopeShaderBehavior::shouldBeUsedFor(
MObject &sourceNode,
MObject &destinationNode,
{
bool result = false;
{
src.getConnections(connections);
for(
unsigned i = 0; i < connections.
length(); i++)
{
connections[i].connectedTo(connectedPlugs, true, false);
for(
unsigned j = 0; j < connectedPlugs.
length(); j++)
{
{
shaderNode = connectedPlugs[j].node();
break;
}
}
{
result = true;
break;
}
}
}
{
result = true;
result = true;
}
return result;
}
MStatus slopeShaderBehavior::connectNodeToNode(
MObject &sourceNode,
MObject &destinationNode,
bool force )
{
{
src.getConnections(connections);
unsigned i;
for(i = 0; i < connections.
length(); i++)
{
connections[i].connectedTo(connectedPlugs, true, false);
for(
unsigned j = 0; j < connectedPlugs.
length(); j++)
{
MObject currentnode = connectedPlugs[j].node();
{
shaderNodes.
append(currentnode);
}
}
}
{
{
for(i = 0; i < shaderNodes.
length(); i++)
{
MPlug srcPlug = dest.findPlug(
"worldMesh");
{
cmd += srcPlug.
name() +
" ";
}
}
MObject shadingEngine = findShadingEngine(sourceNode);
{
MString cmd =
"sets -edit -forceElement ";
}
}
}
}
else if(src.typeName() == "slopeShader")
{
{
MPlug srcPlug = dest.findPlug(
"worldMesh");
MPlug destPlug = src.findPlug(
"dirtyShaderPlug");
{
cmd += srcPlug.
name() +
" ";
}
}
}
return result;
}
MStatus slopeShaderBehavior::connectNodeToAttr(
MObject &sourceNode,
MPlug &destinationPlug,
bool force )
{
if(src.typeName() == "slopeShader")
{
MPlug srcPlug = src.findPlug(
"outColor");
{
cmd += srcPlug.
name() +
" ";
cmd += destinationPlug.
name();
}
}
} else {
result = connectNodeToNode(sourceNode, destinationNode, force);
}
return result;
}
{
MPlug srcPlug = nodeFn.findPlug(
"outColor");
for(
unsigned i = 0; i < nodeConnections.
length(); i++)
{
return nodeConnections[i].node();
}
}