All scripts must be prefaced with these imports:
import maya.cmds as cmds
import maya.mel as mel
import mtoa.core as core
import webbrowser
import os
import maya.cmds as cmds
import maya.mel as mel
import mtoa.core as core
import webbrowser
import os
File Explorer
filepath = cmds.file(q=True, sn=True)
joiner = '/'.join(filepath.split('/')[0:-1])
webbrowser.open(joiner)
joiner = '/'.join(filepath.split('/')[0:-1])
webbrowser.open(joiner)
File Path Sourceimages
filepath = cmds.file(q=True, sn=True)
joiner = '/'.join(filepath.split('/')[0:-2]) + '/sourceimages'
if os.path.exists(joiner):
webbrowser.open(joiner)
else:
cmds.warning('SOURCEIMAGES FOLDER DOES NOT EXIST')
joiner = '/'.join(filepath.split('/')[0:-2]) + '/sourceimages'
if os.path.exists(joiner):
webbrowser.open(joiner)
else:
cmds.warning('SOURCEIMAGES FOLDER DOES NOT EXIST')
Plugin Cleaner
cmds.delete(cmds.ls(type="unknown"))
plugins_list = cmds.unknownPlugin(q=True,l=True)
if plugins_list:
for plugin in plugins_list:
print(plugin)
cmds.unknownPlugin(plugin, r=True)
else:
cmds.warning('ALREADY CLEANED UP')
plugins_list = cmds.unknownPlugin(q=True,l=True)
if plugins_list:
for plugin in plugins_list:
print(plugin)
cmds.unknownPlugin(plugin, r=True)
else:
cmds.warning('ALREADY CLEANED UP')
Creating Reference
try:
ref_node = cmds.referenceQuery('Name of fileRN', referenceNode=True)
except RuntimeError:
pass
else:
cmds.warning('Already referenced')
return
cmds.file('link to reference maya file', reference=True,namespace='MaleScale')
ref_node = cmds.referenceQuery('Name of fileRN', referenceNode=True)
except RuntimeError:
pass
else:
cmds.warning('Already referenced')
return
cmds.file('link to reference maya file', reference=True,namespace='MaleScale')