1 from __future__
import division
67 import maya.OpenMaya
as OpenMaya
68 import maya.OpenMayaUI
as OpenMayaUI
69 import maya.OpenMayaMPx
as OpenMayaMPx
71 kPluginCmdName =
"spZoomCamera"
73 print(
"zoomCameraCmd.py has been imported....")
76 class scriptedCommand(OpenMayaMPx.MPxCommand):
79 OpenMayaMPx.MPxCommand.__init__(self)
84 f1 = fnCamera.focalLength()
85 fnCamera.setFocalLength(f1 * 2.0)
90 f1 = fnCamera.focalLength()
91 fnCamera.setFocalLength(f1 / 2.0)
99 sys.stderr.write(
"ERROR: getting camera \n" )
103 def isUndoable(self):
108 return OpenMayaMPx.asMPxPtr( scriptedCommand() )
111 def initializePlugin(obj):
112 plugin = OpenMayaMPx.MFnPlugin(obj)
114 plugin.registerCommand( kPluginCmdName, cmdCreator)
116 sys.stderr.write(
"Failed to register command: %s\n" % kPluginCmdName )
119 def uninitializePlugin(obj):
120 plugin = OpenMayaMPx.MFnPlugin(obj)
122 plugin.deregisterCommand(kPluginCmdName)
124 sys.stderr.write(
"Failed to unregister command: %s\n" % kPluginCmdName )