Is there a reason why the MaterialDef class does not extends from AssetKey?
I understand that material definitions are actually loaded by materials themselves but is it actually possible to load a material definition from a piece code?
The reason I’m asking this is because I’m making a meta-asset project that generates code for all assets, including their asset keys.
EDIT : Whilst searching for .vert and .frag asset keys, I found out that the class ShaderNodeDefinition, which extends AssetKey, is for material definitions. Am I correct? It’s quite ambiguous if I should use the ShaderNodeDefinition or MaterialDef class.
I am quite confused myself by all the asset types, so sorry if say something wrong.
The reason is, there is absolutely no reason to do it.
The AsseyKey class is used to send loading params to the assetManager (and to the undelying asset loader) to load an asset. The MaterialDefinition is an asset.
Mhh somehow, the material definitions is needed to load the material yes, and there are convenience methods to create a material loading the materialDef.
Any JME asset can be loaded with assetManager.loadAsset(“path/to/asset”) with an optional assetKey. loadModel, loadMaterial… are convenience methods.
Definitely not. It would make no sense at all
You must mistake with
Which is the AssetKey to load a ShaderNodeDefinition.
It’s only for material definitions using shader nodes.
An assets key is equivalent to it’s path, it’s the bit most people don’t understand about the asset system. (“Why can’t I move files” “Why can’t I use j3o as an exchange file format” etc)