View in #code on Slack
@markj_red9: Hi all, wondering if somebody should shed a light on when the kAfterOpen callback kicks in
om.MSceneMessage.addCallback(om.MSceneMessage.kAfterOpen, func)
we have a client running our health systems and triggered a test on the kAfterOpen BUT on a file with references it seems like this callback is triggered not when the file is loaded, but when the holding file is loaded, so it hits during the reference load of the file load
I saw somewhere you could use maya.utils.executeDeferred as an additional arg but can’t find anything about it
@bob.w: what version of maya?
@markj_red9: 2018+
although ideally the solution would need to run 2017 too
@dhruv: You might want to use AfterLoadReference as well.
Ie in the AfterOpen, you’d want to check for references and defer till the AfterLoadReference is complete.
Afaik they made reference loading partially async in 2017(???) and that’s the way to handle it IMHO
@bob.w: Did they now?
@markj_red9: what in the func thats being passed to the kAfterOpen?
@dhruv: Yeah so in your AfterOpen callback check for references. If they are there, defer to your callbacks on AfterLoadReference. In those check for each reference being loaded and see if there are more to be loaded, in case something disabled one along the way. When none are left, then run your original code
@markj_red9: yeah think that makes sense, just a bit confusing that the AfterOpen isn’t actually after open in the first place