Godot Version
Godot v4.4.1 stable_mono_win64
Question
I am trying to create an EditorPlugin/EditorImportPlugin to import fbx files. More specifically I want to extract the animations from the files and save them as a .res file.
Normally I go over the advanced import tab select the animation and enable save to file:
I have my EditorPlugin:
[Tool]
public partial class FbxAnimationImportPlugin : EditorPlugin
{
private FbxAnimationImporter fbxAnimationImporter;
public override void _EnterTree()
{
fbxAnimationImporter = new FbxAnimationImporter();
AddImportPlugin(fbxAnimationImporter);
}
public override void _ExitTree()
{
RemoveImportPlugin(fbxAnimationImporter);
fbxAnimationImporter = null;
}
}
And the corresponding EditorImportPlugin:
[Tool]
public partial class FbxAnimationImporter : EditorImportPlugin
{
public override string _GetImporterName()
{
return "fbx_animation_importer";
}
public override string _GetVisibleName()
{
return "FbxAnimationImporter";
}
public override string[] _GetRecognizedExtensions()
{
return ["fbx"];
}
public override string _GetSaveExtension()
{
return "res";
}
public override string _GetResourceType()
{
return "PackedScene";
}
public override Error _Import(string sourceFile, string savePath, Dictionary options, Array<string> platformVariants, Array<string> genFiles)
{
Resource scene = ResourceLoader.Load(sourceFile, "PackedScene");
//Doing stuff with the scene and animations...
return Error.Ok;
}
}
However I get the error:
ERROR: Failed loading resource: res://assets/protof/FileName.fbx. Make sure resources have been imported by opening the project in the editor at least once.
How can I load the fbx file into a PackedScene so I can access the embedded AnimationPlayer?
