well , I am little bit confused , If I have the code below in userSetup.py everything works fine…
import maya.mel as mel
import maya.cmds as cmds
import revealInOutliner
import setimgpln
scrloc=cmds.internalVar(usd=True)+"selViewCamera.mel"
def menu():
"""
This function includes the menu shortcut to various tools.
1. Toggle Imageplane
2. Set ImagePlane
3. Create Camera from selected view
4. Reveal selected object in Outliner
5. Reveal selected object's material in Hypershade
"""
cmds.evalDeferred("men = cmds.menu( label='SMT', tearOff = True, p='MayaWindow', )")
cmds.evalDeferred("Sub = cmds.menuItem( subMenu=True, label='Reveal' )")
cmds.evalDeferred("cmds.menuItem( label='Object In Outliner', c= 'revealInOutliner.run()')")
cmds.evalDeferred("cmds.menuItem( label='Material in Hypershade', c= 'revealInOutliner.run(4)')")
cmds.evalDeferred("cmds.setParent( '..', menu=True )")
cmds.evalDeferred("cmds.menuItem( label='Create Camera Selected View', c='source \"'+scrloc+'\";selViewCamera()', stp='mel')")
cmds.evalDeferred("cmds.menuItem( label='Set Imageplane', c= 'setimgpln.main()')")
cmds.evalDeferred("cmds.menuItem( label='Toggle Imageplane', c= 'setimgpln.main(4)')")
menu()
but if I put the code above to SMT.py and then import SMT from userSetup.py I get error 5 times cmds not found. so then I included import maya.cmds as cmds and import maya.mel as mel inside userSetup.py that makes sense since everything in userSetup.py is global scope but then menu Loads up but the menu itmes dont work for that I have to put
import revealInOutliner
import setimgpln
scrloc=cmds.internalVar(usd=True)+“selViewCamera.mel”
inside of userSetup.py then everything works fine…
all I wanted is If i put import SMT in userSetup.py everything should work but it doesnt … how should i set it up properly … that I tell the artist just import SMT in his userSetup.py and nothing else and whole tools menu should load up with working menu items…