Hi,

as promised here the first version of the mdl resave dll. Please always be aware that i've done this code in around 2 hours, so do NOT expect really good quality (good quality is not for free tongue ) - espcially as big parts of this code are from my old project GED. So there will be probably a lot of bugs to fix, as i just do not have the time currently to check the code with a lot of different models and configurations. Espcially the speed & the memory consumtpion of the project is far from beeing optimal laugh I did NOT have the time to test a free plugin properly, so:
BACKUP YOUR MODELS BEFORE USING THIS PLUGIN and read the bug section before committing bugs.

Enough warnings. Very short tutorial:

Folder Structure
Basically there are two folders:
1) bin: Contains DLL File mdl_resave.dll. Copy this file to your acknex_plugins folder to get things runnings
2) mdl_resave: Contains Source of the DLL. There are not dependencies besides the MDL and the Gamestudio SDK, so everyone should get this code running.

Get Plugin working
As already said, copy the mdl_resave.dll out of the "bin" folder into your acknex_plugins (or any PRAGMA_PLUGIN) folder. Open SED and add the following six function definitions anywhere to the top of one of your headers:

Code:
void* LoadModel(ENTITY* ent);
void* LoadModelFromFile(STRING* str);

BOOL SaveModel(ENTITY* ent);
BOOL SaveModelWithLoader(ENTITY* ent,void* loader);

BOOL FreeLoader(void* loader);



You can find a very basic example how to use the resave plugin in the mdl_resave folder (file: test.c).

Available Functions

Probably you'll only need the function SaveModel(ENTITY* ent). You pass an ENTITY to the function and the entity will be saved.
The functions LoadModel and LoadModelFromFile will return an internal loader object. In future - if anyone needs it - this loader object COULD be used to change any option in the mdl file you wish (e.g. even ADDING or REMOVING vertices or changing bones / lod-settings etc.). In the case you want to use the SaveModelWithLoader / LoadModel functionalities - PLEASE: use the FreeLoader function, otherwise there will be giantic memory leaks. The plugin is not clever enough to detected entity removal, and will therefore NOT clear up on it's own.

What does the Plugin change?

At the moment the only thing which is changed are the vertices. So any changes you make to your skins are NOT accepted or changed by the mdl resave plugin.

Where to download

http://www.dev-software.com/mdl_save.rar

How to submit bugs

Yep - as already said there will be bugs with a lot of models, as i do NOT have the time to test properly. If you have a model where the resaving crashs and / or changes please do NOT say: "blabla - does not work - blabla" but upload the model and send a link to this model via pm. Reproducing problems should be just a matter of time.


best regards,
Timo