The code below works fine for 2010 and before, but now in 2011 it no longer
works, in fact NOTHING happens.
Autodesk replied with the following -
"Unfortunately with the introduction to QT some things have changed in Maya
2011, you can no longer just overwrite fileBrowser procedure, you would need
to overwrite projectViewer proc, but doing so gets to be more complicated."
But they don't know how, or won't say how. Anyone have any luck overriding
this method?
Even an example that simply prints when File->Open is selected in 2011 would
be GREATLY appreciated.
def fileBrowser(callback, action, type, mode, source='python', dir=None,
*args, **kwds):
print '\nCallback: %s\nAction: %s\nType: %s\nMode: %s\nSource: %s\n' %
(callback, action, type, mode, source)
def __execute__(files, fileType=type):
if fi(fileType) == '*':
fileType = 'Best Guess'
for file in files:
if source == 'mel':
command = callback + ' "' + str(file) + '" "' +
str(fileType) + '"'
mm.eval(command)
elif source == 'python':
try:
if callable(callback):
callback(file, fileType)
else:
mc.executeInMainThread(callback + '("' + str(file) +
'", "' + fileType + '")')
except:
fileBrowser.dir = os.path.dirname(file)
return 0
return 1
mel += '{'
mel += ' print(python("from motion import myBrowser;
myBrowser.fileBrowser(callback=\'" + $callback + "\', action=\'" + $action +
"\', type=\'" + $type + "\', mode=" + $mode + ", source=\'mel\')"));'
mel += ' return 1;}'
mm.eval(mel)
mel = 'global proc int pv_goDirectory(string $path)'
mel += '{'
mel += ' python("print 'My own file browser'");'
mel += ' return 1;'
mel += '}'
mm.eval(mel)
--
http://groups.google.com/group/python_inside_maya