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

Method RemoveOrphanedNodes

Source/FlowEditor/Private/Graph/FlowGraph.cpp:398–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398void UFlowGraph::RemoveOrphanedNodes()
399{
400 TSet<UObject*> NodeInstances;
401 CollectAllNodeInstances(NodeInstances);
402
403 NodeInstances.Remove(nullptr);
404
405 // Obtain a list of all nodes actually in the asset and discard unused nodes
406 TArray<UObject*> AllInners;
407 constexpr bool bIncludeNestedObjects = false;
408 GetObjectsWithOuter(GetOuter(), AllInners, bIncludeNestedObjects);
409 for (auto InnerIt = AllInners.CreateConstIterator(); InnerIt; ++InnerIt)
410 {
411 UObject* TestObject = *InnerIt;
412 if (!NodeInstances.Contains(TestObject) && CanRemoveNestedObject(TestObject))
413 {
414 OnNodeInstanceRemoved(TestObject);
415
416 TestObject->SetFlags(RF_Transient);
417 TestObject->Rename(nullptr, GetTransientPackage(), REN_DontCreateRedirectors | REN_NonTransactional | REN_ForceNoResetLoaders);
418 }
419 }
420}
421
422void UFlowGraph::CollectAllNodeInstances(TSet<UObject*>& NodeInstances)
423{

Callers

nothing calls this directly

Calls 1

OnNodeInstanceRemovedFunction · 0.85

Tested by

no test coverage detected