Files
UnrealEngineUWP/Engine/Source/Editor/GraphEditor/Private/GraphEditorModule.cpp
jordan hoffmann ff6648b05f [BugFix] BP_Diff data flow changes
- because the graphs were being diffed in two different ways - once to generate the list and once to determine how to render the nodes, there were some differences in the diff behavior that caused certain nodes to not render as diffed even though they showed up in the list. this change uses the same diff list for both now so there shouldn't be any differences anymore

- This also solves an issue that caused highlighted pins from Blueprint Diff to persist to the blueprint itself. Now all visual modifications made by the diff viewer only appear in the diff panels rather than the main graph
#jira UE-93061
#preflight 62a256ef2469f462fdd9c693
#rb daren.cheng

This change sets up for future style changes allowing for us to render nodes in the diff graph based on their diff type. There are no style changes in this CL however.

[CL 20584624 by jordan hoffmann in ue5-main branch]
2022-06-09 16:44:27 -04:00

93 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "GraphEditorModule.h"
#include "Modules/ModuleManager.h"
#include "GraphEditorActions.h"
#include "SGraphEditorImpl.h"
#include "ToolMenus.h"
IMPLEMENT_MODULE(FGraphEditorModule, GraphEditor);
#define LOCTEXT_NAMESPACE "GraphEditorModule"
/////////////////////////////////////////////////////
// FGraphEditorModule
void FGraphEditorModule::StartupModule()
{
FGraphEditorCommands::Register();
TArray< TWeakPtr<SGraphEditor> >& Instances = SGraphEditor::AllInstances;
for (auto InstanceIt = SGraphEditor::AllInstances.CreateIterator(); InstanceIt; ++InstanceIt)
{
TWeakPtr<SGraphEditor>& Instance = *InstanceIt;
if (Instance.IsValid())
{
Instance.Pin()->OnModuleReloaded();
}
}
}
void FGraphEditorModule::ShutdownModule()
{
UToolMenus::UnRegisterStartupCallback(this);
UToolMenus::UnregisterOwner(this);
// Notify all the instances of GraphEditor that their code is about to be unloaded.
for (auto InstanceIt = SGraphEditor::AllInstances.CreateIterator(); InstanceIt; ++InstanceIt)
{
TWeakPtr<SGraphEditor>& Instance = *InstanceIt;
if (Instance.IsValid())
{
Instance.Pin()->OnModuleUnloading();
}
}
FGraphEditorCommands::Unregister();
}
/**
* DO NOT CALL THIS METHOD. Use SNew(SGraphEditor) to make instances of SGraphEditor.
*
* @return A GraphEditor implementation.
*/
TSharedRef<SGraphEditor> FGraphEditorModule::PRIVATE_MakeGraphEditor(
const TSharedPtr<FUICommandList>& InAdditionalCommands,
const TAttribute<bool>& InIsEditable,
const TAttribute<bool>& InDisplayAsReadOnly,
const TAttribute<bool>& InIsEmpty,
TAttribute<FGraphAppearanceInfo> Appearance,
TSharedPtr<SWidget> InTitleBar,
UEdGraph* InGraphToEdit,
SGraphEditor::FGraphEditorEvents InGraphEvents,
bool InAutoExpandActionMenu,
TSharedPtr<TArray<FDiffSingleResult>> DiffResults,
TAttribute<int32> FocusedDiffResult,
FSimpleDelegate InOnNavigateHistoryBack,
FSimpleDelegate InOnNavigateHistoryForward,
TAttribute<bool> ShowGraphStateOverlay)
{
return
SNew(SGraphEditorImpl)
.AdditionalCommands(InAdditionalCommands)
.IsEditable(InIsEditable)
.DisplayAsReadOnly(InDisplayAsReadOnly)
.Appearance(Appearance)
.TitleBar(InTitleBar)
.GraphToEdit(InGraphToEdit)
.GraphEvents(InGraphEvents)
.AutoExpandActionMenu(InAutoExpandActionMenu)
.DiffResults(DiffResults)
.FocusedDiffResult(FocusedDiffResult)
.OnNavigateHistoryBack(InOnNavigateHistoryBack)
.OnNavigateHistoryForward(InOnNavigateHistoryForward)
.ShowGraphStateOverlay(ShowGraphStateOverlay);
}
/////////////////////////////////////////////////////
#undef LOCTEXT_NAMESPACE