-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid child properties of edited managed references
- Loading branch information
Showing
5 changed files
with
79 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 3 additions & 21 deletions
24
Assets/Editor Toolbox/Editor/Drawers/Helpers/DrawerDataStorageBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Assets/Editor Toolbox/Editor/Drawers/Helpers/DrawerStorageManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Toolbox.Editor.Drawers | ||
{ | ||
internal static class DrawerStorageManager | ||
{ | ||
static DrawerStorageManager() | ||
{ | ||
ToolboxEditorHandler.OnEditorReload -= ClearStorages; | ||
ToolboxEditorHandler.OnEditorReload += ClearStorages; | ||
} | ||
|
||
private static readonly List<DrawerDataStorageBase> storages = new List<DrawerDataStorageBase>(); | ||
|
||
internal static void ClearStorages() | ||
{ | ||
ClearStorages(null); | ||
} | ||
|
||
internal static void ClearStorages(Func<DrawerDataStorageBase, bool> predicate) | ||
{ | ||
for (var i = 0; i < storages.Count; i++) | ||
{ | ||
var storage = storages[i]; | ||
if (predicate != null && !predicate(storage)) | ||
{ | ||
continue; | ||
} | ||
|
||
storage.ClearItems(); | ||
} | ||
} | ||
|
||
internal static void AppendStorage(DrawerDataStorageBase storage) | ||
{ | ||
storages.Add(storage); | ||
} | ||
|
||
internal static bool RemoveStorage(DrawerDataStorageBase storage) | ||
{ | ||
return storages.Remove(storage); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Editor Toolbox/Editor/Drawers/Helpers/DrawerStorageManager.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters