Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 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.

Code:
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 test_01.ma, OPEN scene test_02.ma
Works as expected.

#BEFORE: ../../test_01.ma
#AFTER: ../../test_02.ma

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

#BEFORE: ../../test_02.ma
#AFTER: ../../test_02.ma

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

# 2 21-09-2016 , 07:06 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
What exactly are you trying to achieve?

In your second case, you probably want kBeforeSave and kAfterSave.


Imagination is more important than knowledge.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads