So phase 1 is finally over:
I now have the entire set of meshes already animated saved and all their rotations and offsets saved and correct. In fact, I designed my plugin that works on the scenario so it directly writes the code of the final addon, I already tested it and it works perfectly.
I'd like to spend a couple of words on this phase, since it can seem simple but it was some kind of madness:
In order to get everything I needed, with so many vessels and such a complexity, I only had the option of proceeding through coding and not by hand. So I designed a plugin that allowed me to do the following.
Starting from a pivot vessel I had to find the way to get all the meshnames of the linked vessels, all their rotations and all their offsets, starting with nothing else than the scenario and the dockings/attachments between them.
So I chose the CMG which is a good starting point for this and I designed the plugin so connection by connection it is capable of identifying the rotation matrixes of the connections and store a global rotation matrix and global offset. So after this step I had a series of vessels definitions that I knew where they were and how they were rotated.
Then I had to get the meshes from them.
Even though this might look simple it was not so simple: for some vessels I could use the orbiter functions directly, for SC3 vessels I had to go and make the plugin directly parse the ini file of the various SC3 vessels to find all the meshes (vessels and payloads!) and store them correctly. But still there were some 30 vessels which I couldn't find the meshname, mostly the ISSR part, so I had to make the plugin recreate the first line of each mesh (knowing groups information from orbiter) and go and check for each file inside the mesh folder and subfolders if there was a matching mesh. Amazingly it checks the first 5 lines of more than 1230 files and also dumps out all the information for reference on a text file (huge one because in order to check the process I needed a lot of debug info) in just 2/3 seconds... modern technology still has the ability to surprise me... :lol:
So now I had all filenames, where they had to be put and how they need to be rotated.
BUT it was not over at all: for many vessels (almost all of them) I needed to have the animated mesh, not the base one, so for each group of each mesh of each vessel I needed to find out the vertexes position at the animation state that was currently in the sim. Jarmonik helped me with his special funciton in D3D9, but i was already well ahead in the process of developing the code for this so I used his function as a check. I basically had to recreate completely the orbiter animation structure to get correctly how each group was manipulated by each animation. Once this was done (after some time awake while the babies where sleeping
) I then could let my plugin rewrite all the mesh files (of course in a separate dedicated folder!!!) with the animated vertexes and have stored the rotation of each mesh and the offset of each mesh.
I also had to use some tricks... for example I found out that SC3 sets the animation state at every step so it was messing all my work. So I made the plugin set the simulation to pause as soon as all the animations were reset so SC3 could not set again all those.
So then I plugged in the new unique vessel the code I made my plugin write and ...
:woohoo::woohoo::woohoo:
That is a unique vessel with 229 meshes on...
The solar panels are not animated yet of course so you see them just in their base position. All the experts: please don't jump at me already if you see any imperfection because this is just the first step... please notice if anything is out of place of course but remember that now the fun part begins: preparing the vessel so it can work from a configuration file and can be highly customizable. for now anyway, I'm pretty happy because the phase 1 could seriously have been a show stopper due to its complexity!