def SundayInstallPipelineCheckForUpdate(mode): import SundaySetupPublicPy as SundaySetupPublicPy reload(SundaySetupPublicPy) import SundayDialogPy as SundayDialogPy reload(SundayDialogPy) fetchFile = tempfile.gettempdir() + os.sep + 'SundayInstallPipelinePublicPy.py' try: open(fetchFile, 'wb').write(urllib2.urlopen('http://3dg.dk/sundaypipeline/mayapublic/SundayInstallPipelinePublicPy.temp').read()) except: if mode == 'active': SundayDialogPy.SundayDialogConfirm('Error Fetching Pipeline From Online Repository ', 'Check Net Connection or Firewall Settings', 'OK') else: print 'Error Fetching Pipeline From Online Repository - Check Net Connection or Firewall Settings' return None onlineVersion = imp.load_source('module.name', fetchFile).SundayInstallPipelineVersion() if onlineVersion > SundayInstallPipelineVersion(): updateResult = SundayDialogPy.SundayDialogPromptYesNoCancel('New Sunday Pipeline Version: ' + str(onlineVersion) + ' ', 'Update now?', ' CHANGE LOG ', 'YES', 'NO') if updateResult == 'YES': try: SundaySetupPublicPy.SundaySetupSettingssUIClose() except: pass imp.load_source('module.name', fetchFile).SundayInstallPipeline() if updateResult == ' CHANGE LOG ': cmds.showHelp('http://www.3dg.dk/2011/08/12/sunday-pipeline-maya-public/#changelog', absolute = True) elif mode == 'active': SundayDialogPy.SundayDialogConfirm('Sunday Pipeline Is Up To Date ', 'Current Version: ' + str(SundayInstallPipelineVersion()), 'OK') else: print 'Sunday Pipeline Is Up To Date. Current Version: ' + str(SundayInstallPipelineVersion())
def upToDateCheck(revision, prompt=True): ''' This is a check that can be run by scripts that import ml_utilities to make sure they have the correct version. ''' if revision > __revision__: if prompt and mc.optionVar(query='ml_utilities_revision') < revision: result = mc.confirmDialog( title='Module Out of Date', message= 'Your version of ml_utilities may be out of date for this tool. Without the latest file you may encounter errors.', button=[ 'Download Latest Revision', 'Ignore', "Don't Ask Again" ], defaultButton='Download Latest Revision', cancelButton='Ignore', dismissString='Ignore') if result == 'Download Latest Revision': mc.showHelp('http://morganloomis.com/download/ml_utilities.py', absolute=True) elif result == "Don't Ask Again": mc.optionVar(intValue=('ml_utilities_revision', revision)) return False return True
def mayaDocsLocation(version=None): docLocation = None if (version == None or version == versions.installName() ) and mayaIsRunning(): # Return the doc location for the running version of maya from maya.cmds import showHelp docLocation = showHelp("", q=True, docs=True) # Older implementations had no trailing slash, but the result returned by # showHelp has a trailing slash... so eliminate any trailing slashes for # consistency while docLocation != "" and os.path.basename(docLocation) == "": docLocation = os.path.dirname(docLocation) # Want the docs for a different version, or maya isn't initialized yet if not docLocation or not os.path.isdir(docLocation): docLocation = getMayaLocation(version) # use original version if docLocation is None and version is not None: docLocation = getMayaLocation(None) _logger.warning("Could not find an installed Maya for exact version %s, using first installed Maya location found in %s" % (version, docLocation) ) if version: short_version = versions.parseVersionStr(version, extension=False) else: short_version = versions.shortName() if platform.system() == 'Darwin': docLocation = os.path.dirname(os.path.dirname(docLocation)) docLocation = os.path.join(docLocation , 'docs/Maya%s/en_US' % short_version) return os.path.realpath(docLocation)
def mayaDocsLocation(version=None): docLocation = os.environ.get('MAYA_DOC_DIR') if (not docLocation and (version is None or version == versions.installName() ) and mayaIsRunning()): # Return the doc location for the running version of maya from maya.cmds import showHelp docLocation = showHelp("", q=True, docs=True) # Older implementations had no trailing slash, but the result returned by # showHelp has a trailing slash... so eliminate any trailing slashes for # consistency while docLocation != "" and os.path.basename(docLocation) == "": docLocation = os.path.dirname(docLocation) # Want the docs for a different version, or maya isn't initialized yet if not docLocation or not os.path.isdir(docLocation): docBaseDir = os.environ.get('MAYA_DOC_BASE_DIR') if not docBaseDir: docBaseDir = getMayaLocation(version) # use original version if docBaseDir is None and version is not None: docBaseDir = getMayaLocation(None) _logger.warning("Could not find an installed Maya for exact version %s, using first installed Maya location found in %s" % (version, docBaseDir) ) if platform.system() == 'Darwin': docBaseDir = os.path.dirname(os.path.dirname(docBaseDir)) docBaseDir = os.path.join(docBaseDir, 'docs') if version: short_version = versions.parseVersionStr(version, extension=False) else: short_version = versions.shortName() docLocation = os.path.join(docBaseDir , 'Maya%s' % short_version, 'en_US') return os.path.realpath(docLocation)
def _startResolve(self): if not self.isResolving: self.isResolving = True if cmds.about(batch=True): cmds.warning(kConvertBatchError % cmds.showHelp(kRelativeHelpLink, q=True)) else: command = "import maya.app.renderSetup.model.conversion as conversion; conversion.Observer2016R2.instance()." + \ ("autoResolve()" if hasAutoConvertFlag() and getAutoConvertFlag() else "assistedResolve()") cmds.evalDeferred(command)
def upToDateCheck(revision, prompt=True): ''' This is a check that can be run by scripts that import ml_utilities to make sure they have the correct version. ''' if not '__revision__' in locals(): return if revision > __revision__: if prompt and mc.optionVar(query='ml_utilities_revision') < revision: result = mc.confirmDialog( title='Module Out of Date', message='Your version of ml_utilities may be out of date for this tool. Without the latest file you may encounter errors.', button=['Download Latest Revision','Ignore', "Don't Ask Again"], defaultButton='Download Latest Revision', cancelButton='Ignore', dismissString='Ignore' ) if result == 'Download Latest Revision': mc.showHelp('http://morganloomis.com/download/ml_utilities.py', absolute=True) elif result == "Don't Ask Again": mc.optionVar(intValue=('ml_utilities_revision', revision)) return False return True
def context_menu(): """ Create context menu for output window. """ # context menu output_win = cmds.cmdScrollFieldReporter(SCRIPT_OUTPUT_SCROLLFIELD, fst="") cmds.popupMenu(parent=output_win) cmds.menuItem( label="Clear Output", command=lambda c: cmds.cmdScrollFieldReporter(output_win, e=True, clear=True) ) # Echo all commands toggle cmds.menuItem( label="Toggle Echo Commands", command=lambda c: cmds.commandEcho(state=not (cmds.commandEcho(q=True, state=True))), ) # Go to python reference cmds.menuItem(label="Python Command Reference", command=lambda c: cmds.showHelp("DocsPythonCommands"))
def script_output(direction): """ Script output dock for layouts. """ dock_control = config['WINDOW_SCRIPT_OUTPUT_DOCK'] dock_window = config['WINDOW_SCRIPT_OUTPUT'] if cmds.dockControl(dock_control, ex=True): return cmds.dockControl(dock_control, e=True, vis=True, fl=False) if cmds.window(dock_window, ex=True): main_win = dock_window else: main_win = cmds.window(dock_window, title='Output Window') cmds.paneLayout(parent=main_win) # context menu output_win = cmds.cmdScrollFieldReporter(fst="") cmds.popupMenu(parent=output_win) cmds.menuItem( label='Clear Output', command=lambda c: cmds.cmdScrollFieldReporter( output_win, e=True, clear=True), ) # Echo all commands toggle cmds.menuItem( label='Toggle Echo Commands', command=lambda c: cmds.commandEcho( state=not(cmds.commandEcho(q=True, state=True))), ) # Go to python reference cmds.menuItem( label='Python Command Reference', command=lambda c: cmds.showHelp('DocsPythonCommands'), ) cmds.dockControl( dock_control, content=main_win, label='Output Window', area=direction, height=500, floating=False, allowedArea=['left', 'right'] )
def script_output(direction): """ Script output dock for layouts. """ dock_control = config['WINDOW_SCRIPT_OUTPUT_DOCK'] dock_window = config['WINDOW_SCRIPT_OUTPUT'] if cmds.dockControl(dock_control, ex=True): return cmds.dockControl(dock_control, e=True, vis=True, fl=False) if cmds.window(dock_window, ex=True): main_win = dock_window else: main_win = cmds.window(dock_window, title='Output Window') cmds.paneLayout(parent=main_win) # context menu output_win = cmds.cmdScrollFieldReporter(fst="") cmds.popupMenu(parent=output_win) cmds.menuItem( label='Clear Output', command=lambda c: cmds.cmdScrollFieldReporter( output_win, e=True, clear=True), ) # Echo all commands toggle cmds.menuItem( label='Toggle Echo Commands', command=lambda c: cmds.commandEcho(state=not (cmds.commandEcho( q=True, state=True))), ) # Go to python reference cmds.menuItem( label='Python Command Reference', command=lambda c: cmds.showHelp('DocsPythonCommands'), ) cmds.dockControl(dock_control, content=main_win, label='Output Window', area=direction, height=500, floating=False, allowedArea=['left', 'right'])
def showHelp(self, args): cmds.showHelp("https://github.com/JaewanKim/maya-plugin", absolute=True)
__revision__ = 4 import maya.cmds as mc import maya.mel as mm from maya import OpenMaya import random try: import euclid except ImportError: result = mc.confirmDialog( title='Module Not Found', message='This tool requires the euclid module, which can be downloaded for free from the internet. Once downloaded you will need to restart Maya.', button=['Go To Website','Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel' ) if result != 'Cancel': mc.showHelp('http://partiallydisassembled.net/euclid.html',absolute=True) try: import ml_utilities as utl utl.upToDateCheck(9) except ImportError: result = mc.confirmDialog( title='Module Not Found', message='This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module','Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel' ) if result == 'Download Module': mc.showHelp('http://morganloomis.com/download/animationScripts/ml_utilities.py',absolute=True) def ui():
import maya.mel as mm from maya import OpenMaya try: import euclid except ImportError: result = mc.confirmDialog( title='Module Not Found', message= 'This tool requires the euclid module, which can be downloaded for free from the internet. Once downloaded you will need to restart Maya.', button=['Go To Website', 'Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel') if result != 'Cancel': mc.showHelp('http://partiallydisassembled.net/euclid.html', absolute=True) try: import ml_utilities as utl utl.upToDateCheck(9) except ImportError: result = mc.confirmDialog( title='Module Not Found', message= 'This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module', 'Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel') if result == 'Download Module':
def myHelp(): cmds.showHelp("Commands/showHelp.html", docs=True)
def open_releases_page(): ''' Opens a web browser with the latest release ''' cmds.showHelp ('https://github.com/TrevisanGMW/gt-tools/releases/latest', absolute=True)
from functools import partial import maya.cmds as mc from maya import OpenMaya try: import ml_utilities as utl utl.upToDateCheck(32) except ImportError: result = mc.confirmDialog( title='Module Not Found', message='This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module','Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel' ) if result == 'Download Module': mc.showHelp('http://morganloomis.com/tool/ml_utilities/',absolute=True) def ui(): ''' User interface for world bake ''' with utl.MlUi('ml_worldBake', 'World Bake', width=400, height=175, info='''Select objects, bake to locators in world, camera, or custom space. When you're ready to bake back, select locators and bake "from locators" to re-apply your animation.''') as win: mc.checkBoxGrp('ml_worldBake_bakeOnOnes_checkBox',label='Bake on Ones', annotation='Bake every frame. If deselected, the tool will preserve keytimes.') tabs = mc.tabLayout() tab1 = mc.columnLayout(adj=True)
def EngineGrid(): version = " v1.1" title = "EngineGrid" # colors frameBGC = [0.17, 0.30, 0.30] unityBGC = [0.25, 0.25, 0.35] udkBGC = [0.35, 0.25, 0.25] cryengineBGC = [0.25, 0.35, 0.25] mayaBGC = [0.33, 0.33, 0.33] # kills open instance of window if cmds.window("EngineGrid", exists=True): cmds.deleteUI("EngineGrid") # creates window and assigns title cmds.window("EngineGrid", title=title + version, iconName=title + version, menuBar=False, minimizeButton=False, maximizeButton=False, sizeable=False) # overall parent frame that holds all children cmds.columnLayout("gridSettingsColumn", columnWidth=261) cmds.separator(style="in") # frame around all buttons with instruction to set grid. is collapsible in Maya 2013 despite flag set to false cmds.frameLayout('gridButtonsColumn', label="select your grid", collapsable=False, backgroundColor=frameBGC, collapse=False, borderStyle="etchedIn", width=261, marginHeight=1, parent="gridSettingsColumn") # grid selection buttons cmds.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 64), (2, 64), (3, 64), (4, 64)], parent="gridButtonsColumn") # changeGridSettings(set, size, spacing, divisions, nearClipPlane, farClipPlane, gridAxisColor, gridHighlightColor, gridColor, trans) cmds.button(h=64, label="Unity", bgc=unityBGC, c=lambda z: changeGridSettings("unity", 150, 10, 1, 0.1, 100000.0, 1, 3, 2, 10000.0)) cmds.button(h=64, label="UDK", bgc=udkBGC, c=lambda z: changeGridSettings("udk", 512, 16, 1, 0.1, 100000.0, 1, 3, 2, 10000.0)) cmds.button(h=64, label="CryEngine", bgc=cryengineBGC, c=lambda z: changeGridSettings("cryengine", 150, 10, 1, 0.1, 100000.0, 1, 3, 2, 10000.0)) cmds.button(h=64, label="Maya", bgc=mayaBGC, c=lambda z: changeGridSettings("maya", 12, 5, 5, 0.1, 10000.0, 1, 3, 3, 100.1)) # grid square division text cmds.rowColumnLayout('unityDivUnits', visible=False, numberOfColumns=3, columnWidth=[(1, 125), (2, 28), (3, 60)], parent="gridButtonsColumn") cmds.text(align="left", label=" 1 grid square is ") cmds.intField('unityMultiplier', min=0, value=100) cmds.text(label=" centimeters") cmds.rowColumnLayout('udkDivUnits', visible=False, numberOfColumns=3, columnWidth=[(1, 140), (2, 20), (3, 30)], parent="gridButtonsColumn") cmds.text(align="left", label=" 1 grid square is ") cmds.intField('udkMultiplier', min=0, value=16) cmds.text(label=" units") cmds.rowColumnLayout('cryengineDivUnits', visible=False, numberOfColumns=3, columnWidth=[(1, 125), (2, 28), (3, 60)], parent="gridButtonsColumn") cmds.text(align="left", label=" 1 grid square is ") cmds.intField('cryengineMultiplier', min=0, value=100) cmds.text(label=" centimeters") # grid division buttons cmds.rowColumnLayout('unityDivButtons', visible=False, numberOfColumns=5, columnWidth=[(1, 51), (2, 51), (3, 52), (4, 51), (5, 51)], parent="gridButtonsColumn") cmds.button(h=32, label="1cm", bgc=unityBGC, command=lambda z: setGridDivisions(100, 1)) cmds.button(h=32, label="10cm", bgc=unityBGC, command=lambda z: setGridDivisions(10, 10)) cmds.button(h=32, label="25cm", bgc=unityBGC, command=lambda z: setGridDivisions(4, 25)) cmds.button(h=32, label="50cm", bgc=unityBGC, command=lambda z: setGridDivisions(2, 50)) cmds.button(h=32, label="100cm", bgc=unityBGC, command=lambda z: setGridDivisions(1, 100)) cmds.rowColumnLayout('udkDivButtons', visible=False, numberOfColumns=5, columnWidth=[(1, 51), (2, 51), (3, 52), (4, 51), (5, 51)], parent="gridButtonsColumn") cmds.button(h=32, label="1", bgc=udkBGC, command=lambda z: setGridDivisions(16, 1)) cmds.button(h=32, label="2", bgc=udkBGC, command=lambda z: setGridDivisions(8, 2)) cmds.button(h=32, label="4", bgc=udkBGC, command=lambda z: setGridDivisions(4, 4)) cmds.button(h=32, label="8", bgc=udkBGC, command=lambda z: setGridDivisions(2, 8)) cmds.button(h=32, label="16", bgc=udkBGC, command=lambda z: setGridDivisions(1, 16)) cmds.rowColumnLayout('cryengineDivButtons', visible=False, numberOfColumns=5, columnWidth=[(1, 51), (2, 51), (3, 52), (4, 51), (5, 51)], parent="gridButtonsColumn") cmds.button(h=32, label="1cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(100, 1)) cmds.button(h=32, label="10cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(10, 10)) cmds.button(h=32, label="25cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(4, 25)) cmds.button(h=32, label="50cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(2, 50)) cmds.button(h=32, label="100cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(1, 100)) # grid grow/shrink and "about" buttons cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 85), (2, 86), (3, 85)], p="gridButtonsColumn") cmds.button(h=20, label="grow", bgc=frameBGC, command=lambda z: gridSizeChange("up", 50)) cmds.button(h=20, label="shrink", bgc=frameBGC, command=lambda z: gridSizeChange("down", 50)) cmds.button(h=20, label="about", bgc=frameBGC, command=lambda z: cmds.showHelp( 'http://krellgames.com/tools.html', absolute=True)) # prints version and author info to the command line consolePrint((title + version), " by Krell of krellgames.com") # draws the main window cmds.showWindow() cmds.window("EngineGrid", e=True, resizeToFitChildren=True, sizeable=True, height=190, width=261) cmds.frameLayout( 'gridButtonsColumn', edit=True, cc=lambda *args: editWinSize('EngineGrid', 'gridButtonsColumn'))
__category__ = 'animationScripts' __revision__ = 1 import maya.cmds as mc try: import ml_utilities as utl utl.upToDateCheck(22) except ImportError: result = mc.confirmDialog( title='Module Not Found', message='This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module','Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel' ) if result == 'Download Module': mc.showHelp('http://morganloomis.com/download/animationScripts/ml_utilities.py',absolute=True) def main(): sel = mc.ls(sl=True) if not sel: raise RuntimeError('Please select an object.') if [x for x in sel if not mc.attributeQuery('translate', exists=True, node=x)]: raise RuntimeError('Only works on transform nodes, please adjust your selection.') frameRate = utl.getFrameRate() timeFactor = 1.0/frameRate
def mouseDoubleClickEvent(self, *args, **kwargs): if self.help: cmds.showHelp(self.help, absolute=True)
def open_gt_tools_documentation(): ''' Opens a web browser with the latest release ''' cmds.showHelp( 'https://github.com/TrevisanGMW/gt-tools/tree/master/docs#-gt-auto-biped-rigger-', absolute=True)
def onHelp(self, *args): cmds.showHelp(kRelativeHelpLink)
def EngineGrid(): version = " v1.1" title = "EngineGrid" # colors frameBGC = [0.17, 0.30, 0.30] unityBGC = [0.25, 0.25, 0.35] udkBGC = [0.35, 0.25, 0.25] cryengineBGC = [0.25, 0.35, 0.25] mayaBGC = [0.33, 0.33, 0.33] # kills open instance of window if cmds.window("EngineGrid", exists=True): cmds.deleteUI("EngineGrid") # creates window and assigns title cmds.window("EngineGrid", title=title + version, iconName=title + version, menuBar=False, minimizeButton=False, maximizeButton=False, sizeable=False) # overall parent frame that holds all children cmds.columnLayout("gridSettingsColumn", columnWidth=261) cmds.separator(style="in") # frame around all buttons with instruction to set grid. is collapsible in Maya 2013 despite flag set to false cmds.frameLayout('gridButtonsColumn', label="select your grid", collapsable=False, backgroundColor=frameBGC, collapse=False, borderStyle="etchedIn", width=261, marginHeight=1, parent="gridSettingsColumn") # grid selection buttons cmds.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 64), (2, 64), (3, 64), (4, 64)], parent="gridButtonsColumn") # changeGridSettings(set, size, spacing, divisions, nearClipPlane, farClipPlane, gridAxisColor, gridHighlightColor, gridColor, trans) cmds.button(h=64, label="Unity", bgc=unityBGC, c=lambda z: changeGridSettings("unity", 150, 10, 1, 0.1, 100000.0, 1, 3, 2, 10000.0)) cmds.button(h=64, label="UDK", bgc=udkBGC, c=lambda z: changeGridSettings("udk", 512, 16, 1, 0.1, 100000.0, 1, 3, 2, 10000.0)) cmds.button(h=64, label="CryEngine", bgc=cryengineBGC, c=lambda z: changeGridSettings("cryengine", 150, 10, 1, 0.1, 100000.0, 1, 3, 2, 10000.0)) cmds.button(h=64, label="Maya", bgc=mayaBGC, c=lambda z: changeGridSettings("maya", 12, 5, 5, 0.1, 10000.0, 1, 3, 3, 100.1)) # grid square division text cmds.rowColumnLayout('unityDivUnits', visible=False, numberOfColumns=3, columnWidth=[(1, 125), (2, 28), (3, 60)], parent="gridButtonsColumn") cmds.text(align="left", label=" 1 grid square is ") cmds.intField('unityMultiplier', min=0, value=100) cmds.text(label=" centimeters") cmds.rowColumnLayout('udkDivUnits', visible=False, numberOfColumns=3, columnWidth=[(1, 140), (2, 20), (3, 30)], parent="gridButtonsColumn") cmds.text(align="left", label=" 1 grid square is ") cmds.intField('udkMultiplier', min=0, value=16) cmds.text(label=" units") cmds.rowColumnLayout('cryengineDivUnits', visible=False, numberOfColumns=3, columnWidth=[(1, 125), (2, 28), (3, 60)], parent="gridButtonsColumn") cmds.text(align="left", label=" 1 grid square is ") cmds.intField('cryengineMultiplier', min=0, value=100) cmds.text(label=" centimeters") # grid division buttons cmds.rowColumnLayout('unityDivButtons', visible=False, numberOfColumns=5, columnWidth=[(1, 51), (2, 51), (3, 52), (4, 51), (5, 51)], parent="gridButtonsColumn") cmds.button(h=32, label="1cm", bgc=unityBGC, command=lambda z: setGridDivisions(100, 1)) cmds.button(h=32, label="10cm", bgc=unityBGC, command=lambda z: setGridDivisions(10, 10)) cmds.button(h=32, label="25cm", bgc=unityBGC, command=lambda z: setGridDivisions(4, 25)) cmds.button(h=32, label="50cm", bgc=unityBGC, command=lambda z: setGridDivisions(2, 50)) cmds.button(h=32, label="100cm", bgc=unityBGC, command=lambda z: setGridDivisions(1, 100)) cmds.rowColumnLayout('udkDivButtons', visible=False, numberOfColumns=5, columnWidth=[(1, 51), (2, 51), (3, 52), (4, 51), (5, 51)], parent="gridButtonsColumn") cmds.button(h=32, label="1", bgc=udkBGC, command=lambda z: setGridDivisions(16, 1)) cmds.button(h=32, label="2", bgc=udkBGC, command=lambda z: setGridDivisions(8, 2)) cmds.button(h=32, label="4", bgc=udkBGC, command=lambda z: setGridDivisions(4, 4)) cmds.button(h=32, label="8", bgc=udkBGC, command=lambda z: setGridDivisions(2, 8)) cmds.button(h=32, label="16", bgc=udkBGC, command=lambda z: setGridDivisions(1, 16)) cmds.rowColumnLayout('cryengineDivButtons', visible=False, numberOfColumns=5, columnWidth=[(1, 51), (2, 51), (3, 52), (4, 51), (5, 51)], parent="gridButtonsColumn") cmds.button(h=32, label="1cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(100, 1)) cmds.button(h=32, label="10cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(10, 10)) cmds.button(h=32, label="25cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(4, 25)) cmds.button(h=32, label="50cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(2, 50)) cmds.button(h=32, label="100cm", bgc=cryengineBGC, command=lambda z: setGridDivisions(1, 100)) # grid grow/shrink and "about" buttons cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 85), (2, 86), (3, 85)], p="gridButtonsColumn") cmds.button(h=20, label="grow", bgc=frameBGC, command=lambda z: gridSizeChange("up", 50)) cmds.button(h=20, label="shrink", bgc=frameBGC, command=lambda z: gridSizeChange("down", 50)) cmds.button(h=20, label="about", bgc=frameBGC, command=lambda z: cmds.showHelp('http://krellgames.com/tools.html', absolute=True)) # prints version and author info to the command line consolePrint((title + version), " by Krell of krellgames.com") # draws the main window cmds.showWindow() cmds.window("EngineGrid", e=True, resizeToFitChildren=True, sizeable=True, height=190, width=261) cmds.frameLayout('gridButtonsColumn', edit=True, cc=lambda *args: editWinSize('EngineGrid', 'gridButtonsColumn'))
def getPrintStudioDialog(): global downloadInfo window = cmds.window( title=maya.stringTable['y_printStudio.kPrintStudioDownload'], widthHeight=(340, 180), menuBar=False, sizeable=False) formLayout = cmds.formLayout() tabLayout = cmds.tabLayout(innerMarginWidth=0, innerMarginHeight=0, tabsVisible=False) cmds.formLayout(formLayout, edit=True, attachForm=((tabLayout, 'top', 0), (tabLayout, 'left', 0), (tabLayout, 'bottom', 0), (tabLayout, 'right', 0))) # Tab 1 - Print Studio is not currently installed cmds.columnLayout(width=340) cmds.columnLayout(width=340) cmds.text(width=340, height=60, label=maya.stringTable['y_printStudio.kNotIntalled1'], align='center') cmds.text(width=340, height=16, label=maya.stringTable['y_printStudio.kNotIntalled2'], align='center') sizeInfo = '' if printStudioDownloadURL() is not None: file_name = downloadInfo['url'].split('/')[-1] sizeInfo = '%s (%d MB)' % ( file_name, int(round(downloadInfo['size'] / 1048576.0))) cmds.text(width=340, height=24, label=sizeInfo, align='center') cmds.separator(width=340, height=44, style='none') cmds.separator(width=340) cmds.setParent('..') cmds.rowLayout(numberOfColumns=5, columnAttach=[(1, 'left', 4), (5, 'right', 4)]) aboutCommand = lambda widget: cmds.showHelp( 'https://ember.autodesk.com/overview#software', absolute=True) aboutButton = cmds.button( width=120, label=maya.stringTable['y_printStudio.kAboutPrintStudio'], command=aboutCommand) cmds.separator(width=4, horizontal=False) downloadCommand = lambda widget: downloadPrintStudio(window=window, tabLayout=tabLayout) downloadButton = cmds.button( width=94, label=maya.stringTable['y_printStudio.kDownload'], command=downloadCommand) cmds.separator(width=4, horizontal=False) cancelCommand = lambda widget: cmds.deleteUI(window, window=True) cmds.button(width=94, label=maya.stringTable['y_printStudio.kCancel'], command=cancelCommand) cmds.setParent('..') cmds.setParent('..') # Tab 2 - Downloading Print Studio Installer cmds.columnLayout(width=340) cmds.columnLayout(width=340) cmds.text(width=340, height=60, label=maya.stringTable['y_printStudio.kDownloading'], align='center') cmds.rowLayout(numberOfColumns=1, columnAttach=[(1, 'left', 30)]) progressBar = cmds.progressBar(width=270, height=16) cmds.setParent('..') cmds.separator(width=340, height=4, style='none') cmds.text(width=340, height=60, label=maya.stringTable['y_printStudio.kPressToCancel'], align='center') downloadCommand = lambda widget: downloadPrintStudio( window=window, tabLayout=tabLayout, progressBar=progressBar) cmds.button(downloadButton, edit=True, command=downloadCommand) cmds.tabLayout(tabLayout, edit=True, selectTabIndex=1) cmds.showWindow(window)
def visitHomePage(*arg): cmds.showHelp('https://www.woheyun.com/#/', absolute=True)
def SundayPlusSaveWrongFileConvention(): plusSaveHelpDialog = SundayDialogPy.SundayDialogPromptYesNo('Error ', 'Scene is not the right file convention: Name_###_Author.mb', 'OK', 'HELP') if plusSaveHelpDialog == 'HELP': cmds.showHelp('http://www.3dg.dk/2011/12/07/sunday-pipeline-plus-save/', absolute = True)
def open_transfer_uvs_docs(): ''' Opens a web browser with the docs about this script ''' cmds.showHelp ('https://github.com/TrevisanGMW/gt-tools/tree/release/docs#-gt-transfer-uvs-', absolute=True)
try: import ml_utilities as utl utl.upToDateCheck(2) except ImportError: result = mc.confirmDialog( title='Module Not Found', message= 'This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module', 'Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel') if result == 'Download Module': mc.showHelp('http://morganloomis.com/download/ml_utilities.py', absolute=True) hotkey = { 'd': 'deleteKey(deleteSubFrames=True, selectedChannels=True, visibleInGraphEditor=True)' } def ui(): ''' User interface for ml_deleteKey ''' with utl.MlUi( 'ml_deleteKey', 'deleteKey',
_html += '</br>' _html += _cam if _renderable == 0: _html += _tagS[0] _html += 'WARNING: no renderable cameras' _html += _tagS[1] _html += '</dd>' # references _refs = cmds.file (query = True, reference = True) if len (_refs) > 0: _html += '</br> referenced scripts: </br>' for _ref in _refs: _html += _tag[0] + ' ................... ' \ + _ref + _tag[1] # write and open html if len( _attrib) > 0: _fileName = _scene.path + _scene.name + '__scriptInfo.html' _infoFile = open (_fileName, 'w') _infoFile.write (_html) _infoFile.close () cmds.showHelp (_fileName, absolute = True) else: mm.eval ('warning "trouble...";')
def SundayGeometryCacheShowHelp(): cmds.showHelp('http://www.3dg.dk/2011/12/07/sunday-pipeline-maya-geometry-cache/', absolute = True)
def help(): ''' This just launches the online help and serves as a placeholder for the default function for this script. ''' mc.showHelp('http://morganloomis.com/wiki/tools.html#ml_utilities', absolute=True)
def main(): ''' This just launches the online help and serves as a placeholder for the default function for this script. ''' mc.showHelp(wikiURL+'#ml_utilities', absolute=True)
def myHelp(): cmds.showHelp( 'Commands/showHelp.html', docs=True )
__revision__ = 6 import maya.cmds as mc import maya.mel as mm try: import ml_utilities as utl utl.upToDateCheck(8) except ImportError: result = mc.confirmDialog( title='Module Not Found', message='This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module','Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel' ) if result == 'Download Module': mc.showHelp('http://morganloomis.com/download/ml_utilities.py',absolute=True) def main(selectedChannels=True, transformsOnly=False): ''' Resets selected channels in the channel box to default, or if nothing's selected, resets all keyable channels to default. ''' gChannelBoxName = mm.eval('$temp=$gChannelBoxName') sel = mc.ls(sl=True) if not sel: return chans = None if selectedChannels: chans = mc.channelBox(gChannelBoxName, query=True, sma=True)
''' More Loops ''' # enumerate # Showing all the files in a directory. ''' Help and Web Pages ''' # string # maya help & showHelp commands cmds.help( 'textScrollList', language='python', doc=True ) cmds.showHelp( 'http://www.autodesk.com/', absolute=True ) # google search # http://www.google.com/search?sourceid=chrome&ie=UTF-8&q= def googleSearch( item ): google = r'http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=' cmds.showHelp( google + item, absolute=True ) googleSearch( "python" ) ''' Standard Library ''' import os
try: import ml_utilities as utl utl.upToDateCheck(31) except ImportError: result = mc.confirmDialog( title='Module Not Found', message= 'This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module', 'Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel') if result == 'Download Module': mc.showHelp( 'http://morganloomis.com/download/animationScripts/ml_utilities.py', absolute=True) def ui(): ''' user interface for ml_copyAnim ''' with utl.MlUi( 'ml_copyAnim', 'Copy Animation', width=400, height=120, info= '''Copy animation across single nodes, or hierarchies based on name.
def googleSearch( item ): google = r'http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=' cmds.showHelp( google + item, absolute=True )
try: import ml_utilities as utl utl.upToDateCheck(32) except ImportError: result = mc.confirmDialog( title='Module Not Found', message= 'This tool requires the ml_utilities module. Once downloaded you will need to restart Maya.', button=['Download Module', 'Cancel'], defaultButton='Cancel', cancelButton='Cancel', dismissString='Cancel') if result == 'Download Module': mc.showHelp('http://morganloomis.com/tool/ml_utilities/', absolute=True) def ui(): ''' User interface for world bake ''' with utl.MlUi( 'ml_worldBake', 'World Bake', width=400, height=175, info= '''Select objects, bake to locators in world, camera, or custom space. When you're ready to bake back, select locators
def helpCB(*args): cmds.showHelp('Nodes/%s.html' % type, docs=True)