#nullable enable using T3.Core.Operator; using T3.Core.Operator.Slots; using T3.Core.Resource.Assets; namespace T3.Editor.Gui.Windows.AssetLib; /// /// Holds the complete ui state of an asset library window. /// This is then passed on the subcomponents for rendering content. /// internal sealed class AssetLibState { /// /// All assets found in resource folders. /// This is completely cleared and recreated on external file changes. /// public readonly List AllAssets = []; /// /// Stores assetItem data by alias path /// public readonly Dictionary AssetCache = []; /// /// The available / relevant resource folders depends on the context of the current composition instance. /// When I'm in a lib-operator, we don't want to show (or expose) files outside of this context. /// public Instance? Composition; /// /// If a child is selected and shown in the parameter window, we can indicate which items it supports. /// public Instance? ActiveInstance; public bool HasActiveInstanceChanged; public double TimeActiveInstanceChanged; // Useful for animations /// /// If this is not null, the ActiveInstance has a string-input with FilePath usage. /// We can access or set this input to update its referenced resource. /// public InputSlot? ActivePathInput; /// /// We need to indicate if a closed folder contains the file referenced in the /// public string? ActiveAssetAddress; public Asset? ActiveAsset; /// /// List of extensions than can be opened by operator /// internal List CompatibleExtensionIds = []; public readonly AssetFolder RootFolder = new(AssetFolder.RootNodeId); //public readonly SymbolFilter Filter = new(); public string SearchString = string.Empty; public bool SearchStringChanged = false; public readonly HashSet ActiveTypeFilters = []; internal readonly SelectionHandler Selection = new(); internal Guid AnchorSelectionKey; internal Guid RenamingInProcessId; internal string RenameBuffer = string.Empty; /// /// An internal list that is updated on every draw call. /// internal List LastVisibleTreeItemIds = new(128); /** Is collecting while drawing the current frame */ internal List KeepVisibleTreeItemIds = new List(128); /// /// An internal counter to check if any of the resource folders have changed externally. /// If changed we completely rescan ResourceFolders. /// public int LastFileWatcherState = -1; public bool OpenedExamplesFolderOnce; public bool OpenedProjectsFolderOnce; public readonly TreeHandler TreeHandler = new(); public bool FilteringNeedsUpdate; }