nDisplay: Fixed viewport unqiue naming so that a viewport name is unique across the entire cluster, not just within its cluster node.

#jira UE-114093
#jira UE-114503

#rb Patrick.Hardy

#ROBOMERGE-SOURCE: CL 16150313 in //UE4/Release-4.27/...
#ROBOMERGE-BOT: RELEASE (Release-4.27 -> Main) (v789-15992632)

[CL 16150316 by trystan binkley-jone in Main branch]
This commit is contained in:
trystan binkley-jone
2021-04-28 18:38:46 -04:00
parent e1f59bae18
commit 2702276f77

View File

@@ -590,7 +590,31 @@ FString FDisplayClusterConfiguratorClusterUtils::GetUniqueNameForViewport(FStrin
UniqueName = FString::Printf(TEXT("%s_%d"), *InitialName, NameIndex);
}
while (ParentClusterNode->Viewports.Contains(UniqueName))
// Viewport names must be unique across the entire cluster, not just within its parent cluster nodes. Gather all of the viewport names
// in the cluster to check for uniqueness. Add the parent cluster node's viewports first, in case we can't get to the root cluster through
// the cluster node's Outer (i.e. the cluster node has not been added to the cluster yet)
TSet<FString> UsedViewportNames;
for (const TPair<FString, UDisplayClusterConfigurationViewport*>& ViewportKeyPair : ParentClusterNode->Viewports)
{
UsedViewportNames.Add(ViewportKeyPair.Key);
}
if (UDisplayClusterConfigurationCluster* Cluster = Cast<UDisplayClusterConfigurationCluster>(ParentClusterNode->GetOuter()))
{
for (const TPair<FString, UDisplayClusterConfigurationClusterNode*>& ClusterNodeKeyPair : Cluster->Nodes)
{
UDisplayClusterConfigurationClusterNode* ClusterNode = ClusterNodeKeyPair.Value;
if (ClusterNode != ParentClusterNode)
{
for (const TPair<FString, UDisplayClusterConfigurationViewport*>& ViewportKeyPair : ClusterNode->Viewports)
{
UsedViewportNames.Add(ViewportKeyPair.Key);
}
}
}
}
while (UsedViewportNames.Contains(UniqueName))
{
UniqueName = FString::Printf(TEXT("%s_%d"), *InitialName, ++NameIndex);
}