#include <maya/MIOStream.h>
#include <maya/MPxCommand.h>
#include <maya/MFnPlugin.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>
{
public:
zoomCamera() {};
~zoomCamera() override;
static void* creator();
private:
};
zoomCamera::~zoomCamera() {}
void* zoomCamera::creator()
{
return new zoomCamera();
}
{
if ( MS::kSuccess == stat ) {
redoIt();
}
else {
cerr << "Error getting camera" << endl;
}
return stat;
}
{
double fl = fnCamera.focalLength();
fnCamera.setFocalLength( fl * 2.0 );
return MS::kSuccess;
}
{
double fl = fnCamera.focalLength();
fnCamera.setFocalLength( fl / 2.0 );
return MS::kSuccess;
}
bool zoomCamera::isUndoable() const
{
return true;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerCommand( "zoomCamera", zoomCamera::creator );
if (!status) {
status.
perror(
"registerCommand");
return status;
}
return status;
}
{
status = plugin.deregisterCommand( "zoomCamera" );
if (!status) {
status.
perror(
"deregisterCommand");
return status;
}
return status;
}