forked from Misaki/GhostEngine
Update plan
This commit is contained in:
@@ -2,8 +2,6 @@ namespace Ghost.Data.Models;
|
|||||||
|
|
||||||
public class ProjectMetadata
|
public class ProjectMetadata
|
||||||
{
|
{
|
||||||
public const string PROJECT_EXTENSION = "ghostproj";
|
|
||||||
|
|
||||||
public Guid ID
|
public Guid ID
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
@@ -39,7 +37,9 @@ public class ProjectMetadata
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parameterless constructor for deserialization
|
// Parameterless constructor for deserialization
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
|
||||||
public ProjectMetadata()
|
public ProjectMetadata()
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ internal partial class ProjectService
|
|||||||
private const string _TEMPLATE_CONTENT_FILE = "content.zip";
|
private const string _TEMPLATE_CONTENT_FILE = "content.zip";
|
||||||
|
|
||||||
public const string ASSETS_FOLDER = "Assets";
|
public const string ASSETS_FOLDER = "Assets";
|
||||||
public const string CONFIG_FOLDER = "ProjectConfig";
|
public const string CACHE_FOLDER = "Caches";
|
||||||
|
public const string CONFIG_FOLDER = "Configs";
|
||||||
|
|
||||||
public static ProjectMetadataInfo CurrentProject
|
public static ProjectMetadataInfo CurrentProject
|
||||||
{
|
{
|
||||||
|
|||||||
88
Ghost.Editor.Core/AssetHandle/AssetDBPlan.md
Normal file
88
Ghost.Editor.Core/AssetHandle/AssetDBPlan.md
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
# Asset Database Plan
|
||||||
|
|
||||||
|
AssetDB is a core component of the Ghost Editor that manages the storage, retrieval, and organization of various assets used within the editor.
|
||||||
|
This document outlines the plan for implementing the AssetDB, including its structure, functionality, and integration with other components of the Ghost Editor.
|
||||||
|
|
||||||
|
## Data Structure
|
||||||
|
|
||||||
|
- Asset Metadata: Each asset will have associated metadata, including:
|
||||||
|
- Unique Identifier (GUID)
|
||||||
|
- Version
|
||||||
|
- Importer Settings
|
||||||
|
|
||||||
|
An example of metadata file (filename.png.gmeta):
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"Guid": "123e4567-e89b-12d3-a456-426614174000",
|
||||||
|
"Version": 1,
|
||||||
|
"ImporterSettings": {
|
||||||
|
"TextureImporter": {
|
||||||
|
"MaxSize": 2048,
|
||||||
|
"MipLevels": 1
|
||||||
|
},
|
||||||
|
"OtherImporter": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- Asset: The base class for all assets.
|
||||||
|
|
||||||
|
- Asset Database: A centralized database that stores and manages all assets. It will handle:
|
||||||
|
- Asset registration and deregistration
|
||||||
|
- Asset lookup by GUID
|
||||||
|
- Asset lookup by path
|
||||||
|
- Automatic handle file creation, remove, rename, move, etc.
|
||||||
|
- Asset dependency management
|
||||||
|
- Automatic asset re-importing when source files change.
|
||||||
|
- Asset tagging.
|
||||||
|
- Add type specific default importer settings for new asset.
|
||||||
|
- SQLite for persistent storage and efficient querying. (Don't use JSON or XML for the database itself, only for metadata files. Also don't use heavy)
|
||||||
|
|
||||||
|
## Simplified Workflow
|
||||||
|
|
||||||
|
### New Asset Addition
|
||||||
|
|
||||||
|
1. A file is added to the project directory.
|
||||||
|
2. Generates the metadata for the asset with name filename.etx + ".gmeta" (You can get the extension from Ghost.Editor.Core.Utilities.FileExtensions.META_FILE_EXTENSION)
|
||||||
|
3. Add the asset to the database.
|
||||||
|
|
||||||
|
### File Removal
|
||||||
|
|
||||||
|
1. A file is removed from the project directory.
|
||||||
|
2. Deletes the corresponding asset metadata.
|
||||||
|
|
||||||
|
### File Renaming/Moving
|
||||||
|
|
||||||
|
1. A file is renamed or moved within the project directory.
|
||||||
|
2. Check if the new path has an existing metadata file (just in case user move the file with the metadata file together).
|
||||||
|
- If exists, validate the data and update the database accordingly.
|
||||||
|
- if not, regenerate the metadata file for the new path and update the database.
|
||||||
|
3. Delete the old metadata file if exists.
|
||||||
|
|
||||||
|
## Features Checklist
|
||||||
|
|
||||||
|
### In Code (API)
|
||||||
|
|
||||||
|
- [ ] Find GUID by path
|
||||||
|
- [ ] Find path by GUID
|
||||||
|
- [ ] Load asset by GUID (May need special asset loader, not included in this plan, leave an API and TODO comment)
|
||||||
|
- [ ] API for adding/removing/moving/copying assets
|
||||||
|
- [ ] API for opening asset in editor or external program
|
||||||
|
- [ ] API to set asset dirty and save all assets if dirty
|
||||||
|
- [ ] Get and set asset tags.
|
||||||
|
- [ ] Refresh asset database (re-scan project directory for changes)
|
||||||
|
|
||||||
|
### In Editor (API Only, I will handle the UI part)
|
||||||
|
|
||||||
|
- [ ] Asset Browser window to view and manage assets (automatically refresh when assets change)
|
||||||
|
- [ ] Skip meta file in asset browser view
|
||||||
|
- [ ] Search assets by name, tag, type, etc.
|
||||||
|
|
||||||
|
### In Background
|
||||||
|
|
||||||
|
- [ ] File system watcher to monitor changes in the project directory and update the AssetDB accordingly.
|
||||||
|
- [ ] Automatic asset re-importing when source files change (detect changes via file system watcher and quick hash comparison).
|
||||||
|
- [ ] Asset dependency management.
|
||||||
|
- [ ] Validate and fix AssetDB on project load (check for missing/corrupted assets if user add/delete/rename/move files when the editor is not running, etc.)
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
<langversion>preview</langversion>
|
<langversion>preview</langversion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7175" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7463" />
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.251106002" />
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260101001" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.250402" />
|
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.251219" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
<ProjectCapability Include="Msix" />
|
<ProjectCapability Include="Msix" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.2.250402" />
|
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.2.251219" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.TabbedCommandBar" Version="8.2.250402" />
|
<PackageReference Include="CommunityToolkit.WinUI.Controls.TabbedCommandBar" Version="8.2.251219" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
|
||||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7175" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7463" />
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.251106002" />
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260101001" />
|
||||||
<PackageReference Include="WinUIEx" Version="2.9.0" />
|
<PackageReference Include="WinUIEx" Version="2.9.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
14
Ghost.MicroTest/Ghost.MicroTest.csproj
Normal file
14
Ghost.MicroTest/Ghost.MicroTest.csproj
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Ghost.Test.Core\Ghost.Test.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
2
Ghost.MicroTest/Program.cs
Normal file
2
Ghost.MicroTest/Program.cs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
Console.WriteLine("Hello, World!");
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
<Platform Solution="*|x86" Project="x86" />
|
<Platform Solution="*|x86" Project="x86" />
|
||||||
<Deploy />
|
<Deploy />
|
||||||
</Project>
|
</Project>
|
||||||
|
<Project Path="Ghost.MicroTest/Ghost.MicroTest.csproj" Id="8c8ffa4b-e1e4-46a1-9221-7b508a109edd" />
|
||||||
<Project Path="Ghost.Shader.Test/Ghost.Shader.Test.csproj" />
|
<Project Path="Ghost.Shader.Test/Ghost.Shader.Test.csproj" />
|
||||||
<Project Path="Ghost.Test.Core/Ghost.Test.Core.csproj" />
|
<Project Path="Ghost.Test.Core/Ghost.Test.Core.csproj" />
|
||||||
</Folder>
|
</Folder>
|
||||||
|
|||||||
Reference in New Issue
Block a user