Content compiler with multiple outputs

Started by
1 comment, last by 3DModelerMan 10 years, 2 months ago

I'm working on a content compiler that will take my raw input assets and convert them into resources for loading into my engine. The actual conversion is easy and I've already got it working fine. The problem is that one input file (a PSD image for example) can produce multiple output files (each layer of the PSD as a separate DDS texture if that option is enabled). This part is working fine too, but I need to figure out how to clean the resources up when the input file is deleted. I don't want to have to re build all the assets every time a file is deleted/renamed/whatever. I just want to be able to delete the multiple outputs from the one asset file, and rebuild that single file. How would you recommend going about tracking the outputs? I already have a metadata file for per-asset options, but using that to track outputs seems like it would be fragile to any changes made in Windows Explorer while the content compiler wasn't running.

Advertisement

I don't currently have this feature implemented (i.e. if I delete an input file, it's outputs still continue to exist until next time I force a full rebuild by deleting the compiled data directory).

However, I have the build-system maintain a central database of records of all the work it's done. Whenever a file is built, the input and output file-names, time-stamps and hashes are stored in this database, along with the version number of the data-compiler plugin that was used.

At the moment this lets me check if an input file has been modified, and then find all outputs that were built using that input file, so they can be re-built.

To implement your feature, I could check if an input file no longer exists, find all the outputs that were built using it, and delete them.

When I start up my tool, I scan the entire content directory checking file-names and time-stamps, which is extremely fast, and lets you detect any missing or modified files. I then subscribe to events about any changes to that directory, so the tool is notified of modifications/creations/deletions while it's running.

Thanks for the help. It's working great now.

This topic is closed to new replies.

Advertisement