/** * Takes two blueprints and compares them (as if we were running the in-editor * diff tool). Any discrepancies between the two graphs will be listed in the DiffsOut array. * * @param LhsBlueprint The baseline blueprint you wish to compare against. * @param RhsBlueprint The blueprint you wish to look for changes in. * @param DiffsOut An output list that will contain any graph internal differences that were found. * @return True if the two blueprints differ, false if they are identical. */ static bool DiffBlueprints(UBlueprint* const LhsBlueprint, UBlueprint* const RhsBlueprint, TArray<FDiffSingleResult>& DiffsOut) { TArray<UEdGraph*> LhsGraphs; LhsBlueprint->GetAllGraphs(LhsGraphs); TArray<UEdGraph*> RhsGraphs; RhsBlueprint->GetAllGraphs(RhsGraphs); bool bDiffsFound = false; // walk the graphs in the rhs blueprint (because, conceptually, it is the more up to date one) for (auto RhsGraphIt(RhsGraphs.CreateIterator()); RhsGraphIt; ++RhsGraphIt) { UEdGraph* RhsGraph = *RhsGraphIt; UEdGraph* LhsGraph = NULL; // search for the corresponding graph in the lhs blueprint for (auto LhsGraphIt(LhsGraphs.CreateIterator()); LhsGraphIt; ++LhsGraphIt) { // can't trust the guid until we've done a resave on every asset //if ((*LhsGraphIt)->GraphGuid == RhsGraph->GraphGuid) // name compares is probably sufficient, but just so we don't always do a string compare if (((*LhsGraphIt)->GetClass() == RhsGraph->GetClass()) && ((*LhsGraphIt)->GetName() == RhsGraph->GetName())) { LhsGraph = *LhsGraphIt; break; } } // if a matching graph wasn't found in the lhs blueprint, then that is a BIG inconsistency if (LhsGraph == NULL) { bDiffsFound = true; continue; } bDiffsFound |= FGraphDiffControl::DiffGraphs(LhsGraph, RhsGraph, DiffsOut); } return bDiffsFound; }