|
|
|
@ -181,75 +181,50 @@ namespace editor
|
|
|
|
// FILE
|
|
|
|
// FILE
|
|
|
|
if (mDoNewProject)
|
|
|
|
if (mDoNewProject)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!mFileBrowser.IsOpen())
|
|
|
|
if (mFileBrowser.GetResult() == FileBrowser::Result::OK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mFileBrowser.SetSelectionMode(FileBrowser::SelectionMode::FILES_ONLY);
|
|
|
|
mpPath = mFileBrowser.GetSelectedItem();
|
|
|
|
mFileBrowser.SetPrompt("Pick a location and name for the project");
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "Generating new project at %s", mpPath->string().c_str());
|
|
|
|
if (!mFileBrowser.OpenInDirectory(""))
|
|
|
|
|
|
|
|
|
|
|
|
// Generate new project at mpPath
|
|
|
|
|
|
|
|
OpRes result = mProject.GenerateProject(mpPath->filename().string(), mpPath->parent_path());
|
|
|
|
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mDoNewProject = false;
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not create a new project: %s", result.Description);
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not open the File Browser");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
((AssetBrowser*)mPanelManager.GetPanel(PanelType::PT_ASSET_BROWSER))->SetAssetDirectory(*mpPath / std::filesystem::path("contents/assets"));
|
|
|
|
|
|
|
|
mDoNewProject = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else if (mFileBrowser.GetResult() == FileBrowser::Result::CANCEL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mFileBrowser.GetResult() == FileBrowser::Result::OK)
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "New Project operation cancelled");
|
|
|
|
{
|
|
|
|
mDoNewProject = false;
|
|
|
|
mpPath = mFileBrowser.GetSelectedItem();
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "Generating new project at %s", mpPath->string().c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Generate new project at mpPath
|
|
|
|
|
|
|
|
OpRes result = mProject.GenerateProject(mpPath->filename().string(), mpPath->parent_path());
|
|
|
|
|
|
|
|
if (Failed(result))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not create a new project: %s", result.Description);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
((AssetBrowser*)mPanelManager.GetPanel(PanelType::PT_ASSET_BROWSER))->SetAssetDirectory(*mpPath / std::filesystem::path("contents/assets"));
|
|
|
|
|
|
|
|
mDoNewProject = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (mFileBrowser.GetResult() == FileBrowser::Result::CANCEL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "New Project operation cancelled");
|
|
|
|
|
|
|
|
mDoNewProject = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mDoOpenProject)
|
|
|
|
if (mDoOpenProject)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!mFileBrowser.IsOpen())
|
|
|
|
if (mFileBrowser.GetResult() == FileBrowser::Result::OK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mFileBrowser.SetSelectionMode(FileBrowser::SelectionMode::FILES_ONLY);
|
|
|
|
mpPath = mFileBrowser.GetSelectedItem();
|
|
|
|
mFileBrowser.SetPrompt("Pick a location and name for the project");
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "Generating new project at %s", mpPath->string().c_str());
|
|
|
|
if (!mFileBrowser.OpenInDirectory(""))
|
|
|
|
|
|
|
|
|
|
|
|
// Open project at mpPath
|
|
|
|
|
|
|
|
OpRes result = mProject.LoadProject(*mpPath);
|
|
|
|
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mDoNewProject = false;
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not open project: %s -- reason: %s", mpPath->string().c_str(), result.Description);
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not open the File Browser");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
((AssetBrowser*)mPanelManager.GetPanel(PanelType::PT_ASSET_BROWSER))->SetAssetDirectory(*mpPath / std::filesystem::path("contents/assets"));
|
|
|
|
|
|
|
|
mDoOpenProject = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else if (mFileBrowser.GetResult() == FileBrowser::Result::CANCEL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mFileBrowser.GetResult() == FileBrowser::Result::OK)
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "Open Project operation cancelled");
|
|
|
|
{
|
|
|
|
mDoOpenProject = false;
|
|
|
|
mpPath = mFileBrowser.GetSelectedItem();
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "Generating new project at %s", mpPath->string().c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Open project at mpPath
|
|
|
|
|
|
|
|
OpRes result = mProject.LoadProject(*mpPath);
|
|
|
|
|
|
|
|
if (Failed(result))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not open project: %s -- reason: %s", mpPath->string().c_str(), result.Description);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
((AssetBrowser*)mPanelManager.GetPanel(PanelType::PT_ASSET_BROWSER))->SetAssetDirectory(*mpPath / std::filesystem::path("contents/assets"));
|
|
|
|
|
|
|
|
mDoOpenProject = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (mFileBrowser.GetResult() == FileBrowser::Result::CANCEL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::INFO, "Open Project operation cancelled");
|
|
|
|
|
|
|
|
mDoOpenProject = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mDoSaveProject)
|
|
|
|
if (mDoSaveProject)
|
|
|
|
@ -288,11 +263,26 @@ namespace editor
|
|
|
|
if (ImGui::MenuItem("New Project"))
|
|
|
|
if (ImGui::MenuItem("New Project"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mDoNewProject = true;
|
|
|
|
mDoNewProject = true;
|
|
|
|
|
|
|
|
mFileBrowser.SetSelectionMode(FileBrowser::SelectionMode::FILES_ONLY);
|
|
|
|
|
|
|
|
mFileBrowser.SetPrompt("Pick a location and name for the project");
|
|
|
|
|
|
|
|
if (!mFileBrowser.OpenInDirectory(""))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mDoNewProject = false;
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not open the File Browser");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ImGui::MenuItem("Open Project"))
|
|
|
|
if (ImGui::MenuItem("Open Project"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mDoOpenProject = true;
|
|
|
|
mDoOpenProject = true;
|
|
|
|
|
|
|
|
mFileBrowser.SetSelectionMode(FileBrowser::SelectionMode::FILES_ONLY);
|
|
|
|
|
|
|
|
mFileBrowser.SetPrompt("Pick a location and name for the project");
|
|
|
|
|
|
|
|
if (!mFileBrowser.OpenInDirectory(""))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mDoOpenProject = false;
|
|
|
|
|
|
|
|
Logger::Log(LogCat, LogLevel::ERROR, "Could not open the File Browser");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ImGui::MenuItem("Save Project"))
|
|
|
|
if (ImGui::MenuItem("Save Project"))
|
|
|
|
|