python - Maya Pymel: pass fileDialog2's return to a UI textfield -


i'm having trouble understanding how use filedialog2's "optionsuicommit" flag. when user hit's "save" in file dialog box, want run command on_save_dialog_file. file, seems want me use mel command.

http://help.autodesk.com/cloudhelp/2016/enu/maya-tech-docs/commandspython/index.html

mel only. string interpreted mel callback, called when dialog dismissed. not called if user cancels dialog, or closes window using window title bar controls or other window system means. callback of form: global proc mycustomoptionsuicommit(string $parent)

the parent argument parent layout controls have been added using optionsuicreate flag

this seems...complicated.

here's code.

import pymel.core pm   def on_save_dialog_file(mydialog):     print "hello file_dialog_save_file()!"   def file_dialog_save_file():     mydialog = pm.filedialog2(ocm="on_save_dialog_file", fm=0, ff="maya files (*.ma *.mb);;maya ascii (*.ma);;maya binary (*.mb);;all files (*.*)", dialogstyle=2)     print mydialog   file_dialog_save_file() 

even trying weird mel->python command didn't work. ocm="python \"on_save_dialog_file()\";"

is there easier/more straightforward way run command after setting save file in dialog?

you can this, without callback. other user selection return none

c = cmds.filedialog2(fm=0, ff="maya files (*.ma *.mb);;maya ascii (*.ma);;maya binary (*.mb);;all files (*.*)", dialogstyle=2) if c:     print c else:     print "user cancelled" 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -