#include <stdio.h>
#include <maya/MArgList.h>
#include <maya/MCursor.h>
#include <maya/MDistance.h>
#include <maya/MEulerRotation.h>
#include <maya/MFn.h>
#include <maya/MFnCamera.h>
#include <maya/MFnNumericData.h>
#include <maya/MFnFreePointTriadManip.h>
#include <maya/MFnTransform.h>
#include <maya/MFnUnitAttribute.h>
#include <maya/MGlobal.h>
#include <maya/MItSelectionList.h>
#include <maya/MModelMessage.h>
#include <maya/MIOStream.h>
#include <maya/MPlug.h>
#include <maya/MPoint.h>
#include <maya/MPxNode.h>
#include <maya/MSelectionList.h>
#include "customTriadManip.h"
MTypeId customTriadManip::id( 0x80026 );
customTriadManip::customTriadManip()
{
}
customTriadManip::~customTriadManip()
{
}
void *customTriadManip::creator()
{
return new customTriadManip();
}
MStatus customTriadManip::initialize()
{
return stat;
}
MStatus customTriadManip::createChildren()
{
fTriadManip = addFreePointTriadManip("customtManip", "customPoint");
}
MVector customTriadManip::nodeTranslation() const
{
}
void customTriadManip::updateManipLocations()
{
MVector offset = nodeTranslation();
manipFn.setPoint(offset);
}
{
dagNodeFn.getPath(fNodePath);
MPlug cPlug = nodeFn.findPlug(
"translate", &stat);
manipFn.connectToPointPlug(cPlug);
finishAddingManips();
updateManipLocations();
return stat;
}
#define MOVEHELPSTR "Drag the triad manip to change the translation values"
#define MOVETITLESTR "customTriadManip"
static void updateTriadManipulator(void * data);
static MCallbackId mid = 0;
customTriadCtx::customTriadCtx()
{
setTitleString(str);
}
void customTriadCtx::toolOnSetup(
MEvent &)
{
setHelpString(str);
updateTriadManipulator(this);
updateTriadManipulator,
this, &status);
if (!status) {
cerr << "Model addCallback failed\n";
}
}
void customTriadCtx::toolOffCleanup()
{
if (!status) {
cerr << "Model remove callback failed\n";
}
}
static void updateTriadManipulator(void * data)
{
customTriadCtx * ctxPtr = (customTriadCtx *) data;
ctxPtr->deleteManipulators();
if (MS::kSuccess == stat) {
for (; !iter.isDone(); iter.next()) {
MString manipName (
"customTriadManip");
ctxPtr->caManip = (customTriadManip *) customTriadManip::newManipulator(manipName, manipObject);
if (NULL != ctxPtr->caManip) {
iter.getDependNode(dependNode);
ctxPtr->addManipulator(manipObject);
dependNodeFn.findPlug("translate", &stat);
ctxPtr->deleteManipulators();
return;
}
ctxPtr->caManip->connectToDependNode(dependNode);
}
}
}
}
{
return setHelpString(str);
}
{
customTriadCtx *newC = new customTriadCtx();
return newC;
}
void *customTriadCtxCommand::creator()
{
return new customTriadCtxCommand;
}