So, i was able to build definitions for many types (Entity, World and Scene Definitions) successfuly but i can't save them because LoosePackageLoader will trigger an assert about the file is not found in their internal file list, when you use the SaveAsset(); function, and because their AssetPath is inexistent.
So, i've create an little workaround an class called DefinitionStorage which creates an package like WorldManager does, it's saved in the root data directory as Definitions/ which provides an default AssetPath and Package to storage recently created definitions, and to save it without relying of LoosePackageLoader i did this:
/// Dirty hack to force to saving the asset without an file existing previously.
void Helium::EditorHelpers::ForceSaveAsset(Asset * pAsset)
{
AssetIdentifier assetId;
FilePath path = std::string(pAsset->GetPath().ToFilePathString().GetData());
FilePath fullPath;
FileLocations::GetDataDirectory(fullPath);
fullPath += "/Content";
fullPath += path;
fullPath.ReplaceExtension("json");
HELIUM_TRACE(TraceLevels::Info, "Helium::EditorHelpers::ForceSaveAsset(): Saving asset to: %s", fullPath.Get().c_str());
Persist::ArchiveWriter::WriteToFile(fullPath, pAsset, &assetId, Persist::ArchiveType::Json);
pAsset->ClearFlags(Asset::FLAG_CHANGED_SINCE_LOADED);
}
And works succesfully!, but when i try to load with the new files this will trigger another assert in LooseAssetLoader about my new .json file cant find an type, this happens using an empty SceneDefinition and WorldDefinition and shows like this
WorldDefinition.json located in /Data/System:
[
{
"Dragora::WorldDefinition": {}
}
]
SceneDefinition.json located in /Data/Worlds
[
{
"Dragora::SceneDefinition": {
"m_WorldDefinition": "/System:WorldDefinition"
}
}
]
There's an better way to create an asset or an detailed explanation of what you're thinking to how authoring assets to make at least an implementation, the same with resources....