MCPcopy Create free account
hub / github.com/MothCocoon/FlowGraph / HandleGraphChanged

Method HandleGraphChanged

Source/FlowEditor/Private/Asset/SFlowDiff.cpp:673–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673void SFlowDiff::HandleGraphChanged(const FString& GraphPath)
674{
675 SetCurrentMode(GraphMode);
676
677 UEdGraph* GraphOld = nullptr;
678 UEdGraph* GraphNew = nullptr;
679 TSharedPtr<TArray<FDiffSingleResult>> DiffResults;
680 int32 RealDifferencesStartIndex = INDEX_NONE;
681 {
682 UEdGraph* NewGraph = GraphToDiff->GetGraphNew();
683 UEdGraph* OldGraph = GraphToDiff->GetGraphOld();
684 const FString OtherGraphPath = NewGraph ? FGraphDiffControl::GetGraphPath(NewGraph) : FGraphDiffControl::GetGraphPath(OldGraph);
685 if (GraphPath.Equals(OtherGraphPath))
686 {
687 GraphNew = NewGraph;
688 GraphOld = OldGraph;
689 DiffResults = GraphToDiff->FoundDiffs;
690 RealDifferencesStartIndex = GraphToDiff->RealDifferencesStartIndex;
691 }
692 }
693
694 const TAttribute<int32> FocusedDiffResult = TAttribute<int32>::CreateLambda(
695 [this, RealDifferencesStartIndex]()
696 {
697 int32 FocusedIndex = INDEX_NONE;
698 if (RealDifferencesStartIndex != INDEX_NONE)
699 {
700 FocusedIndex = DiffTreeView::CurrentDifference(DifferencesTreeView.ToSharedRef(), RealDifferences) - RealDifferencesStartIndex;
701 }
702
703 // find selected index in all the graphs, and subtract the index of the first entry in this graph
704 return FocusedIndex;
705 });
706
707 // only regenerate PanelOld if the old graph has changed
708 if (PanelOld.FlowAsset && (!PanelOld.GraphEditor.IsValid() || GraphOld != PanelOld.GraphEditor.Pin()->GetCurrentGraph()))
709 {
710 PanelOld.GeneratePanel(GraphOld, DiffResults, FocusedDiffResult);
711 }
712
713 // only regenerate PanelNew if the old graph has changed
714 if (PanelNew.FlowAsset && (!PanelNew.GraphEditor.IsValid() || GraphNew != PanelNew.GraphEditor.Pin()->GetCurrentGraph()))
715 {
716 PanelNew.GeneratePanel(GraphNew, DiffResults, FocusedDiffResult);
717 }
718}
719
720void SFlowDiff::GenerateDifferencesList()
721{

Callers

nothing calls this directly

Calls 2

IsValidMethod · 0.80
GeneratePanelMethod · 0.80

Tested by

no test coverage detected