This is an updated collection of tools that I have made and pulled together into a single location in Maya.
New Features:
NAN Perspective Fix.
import maya.cmds as cmds
import maya.mel as mel
#New Scene with No Dialogue Tool function and buttion.
def NewSceneNoDialogue(*args):
cmds.file(new=True,force=True);
#Center Asset Tool function and buttion.
def CappingTool(*args):
capObjects = cmds.ls(sl=True);
cmds.polyExtrudeEdge(capObjects, ls=(.1, .1, 0));
cmds.MergeToCenter(capObjects);
#Capping Tool Tool function and buttion.
def centerAsset(*args):
centerObjects = cmds.ls(sl=True);
cmds.CenterPivot(centerObjects);
print centerObjects;cmds.move(0,0,0,rpr=True);
#Select Cap Tool function and buttion.
def selectCap(*args):
CapSF=cmds.polyListComponentConversion (tf=True);
CapSF=cmds.select (CapSF,r=True);
CapSF=cmds.ls (sl=True,fl=True);
#NAN Perspective Fix function and buttion.
def nanPerspFix(*args):
cmds.select('persp',r=True);
mel.eval('ResetTransformations');
mel.eval('GoToDefaultView');
#Main UI Window Start.
cmds.window( widthHeight=(390, 390), t="Toms Tools." )
form = cmds.formLayout()
tabs = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5)
cmds.formLayout( form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0)) )
#Tools Tab UI.
ToolsTab = cmds.rowColumnLayout(numberOfColumns=1)
cmds.iconTextButton( style='iconAndTextHorizontal', image1='polyCube.png', label='New Scene With No Dialogue Tool.', command=NewSceneNoDialogue )
cmds.iconTextButton( style='iconAndTextHorizontal', image1='locator.png', label='Center Asset Tool.', command=centerAsset )
cmds.iconTextButton( style='iconAndTextHorizontal', image1='polyPipe.png', label='Capping Tool Tool.', command=CappingTool )
cmds.iconTextButton( style='iconAndTextHorizontal', image1='polyCollapseEdge.png', label='Select Cap Tool.', command=selectCap )
cmds.iconTextButton( style='iconAndTextHorizontal', image1='view.png', label='NAN Perspective Fix. [UNTESTED!]', command=nanPerspFix )
cmds.setParent( '..' )
#Help Tab UI.
HelpTab = cmds.rowColumnLayout(numberOfColumns=2)
cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(170, 50) )
#New Scene No Dialogue Tool help with description.
cmds.text( l='New Scene No Dialogue Tool', al='center', ww=True,w=1,rs=True )
cmds.text( l='Opens up a new scene with no new scene dialogue. Use with caution!', al='center', ww=True )
#Center Asset Tool help with description.
cmds.text( l='Center Asset Tool', al='center', ww=True,rs=True )
cmds.text( l='Click this button to centre a pivot point of an asset and then move the asset to the centre of the world.', al='center', ww=True )
#Capping tool help with description.
cmds.text( l='Capping Tool', al='center', ww=True, w=1,rs=True )
cmds.text( l='Simply select a edge loop of a pipe and click this button to cap the pipe.', al='center', ww=True )
#Capping tool help with description.
cmds.text( l='Select Cap Tool', al='center', ww=True,rs=True )
cmds.text( l='Simply select the centre vertex of the cap and click the button to select the cap.', al='center', ww=True )
#Capping tool help with description.
cmds.text( l='NAN Perspective Fix. [UNTESTED!]', al='center', ww=True,rs=True )
cmds.text( l='Simply select click the button to Fix Perspective camera. The perpective camera must be named "persp"', al='center', ww=True )
#Support with description.
cmds.text( l='Support', al='center', ww=True,rs=True )
cmds.text( l='tom.revill@gmail.com', al='center', ww=True,rs=True )
cmds.setParent( '..' )
#Main UI Window End.
#Defines the tabs
cmds.tabLayout( tabs, edit=True, tabLabel=((ToolsTab, 'Tools'), (HelpTab, 'Help')) )
cmds.showWindow()