template/zoomCameraTemplate/zoomCameraTemplate.cpp
#include <maya/MTemplateCommand.h>
#include <maya/MString.h>
#include <maya/MArgList.h>
#include <maya/MFnCamera.h>
#include <maya/MGlobal.h>
#include <maya/M3dView.h>
#include <maya/MDagPath.h>
#include <maya/MIOStream.h>
class zoomCameraTemplate;
char cmdName[] = "zoomCameraTemplate";
class zoomCameraTemplate :
public MTemplateCommand<zoomCameraTemplate,cmdName, MTemplateCommand_nullSyntax >
{
public:
zoomCameraTemplate()
{}
virtual ~zoomCameraTemplate()
{}
{
}
else {
cerr << "Error getting camera" << endl;
}
return stat;
}
{
double fl = fnCamera.focalLength();
fnCamera.setFocalLength( fl * 2.0 );
}
{
double fl = fnCamera.focalLength();
fnCamera.setFocalLength( fl / 2.0 );
}
private:
};
static zoomCameraTemplate _zoom;
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"2009",
"Any");
status = _zoom.registerCommand( obj );
if (!status)
{
status.
perror(
"registerCommand");
return status;
}
return status;
}
{
status = _zoom.deregisterCommand( obj );
if (!status)
{
status.
perror(
"deregisterCommand");
return status;
}
return status;
}