Open IniKiwi opened 3 weeks ago
Version dev, Branch: docking
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Linux Debian 12
Dear ImGui 1.91.5 WIP (19141) -------------------------------- sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20 define: __cplusplus=201703 define: __linux__ define: __GNUC__=13 define: IMGUI_HAS_VIEWPORT define: IMGUI_HAS_DOCK -------------------------------- io.BackendPlatformName: imgui_impl_glfw io.BackendRendererName: imgui_impl_opengl3 io.ConfigFlags: 0x00000081 NavEnableKeyboard DockingEnable io.ConfigViewportsNoDecoration io.ConfigNavCaptureKeyboard io.ConfigInputTextCursorBlink io.ConfigWindowsResizeFromEdges io.ConfigWindowsMoveFromTitleBarOnly io.ConfigMemoryCompactTimer = 60.0 io.BackendFlags: 0x00001C0E HasMouseCursors HasSetMousePos PlatformHasViewports HasMouseHoveredViewport RendererHasVtxOffset RendererHasViewports -------------------------------- io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,128 io.DisplaySize: 1280.00,720.00 io.DisplayFramebufferScale: 1.00,1.00 -------------------------------- style.WindowPadding: 8.00,8.00 style.WindowBorderSize: 1.00 style.FramePadding: 4.00,3.00 style.FrameRounding: 0.00 style.FrameBorderSize: 0.00 style.ItemSpacing: 8.00,4.00 style.ItemInnerSpacing: 4.00,4.00
I'm following this example https://github.com/ocornut/imgui/blob/368123ab06b2b573d585e52f84cd782c5c006697/imgui_demo.cpp#L2662C48-L2662C71. But when I'm adding a drag and drop target, treenodes disappears.
https://github.com/user-attachments/assets/cb85b607-c829-444f-ac66-b3c6d5f0369e
int flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanTextWidth; if(m_SelectedObject == e) flags |= ImGuiTreeNodeFlags_Selected; std::set<Instance*> childs = e->GetChildrens(); if(!(childs.size() > 0)) flags |= ImGuiTreeNodeFlags_Leaf; std::string label = fmt::format("{}{}", InstanceClassNameToIcon(e), e->GetName()); bool skip; if(show){ skip = ImGui::TreeNodeEx((void*)e, flags, label.c_str()); if (ImGui::IsItemClicked() && !ImGui::IsItemToggledOpen()) m_SelectedObject = e; if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)){ ImGui::SetDragDropPayload("_INSTANCE", e, sizeof(void*)); ImGui::Text(label.c_str()); ImGui::EndDragDropSource(); } /*if(ImGui::BeginDragDropTarget()){ if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_INSTANCE")){ IM_ASSERT(payload->DataSize == sizeof(void*)); Instance* object = (Instance*)payload->Data; object->SetParent(e); } ImGui::EndDragDropTarget(); }*/ if (ImGui::BeginPopupContextItem()){ m_SelectedObject = e; ImGui::MenuItem(ICON_CUT_RED" Cut", "Ctrl+X", &m_instanceContextMenuActions.Cut); ImGui::MenuItem(ICON_PAGE_COPY" Copy", "Ctrl+C", &m_instanceContextMenuActions.Copy); ImGui::MenuItem(ICON_BLANK" Paste Into", "Ctrl+Shift+V", &m_instanceContextMenuActions.PasteInto); ImGui::MenuItem(ICON_PAGE_COPY" Duplicate", "Ctrl+D", &m_instanceContextMenuActions.Duplicate); ImGui::MenuItem(ICON_DELETE" Delete", "Del", &m_instanceContextMenuActions.Delete); ImGui::MenuItem(ICON_PENCIL" Rename", "", &m_instanceContextMenuActions.Rename); ImGui::Separator(); ImGui::MenuItem(ICON_SHAPE_GROUP" Group", "Ctrl+G", &m_instanceContextMenuActions.Group); ImGui::MenuItem(ICON_SHAPE_UNGROUP" Ungroup", "Ctrl+U", &m_instanceContextMenuActions.Ungroup); ImGui::Separator(); ImGui::MenuItem(ICON_BRICK_ADD" Insert Part", "", &m_instanceContextMenuActions.InsertPart); ImGui::MenuItem(ICON_BRICK_ADD" Insert Object", "", &m_instanceContextMenuActions.InsertPart); ImGui::EndPopup(); } } if(skip){ for(Instance* child: childs){ RenderExplorerElement(child); } if(show)ImGui::TreePop(); }
Hello, Your code is missing details, but it would be good if you can narrow this into a more minimal repro can I can paste anywhere.
Version/Branch of Dear ImGui:
Version dev, Branch: docking
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Linux Debian 12
Full config/build information:
Details:
I'm following this example https://github.com/ocornut/imgui/blob/368123ab06b2b573d585e52f84cd782c5c006697/imgui_demo.cpp#L2662C48-L2662C71. But when I'm adding a drag and drop target, treenodes disappears.
Screenshots/Video:
https://github.com/user-attachments/assets/cb85b607-c829-444f-ac66-b3c6d5f0369e
Minimal, Complete and Verifiable Example code: