Scene: Added "Include Build Scenes", when sorting scenes into sub-menu
This commit is contained in:
parent
29ab1a90a0
commit
8b927d1997
5 changed files with 70 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
public string name;
|
||||
public ESceneGroupFilterType filterType;
|
||||
public ESceneGroupBehaviourType behaviourType;
|
||||
public bool includeBuildScenes;
|
||||
public string optionalMainScenePath;
|
||||
public string subMenuPath = "Submenu";
|
||||
public List<string> filters = new();
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
{
|
||||
name = asset.name,
|
||||
shortname = asset.shortname,
|
||||
paths = { asset.path }
|
||||
paths = { asset.path },
|
||||
inBuildSettings = true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -120,7 +121,11 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
continue;
|
||||
|
||||
filteredScenes = FilterToUniques(filteredScenes);
|
||||
filteredScenes = FilterAllExcept(filteredScenes, scenes);
|
||||
|
||||
if (sceneGroup.includeBuildScenes)
|
||||
filteredScenes = FilterAllExceptWithBuildScenes(filteredScenes, scenes);
|
||||
else
|
||||
filteredScenes = FilterAllExcept(filteredScenes, scenes);
|
||||
|
||||
if (filteredScenes.Count != 0)
|
||||
scenes.Add(new SceneElement{ includeAsSelectable = false });
|
||||
|
|
@ -195,6 +200,38 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return filtered;
|
||||
}
|
||||
|
||||
private static List<WorkingSetScene> FilterAllExceptWithBuildScenes(List<WorkingSetScene> list, List<SceneElement> except, bool includeGroups = false)
|
||||
{
|
||||
var filtered = new List<WorkingSetScene>(list.Count);
|
||||
|
||||
for (var i = 0; i < list.Count; i++)
|
||||
{
|
||||
var contains = false;
|
||||
|
||||
for (var j = except.Count - 1; j >= 0; j--)
|
||||
{
|
||||
if (except[j].isGroup && !includeGroups)
|
||||
continue;
|
||||
if (!except[j].paths.Contains(list[i].path))
|
||||
continue;
|
||||
|
||||
if (except[j].inBuildSettings)
|
||||
{
|
||||
except.RemoveAt(j);
|
||||
break;
|
||||
}
|
||||
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!contains)
|
||||
filtered.Add(list[i]);
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
private void FetchAllLabels()
|
||||
{
|
||||
labels = new GUIContent[scenes.Count];
|
||||
|
|
@ -395,6 +432,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
public string shortname;
|
||||
public bool includeAsSelectable = true;
|
||||
public bool isGroup;
|
||||
public bool inBuildSettings;
|
||||
public readonly List<string> paths = new List<string>();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue