Editor Refactor

This refactor of the editor code makes the code more maintainable.

All widget objects have now moved away from RAII and are now just allocated object that live for the entirety of the applications lifetime.
This feels better as I am used to this style plus constantly pushing and popping objects from the stack seems a little wasteful (although I as of right now have no way to prove that it is ).
This commit is contained in:
2023-01-14 17:27:37 +01:00
parent 79b68fbff1
commit 145338d666
40 changed files with 1138 additions and 1044 deletions

View File

@ -20,7 +20,7 @@ void Project::SaveProject(std::filesystem::path path, Project& project)
projectFile.close();
}
void Project::LoadProject(std::filesystem::path path, std::unique_ptr<Project>& project)
void Project::LoadProject(std::filesystem::path path, Project& project)
{
std::string YAMLProject;
std::stringstream sstream;
@ -36,10 +36,9 @@ void Project::LoadProject(std::filesystem::path path, std::unique_ptr<Project>&
YAML::Node node = YAML::Load(YAMLProject);
// this is probably not perfect but it seems to work for now
project.release();
project = std::make_unique<Project>(node.as<Project>());
project = node.as<Project>();
std::cout << "loading..." << project.get()->Name << std::endl;
std::cout << "loading..." << project.Name << std::endl;