mirror of
https://github.com/antopilo/Nuake.git
synced 2026-01-03 14:09:46 +03:00
Automatically dock new scene editors + fixed upside down images in filebrowser widget
This commit is contained in:
@@ -2774,7 +2774,7 @@ namespace Nuake {
|
||||
|
||||
ImGuiWindowClass top_level_class;
|
||||
top_level_class.ClassId = ImHashStr("SceneEditor");
|
||||
top_level_class.DockingAllowUnclassed = false;
|
||||
top_level_class.DockingAllowUnclassed = true;
|
||||
|
||||
ImGuiDockNodeFlags flags = ImGuiDockNodeFlags_NoSplit | ImGuiDockNodeFlags_NoResize;
|
||||
ImGuiID dockspaceNodeId = ImGui::GetID("SceneEditorDockSpace");
|
||||
@@ -2787,6 +2787,18 @@ namespace Nuake {
|
||||
SceneEditorDockspaceNodeID = ImGui::DockBuilderAddNode(dockspaceId, ImGuiDockNodeFlags_DockSpace);
|
||||
}
|
||||
|
||||
// We need to cache, because we might delete one while iterating
|
||||
auto cachedEditors = sceneEditors;
|
||||
for (auto& sceneEditor : cachedEditors)
|
||||
{
|
||||
sceneEditor->Draw();
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowDockID(dockspaceNodeId);
|
||||
ImGui::Begin("test");
|
||||
|
||||
ImGui::End();
|
||||
|
||||
//ImGuiID node2 = ImGui::DockBuilderAddNode(dockspaceNodeId, ImGuiDockNodeFlags_DockSpace);
|
||||
//ImGui::DockBuilderSetNodeSize(node2, dockSize);
|
||||
|
||||
@@ -2826,12 +2838,7 @@ namespace Nuake {
|
||||
prefabEditors->Draw();
|
||||
}
|
||||
|
||||
// We need to cache, because we might delete one while iterating
|
||||
auto cachedEditors = sceneEditors;
|
||||
for (auto& sceneEditor : cachedEditors)
|
||||
{
|
||||
sceneEditor->Draw();
|
||||
}
|
||||
|
||||
|
||||
//pInterface.DrawEntitySettings();
|
||||
//DrawViewport();
|
||||
|
||||
@@ -46,10 +46,10 @@ void SceneEditorWindow::Draw()
|
||||
windowClass.ClassId = ImHashStr("SceneEditor");
|
||||
windowClass.DockingAllowUnclassed = false;
|
||||
ImGui::SetNextWindowClass(&windowClass);
|
||||
|
||||
ImGui::SetNextWindowDockID(ImGui::GetID("SceneEditorDockSpace"));
|
||||
ImGui::SetNextWindowSizeConstraints({1280, 720}, { FLT_MAX, FLT_MAX });
|
||||
bool shouldStayOpen = true;
|
||||
std::string windowName = std::string(ICON_FA_WINDOW_MAXIMIZE + std::string(" ") + sceneName);
|
||||
std::string windowName = std::string(ICON_FA_WINDOW_MAXIMIZE + std::string(" ") + sceneName);
|
||||
if (ImGui::Begin(windowName.c_str(), &shouldStayOpen))
|
||||
{
|
||||
ImGuiWindowClass localSceneEditorClass;
|
||||
@@ -78,9 +78,11 @@ void SceneEditorWindow::Draw()
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::DockBuilderDockWindow(windowName.c_str(), dockId);
|
||||
if (!layoutInitialized)
|
||||
{
|
||||
//ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Down, 0.3f, nullptr, &dockId);
|
||||
//ImGui::DockBuilderDockWindow(windowName.c_str(), dockId);
|
||||
|
||||
if (dockId != 0)
|
||||
{
|
||||
//ImGui::DockBuilderDockWindow(windowName.c_str(), dockId);
|
||||
|
||||
@@ -360,7 +360,7 @@ void FileBrowserWidget::DrawDirectory(Ref<Nuake::Directory> directory, uint32_t
|
||||
|
||||
|
||||
ImGui::SetCursorPos(prevCursor);
|
||||
ImGui::Image((ImTextureID)TextureManager::Get()->GetTexture2("Resources/Images/folder_icon.png")->GetImGuiDescriptorSet(), ImVec2(100, 100));
|
||||
ImGui::Image((ImTextureID)TextureManager::Get()->GetTexture2("Resources/Images/folder_icon.png")->GetImGuiDescriptorSet(), ImVec2(100, 100), {0, 1}, {1, 0});
|
||||
|
||||
auto imguiStyle = ImGui::GetStyle();
|
||||
|
||||
@@ -643,7 +643,7 @@ void FileBrowserWidget::DrawFile(Ref<Nuake::File> file, uint32_t drawId)
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(prevCursor);
|
||||
ImGui::Image(reinterpret_cast<ImTextureID>(textureImage->GetImGuiDescriptorSet()), ImVec2(100, 100));
|
||||
ImGui::Image(reinterpret_cast<ImTextureID>(textureImage->GetImGuiDescriptorSet()), ImVec2(100, 100), { 0, 1 }, { 1, 0 });
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
auto& imguiStyle = ImGui::GetStyle();
|
||||
|
||||
Reference in New Issue
Block a user