-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column problem #28
Comments
Hello @durswd, I'm afraid there is a conflict here in the ImDrawList channel splitter. Columns API now is using it to separate column drawing. Node editor is also using channel splitter to manage node drawing. Please use workaround with child window now, I will need to think how to address this problem. @ocornut Is there a way to split single channel into sub-channels, to make channel splitter recursive? Or is this out of the scope of ImDrawList? |
It should be possible now if you use the (ImDrawList carry its own ImDrawListSplitter for legacy reason, but you can ignore that instance and use yours). |
Thank you for advice. This is almost exactly what I did. Since my code relay on splitter inside ImDrawList I ended up swapping splitter while editor is drawing to avoid major rewrite. |
@durswd Assert is solved. Editor should work in both cases now. Solution was simpler than I initially thought. |
Thank you ! |
I ran into a similar issue. I thought I might organize my node drawing using Columns, but can't due to the ImDrawList issue. Of course I can implement the node contents a different way, but thought I would leave another test case here for you. ed::BeginNode(nodeB_Id);
ImGui::Text("Node B");
ImGui::Columns(2);
ed::BeginPin(nodeB_InputPinId1, ed::PinKind::Input);
ImGui::Text("-> In1");
ed::EndPin();
ed::BeginPin(nodeB_InputPinId2, ed::PinKind::Input);
ImGui::Text("-> In2");
ed::EndPin();
ImGui::NextColumn();
ed::BeginPin(nodeB_OutputPinId, ed::PinKind::Output);
ImGui::Text("Out ->");
ed::EndPin();
ImGui::Columns();
ed::EndNode(); The assert occurs here: void ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count)
{
IM_ASSERT(_Current == 0 && _Count <= 1); |
I see the problem. I should be able to make similar fix to enable this use case. |
@meshula I fixed an assert. Now channel splitting can be used between Begin/End for nodes and pins. However Columns API will not work inside node because it relay on windows size internally and always span to full width, which is incorrect for node. In node you want to minimize size, that's why I used stack layouts. There is a workaround for that issue: void ImGuiEx_BeginColumn()
{
ImGui::BeginGroup();
}
void ImGuiEx_NextColumn()
{
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
}
void ImGuiEx_EndColumn()
{
ImGui::EndGroup();
}
// and code:
ed::BeginNode(nodeB_Id);
ImGui::Text("Node B");
ImGuiEx_BeginColumn();
ed::BeginPin(nodeB_InputPinId1, ed::PinKind::Input);
ImGui::Text("-> In1");
ed::EndPin();
ed::BeginPin(nodeB_InputPinId2, ed::PinKind::Input);
ImGui::Text("-> In2");
ed::EndPin();
ImGuiEx_NextColumn();
ed::BeginPin(nodeB_OutputPinId, ed::PinKind::Output);
ImGui::Text("Out ->");
ed::EndPin();
ImGuiEx_EndColumn();
ed::EndNode(); Does this works for you? The way Column API work collide with how canvas work. Maybe it is a way to make work both but that will require sending PR's to patch Column API and as far as I know it is still in the flux, changing and probably evolve even more with tables @ocornut is working on. So until that's done I think above workaround is the next best thing we got. |
Yes, that's perfect. Your example is a nice "cookbook" reference :) |
Hi everybody, This is the error I get
|
Introduction of ImDrawListSplitter changed how channels should be managed internally. Now we do not need to worry about user code colliding with ours.
Thanks. |
Introduction of ImDrawListSplitter changed how channels should be managed internally. Now we do not need to worry about user code colliding with ours.
I found a problem.
This code causes assert in Suspend.
But this codes runs with Begin and End child.
Is it a bug?
Best regards.
The text was updated successfully, but these errors were encountered: