motionPathCmd/motionPathCmd.cpp
#include <string.h>
#include <maya/MIOStream.h>
#include <maya/MFnPlugin.h>
#include <maya/MString.h>
#include <maya/MArgList.h>
#include <maya/MSelectionList.h>
#include <maya/MItSelectionList.h>
#include <maya/MGlobal.h>
#include <maya/MDagPath.h>
#include <maya/MFnMotionPath.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MTime.h>
#include <maya/MPxCommand.h>
{
public:
motionPath() {};
virtual ~motionPath();
static void* creator();
};
void* motionPath::creator()
{
return new motionPath();
}
motionPath::~motionPath() {}
{
for (; !itr.isDone(); itr.next() )
{
if ( !objectToAnimate.
isValid() ) {
itr.getDagPath( objectToAnimate, component );
}
else if ( !motionCurve.
isValid() ) {
itr.getDagPath( motionCurve, component );
}
else {
break;
}
}
mdepNode = fnMotionPath.
create( motionCurve, objectToAnimate,
startTime, endTime );
}
return stat;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerCommand( "motionPath", motionPath::creator );
if (!status) {
status.
perror(
"registerCommand");
return status;
}
return status;
}
{
status = plugin.deregisterCommand( "motionPath" );
if (!status) {
status.
perror(
"deregisterCommand");
return status;
}
return status;
}