ViewNudger¶
Unfortunately in maya you are unable to nudge a camera or by sub pixel amounts. ViewNudger solves that by letting you.
Features¶
- Any pixel amount nudging.
- Great for fixing stubborn tracks in Maya.
- No extra libraries needed.
Planned Features¶
- Give me ideas!
Requirements¶
- Autodesk Maya 2015 (http://www.autodesk.com/products/maya/overview)
Table of Contents¶
Installation¶
Get ViewNudger for Maya¶
Using the MEL setup script¶
- Download the package from the github repo http://github.com/chrisdevito/ViewNudger.git and click Download Zip.
- After extraction, drag and drop the setup.mel (found in the ViewNudger directory) into any open maya window.
- This will install it into your maya/scripts directory.
Using Pip¶
$ pip install ViewNudger
Git¶
$ git clone https://github.com/chrisdevito/ViewNudger
$ cd ViewNudger
$ python setup.py install
Manual¶
- Download the package from the github repo http://github.com/chrisdevito/ViewNudger.git and click Download Zip.
- Copy the ViewNudger folder into your maya/scripts path.
How to Run¶
Drop this code as a button or run from the maya python script editor.
from ViewNudger import ui
if __name__ == '__main__':
global win
try:
win.close()
except:
pass
win = ui.UI()
win.create()
API¶
-
ViewNudger.api.
force_update
(view)[source]¶ Selects the center of the viewport to force it to refresh properly in VP1. THIS IS AWFUL.
Parameters: view (OpenMaya.M3dView) – View to convert point. Raises: None Returns: None Return type: NoneType
-
ViewNudger.api.
getCamera
(view)[source]¶ Gets the camera from the current view.
Parameters: view (OpenMaya.M3dView) – View to get camera from. Raises: None Returns: Camera function set. Return type: OpenMaya.MFnCamera
-
ViewNudger.api.
getRenderer
(view)[source]¶ Gets the current renderer in viewport.
Parameters: view (OpenMaya.M3dView) – View to convert point. Raises: None Returns: Name of current renderer. Return type: str
-
ViewNudger.api.
getSelection
()[source]¶ Gets the current selection.
Raises: RuntimeError – If nothing selected. Returns: First index of object selected Return type: str
-
ViewNudger.api.
nudge
(transformName=None, pixelAmount=[1.0, 1.0], moveObject=False, rotateView=False, view=None)[source]¶ Moves object/camera by pixel amount in x and y.
Parameters: - transformName (str) – Name of a transform to nudge from.
- pixelAmount (list of 2 floats) – Pixel amount to nudge in x and y.
- moveObject (bool) – Move the object instead of view.
- rotateView (bool) – Rotate the camera back at point after nudge.
- view (OpenMaya.M3dView) – View to calculate nudge one.
Raises: None
Returns: None
Return type: NoneType
-
ViewNudger.api.
parseArgs
(transformName, view=None)[source]¶ Checks input values.
Parameters: - transformName (str) – Name of a transform to nudge from.
- view (OpenMaya.M3dView or Str) – Optional desired M3dView.
Raises: - RuntimeError – If transformName isn’t a transform or doesn’t exist.
- RuntimeError – If view set is not a view.
Returns: view
Return type: OpenMaya.M3dView
-
ViewNudger.api.
screenToWorld
(fnCamera=None, point2D=None, cameraPoint=None, setDistance=1.0, view=None)[source]¶ Converts a screen point to world.
Parameters: - fnCamera (OpenMaya.MFnCamera) – Camera function set.
- point2D (list of 2 floats) – x and y values to convert to 3d value.
- cameraPoint (OpenMaya.MPoint) – Position to test.
- setDistance (float) – Distance to set returned point from camera.
- view (OpenMaya.M3dView) – View to convert point.
Raises: None
Returns: 2d Point converted to 3d point.
Return type: OpenMaya.MPoint
-
ViewNudger.api.
worldToScreen
(fnCamera=None, cameraPoint=None, transformPoint=None, view=None)[source]¶ Converts a world point into a screen point.
Parameters: - fnCamera (OpenMaya.MFnCamera) – Camera function set.
- cameraPoint (OpenMaya.MPoint) – Position to test.
- transformPoint (OpenMaya.MPoint) – Position to test.
- view (OpenMaya.M3dView) – View to convert point.
Raises: None
Returns: x and y position of 3d point.
Return type: list of 2 floats