View Single Post
# 1 20-09-2016 , 03:44 PM
Registered User
Join Date: Sep 2016
Posts: 1

maya MSceneMessage kBeforeSave callback

I need to register to some maya's MSceneMessage callback, and query the scene paths. I need to get both before and after's maya path. (open , save file)

Here's what I have so far.

def before(*args, **kwargs):
    print 'BEFORE: ' + cmds.file(query = True)

def after(*args, **kwargs):
    print 'AFTER: ' + cmds.file(query = True)

om.MSceneMessage.addCallback(om.MSceneMessage.kBef  oreOpen, before)
om.MSceneMessage.addCallback(om.MSceneMessage.kAft  erOpen, after)

Case scenario1; In scene, OPEN scene
Works as expected.

#BEFORE: ../../
#AFTER: ../../

Case scenario2; In scene, SAVE scene
DOESN'T work as expected.

#BEFORE: ../../
#AFTER: ../../

I also tried 'kBeforeSaveCheck' callback, with same result.