Hey I am importing a list of files into a maya scene via python.
Each time a .obj is imported maya gives me following warning:
Warning: Option "Use legacy vertex order" will only take effect when option "Multiple Objects" is enabled.
My question: Is it possible to turn off this warning? Or a way to to not show the warning in the first place?
edit: The problem is that this warning will show up on each and every file that gets imported from the list. I added a screenshot from maya.
I am loading the files like this:
cmds.file(filePath, i = True)
edit2: Here is my function that loops through files in a directory.
def loadFiles(*args):
# load References into scene from savefile
files = 'c:/testfolder'
if os.path.exists(files):
filesInFolder = [f for f in listdir(files) if isfile(join(files, f))]
for file in filesInFolder:
filePath = files + '/' + file
#cmds.file(filePath, i = True)
mel.eval("catchQuiet(`python(\"cmds.file(filePath, i=True)\")`)")
#print filePath
Thank you for your time and have a nice day!
Maya has a function called catchQuiet
which is the easiest way of suppressing warning/error messages. If the expression throws an error, it will return 1
otherwise 0
.
catchQuiet(python("cmds.file(\"/drive/myfile.obj\", i=True)"))
Unfortunately this function does only exist in mel
but you could wrap it in python by using maya.cmds.mel
to execute it.
Python Wrapper
The Python variant looks a little nasty, but that should work.
mel.eval("catchQuiet(`python(\"cmds.file('/drive/myfile.obj', i=1)\")`)")