A slow MDL Tweaker

About a week ago I received a message on the forum that MDL Tweaker crashed on a certain object. After the designer of the object send me his MDL file, I soon figured out why it crashed. This was simply the most complex object I had ever tried to load into MDL Tweaker and a few integers had an overflow because the object had more than 32768 vertices. This was not that hard to fix of course, I just had to make sure that these big integers were read correctly.

But after I had fixed the errors, MDL Tweaker did not behave as before. It was now possible to load the object, but it took a very long time to do so. I thought I had tried to load quite complex objects before, but this one was of a different order (the MDL file is over 1 MB in size). After I while I found out that the internal way I store the MDL object (using collections to store lists of vertices, BGL commands, etc) is not very efficient when these lists grow very long.

This weekend I was visiting my parents. Being away from the internet, that also meant that I could work quitely on an improved version of MDL Tweaker (the train journey also proved to be a good place to work). So I have now tried to make the preview as fast as possible and to prevent people from thinking the tool is no longer responding, I also added a screen that shows the loading progress while you open a MDL file. For a complex object, like the one I described above, the loading can still take a few minutes. But I don’t know if I can find an easy solution for that problem.

I have tried to put most code that takes a lot of time together when you first load the object. So that once it is loaded, the tool works as fast as possible. But unfortunately this is not possible everywhere. Some forms need to collect some information about the object when they are loaded and iterating through the object in memory takes some time on big objects. So in those cases you will have to be patient and don’t think the tool has crashed.

I have now almost finished a new version of MDL Tweaker, so it will be released in a few days. Besides fixing the crash I mentioned and improving the loading of the object, there are some other small improvements. For example you can now select vertices in the vertex list based on the texture applied to them. So this makes it easier to select all vertices that belong to your trees for example (so that you can unify there normals).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.