I want to know filename what will be opened before opening.
Maya have the callback: kBeforeOpen
But when i try to read file name in callback function - i receive a name of current file but not file that will be opened.
def before(*args, **kwargs):
print('scene_name', cmds.file(q=True, sn=True))
om.MSceneMessage.addCallback(om.MSceneMessage.kBeforeOpen, before)
in empty scene i trying to open file: "C:/tmp/pen_01.mb"
.
log told me that command file -o "C:/tmp/pen_01.mb"
is started and then started callback
>>> file -options "v=0;" -typ "mayaBinary" -o "C:/tmp/pen_01.mb";
>>> ('scene_name', u'')
As you can see, function reads current file name (empty).
How in callback function read information about what exactly will be opened?