Hello,
I hope to extend FAnimationEditorMode so that when entering the animation editor, a custom tab window can be opened, and the tab can be placed in a specified layout position.
I tried binding the callbacks `PersonaModule.OnRegisterTabs()` and `PersonaModule.OnRegisterLayoutExtensions()`. Below is my simple implementation scheme:
const FName AnimationXXXToolTabs::AnimationXXXTool(TEXT("AnimationXXXToolTab"));
void UAnimationXXXTabExtender::OnRegisterTabs(FWorkflowAllowedTabSet& TabFactories, TSharedPtr<FAssetEditorToolkit> InHostingApp)
{
TSharedRef<IAnimationEditor> AnimationEditor = StaticCastSharedRef<IAnimationEditor>(InHostingApp.ToSharedRef());
TabFactories.RegisterFactory(MakeShareable(new FAnimationXXXTabSummoner(InHostingApp, AnimationEditor->GetPersonaToolkit()->GetPreviewScene())));
}
void UAnimationXXXTabExtender::OnRegisterLayoutExtensions(FLayoutExtender& LayoutExtender)
{
//LayoutExtender.ExtendLayout(AnimationEditorTabs_AdvancedPreviewTab, ELayoutExtensionPosition::After, FTabManager::FTab(AnimationXXXToolTabs::AnimationXXXTool, ETabState::OpenedTab));
LayoutExtender.ExtendStack(AnimationEditorTabs_AdvancedPreviewTab, ELayoutExtensionPosition::Below, FTabManager::FTab(AnimationXXXToolTabs::AnimationXXXTool, ETabState::OpenedTab));
}
FAnimationXXXTabSummoner::FAnimationXXXTabSummoner(TSharedPtr<class FAssetEditorToolkit> InHostingApp, const TSharedRef<class IPersonaPreviewScene>& InPreviewScene)
: FWorkflowTabFactory(AnimationXXXToolTabs::AnimationXXXTool, InHostingApp)
, PreviewScene(InPreviewScene)
{
TabLabel = INVTEXT("Animation XXX Tool Tab");
TabIcon = FSlateIcon(FAppStyle::GetAppStyleSetName(), "Persona.Tabs.AnimCurveMetadataEditor");
bIsSingleton = true;
ViewMenuDescription = INVTEXT("Animation XXX Tool Tab");
ViewMenuTooltip = INVTEXT("Shows the Animation XXX Tool Tab.");
}
However, when testing, I found that when I open the animation asset, my customized tab window does not open automatically and shows an error: `LogSlate: The tab “AnimationXXXTool_Dock” attempted to spawn in layout ‘Standalone_AnimationEditor_Layout_v1.5’ but failed for some reason. It will not be displayed.` I can only find the tab window name in the menu and open it manually, and its position is not in the layout I specified.
I hope that when I open the animation asset, my customized tab window can open automatically and be correctly placed in the layout I specified. Could it be that my extension method is incorrect? Or did I miss some steps?
Thank you.