@@ -291,12 +291,6 @@ MACRO(Crossing, bWriteCrossing, Crossing,TEXT("bCrossing"))
291291 if (Edge.IOIndex >= 0 ) { EdgesInIOIndices.Add (Edge.IOIndex ); }
292292 }
293293
294- void FSubGraph::Invalidate (FGraph* InGraph)
295- {
296- for (const int32 EdgeIndex : Edges) { InGraph->Edges [EdgeIndex].bValid = false ; }
297- for (const int32 NodeIndex : Nodes) { InGraph->Nodes [NodeIndex].bValid = false ; }
298- }
299-
300294 void FSubGraph::BuildCluster (const TSharedRef<PCGExCluster::FCluster>& InCluster)
301295 {
302296 // Correct edge IO Index that has been overwritten during subgraph processing
@@ -743,7 +737,7 @@ MACRO(EdgeUnionSize, int32, 0, UnionSize)
743737 FGraphEdgeMetadata& FGraph::GetOrCreateEdgeMetadata_Unsafe (const int32 EdgeIndex, const FGraphEdgeMetadata* Parent)
744738 {
745739 if (FGraphEdgeMetadata* MetadataPtr = EdgeMetadata.Find (EdgeIndex)) { return *MetadataPtr; }
746- return EdgeMetadata.Emplace (EdgeIndex, FGraphEdgeMetadata (EdgeIndex, Parent));
740+ return EdgeMetadata.Add (EdgeIndex, FGraphEdgeMetadata (EdgeIndex, Parent));
747741 }
748742
749743 FGraphEdgeMetadata& FGraph::GetOrCreateEdgeMetadata (const int32 EdgeIndex, const FGraphEdgeMetadata* Parent)
@@ -895,14 +889,19 @@ MACRO(EdgeUnionSize, int32, 0, UnionSize)
895889
896890 for (int i = 0 ; i < Nodes.Num (); i++)
897891 {
898- const FNode& CurrentNode = Nodes[i];
892+ FNode& CurrentNode = Nodes[i];
899893
900894 if (VisitedNodes[i]) { continue ; }
901895
902896 VisitedNodes[i] = true ;
903897 VisitedNum++;
904898
905- if (!CurrentNode.bValid || CurrentNode.IsEmpty ()) { continue ; }
899+ if (!CurrentNode.bValid ) { continue ; }
900+ if (CurrentNode.IsEmpty ())
901+ {
902+ CurrentNode.bValid = false ;
903+ continue ;
904+ }
906905
907906 PCGEX_MAKE_SHARED (SubGraph, FSubGraph)
908907 SubGraph->WeakParentGraph = SharedThis (this );
@@ -944,8 +943,16 @@ MACRO(EdgeUnionSize, int32, 0, UnionSize)
944943 }
945944 }
946945
947- if (!Limits.IsValid (SubGraph)) { SubGraph->Invalidate (this ); } // Will invalidate isolated points
948- else if (!SubGraph->Edges .IsEmpty ()) { SubGraphs.Add (SubGraph.ToSharedRef ()); }
946+ if (!Limits.IsValid (SubGraph))
947+ {
948+ // Invalidate traversed points and edges
949+ for (const int32 j : SubGraph->Nodes ) { Nodes[j].bValid = false ; }
950+ for (const int32 j : SubGraph->Edges ) { Edges[j].bValid = false ; }
951+ }
952+ else if (!SubGraph->Edges .IsEmpty ())
953+ {
954+ SubGraphs.Add (SubGraph.ToSharedRef ());
955+ }
949956 }
950957 }
951958
@@ -1066,7 +1073,7 @@ MACRO(EdgeUnionSize, int32, 0, UnionSize)
10661073 // Filter all valid nodes
10671074 for (FNode& Node : Nodes)
10681075 {
1069- if (!Node.bValid || Node. IsEmpty () )
1076+ if (!Node.bValid )
10701077 {
10711078 bHasInvalidNodes = true ;
10721079 continue ;
@@ -1133,7 +1140,6 @@ MACRO(EdgeUnionSize, int32, 0, UnionSize)
11331140 // Init array of indice as a valid order range first, will be truncated later.
11341141 // We save a bit of memory by re-using it
11351142 PCGEx::ArrayOfIndices (ReadIndices, OutNodeData->GetNumPoints ());
1136- ReadIndices.SetNumUninitialized (OutNodeData->GetNumPoints ());
11371143
11381144 // Sort valid nodes based on outgoing transforms
11391145 ValidNodes.Sort (
@@ -1158,7 +1164,6 @@ MACRO(EdgeUnionSize, int32, 0, UnionSize)
11581164 PCGEx::ReorderPointArrayData (OutNodeData, ReadIndices);
11591165
11601166 // Truncate output to the number of nodes
1161- ReadIndices.SetNum (NumValidNodes);
11621167 OutNodeData->SetNumPoints (NumValidNodes);
11631168 }
11641169 }
0 commit comments