NK-114 - Creating Prefab without extension doesn't add .prefab

This commit is contained in:
emerycp
2023-07-22 00:25:30 -04:00
parent 9df2adaea1
commit 47b375b1af
2 changed files with 13 additions and 3 deletions

View File

@@ -402,8 +402,18 @@ namespace Nuake {
{
Ref<Prefab> newPrefab = Prefab::CreatePrefabFromEntity(Selection.Entity);
std::string savePath = FileDialog::SaveFile("*.prefab");
newPrefab->SaveAs(savePath);
Selection.Entity.AddComponent<PrefabComponent>().PrefabInstance = newPrefab;
if (!String::EndsWith(savePath, ".prefab"))
{
savePath += ".prefab";
}
if (!savePath.empty())
{
newPrefab->SaveAs(savePath);
Selection.Entity.AddComponent<PrefabComponent>().PrefabInstance = newPrefab;
FileSystem::Scan();
FileSystemUI::m_CurrentDirectory = FileSystem::RootDirectory;
}
}
ImGui::EndPopup();
}

View File

@@ -247,7 +247,7 @@ namespace Nuake
path += ".material";
}
if (path != "")
if (!path.empty())
{
Ref<Material> material = CreateRef<Material>();
material->IsEmbedded = false;