Hi,
my general question is: Is there anything built-in the Engine that solves similar problems like the DOM-traversal JavaScript offers? I am trying to add features/UI/widgets to existing Editors through my own plugin without touching the Engine code. I would need to manipulate existing editors as follows:
- Add widgets
- Read editor content
- Write editor content
- Bind to UI events
My specific problem at hands is in Translation Editor:
(see TranslationEditorModule.h
see Unreal Editor → Tools → Localization Dashboard → Edit Translation Unit → Edit translation for this culture)
- In the tab “Needs Review” I would like to have a Button “Check all” that checks all the “Has been Reviewed” checkboxes.
- In the tab “Untranslated” I would like to have a button that copies all sources to the translations row.
Through FExtender I was able to draw a button in the Toolbar. However, I struggle with implementing the functionality, as almost everything in the TranslationEditorModule is encapsulated. Therefore I’d wish to have some kind of DOM-traversal to implement the 2 features, because that would trigger everything necessary through PostEditChangeProperty and I wouldn’t have to break encapsulation i.e. change the engine code.
Any ideas? Thanks already for reading this long post!
Btw. this is my code so far:
#include "TranslationEditorExtensions.h"
#include "TranslationEditorModule.h"
#define LOCTEXT_NAMESPACE "TranslationEditorExtensions"
void FTranslationEditorExtensionsModule::StartupModule()
{
UE_LOG(LogTemp, Display, TEXT("%s"), *FString(__FUNCTION__));
FTranslationEditorModule& TransEdModule = FModuleManager::LoadModuleChecked<FTranslationEditorModule>("TranslationEditor");
struct Local
{
static void AddToolbarButton(FToolBarBuilder& ToolbarBuilder)
{
TSharedRef<SWidget> AllReviewedButton = SNew( SButton )
.HAlign( HAlign_Center )
.VAlign( VAlign_Center )
.OnClicked_Static(&Local::OnAllReviewedButtonClicked)
[
SNew(STextBlock)
.Text(LOCTEXT("AllReviewedButton", "Check all Reviewed"))
.Justification(ETextJustify::Center)
];
ToolbarBuilder.AddWidget(AllReviewedButton);
}
static FReply OnAllReviewedButtonClicked()
{
UE_LOG(LogTemp, Log, TEXT("Button clicked!"));
return FReply::Handled();
}
};
TSharedPtr<FExtender> ToolBarExtender = MakeShareable(new FExtender());
ToolBarExtender->AddToolBarExtension(
"Asset",
EExtensionHook::After,
NULL,
FToolBarExtensionDelegate::CreateStatic(&Local::AddToolbarButton));
TransEdModule.GetToolbarExtensibilityManager()->AddExtender(ToolBarExtender);
}
IMPLEMENT_MODULE(FTranslationEditorExtensionsModule, TranslationEditorExtensions)
(“Needs Review” is true whenever Source of new array of TranslationUnits differs from Source of archived Array. Can be done by importing a .PO-file with manipulated msgid)
Playground_ES_Modified.po (1.8 KB)
Playground_ES.po (1.8 KB)