mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Merge branch 'main' of https://github.com/antopilo/Nuake
# Conflicts: # Nuake/src/Core/Physics/DynamicWorld.cpp # Nuake/src/Core/Physics/DynamicWorld.h
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -144,43 +144,89 @@ namespace Nuake
|
||||
ImGui::OpenPopup(hoverMenuId.c_str());
|
||||
m_hasClickedOnFile = true;
|
||||
}
|
||||
|
||||
|
||||
const std::string openScene = "Open Scene" + std::string("##") + hoverMenuId;
|
||||
bool shouldOpenScene = false;
|
||||
|
||||
|
||||
if (ImGui::BeginPopup(hoverMenuId.c_str()))
|
||||
{
|
||||
if (ImGui::MenuItem("Show in File Explorer"))
|
||||
if (file->GetExtension() != ".scene")
|
||||
{
|
||||
OS::ShowInFileExplorer(file->GetAbsolutePath());
|
||||
}
|
||||
|
||||
if(file->GetExtension() == ".wren")
|
||||
{
|
||||
ImGui::Separator();
|
||||
|
||||
if(ImGui::MenuItem("Open..."))
|
||||
if (ImGui::MenuItem("Open in Editor"))
|
||||
{
|
||||
OS::OpenIn(file->GetAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
if(file->GetExtension() != ".project")
|
||||
else
|
||||
{
|
||||
if (ImGui::MenuItem("Load Scene"))
|
||||
{
|
||||
shouldOpenScene = true;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::BeginMenu("Copy"))
|
||||
{
|
||||
if (ImGui::MenuItem("Full Path"))
|
||||
{
|
||||
OS::CopyToClipboard(file->GetAbsolutePath());
|
||||
}
|
||||
|
||||
if (ImGui::MenuItem("File Name"))
|
||||
{
|
||||
OS::CopyToClipboard(file->GetName());
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (file->GetExtension() != ".project")
|
||||
{
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("Delete"))
|
||||
{
|
||||
if(FileSystem::RemoveFile(file->GetAbsolutePath()) != 0)
|
||||
|
||||
if (FileSystem::RemoveFile(file->GetAbsolutePath()) != 0)
|
||||
{
|
||||
Logger::Log("Failed to remove file: " + file->GetRelativePath(), "editor", CRITICAL);
|
||||
}
|
||||
RefreshFileBrowser();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.2f));
|
||||
ImGui::MenuItem("Delete");
|
||||
ImGui::PopStyleColor();
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||
ImGui::TextUnformatted("The file you're trying to delete is currently loaded by the game engine.");
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.2f));
|
||||
if (ImGui::MenuItem("Rename"))
|
||||
{
|
||||
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("Show in File Explorer"))
|
||||
{
|
||||
OS::ShowInFileExplorer(file->GetAbsolutePath());
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
const std::string openScene = "Open Scene" + std::string("##") + hoverMenuId;
|
||||
|
||||
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
|
||||
{
|
||||
if (file->GetExtension() == ".scene")
|
||||
@@ -189,7 +235,12 @@ namespace Nuake
|
||||
}
|
||||
}
|
||||
|
||||
if (PopupHelper::DefineDialog(openScene, "Open the scene? \n Changes will not be saved."))
|
||||
if (shouldOpenScene)
|
||||
{
|
||||
PopupHelper::Confirmation(openScene);
|
||||
}
|
||||
|
||||
if (PopupHelper::DefineDialog(openScene, " Open the scene? \n Changes will not be saved."))
|
||||
{
|
||||
Ref<Scene> scene = Scene::New();
|
||||
const std::string projectPath = file->GetAbsolutePath();
|
||||
@@ -247,7 +298,7 @@ namespace Nuake
|
||||
path += ".material";
|
||||
}
|
||||
|
||||
if (path != "")
|
||||
if (!path.empty())
|
||||
{
|
||||
Ref<Material> material = CreateRef<Material>();
|
||||
material->IsEmbedded = false;
|
||||
|
||||
Reference in New Issue
Block a user