It’s been a while since any FSDSxTweak traffic – mostly because it is stable and we have pushed things about as far as we can. But here is a helpful hint.
Some users have reported that compiling small models under FSDSxTweak v2.81 can lead to very large MDL files. For example – compile a model with FSDS only and you have a 150kb MDL file; tweak and compile with FSDSxTweak, and you end up with a 3MB file. After much digging into this problem (which only occurs for some users, making it even harder to narrow down), Free Flight Design Forum user Hunter10 narrowed down the problem to old temp files left behind in the FSDS folder by older compiles (read the thread of how he came to this conclusion).
The obvious solution is to have FSDSxTweak clean up all temp files after it compiles and tweaks a model. Luckily, on a cloudy day in 2008, I added a feature into FSDSxTweak_plugin that easily allows you to do this. You may have noticed (probably not), that FSDSxTweak_plugin allows you to inject DOS batch files into the compilation pipeline for exotic tasks. You can inject at three stages:
- Pre-build: Before any tweaking or compilation happens
- Mid-build: After tweaking, but before compilation with xtomdl
- Post build: After tweaking and compilation.
Obviously the post-build step is where we want to do this clean up task. You inject into the exterior and interior model pipelines separately, so if you are building a model with VC, you will need to set up the following for both of these.
Step 1: Create a batch file to clean up the temp files
This is a simple DOS batch file. The only thing to notice is that the batch file will be run from from the [your fsds location]\plugins folder, and all the temp files live in [your fsds location] folder. Other than that, nothing special. Here is one that will work for exterior models (you can cut and paste this into a cleat text file, name it exterior_cleanup.bat, and save it to your FSDS folder:
del ..\_temp.x del ..\_temp.xml del ..\_temp.mdl del ..\_temp.xanim del ..\_matTemp.txt del ..\_nrmTemp.txt del ..\_exterior.x del ..\_exterior.xml del ..\_exterior.mdl del ..\_exterior.xanim
Here is the equivalent file for interior models (VCs). Name it interior_cleanup.bat, and save it to your FSDS folder:
del ..\_temp_interior.x del ..\_temp_interior.xml del ..\_temp_interior.mdl del ..\_temp_interior.xanim del ..\_matTemp_interior.txt del ..\_nrmTemp_interior.txt del ..\_interior.x del ..\_interior.xml del ..\_interior.mdl del ..\_interior.xanim
Step 2: Get FSDSxTweak_plugin to run your batch file after tweak and compile
Now we are ready to tell FSDSxTweak_plugin to use these batch files. Start up FSDSxTweak_plugin, and hit the Advanced button in the exterior model group of controls:
Now in the pop-up window, enter the full path to your cleanup batch file in the post build batch file text box (or browse to it using the Browse button):
Now close the pop-up window. Repeat this step with the interior model if necessary. From now on, whenever you build the model, the temp files will be deleted after tweaking and compilation.