Hi everyone
I need to open some large/messy scenes from other artists. It always prompts out a lot of warnings and freezes Maya for a long time. I try to write a custom "open file" with python to suppress warning messages. But it seems not really "mute" script editor entirely. Let's say, when I open Hypershade window after open file, warnings prompt out again since I have lots of missing textures. The script I use now is:
import maya.cmds as cmds import maya.mel as mel filename = cmds.fileDialog2(fileMode=1) reporter = mel.eval( 'string $tmp = $gCommandReporter;' ) cmds.scriptEditorInfo(reporter,suppressWarnings=True,suppressInfo=1,se=1,ch=1) cmds.disableIncorrectNameWarning() cmds.file( filename[0], i=True );
Not sure if I use this API correctly, Many thanks for your advice.
Thank you
Solved! Go to Solution.
Solved by aboutvenice. Go to Solution.
hi,
Try this....
In the Script Editor, turn off History > Echo All Commands.
Hi. it's not working, warning and error are not effect by this option.
And I expect to use a script instead of menu action.
Thanks
Finally, succeed. So basically this works:
import maya.cmds as cmds cmds.scriptEditorInfo(suppressWarnings=0,suppressInfo=0,se=0)
The reason I couldn't get it to work is that I use Charcoal Editor for Maya to write python. It somehow not suppress warnings. After I unload it everything is ok.
http://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/CommandsPython/
The document doesn't mention the default value but I guess you can query the flag value before you do any changes.
import maya.cmds as cmds info = cmds.scriptEditorInfo(query=True, suppressInfo = True) print(info)
Hi,
You also can try this: History > Suppress Warning Messages.
Hope this helps
Store the settings of the scriptEditor window in a dictionary called "state":
flags = ["se", "si", "sr", "sw", "ssw"]
state = {}
for x in flags:
kwargs = {"q" : True, x : True}
val = maya.cmds.scriptEditorInfo(**kwargs)
state[x] = val
print(state)
Do your settings. In my case, I want to suppress warnings
maya.cmds.scriptEditorInfo(e=True, sw=True)
Then reset things back to the way they were:
for x, val in state.iteritems():
kwargs = {"e" : True, x : val}
maya.cmds.scriptEditorInfo(**kwargs)
You may want to clear the stack before you do this, it can chugalug a bit if you've got a long history.