Greetings! I am looking to figure out how to script an importer for custom file types. I am not seeing anything in the documentation on this or anything on the import process pipeline. I found the " ImportFileEntry" and " AssetImportEntry" classes but I have not been able to figure out how to use these. Any help would be appreciated
You might want to take a look here:
You could code your own libraries for anything and then link to those directly.
Thank you for the quick response! I don’t think this is quiet what I am looking for though… At least not yet. I’m coming from Unity and what I am used to is an asset processor type class. So far I have managed to get most of the way there by making a ‘Plugin’ and manually adding a delegate to the ‘ImportFileEntry.FileTypes’ dictionary to return a custom ‘ImportFileEntry’ then processing from there. It appears to work but I am not sure if this is the correct method?
Examples:
public class CustomImportEntry : AssetImportEntry
{
public CustomImportEntry(ref Request request) : base(ref request)
{
}
public override bool Import()
{
// do stuff
return true;
}
}
public class CustomImporterPlugin : EditorPlugin
{
const string _fileExt = "customExtension";
private static ImportFileEntry ImportCustomAsset(ref Request request)
{
var importEntry = new CustomImportEntry(ref request);
return importEntry;
}
public override void InitializeEditor()
{
var fileTypes = FlaxEditor.Content.Import.ImportFileEntry.FileTypes;
if (fileTypes.ContainsKey(_fileExt) is false)
{
fileTypes.Add(_fileExt, ImportCustomAsset);
}
base.InitializeEditor();
}
public override void DeinitializeEditor()
{
var fileTypes = FlaxEditor.Content.Import.ImportFileEntry.FileTypes;
fileTypes.Remove(_fileExt);
base.DeinitializeEditor();
}
}
I have implemented custom file importers for the RmlUi plugin here as a reference: https://github.com/GoaLitiuM/RmlUi/blob/master/Source/RmlUi/RmlUiImport.cs