Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Source/Flow/Private/Nodes/Graph/FlowNode_FormatText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#define LOCTEXT_NAMESPACE "FlowNode_FormatText"

const FName UFlowNode_FormatText::OUTPIN_TextOutput("Formatted Text");

UFlowNode_FormatText::UFlowNode_FormatText(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
Expand All @@ -15,12 +17,12 @@ UFlowNode_FormatText::UFlowNode_FormatText(const FObjectInitializer& ObjectIniti
NodeDisplayStyle = FlowNodeStyle::Terminal;
#endif

OutputPins.Add(FFlowPin(TEXT("Formatted Text"), FFlowPinType_Text::GetPinTypeNameStatic()));
OutputPins.Add(FFlowPin(OUTPIN_TextOutput, FFlowPinType_Text::GetPinTypeNameStatic()));
}

FFlowDataPinResult UFlowNode_FormatText::TrySupplyDataPin_Implementation(FName PinName) const
{
if (PinName == TEXT("Formatted Text"))
if (PinName == OUTPIN_TextOutput)
{
FText FormattedText;
const EFlowDataPinResolveResult FormatResult = TryResolveFormatText(PinName, FormattedText);
Expand Down
2 changes: 1 addition & 1 deletion Source/FlowEditor/Private/Asset/FlowObjectDiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void FFlowObjectDiff::DiffProperties(TArray<FSingleObjectDiffEntry>& OutProperty
if (OldDetailsView.IsValid() && NewDetailsView.IsValid())
{
static constexpr bool bSortByDisplayOrder = true;
//OldDetailsView->DiffAgainst(*NewDetailsView.Get(), OutPropertyDiffsArray, bSortByDisplayOrder);
OldDetailsView->DiffAgainst(*NewDetailsView.Get(), OutPropertyDiffsArray, bSortByDisplayOrder);
}
}

Expand Down
51 changes: 31 additions & 20 deletions Source/FlowEditor/Private/Asset/SFlowDiff.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright https://github.com/MothCocoon/FlowGraph/graphs/contributors

#include "Asset/SFlowDiff.h"
#include "Asset/FlowDiffControl.h"

#include "Asset/FlowDiffControl.h"
#include "FlowAsset.h"
#include "Graph/Nodes/FlowGraphNode.h"

#include "EdGraphUtilities.h"
#include "Editor.h"
Expand Down Expand Up @@ -38,11 +39,11 @@ static int32 GetCurrentIndex(SListView<TSharedPtr<FDiffSingleResult>> const& Lis
const TArray<TSharedPtr<FDiffSingleResult>>& Selected = ListView.GetSelectedItems();
if (Selected.Num() == 1)
{
for (const TSharedPtr<FDiffSingleResult>& Diff : ListViewSource)
for (int32 Index = 0; Index < ListViewSource.Num(); ++Index)
{
if (Diff == Selected[0])
if (ListViewSource[Index] == Selected[0])
{
return 0;
return Index;
}
}
}
Expand All @@ -52,23 +53,21 @@ static int32 GetCurrentIndex(SListView<TSharedPtr<FDiffSingleResult>> const& Lis
void FlowDiffUtils::SelectNextRow(SListView<TSharedPtr<FDiffSingleResult>>& ListView, const TArray<TSharedPtr<FDiffSingleResult>>& ListViewSource)
{
const int32 CurrentIndex = GetCurrentIndex(ListView, ListViewSource);
if (CurrentIndex == ListViewSource.Num() - 1)
const int32 NextIndex = CurrentIndex + 1;
if (ListViewSource.IsValidIndex(NextIndex))
{
return;
ListView.SetSelection(ListViewSource[NextIndex]);
}

ListView.SetSelection(ListViewSource[CurrentIndex + 1]);
}

void FlowDiffUtils::SelectPrevRow(SListView<TSharedPtr<FDiffSingleResult>>& ListView, const TArray<TSharedPtr<FDiffSingleResult>>& ListViewSource)
{
const int32 CurrentIndex = GetCurrentIndex(ListView, ListViewSource);
if (CurrentIndex == 0)
const int32 PrevIndex = CurrentIndex - 1;
if (ListViewSource.IsValidIndex(PrevIndex))
{
return;
ListView.SetSelection(ListViewSource[PrevIndex]);
}

ListView.SetSelection(ListViewSource[CurrentIndex - 1]);
}

bool FlowDiffUtils::HasNextDifference(const SListView<TSharedPtr<FDiffSingleResult>>& ListView, const TArray<TSharedPtr<FDiffSingleResult>>& ListViewSource)
Expand Down Expand Up @@ -538,16 +537,28 @@ void FFlowDiffPanel::GeneratePanel(UEdGraph* Graph, TSharedPtr<TArray<FDiffSingl

InEvents.OnCreateNodeOrPinMenu = SGraphEditor::FOnCreateNodeOrPinMenu::CreateStatic(ContextMenuHandler);
}


// Node single-click path (via SNodePanel)
InEvents.OnNodeSingleClicked = SGraphEditor::FOnNodeSingleClicked::CreateRaw(this, &FFlowDiffPanel::OnNodeClicked);

// Selection-change path (covers sub-node/AddOn clicks)
InEvents.OnSelectionChanged = SGraphEditor::FOnSelectionChanged::CreateLambda([this](const FGraphPanelSelectionSet& NewSelection)
{
if (NewSelection.Num() == 1)
{
UObject* SelectedObj = NewSelection.Array()[0];
OnNodeClicked(SelectedObj);
}
});

if (!GraphEditorCommands.IsValid())
{
GraphEditorCommands = MakeShared<FUICommandList>();

GraphEditorCommands->MapAction(FGenericCommands::Get().Copy,
FExecuteAction::CreateRaw(this, &FFlowDiffPanel::CopySelectedNodes),
FCanExecuteAction::CreateRaw(this, &FFlowDiffPanel::CanCopyNodes)
GraphEditorCommands->MapAction(
FGenericCommands::Get().Copy,
FExecuteAction::CreateRaw(this, &FFlowDiffPanel::CopySelectedNodes),
FCanExecuteAction::CreateRaw(this, &FFlowDiffPanel::CanCopyNodes)
);
}

Expand Down Expand Up @@ -683,14 +694,14 @@ void SFlowDiff::HandleGraphChanged(const FString& GraphPath)
const TAttribute<int32> FocusedDiffResult = TAttribute<int32>::CreateLambda(
[this, RealDifferencesStartIndex]()
{
int32 FocusedDiffResult = INDEX_NONE;
int32 FocusedIndex = INDEX_NONE;
if (RealDifferencesStartIndex != INDEX_NONE)
{
FocusedDiffResult = DiffTreeView::CurrentDifference(DifferencesTreeView.ToSharedRef(), RealDifferences) - RealDifferencesStartIndex;
FocusedIndex = DiffTreeView::CurrentDifference(DifferencesTreeView.ToSharedRef(), RealDifferences) - RealDifferencesStartIndex;
}

// find selected index in all the graphs, and subtract the index of the first entry in this graph
return FocusedDiffResult;
return FocusedIndex;
});

// only regenerate PanelOld if the old graph has changed
Expand Down Expand Up @@ -934,4 +945,4 @@ void SFlowDiff::OnModeChanged(const FName& InNewViewMode) const
UpdateTopSectionVisibility(InNewViewMode);
}

#undef LOCTEXT_NAMESPACE
#undef LOCTEXT_NAMESPACE
Loading