Skip to content

Instantly share code, notes, and snippets.

@fereria fereria/sourceMel.py Secret
Created Feb 21, 2014

Embed
What would you like to do?
import maya.cmds as mc
import maya.mel as mm
import glob,os.path,re
def sourceMelFolder(Path):
drivenKeyFile = glob.glob(Path + "/*.mel")
if isinstance(drivenKeyFile,list) == True:
for keyFile in drivenKeyFile:
keyFile = re.sub('\','/',keyFile)
print ('sourceFile->'+keyFile)
mm.eval('source "' + keyFile + '";')
elif isinstance(drivenKeyFile,str) == True:
mm.eval('source "' + folderPath + '";')
print ('sourceFile->'+keyFile)
else:
print "file does not exists."
def sourceMel(Path):
if isinstance(Path,str):
mm.eval('source "' + Path + '";')
print ('sourceFile->'+Path)
elif isinstance(Path,list):
for mel in Path:
mm.eval('source "' + mel + '";')
print ('sourceFile->' + mel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.