imgui-node-editor icon indicating copy to clipboard operation
imgui-node-editor copied to clipboard

Imgui 1.84 WIP with docking support

Open aabilityuk opened this issue 2 years ago • 9 comments

Hi, dear developer! First of all thank you for a great lib, and if it possible could you please add the docking feature support to your project?

aabilityuk avatar Aug 10 '21 19:08 aabilityuk

Hi.

Node Editor will use version of ImGui you're using. If your code is based on docking branch of ImGui, Node Editor will work fine there.

thedmd avatar Aug 10 '21 19:08 thedmd

My project based on Blueprints example, but blueprints example is using ImGui::Spring, ImGui::HorizontalLayout, ImGui::VerticalLayout wich only included in yours fork of imgui

Is it possible to move out this functions from imgui?

aabilityuk avatar Aug 10 '21 20:08 aabilityuk

Is it possible to move out this functions from imgui?

I'm curious about this as well, as I'm in the same situation. We're using our own fork of ImGui docking branch on our project and at the moment I don't think we can use node editor unless I can replace all of the additions to ImGui you've added @thedmd with something else that doesn't require changes to ImGui files.

It would be great if that pull request of yours could be finally merged into the main library, but it doesn't look like it's going to happen anytime soon. Event then I'm not sure if it would be merged into docking branch as well.

@thedmd If your additions like Horizontal and Vertical layouts, and Spring (and maybe other changes to ImGui I'm not aware of?) could be pulled out into some sort of portable utility header, that would be most helpful 🧡

Jaytheway avatar Aug 11 '21 05:08 Jaytheway

Is it possible to move out this functions from imgui?

It is not possible (yet) to make it separate. Layouts need to tap into one or two ImGui internal functions.

That being said it is usually easy to get them in your local branch. Support for layouts is done in one commit which is available on the branch: https://github.com/thedmd/imgui/tree/layouts I rebase it from time to time, if ImGui moves forward enough or some conflict shows up.

To get it working on docking branch you can do:

  1. Checkout docking branch
  2. Cherry-pick Stack Layout implementation v2.0 from layouts branch

This is how I'm doing that. Now you can do that yourself, so you don't have to wait for me to catch up.

thedmd avatar Aug 11 '21 09:08 thedmd

To get it working on docking branch you can do:

  1. Checkout docking branch
  2. Cherry-pick Stack Layout implementation v2.0 from layouts branch

This is how I'm doing that. Now you can do that yourself, so you don't have to wait for me to catch up.

This is helpful, thank you!

Jaytheway avatar Aug 11 '21 11:08 Jaytheway

Is it possible to move out this functions from imgui?

It is not possible (yet) to make it separate. Layouts need to tap into one or two ImGui internal functions.

That being said it is usually easy to get them in your local branch. Support for layouts is done in one commit which is available on the branch: https://github.com/thedmd/imgui/tree/layouts I rebase it from time to time, if ImGui moves forward enough or some conflict shows up.

To get it working on docking branch you can do:

  1. Checkout docking branch
  2. Cherry-pick Stack Layout implementation v2.0 from layouts branch

This is how I'm doing that. Now you can do that yourself, so you don't have to wait for me to catch up.

Hi dear developer! Thank you very much for advice! I attached the screenshot with a cherry-pick result)))) it is not easy as i think)))) test

aabilityuk avatar Aug 12 '21 20:08 aabilityuk

I made docking branch with layouts docking-layout.

Tested editor with it and it works as expected. image

You may hit an assertion in DrawIcon. Just is case this is a diff to fix that problem:

index 2b44e32..0e2e5c4 100644
--- a/examples/blueprints-example/utilities/drawing.cpp
+++ b/examples/blueprints-example/utilities/drawing.cpp
@@ -110,7 +110,7 @@ void ax::Drawing::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2&
                 const auto p0 = rect_center - ImVec2(r, r);
                 const auto p1 = rect_center + ImVec2(r, r);

-                drawList->AddRectFilled(p0, p1, color, 0, 15 + extra_segments);
+                drawList->AddRectFilled(p0, p1, color, 0, ImDrawFlags_RoundCornersAll);
             }
             else
             {
@@ -121,7 +121,7 @@ void ax::Drawing::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2&
                 if (innerColor & 0xFF000000)
                     drawList->AddRectFilled(p0, p1, innerColor, 0, 15 + extra_segments);

-                drawList->AddRect(p0, p1, color, 0, 15 + extra_segments, 2.0f * outline_scale);
+                drawList->AddRect(p0, p1, color, 0, ImDrawFlags_RoundCornersAll, 2.0f * outline_scale);
             }
         }

thedmd avatar Aug 12 '21 21:08 thedmd

I made docking branch with layouts docking-layout.

I really appreciate your help and your time!!! thank you very much for a quick reply!!! That is what i am looking for!!!

aabilityuk avatar Aug 13 '21 05:08 aabilityuk

I came here to ask for this same thing, and want to say thank you for making that branch!

Atrix256 avatar Dec 15 '23 16:12 Atrix256