What does the header for this look like?
This is my current attempt to make this work
// Copyright Epic Games, Inc. All Rights Reserved.
#include "bplib.h"
#include "Editor/Blutility/Classes/EditorUtilityWidget.h"
#define LOCTEXT_NAMESPACE "FbplibModule"
void FbplibModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}
void FbplibModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}
void FbplibModule::PluginButtonClicked()
{
}
// Modelled on the UEditorUtilityWidgetBlueprint::CreateUtilityWidget() Do it again
TSharedRef FbplibModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
{
UBlueprint* UMGBP = LoadObject<UBlueprint>(nullptr, L"/Script/Blutility.EditorUtilityWidgetBlueprint'/bplib/bplib.bplib'"); //Reference to your EditorUtilityWidget
TSharedRef<SWidget> TabWidget = SNullWidget::NullWidget;
{
UEditorUtilityWidget* CreatedUMGWidget = nullptr;// Created UMG Control
UClass* BlueprintClass = UMGBP->GeneratedClass;
TSubclassOf<UEditorUtilityWidget> WidgetClass = BlueprintClass;
UWorld* World = GEditor->GetEditorWorldContext().World();
if (World)
{
if (CreatedUMGWidget)
{
CreatedUMGWidget->Rename(nullptr, GetTransientPackage());
}
CreatedUMGWidget = CreateWidget<UEditorUtilityWidget>(World, WidgetClass);
}
if (CreatedUMGWidget)
{
TabWidget = SNew(SVerticalBox)
+ SVerticalBox::Slot()
.HAlign(HAlign_Fill)
[
CreatedUMGWidget->TakeWidget()
];
}
}
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FbplibModule, bplib)
header
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
class FbplibModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
/** This function will be bound to Command (by default it will bring up plugin window) */
void PluginButtonClicked();
TSharedRef OnSpawnPluginTab();
};
edit: got it to work, report later