I have been following the tutorial on how to make a custom asset type, and am currently working on a dialogue editor plugin for my game. My plan was to have a graph editor with dialogue nodes, however I have ran into an issue and cannot get the graph tab to open.
void DialogueAssetEditorToolkit::InitEditor(const TArray<UObject*>& InObjects)
{
CurDialogue = Cast<UDialogueAsset>(InObjects[0]);
const TSharedRef<FTabManager::FLayout> Layout = FTabManager::NewLayout("DialogueAssetEditorLayout")
->AddArea
(
FTabManager::NewPrimaryArea()->SetOrientation(Orient_Vertical)
->Split
(
FTabManager::NewSplitter()
->SetSizeCoefficient(0.6f)
->SetOrientation(Orient_Horizontal)
->Split
(
FTabManager::NewStack()
->SetSizeCoefficient(0.8f)
->AddTab("DialogueGraph", ETabState::OpenedTab)
)
->Split
(
FTabManager::NewStack()
->SetSizeCoefficient(0.2f)
->AddTab("DialogueDetails", ETabState::OpenedTab)
)
)
);
FAssetEditorToolkit::InitAssetEditor(EToolkitMode::Standalone, {}, "DialogueAssetEditor", Layout, true, true, InObjects);
}
void DialogueAssetEditorToolkit::RegisterTabSpawners(const TSharedRef<class FTabManager>& DialogueTabManager)
{
FAssetEditorToolkit::RegisterTabSpawners(DialogueTabManager);
WorkspaceMenuCategory = DialogueTabManager->AddLocalWorkspaceMenuCategory(INVTEXT("Dialogue Asset Editor"));
DialogueTabManager->RegisterTabSpawner("DialogueGraph", FOnSpawnTab::CreateLambda([=](const FSpawnTabArgs&)
{
//DGraph = CastChecked<UEdGraph>(FBlueprintEditorUtils::CreateNewGraph(DGraph, NAME_None, UEdGraph::StaticClass(), UEdGraphSchema::StaticClass()));
return SNew(SDockTab)
[
//SNew(DialogueEditorMainUI).GraphToEdit(DGraph)
SNew(SBox)
.HAlign ( HAlign_Left )
.VAlign ( VAlign_Bottom )
.Padding ( 40.f )
.WidthOverride ( 500.0f )
.HeightOverride ( 400.0f)
[
SNew(DialogueEditorMainUI)
]
];
}))
.SetDisplayName(INVTEXT("Dialogue Graph"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef());
FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
FDetailsViewArgs DetailsViewArgs;
DetailsViewArgs.NameAreaSettings = FDetailsViewArgs::HideNameArea;
TSharedRef<IDetailsView> DetailsView = PropertyEditorModule.CreateDetailView(DetailsViewArgs);
DetailsView->SetObjects(TArray<UObject*>{ CurDialogue });
DialogueTabManager->RegisterTabSpawner("DialogueDetails", FOnSpawnTab::CreateLambda([=](const FSpawnTabArgs&)
{
return SNew(SDockTab)
[
DetailsView
];
}))
.SetDisplayName(INVTEXT("Details"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef());
}
DialogueEditorMainUI is a class that derives from SGraphEditor. Made the class following the tutorial some what. If this can be done without making a class derived from it then im all for it. I will need a box that can scroll horizontal and vertical which seems like a graph editor would be what I need. Also if someone wants to tell me how to flag a block of code I will go back and edit