I'm trying to build a list of objects pulled in from the scene and save that list for use in future scene updates.
This seems to work fairly well using maxon::BaseArray<BaseObject *>
. I can use a combination of GetDirty()/GetHDirty() to keep track of hierarchy changes and invalidate the list when the dirty count is increased. However, if I do an undo in the scene, GetDirty()/GetHDirty() do not update and yet the object pointers are changed- leading to an immediate crash when I try to access them again.
What is the proper way of keeping internal references to objects within the scene? At first glance, BaseLink looks like it might have been the way to go, but I can't seen to figure that one out since creating a new BaseLink with BaseLink::Alloc()
and subsequently calling myBaseLink->SetLink(obj)
followed by BaseObject *myObject = static_cast<BaseObject *>(myBaseLink->GetLink(doc))
just causes an immediate segmentation fault.
How can I store objects in a safe manner so that I can access them later on (assuming they're still part of the scene)?
Cheers,
-CMPX