generated from max/template-unity-project
parent
12fd64f015
commit
73ac3485aa
@ -235,6 +235,35 @@ public void LoadPartitions(ulong[] ids)
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadPartitionsAdditive(ulong[] ids)
|
||||
{
|
||||
using (new ProfilerUtility.ProfilerScope($"{nameof(LoadPartitions)}"))
|
||||
{
|
||||
SortedSet<ulong> partitionIds = new SortedSet<ulong>();
|
||||
|
||||
// Additive partitions to load.
|
||||
for (int i = 0; i < ids.Length; i++)
|
||||
{
|
||||
SortedSet<ulong> connections = ScenePartitionUtils.FindDeeplyLinkedObjects(Data.ScenePartitions, ids[i]);
|
||||
foreach (ulong c in connections)
|
||||
{
|
||||
partitionIds.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
// Partitions already loaded.
|
||||
if (Data.HasLoadedPartitions)
|
||||
{
|
||||
foreach (KeyValuePair<ulong, ScenePartition> item in Data.LoadedScenePartitions)
|
||||
{
|
||||
partitionIds.Add(item.Key);
|
||||
}
|
||||
}
|
||||
|
||||
LoadScenePartitions(partitionIds);
|
||||
}
|
||||
}
|
||||
|
||||
private SortedSet<ulong> GetAlwaysLoadIds()
|
||||
{
|
||||
SortedSet<ulong> partitionIds = new SortedSet<ulong>();
|
||||
@ -336,6 +365,14 @@ public void LoadCell(int gridId)
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadCellAdditive(int gridId)
|
||||
{
|
||||
if (Data.SceneGrid.Grid.TryGetValue(gridId, out GridList ids))
|
||||
{
|
||||
LoadPartitionsAdditive(ids.list.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
data = null;
|
||||
|
@ -66,6 +66,7 @@ private static void HandleDuringSceneGui(SceneView sceneView)
|
||||
GenericMenu menu = new GenericMenu();
|
||||
|
||||
menu.AddItem(new GUIContent($"Load {gridId}"), false, Load, gridId);
|
||||
menu.AddItem(new GUIContent($"LoadAdditive {gridId}"), false, LoadAdditive, gridId);
|
||||
menu.ShowAsContext();
|
||||
|
||||
Event.current.Use();
|
||||
@ -95,5 +96,14 @@ private static void Load(object gridId)
|
||||
|
||||
scenePartitionSO.LoadCell(cellId);
|
||||
}
|
||||
|
||||
private static void LoadAdditive(object gridId)
|
||||
{
|
||||
if (scenePartitionSO == null) return;
|
||||
if (gridId == null) return;
|
||||
if (gridId is not int cellId) return;
|
||||
|
||||
scenePartitionSO.LoadCellAdditive(cellId);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user