Fixed bug that allowed the asset browser's back button to leave the project's assets directory

master
Joey Pollack 3 years ago
parent 0160e7c623
commit 57e610b893

@ -1,6 +1,6 @@
High Importance: High Importance:
AssetBrowser back button does not stop at the asset root directory @high AssetBrowser back button does not stop at the asset root directory @high @done(22-07-05 13:53)
✔ Editor does not get absolute paths from the file browser - replace with NFD dialogs @critical @done(22-05-20 18:36) ✔ Editor does not get absolute paths from the file browser - replace with NFD dialogs @critical @done(22-05-20 18:36)
✔ The Map Editor does not get the tile maps when a project is opened @high @done (3/3/2022, 2:47:41 PM) ✔ The Map Editor does not get the tile maps when a project is opened @high @done (3/3/2022, 2:47:41 PM)
✔ Tile Set IDs (as opposed to the Asset ID) is not saved or loaded yet @high @done (3/11/2022, 2:10:30 PM) ✔ Tile Set IDs (as opposed to the Asset ID) is not saved or loaded yet @high @done (3/11/2022, 2:10:30 PM)

@ -144,7 +144,12 @@ namespace editor
ImGui::PushFont(GUI::GetInstance().GetFont(GuiFont::FONT_ROBO_SMALL)); ImGui::PushFont(GUI::GetInstance().GetFont(GuiFont::FONT_ROBO_SMALL));
ImGui::TextUnformatted(mpEditor->GetProject()->MakeRelativeToAssets(mSelectedDir, true).string().c_str()); ImGui::TextUnformatted(mpEditor->GetProject()->MakeRelativeToAssets(mSelectedDir, true).string().c_str());
ImGui::PopFont(); ImGui::PopFont();
if (ImGui::Button("Back"))
// Prevent the back button from leaving the projects asset directory
std::string parent = mSelectedDir.parent_path().lexically_normal().string();
std::string assets_str = mpEditor->GetProject()->GetAssetDirectory().lexically_normal().string();
size_t loc = parent.find(assets_str);
if (ImGui::Button("Back") && (loc != std::string::npos))
{ {
mSelectedDir = mSelectedDir.parent_path(); mSelectedDir = mSelectedDir.parent_path();
mSyncTree = true; mSyncTree = true;

Loading…
Cancel
Save