Class ContentDatabaseModule
Manages assets database and searches for workspace directory changes.
Inheritance
Namespace: FlaxEditor.Modules
Assembly: FlaxEngine.CSharp.dll
Syntax
public sealed class ContentDatabaseModule : EditorModuleFields
Projects
The list of all projects workspace directories (including game, engine and plugins projects).
Declaration
public readonly List<ProjectTreeNode> ProjectsField Value
| System.Collections.Generic.List<ProjectTreeNode> 
 | 
Proxy
The list with all content items proxy objects. Use AddProxy(ContentProxy, Boolean) and RemoveProxy(ContentProxy, Boolean) to modify this or Rebuild(Boolean) to refresh database when adding new item proxy types.
Declaration
public readonly List<ContentProxy> ProxyField Value
| System.Collections.Generic.List<FlaxEditor.Content.ContentProxy> 
 | 
Properties
Engine
The engine directory.
Declaration
public ProjectTreeNode Engine { get; }Property Value
| ProjectTreeNode 
 | 
Game
The project directory.
Declaration
public ProjectTreeNode Game { get; }Property Value
| ProjectTreeNode 
 | 
ItemsCreated
Gets the amount of created items.
Declaration
public int ItemsCreated { get; }Property Value
| System.Int32 
 | 
ItemsDeleted
Gets the amount of deleted items.
Declaration
public int ItemsDeleted { get; }Property Value
| System.Int32 
 | 
Methods
AddProxy(ContentProxy, Boolean)
Adds the proxy.
Declaration
public void AddProxy(ContentProxy proxy, bool rebuild = false)Parameters
| FlaxEditor.Content.ContentProxy
        proxy The proxy type. | 
| System.Boolean
        rebuild Should rebuild entire database after addition. | 
Copy(ContentItem, String)
Copies the specified item to the target location. Handles copying whole directories and single assets.
Declaration
public void Copy(ContentItem item, string targetPath)Parameters
| FlaxEditor.Content.ContentItem
        item The item. | 
| System.String
        targetPath The target item path. | 
Delete(ContentItem, Boolean)
Deletes the specified item.
Declaration
public void Delete(ContentItem item, bool deletedByUser = false)Parameters
| FlaxEditor.Content.ContentItem
        item The item. | 
| System.Boolean
        deletedByUser If the file was deleted by the user and not outside the editor. | 
Find(Guid)
Tries to find item with the specified ID.
Declaration
public ContentItem Find(Guid id)Parameters
| System.Guid
        id The item ID. | 
Returns
| FlaxEditor.Content.ContentItem Found item or null if cannot find it. | 
Find(String)
Tries to find item at the specified path.
Declaration
public ContentItem Find(string path)Parameters
| System.String
        path The path. | 
Returns
| FlaxEditor.Content.ContentItem Found item or null if cannot find it. | 
FindAsset(Guid)
Tries to find asset with the specified ID.
Declaration
public AssetItem FindAsset(Guid id)Parameters
| System.Guid
        id The asset ID. | 
Returns
| FlaxEditor.Content.AssetItem Found asset item or null if cannot find it. | 
FindScript(Guid)
Tries to find script item with the specified ID.
Declaration
public ScriptItem FindScript(Guid id)Parameters
| System.Guid
        id The item ID. | 
Returns
| ScriptItem Found script or null if cannot find it. | 
FindScript(String)
Tries to find script item at the specified path.
Declaration
public ScriptItem FindScript(string path)Parameters
| System.String
        path The path. | 
Returns
| ScriptItem Found script or null if cannot find it. | 
FindScriptWitScriptName(ScriptType)
Tries to find script item that is used by the specified script type.
Declaration
public ScriptItem FindScriptWitScriptName(ScriptType scriptType)Parameters
| FlaxEditor.Scripting.ScriptType
        scriptType The type of the script. | 
Returns
| ScriptItem Found script or null if cannot find it. | 
FindScriptWitScriptName(Script)
Tries to find script item that is used by the specified script object.
Declaration
public ScriptItem FindScriptWitScriptName(Script script)Parameters
| Script
        script The instance of the script. | 
Returns
| ScriptItem Found script or null if cannot find it. | 
FindScriptWitScriptName(String)
Tries to find script item with the specified name.
Declaration
public ScriptItem FindScriptWitScriptName(string scriptName)Parameters
| System.String
        scriptName The name of the script. | 
Returns
| ScriptItem Found script or null if cannot find it. | 
GetAssetProxy(String, String)
Gets the proxy object for the given asset type id.
Declaration
public AssetProxy GetAssetProxy(string typeName, string path)Parameters
| System.String
        typeName The asset type name. | 
| System.String
        path The asset path. | 
Returns
| FlaxEditor.Content.AssetProxy Asset proxy or null if cannot find. | 
GetAssetVirtualProxy(String)
Gets the virtual proxy object from given path.
Declaration
public AssetProxy GetAssetVirtualProxy(string path)Parameters
| System.String
        path The asset path. | 
Returns
| FlaxEditor.Content.AssetProxy Asset proxy or null if cannot find. | 
GetProjectWorkspace(ProjectInfo)
Gets the project workspace used by the given project.
Declaration
public ProjectTreeNode GetProjectWorkspace(ProjectInfo project)Parameters
| ProjectInfo
        project The project. | 
Returns
| ProjectTreeNode The project workspace or null if not loaded into database. | 
GetProxy(ContentItem)
Gets the proxy object for the given content item.
Declaration
public ContentProxy GetProxy(ContentItem item)Parameters
| FlaxEditor.Content.ContentItem
        item The item. | 
Returns
| FlaxEditor.Content.ContentProxy Content proxy for that item or null if cannot find. | 
GetProxy(String)
Gets the proxy object for the given file extension. Warning! Different asset types may share the same file extension.
Declaration
public ContentProxy GetProxy(string extension)Parameters
| System.String
        extension The file extension. | 
Returns
| FlaxEditor.Content.ContentProxy Content proxy for that item or null if cannot find. | 
GetProxy<T>()
Gets the proxy object for the given asset type.
Declaration
public ContentProxy GetProxy<T>()
    where T : AssetReturns
| FlaxEditor.Content.ContentProxy Content proxy for that asset type or null if cannot find. | 
Type Parameters
| T 
 | 
Move(ContentItem, ContentFolder)
Moves the specified item to the different location. Handles moving whole directories and single assets.
Declaration
public void Move(ContentItem item, ContentFolder newParent)Parameters
| FlaxEditor.Content.ContentItem
        item The item. | 
| FlaxEditor.Content.ContentFolder
        newParent The new parent. | 
Move(ContentItem, String)
Moves the specified item to the different location. Handles moving whole directories and single assets.
Declaration
public void Move(ContentItem item, string newPath)Parameters
| FlaxEditor.Content.ContentItem
        item The item. | 
| System.String
        newPath The new path. | 
Move(List<ContentItem>, ContentFolder)
Moves the specified items to the different location. Handles moving whole directories and single assets.
Declaration
public void Move(List<ContentItem> items, ContentFolder newParent)Parameters
| System.Collections.Generic.List<FlaxEditor.Content.ContentItem>
        items The items. | 
| FlaxEditor.Content.ContentFolder
        newParent The new parent. | 
OnEndInit()
Declaration
public override void OnEndInit()Overrides
OnExit()
Declaration
public override void OnExit()Overrides
OnInit()
Declaration
public override void OnInit()Overrides
OnUpdate()
Declaration
public override void OnUpdate()Overrides
Rebuild(Boolean)
Rebuilds the whole database (eg. when adding custom item types from plugin).
Declaration
public void Rebuild(bool immediate = false)Parameters
| System.Boolean
        immediate True if rebuild now, otherwise will be scheduled for the next editor update (eg. to batch multiple rebuilds within a frame). | 
RefreshFolder(ContentItem, Boolean)
Refreshes the given item folder. Tries to find new content items and remove not existing ones.
Declaration
public void RefreshFolder(ContentItem item, bool checkSubDirs)Parameters
| FlaxEditor.Content.ContentItem
        item Folder to refresh | 
| System.Boolean
        checkSubDirs True if search for changes inside a subdirectories, otherwise only top-most folder will be updated | 
RemoveProxy(ContentProxy, Boolean)
Removes the proxy.
Declaration
public void RemoveProxy(ContentProxy proxy, bool rebuild = false)Parameters
| FlaxEditor.Content.ContentProxy
        proxy The proxy type. | 
| System.Boolean
        rebuild Should rebuild entire database after removal. | 
Events
ItemAdded
Occurs when new items is added to the workspace content database.
Declaration
public event Action<ContentItem> ItemAddedEvent Type
| System.Action<FlaxEditor.Content.ContentItem> 
 | 
ItemRemoved
Occurs when new items is removed from the workspace content database.
Declaration
public event Action<ContentItem> ItemRemovedEvent Type
| System.Action<FlaxEditor.Content.ContentItem> 
 | 
WorkspaceModified
Occurs when workspace has been modified.
Declaration
public event Action WorkspaceModifiedEvent Type
| System.Action 
 | 
WorkspaceRebuilding
Occurs when workspace will be rebuilt.
Declaration
public event Action WorkspaceRebuildingEvent Type
| System.Action 
 | 
WorkspaceRebuilt
Occurs when workspace has been rebuilt.
Declaration
public event Action WorkspaceRebuiltEvent Type
| System.Action 
 |