#include <maya/MPxNode.h>
#include <maya/MString.h>
#include <maya/MTypeId.h>
#include <maya/MPlug.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnPlugin.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <string.h>
#include <maya/MIOStream.h>
#include <math.h>
{
public:
transCircle() {};
virtual ~transCircle() {};
static void* creator();
};
MTypeId transCircle::id( 0x80013 );
MObject transCircle::inputTranslate;
MObject transCircle::outputTranslate;
MObject transCircle::inputTranslateX;
MObject transCircle::inputTranslateY;
MObject transCircle::inputTranslateZ;
MObject transCircle::outputTranslateX;
MObject transCircle::outputTranslateY;
MObject transCircle::outputTranslateZ;
void* transCircle::creator()
{
return new transCircle;
}
{
inputTranslateX = nAttr.
create(
"inputTranslateX",
"itX",
inputTranslateY = nAttr.
create(
"inputTranslateY",
"itY",
inputTranslateZ = nAttr.
create(
"inputTranslateZ",
"itZ",
inputTranslate = nAttr.
create(
"inputTranslate",
"it",
inputTranslateX,
inputTranslateY,
inputTranslateZ );
outputTranslateX = nAttr.
create(
"outputTranslateX",
"otX",
outputTranslateY = nAttr.
create(
"outputTranslateY",
"otY",
outputTranslateZ = nAttr.
create(
"outputTranslateZ",
"otZ",
outputTranslate = nAttr.
create(
"outputTranslate",
"ot",
outputTranslateX,
outputTranslateY,
outputTranslateZ );
scale = nAttr.
create(
"scale",
"sc",
frames = nAttr.
create(
"frames",
"fr",
stat = addAttribute( inputTranslate );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( input );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( scale );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( frames );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( outputTranslate );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = attributeAffects( inputTranslateX, outputTranslateX );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( inputTranslateY, outputTranslateY );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( inputTranslateZ, outputTranslateZ );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( inputTranslate, outputTranslateX );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( inputTranslate, outputTranslateY );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( inputTranslate, outputTranslateZ );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( inputTranslate, outputTranslate );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( input, outputTranslateX );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( input, outputTranslateY );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( scale, outputTranslateX );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( scale, outputTranslateY );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( frames, outputTranslateX );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( frames, outputTranslateY );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
}
{
bool k = ( plug == outputTranslateX ) |
( plug == outputTranslateY ) |
( plug == outputTranslateZ ) |
( plug == outputTranslate );
if (!stat) { stat.
perror(
"inputValue: input");
return stat;}
if (!stat) { stat.
perror(
"inputValue: scale");
return stat;}
if (!stat) { stat.
perror(
"inputValue: frames");
return stat;}
if (!stat) { stat.
perror(
"inputValue: inputTranslate");
return stat;}
double currentFrame = inputData.
asDouble();
double scaleFactor = scaleData.
asDouble();
double framesPerCircle = framesData.
asDouble();
double angle = 6.2831853 * ( currentFrame/framesPerCircle );
double3 oTranslate;
oTranslate[0] = iTranslate[0] + (sin( angle ) * scaleFactor);
oTranslate[1] = iTranslate[1] + 1.0;
oTranslate[2] = iTranslate[2] + (cos( angle ) * scaleFactor);
otHandle.
set( oTranslate[0], oTranslate[1], oTranslate[2] );
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerNode( "transCircle", transCircle::id,
transCircle::creator, transCircle::initialize );
if (!status) {
status.
perror(
"registerNode");
return status;
}
return status;
}
{
status = plugin.deregisterNode( transCircle::id );
if (!status) {
status.
perror(
"deregisterNode");
return status;
}
return status;
}