thedmd / imgui-node-editor

Node Editor built using Dear ImGui
MIT License
3.67k stars 539 forks source link

Imgui 1.86 WIP with docking support #155

Closed Ubpa closed 1 year ago

Ubpa commented 2 years ago

Hi, I found that imgui-node-editor does not support with imgui 1.86 docking. Could you please fix the bug? image

thedmd commented 2 years ago

I will check it out

arabine commented 2 years ago

Same thing here, I'm using your branch 1.89 WIP (18808), I cannot dock the window :'(

thedmd commented 2 years ago

Can you provide a repro?

So far I didn't manage to not make it work.

arabine commented 2 years ago

Ah! I have added your simple example to my global frame drawing:

void Blueprint::OnFrame()
{
    auto& io = ImGui::GetIO();

            ed::SetCurrentEditor(m_Editor);
            ed::Begin("My Editor");
            int uniqueId = 1;
            // Start drawing nodes.
            ed::BeginNode(uniqueId++);
                ImGui::Text("Node A");
                ed::BeginPin(uniqueId++, ed::PinKind::Input);
                    ImGui::Text("-> In");
                ed::EndPin();
                ImGui::SameLine();
                ed::BeginPin(uniqueId++, ed::PinKind::Output);
                    ImGui::Text("Out ->");
                ed::EndPin();
            ed::EndNode();
            ed::End();
            ed::SetCurrentEditor(nullptr);

    return;
}

All other windows are docked, when I drag this window I do not see any "blue anchor rectangle". Here the main loop (I'm using SDL2 as renderer):

    int Update(SDL_Renderer *renderer, double deltaTime) override
    {
        draw_editor_layout();
        draw_memory_editor();
        m_blueprint.OnFrame();  // <<------- The Node editor is here
        draw_ost_device(renderer, deltaTime);
        code_editor_draw();

        m_console.Draw("Console", nullptr);

        return 0;
    }
arabine commented 1 year ago

Hello do you need more information? I will try to push my project for you.

thedmd commented 1 year ago

ed::Begin does not create own window. Can you try to enclose code in OnFrame() in ImGui::Begin()/ImGui::End()?

arabine commented 1 year ago

Yes it works, thank you it was obvious now.

ChivenZhang commented 1 year ago

1.86

The newest version of imgui is 1.89, and there's bug when integrating node-editor. It occurs when zooming and scrolling.

image

https://user-images.githubusercontent.com/48938612/208335911-f4ba9144-5408-4982-a0da-0c32b1ba00be.mp4

thedmd commented 1 year ago

As a workaround please avoid running editor with zero size od when ImGui::GetContentRegionAvail() is an empty rect. This will be fixed in the future.

Also, please in the future open new issue instead of hijacking older ones.