Added a bunch more stuff. Too much to care to mention. Still more to do though.

This commit is contained in:
Jamie Greunbaum
2023-09-30 01:25:51 -04:00
parent cfe285b94d
commit 102927a690
60 changed files with 1664 additions and 76 deletions
@@ -24,7 +24,8 @@
#include "Layout/ComboActionForceDirectedSolveLayoutStrategy.h"
#include "Layout/ComboActionTreeSolveLayoutStrategy.h"
//#include "Popups/MDSPopup_GraphValidation.h"
//#include "Search/ComboActionSearchUtils.h"
#include "Search/ComboActionSearchUtils.h"
#include "Search/SComboActionSearch.h"
#include "Settings/ComboActionGraphEditorSettings.h"
#include "UObject/ObjectSaveContext.h"
@@ -54,14 +55,10 @@ FAssetEditor_ComboActionGraph::~FAssetEditor_ComboActionGraph()
this->EditingGraph = nullptr;
UPackage::PackageSavedWithContextEvent.Remove(this->OnPackageSavedDelegateHandle);
FGenericCommands::Unregister();
FGraphEditorCommands::Unregister();
FComboActionGraphEditorCommands::Unregister();
this->ToolbarBuilder.Reset();
}
void FAssetEditor_ComboActionGraph::OnPackageSaved(const FString& String, UPackage* Package, FObjectPostSaveContext ObjectPostSaveContext)
void FAssetEditor_ComboActionGraph::OnPackageSaved(const FString &String, UPackage *Package, FObjectPostSaveContext ObjectPostSaveContext)
{
this->RebuildComboActionGraph();
}
@@ -70,10 +67,6 @@ void FAssetEditor_ComboActionGraph::InitComboActionGraphAssetEditor(const EToolk
{
this->EditingGraph = Graph;
this->CreateEdGraph();
FGenericCommands::Register();
FGraphEditorCommands::Register();
FComboActionGraphEditorCommands::Register();
if (!this->ToolbarBuilder.IsValid())
{
@@ -164,13 +157,13 @@ void FAssetEditor_ComboActionGraph::RegisterTabSpawners(const TSharedRef<FTabMan
.SetGroup(WorkspaceMenuCategoryRef)
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.Tabs.Details"));
//InTabManager->RegisterTabSpawner(FAssetEditorTabs_ComboActionGraph::SearchToolbarID, FOnSpawnTab::CreateSP(this, &FAssetEditor_ComboActionGraph::SpawnTab_Search))
// .SetDisplayName(LOCTEXT("SearchTab", "Search"))
// .SetGroup(WorkspaceMenuCategoryRef)
// .SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "Kismet.Tabs.FindResults"));
InTabManager->RegisterTabSpawner(FAssetEditorTabs_ComboActionGraph::SearchToolbarID, FOnSpawnTab::CreateSP(this, &FAssetEditor_ComboActionGraph::SpawnTab_Search))
.SetDisplayName(LOCTEXT("SearchTab", "Search"))
.SetGroup(WorkspaceMenuCategoryRef)
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "Kismet.Tabs.FindResults"));
}
void FAssetEditor_ComboActionGraph::UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager)
void FAssetEditor_ComboActionGraph::UnregisterTabSpawners(const TSharedRef<FTabManager> &InTabManager)
{
FAssetEditorToolkit::UnregisterTabSpawners(InTabManager);
@@ -250,12 +243,12 @@ void FAssetEditor_ComboActionGraph::UpdateToolbar()
// TODO
}
void FAssetEditor_ComboActionGraph::RegisterToolbarTab(const TSharedRef<FTabManager>& InTabManager)
void FAssetEditor_ComboActionGraph::RegisterToolbarTab(const TSharedRef<FTabManager> &InTabManager)
{
FAssetEditorToolkit::RegisterTabSpawners(InTabManager);
}
void FAssetEditor_ComboActionGraph::AddReferencedObjects(FReferenceCollector& Collector)
void FAssetEditor_ComboActionGraph::AddReferencedObjects(FReferenceCollector &Collector)
{
Collector.AddReferencedObject(this->EditingGraph);
Collector.AddReferencedObject(this->EditingGraph->EdGraph);
@@ -268,8 +261,10 @@ FString FAssetEditor_ComboActionGraph::GetReferencerName() const
void FAssetEditor_ComboActionGraph::SetDialogueBeingEdited(UComboActionGraph *NewDialogue)
{
if (NewDialogue == nullptr) return;
if (NewDialogue == this->EditingGraph) return;
if (NewDialogue == nullptr || NewDialogue == this->EditingGraph)
{
return;
}
UComboActionGraph *Previous = this->EditingGraph;
this->EditingGraph = NewDialogue;
@@ -282,7 +277,7 @@ void FAssetEditor_ComboActionGraph::CreateInternalWidgets()
{
this->ViewportWidget = this->CreateViewportWidget();
FDetailsViewArgs Args; //( false, false, true, FDetailsViewArgs::HideNameArea, false );
FDetailsViewArgs Args;
Args.bUpdatesFromSelection = false;
Args.bLockable = false;
Args.bAllowSearch = true;
@@ -292,11 +287,11 @@ void FAssetEditor_ComboActionGraph::CreateInternalWidgets()
FPropertyEditorModule &PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
this->PropertyWidget = PropertyModule.CreateDetailView(Args);
this->PropertyWidget->SetObject(EditingGraph);
this->PropertyWidget->SetObject(this->EditingGraph);
this->PropertyWidget->OnFinishedChangingProperties().AddSP(this, &FAssetEditor_ComboActionGraph::OnFinishedChangingProperties);
//this->FindResultsView = SNew(SComboActionSearch, SharedThis(this));
this->FindResultsView = SNew(SComboActionSearch, SharedThis(this));
}
TSharedRef<SGraphEditor> FAssetEditor_ComboActionGraph::CreateViewportWidget()
@@ -469,11 +464,6 @@ void FAssetEditor_ComboActionGraph::SelectAllNodes()
}
}
bool FAssetEditor_ComboActionGraph::CanSelectAllNodes()
{
return true;
}
void FAssetEditor_ComboActionGraph::DeleteSelectedNodes()
{
TSharedPtr<SGraphEditor> CurrentGraphEditor = this->GetCurrentGraphEditor();
@@ -528,7 +518,7 @@ void FAssetEditor_ComboActionGraph::DeleteSelectedNodes()
this->RebuildComboActionGraph();
}
bool FAssetEditor_ComboActionGraph::CanDeleteNodes()
bool FAssetEditor_ComboActionGraph::CanDeleteNodes() const
{
// If any of the nodes can be deleted then we should allow deleting
const FGraphPanelSelectionSet SelectedNodes = this->GetSelectedNodes();
@@ -584,11 +574,6 @@ void FAssetEditor_ComboActionGraph::CutSelectedNodes()
this->DeleteSelectedDuplicatableNodes();
}
bool FAssetEditor_ComboActionGraph::CanCutNodes()
{
return this->CanCopyNodes() && this->CanDeleteNodes();
}
void FAssetEditor_ComboActionGraph::CopySelectedNodes()
{
// Export the selected nodes and place the text on the clipboard
@@ -624,7 +609,7 @@ void FAssetEditor_ComboActionGraph::CopySelectedNodes()
FPlatformApplicationMisc::ClipboardCopy(*ExportedText);
}
bool FAssetEditor_ComboActionGraph::CanCopyNodes()
bool FAssetEditor_ComboActionGraph::CanCopyNodes() const
{
// If any of the nodes can be duplicated then we should allow copying
const FGraphPanelSelectionSet SelectedNodes = this->GetSelectedNodes();
@@ -645,11 +630,11 @@ void FAssetEditor_ComboActionGraph::PasteNodes()
TSharedPtr<SGraphEditor> CurrentGraphEditor = this->GetCurrentGraphEditor();
if (CurrentGraphEditor.IsValid())
{
PasteNodesHere(CurrentGraphEditor->GetPasteLocation());
this->PasteNodesHere(CurrentGraphEditor->GetPasteLocation());
}
}
void FAssetEditor_ComboActionGraph::PasteNodesHere(const FVector2D& Location)
void FAssetEditor_ComboActionGraph::PasteNodesHere(const FVector2D &Location)
{
// Find the graph editor with focus
TSharedPtr<SGraphEditor> CurrentGraphEditor = this->GetCurrentGraphEditor();
@@ -731,7 +716,7 @@ void FAssetEditor_ComboActionGraph::PasteNodesHere(const FVector2D& Location)
this->RebuildComboActionGraph();
}
bool FAssetEditor_ComboActionGraph::CanPasteNodes()
bool FAssetEditor_ComboActionGraph::CanPasteNodes() const
{
const FGraphPanelSelectionSet SelectedNodes = this->GetSelectedNodes();
for (FGraphPanelSelectionSet::TConstIterator SelectedIter(SelectedNodes); SelectedIter; ++SelectedIter)
@@ -755,17 +740,6 @@ bool FAssetEditor_ComboActionGraph::CanPasteNodes()
return FEdGraphUtilities::CanImportNodesFromText(CurrentGraphEditor->GetCurrentGraph(), ClipboardContent);
}
void FAssetEditor_ComboActionGraph::DuplicateNodes()
{
this->CopySelectedNodes();
this->PasteNodes();
}
bool FAssetEditor_ComboActionGraph::CanDuplicateNodes()
{
return this->CanCopyNodes();
}
void FAssetEditor_ComboActionGraph::AutoArrange()
{
UEdComboActionGraph *EdGraph = Cast<UEdComboActionGraph>(this->EditingGraph->EdGraph);
@@ -821,21 +795,16 @@ void FAssetEditor_ComboActionGraph::ValidateGraph()
this->RebuildComboActionGraph();
//TArray<FText> ValidationMessages;
//if (ComboActionGraph->ValidateGraph(ValidationMessages, true) == false)
//{
// ValidationWindow = MDSPopup_GraphValidation::Open(ValidationMessages);
//}
//else
//{
// ValidationMessages.Empty();
// ValidationWindow = MDSPopup_GraphValidation::Open(ValidationMessages);
//}
}
bool FAssetEditor_ComboActionGraph::CanValidateGraph() const
{
return true;
TArray<FText> ValidationMessages;
if (ComboActionGraph->ValidateGraph(ValidationMessages, true) == false)
{
//ValidationWindow = MDSPopup_GraphValidation::Open(ValidationMessages);
}
else
{
ValidationMessages.Empty();
//ValidationWindow = MDSPopup_GraphValidation::Open(ValidationMessages);
}
}
void FAssetEditor_ComboActionGraph::OnRenameNode()
@@ -924,12 +893,26 @@ TSharedRef<SDockTab> FAssetEditor_ComboActionGraph::SpawnTab_Details(const FSpaw
auto DockTab = SNew(SDockTab)
.Label(LOCTEXT("Details_Title", "Property"))
[
PropertyWidget.ToSharedRef()
this->PropertyWidget.ToSharedRef()
];
DockTab->SetTabIcon(FAppStyle::GetBrush("LevelEditor.Tabs.Details"));
return DockTab;
}
TSharedRef<SDockTab> FAssetEditor_ComboActionGraph::SpawnTab_Search(const FSpawnTabArgs &Args)
{
check(Args.GetTabId() == FAssetEditorTabs_ComboActionGraph::SearchToolbarID);
auto DockTab = SNew(SDockTab)
.Label(LOCTEXT("Search_Title", "Search"))
[
this->FindResultsView.ToSharedRef()
];
DockTab->SetTabIcon(FAppStyle::GetBrush("Kismet.Tabs.FindResults"));
return DockTab;
}
#undef LOCTEXT_NAMESPACE
@@ -99,25 +99,25 @@ private:
#pragma region GraphEditorCommands
void SelectAllNodes();
bool CanSelectAllNodes();
bool CanSelectAllNodes() const { return true; }
void DeleteSelectedNodes();
bool CanDeleteNodes();
bool CanDeleteNodes() const;
void DeleteSelectedDuplicatableNodes();
void CutSelectedNodes();
bool CanCutNodes();
bool CanCutNodes() const { return this->CanCopyNodes() && this->CanDeleteNodes(); }
void CopySelectedNodes();
bool CanCopyNodes();
bool CanCopyNodes() const;
void PasteNodes();
void PasteNodesHere(const FVector2D &Location);
bool CanPasteNodes();
void DuplicateNodes();
bool CanDuplicateNodes();
bool CanPasteNodes() const;
void DuplicateNodes() { this->CopySelectedNodes(); this->PasteNodes(); }
bool CanDuplicateNodes() { return this->CanCopyNodes(); }
void AutoArrange();
bool CanAutoArrange() const;
void ValidateGraph();
bool CanValidateGraph() const;
bool CanValidateGraph() const { return true; }
void OnRenameNode();
bool CanRenameNodes() const;
@@ -142,6 +142,7 @@ private:
TSharedRef<SDockTab> SpawnTab_Viewport(const FSpawnTabArgs &Args);
TSharedRef<SDockTab> SpawnTab_Details(const FSpawnTabArgs &Args);
TSharedRef<SDockTab> SpawnTab_Search(const FSpawnTabArgs &Args);
class UComboActionGraphEditorSettings *ComboActionGraphEditorSettings;
@@ -155,7 +156,7 @@ private:
TSharedPtr<SGraphEditor> ViewportWidget;
TSharedPtr<class IDetailsView> PropertyWidget;
//TSharedPtr<class SComboActionSearch> FindResultsView;
TSharedPtr<class SComboActionSearch> FindResultsView;
/** The command list for this editor */
TSharedPtr<FUICommandList> GraphEditorCommands;