#include <maya/MIOStream.h>
#include <maya/MFnPlugin.h>
#include <maya/MString.h>
#include <maya/MArgList.h>
#include <maya/MPxCommand.h>
#include <maya/MGlobal.h>
#include <maya/MTime.h>
#include <maya/MDagPath.h>
#include <maya/MItSelectionList.h>
#include <maya/MSelectionList.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MPlugArray.h>
#include <maya/MPlug.h>
#include <maya/MPoint.h>
#include <maya/MPointArray.h>
#include <maya/MDoubleArray.h>
#include <maya/MObjectArray.h>
#include <maya/MFnNurbsCurve.h>
{
public:
motionTrace();
~motionTrace() override;
static void* creator();
private:
double start, end, by;
};
motionTrace::motionTrace() {}
void* motionTrace::creator()
{
return new motionTrace();
}
motionTrace::~motionTrace()
{
}
{
start = 1.0;
end = 60.0;
by = 1.0;
double tmp;
unsigned i;
for ( i = 0; i < args.
length(); i++ )
{
MS::kSuccess == stat)
{
if ( MS::kSuccess == stat )
start = tmp;
}
MS::kSuccess == stat)
{
if ( MS::kSuccess == stat )
end = tmp;
}
MS::kSuccess == stat)
{
if ( MS::kSuccess == stat )
by = tmp;
}
}
stat = redoIt();
return stat;
}
{
unsigned int deg = 1;
unsigned int i;
for ( i = 0; i < cvs.
length(); i++ )
knots, deg,
false, false,
&stat );
if ( MS::kSuccess != stat )
cout<<"Error creating curve."<<endl;
}
{
for ( ; !iter.isDone(); iter.next() )
{
if ( MS::kSuccess != iter.getDependNode( dependNode ) )
{
cerr << "Error getting the dependency node" << endl;
continue;
}
}
unsigned int i;
double time;
for ( time = start; time <= end; time+=by )
{
for ( i = 0; i < picked.
length(); i++ )
{
dependNode = picked[i];
txAttr = fnDependNode.attribute(
MString(
"translateX"), &stat );
MPlug txPlug( dependNode, txAttr );
double tx;
stat = txPlug.getValue( tx );
tyAttr = fnDependNode.attribute(
MString(
"translateY"), &stat );
MPlug tyPlug( dependNode, tyAttr );
double ty;
stat = tyPlug.getValue( ty );
tzAttr = fnDependNode.attribute(
MString(
"translateZ"), &stat );
MPlug tzPlug( dependNode, tzAttr );
double tz;
stat = tzPlug.getValue( tz );
#if 0
fprintf( stderr,
"Time = %2.2lf, XYZ = ( %2.2lf, %2.2lf, %2.2lf )\n\n",
time, tx, ty, tz );
#endif
}
}
for ( i = 0; i < picked.
length(); i++ )
jMakeCurve( pointArrays[i] );
delete [] pointArrays;
return MS::kSuccess;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerCommand( "motionTrace", motionTrace::creator );
if (!status) {
status.
perror(
"registerCommand");
return status;
}
return status;
}
{
status = plugin.deregisterCommand( "motionTrace" );
if (!status) {
status.
perror(
"registerCommand");
return status;
}
return status;
}