Transcript so far:
generic assets are like, a known quantity
feels like we could just add a GenericAssetCopyDependencyBuilder to Gems/LmbrCentral/Code/Source/Builders/CopyDependencyBuilder
and it would load the file and take note of any asset fields
thge asset builder SDK literally has a OutputObject funciton
and that OutputObject function collects deps from the object its outputting
in fact atom already wrote this for the same reason (atom uses a lot of generic assets)
https://github.com/o3de/o3de/blob/ce390d43e323a4d5a80eb209493dc4ea3c1a08fe/Gems/Atom/RPI/Code/Source/RPI.Builders/Common/AnyAssetBuilder.cpp#L190
We should extract that into the generic system (the COpy Dependency Builder) and then add an ability to register types rather than hard code it.
that "any builder" is literally a Generic Asset Builder
it
- loads the given file into an Asset<T>
- checks if there's a "converter" registered (there does not have to be)
- runs the "converter" if registered, or just leaves it as is
- extracts dependencies from the Asset<T> using the standard AssetBuilderSDK::OutputObject function
- pushes back the job product which will copy it
so yeah, if we want to do this, that'd be the task for it
- take the atom AnyAssetBuilder, move it into instead the CopyDependenciesBuilder in the LmbrCentral (or somewhere else, could be aztoolsframework/it don't matter, just somehting always active)
- add some sort of function that registers types to it that would be called by system components booting up somehow. Probably just add a ebus call into its Register function that collects anyone's response. Right now it uses a static array of "azasset", "attimage", "azbuffer". We'd want it to do something like EBUS_EVENT_RESULT(aggregateresult, SomeBus::GetGenericAssetExtensionAndtypeId)
- I dont think there is a 3.
might need ot tweak it slightly since it expects an <any> at the root
but it has the right idea - load the asset, parse its deps, output it
I don't think a std::any has to actually be involved tho
like if we make a proper converter
you'd have to register it by asset type id though, like not just "*.myasset" but also typeid of myasset (the part that goes inside Asset, like Asset<myasset>)
then it could do a objectstreamutils::LoadObjectFromFile(..., typeid)
wish there were hours in a day or me's to code
its doing as simialr trick in anybuilder, its checking if the given typeid derives from baseclass Converter which has a Convert() function and if so, calls it. If no Converter present, it just leaves it as is (direct copy vs process)
AZ_RTTI can enumerate derived/base
it should be using a AZRTTI or any cast tho
its using reinterpret_cast

