Tuesday, April 16, 2013

Maya MObjectHandle

I've been fighting a crash bug in the Red9 MetaData for a while now and finally found the solution! The issue is that in the base class I cache the MObject in the node which means that if you reload the scene, or do a scene new, or reload reference etc that MObject pointer becomes invalid and Maya crashes whenever you try and call it. I really wanted to nail this issue as MetaData is absolutely at the core of all the work we're doing at Crytek.

So I did some digging and found the MObjectHandle class!! brilliant, it's a class designed specifically to test the health/validity of MObjects, basically now I'm caching both the MObject and an MOjectHandler for it, all the calls now just run a really simple test before using the MObject:


Brilliant, all I have to do is raise a good warning and the bug is crushed, should make things a lot more stable hopefully!