New information. Based on the replies I got from martin in
the other thread, and a few experiments, it turns out that the size of the animation list in orbiter indeed
never shrinks. When an animation is deleted, it is kept in the list, but identified by having zero components.
So we literally have to do nothing to fix the issue in D3D9 client. Marking the animstates of deleted animations with -1 as suggested is still a good idea, and I'll see if there are any queries to that where a validation check is in order, but just removing the resizing of animstate in DelAnimation already seems to be producing stable results.
---------- Post added at 09:44 PM ---------- Previous post was at 02:03 PM ----------
Ran upon another (unrelated) problem for which I could use some advice.
When calling VESSEL::GetDevMesh() in the very first clbkVisualCreated of the session, I only get NULLs (only in D3D9, works without trouble in inline). Could you tell me a bit about the processing order here? Is it possible that D3D9client doesn't have the meshes ready at that time?
---------- Post added at 11:51 PM ---------- Previous post was at 09:44 PM ----------
Huh, this is weird... In the inline client, clbkVisualCreated is called after clbkPostCreation, in D3D9client it's called
before. In IMS2 meshes are added in clbkPostCreation, so that's why I'm getting NULLs. But I have no idea what action in D3D9client causes Orbiter to trigger clbkVisualCreated on the vessel. Any ideas?
EDIT: nevermind, got it after hunting through the orbiter sdk docs and comparing sources with D3D7 client.
In Scene::Initialise(), D3D9client calls CheckVisual(), which calls AddVisualRec, which calls RegisterVisObject, which will trigger clbkVisualCreated on the relevant vessel. Evidently, the postCreation on the client is called before it is on the vessels, which makes sense.
Fact is that clbkPostCreation in D3D7client does
not call CheckVisual. It only calls it in Scene::NewVessel() and Scene::Update(), both places at which D3D9client also makes the call. So calling it already in clbkPostCreation results in divergent behavior of the two clients.
Commenting out the call to CheckVisual() in Scene::Initialise() fixes my issue, but I don't know why the call is in there in the first place. Might be that by taking it out we're creating other issues, though judging by the comments the only reason for the call is to create the visuals... which is exactly what shouldn't happen yet. Oppinions?