amethyst/distill

`AssetDaemon` does not load assets without a file notification event

azriel91 opened this issue · 3 comments

Description:

When there are assets that exist under assets/the_asset.txt, even if the AssetDaemon has a "txt" importer, it will not be run unless you touch assets/the_asset.txt while the daemon is running.

This is a surprise/gotcha in a workflow where new assets are created and saved before running the daemon.

Expected behaviour:

When the AssetDaemon starts up, it both processes and imports new assets. I think it currently processes them but does not import them.

Impact:

User frustration / confusion.

I think the problem here is that the FileAssetSource only consumes "dirty file events" from the FileTracker. These events are only produced when a file has changed its contents.

So if you add or change the importer for a file extension, the FileAssetSource will not process any affected files. I think the solution to this would be for the FileAssetSource to scan its own metadata on startup to see if the set of registered importers has changed such that a reimport of certain files is required.

I did some more work on this as per the commit above, but I noticed that in order to trigger a reimport when an importer is newly registered where previously there was none, I need to store all import results in the DB and not just if there was an importer that successfully processed a pair. That still needs to be done, and that probably means that process_pair in source_pair_import needs to return an enum result which is mirrored in the file_asset_source metadata DB.

Probably relevant for @happenslol in the implementation of error states in the metadata. When changing the metadata state format, we should try to accommodate both the error state and the import result state.