Skip to content

Instantly share code, notes, and snippets.

@fereria
Created February 21, 2014 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fereria/4a44afbae9d2a09302aa to your computer and use it in GitHub Desktop.
Save fereria/4a44afbae9d2a09302aa to your computer and use it in GitHub Desktop.
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