#include <maya/MFnPlugin.h>
#include <maya/MIOStream.h>
#include <maya/MPxNode.h>
#include <maya/MString.h>
#include <maya/MTypeId.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFloatVector.h>
{
public:
myComp();
virtual ~myComp();
static void * creator();
private:
};
#define MAKE_INPUT(attr) \
CHECK_MSTATUS( attr.setKeyable(true)); \
CHECK_MSTATUS( attr.setStorable(true)); \
CHECK_MSTATUS( attr.setReadable(true)); \
CHECK_MSTATUS( attr.setWritable(true));
#define MAKE_OUTPUT(attr) \
CHECK_MSTATUS( attr.setKeyable(false)); \
CHECK_MSTATUS( attr.setStorable(false)); \
CHECK_MSTATUS( attr.setReadable(true)); \
CHECK_MSTATUS( attr.setWritable(false));
void myComp::postConstructor( )
{
setMPSafe(true);
}
myComp::myComp()
{
}
myComp::~myComp()
{
}
void * myComp::creator()
{
return new myComp();
}
{
aForegroundColor = nAttr.
createColor(
"foreground",
"fg");
MAKE_INPUT(nAttr);
aBackgroundColor = nAttr.
createColor(
"background",
"bg");
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_OUTPUT(nAttr);
MAKE_OUTPUT(nAttr);
}
{
if((plug != aOutColor) && (plug.
parent() != aOutColor) &&
(plug != aOutAlpha))
if ( alpha > 0.99999f ) alpha = 1.f;
else if ( alpha < 0.00001 ) alpha = 0.f;
resultColor = fore + ((bclr - back) * (1.0f - alpha));
if (resultColor[0] < 0.f ) resultColor[0] = 0.f;
if (resultColor[1] < 0.f ) resultColor[1] = 0.f;
if (resultColor[2] < 0.f ) resultColor[2] = 0.f;
if (resultColor[0] > 1.f ) resultColor[0] = 1.f;
if (resultColor[1] > 1.f ) resultColor[1] = 1.f;
if (resultColor[2] > 1.f ) resultColor[2] = 1.f;
outColor = resultColor;
float& outAlpha = outAlphaHandle.
asFloat();
outAlpha = ( resultColor.
x + resultColor.
y + resultColor.
z ) / 3.0f;
}
{
const MString UserClassify(
"utility/color" );
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"4.5",
"Any");
&myComp::creator, &myComp::initialize,
}
{
}