How to get a reference to the AnimationAsset opened in the AnimationEditor from a custom plugin ?

Hi guys,

I need to add a new button to the Animation Editor and from the function binded to that button I want to get access to the currently opened AnimationAsset. The problem that I’m facing is that I don’t know how get a reference to that AnimationAsset.

I’m addding the button to the AnimationEditor’s Toolbar from the StartupModule function in my plugin. Something like this:

IAnimationEditorModule& AnimationEditorModule = FModuleManager::LoadModuleChecked<IAnimationEditorModule>("AnimationEditor");
TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender);
ToolbarExtender->AddToolBarExtension("Asset", EExtensionHook::After, PluginCommands, FToolBarExtensionDelegate::CreateRaw(this, &FDemoPluginModule::AddToolbarExtension));
AnimationEditorModule.GetToolBarExtensibilityManager()->AddExtender(ToolbarExtender);

That works perfectly.

Now, looking inside the source, the AnimationEditor is loaded from AnimationEditorModule::CreateAnimationEditor using InitAnimationEditor passing as parameter the AnimationAsset that we want to open and AnimationEditorModule.CreateAnimatioEditor is called from a AssetTypeActions_AnimationAsset when you open any AnimationAsset. The currently opened AninationAsset is stored in a private variable in AnimationEditor class

So, my question is. How can I get a refference to that AnimationAsset from my Plugin ?

PD: Sorry for my english :S

Thanks in advance.

bump, bump …

Someone can point me in the right direction here, guys ?

Hello! I think FAssetEditorManager::GetAllEditedAssets() will help you.

Hi artemavrin, Thanks so much for you answer. its not exactly what I was looking for becuase this return me ALL the open assets (SoundCue. Texture etc) … but I can work with this meanwhile, I can loop through the list looking for a AnimSequence. I need to be carefull, and only open one animsequence, the one that I want to edit, but that is not a big problem becuase basically this is a personal tool :slight_smile:

Thanks so much for your answers

Best regards,