Skip to content
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

Imgui Docking #598

Merged
merged 33 commits into from
Nov 6, 2021
Merged

Imgui Docking #598

merged 33 commits into from
Nov 6, 2021

Conversation

MSallermann
Copy link
Member

@MSallermann MSallermann commented Jun 27, 2021

Uses the imgui docking branch to enhance the imgui version of spirit.

M. Sallermann added 15 commits April 6, 2021 13:25
…from it. This makes it easier to modify common behaviour. The base class implements the function show() while the derived classes implement show_content(). This makes it possible to easily render the content into e.g a collapsing header or a free window.
- show(): Moved show_content() behind isHovered check
Removed superfluous ImGui::End in parameters widget.
transform_to_system_frame(), now respects reduced size of spin widget if sidebar is present.
-Enabled split docking.
- Removed explicit size from sidebar dockspace (caused issues because it ignored window padding etc.).
- The sidebar can now not grow larger than 70% of the screen width.
@MSallermann MSallermann changed the title Imgui test Imgui Docking Jun 27, 2021
@codecov
Copy link

codecov bot commented Jun 27, 2021

Codecov Report

Merging #598 (7a1d50e) into develop (945e3d5) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop     #598      +/-   ##
===========================================
- Coverage    48.00%   47.99%   -0.01%     
===========================================
  Files           72       72              
  Lines        11249    11251       +2     
===========================================
  Hits          5400     5400              
- Misses        5849     5851       +2     

@coveralls
Copy link

coveralls commented Jun 27, 2021

Coverage Status

Coverage remained the same at 80.986% when pulling 7a1d50e on imgui-test into 2dab6cf on develop.

@GPMueller
Copy link
Member

GPMueller commented Jul 3, 2021

In order to determine whether any windows are docked into the right-side dock-space, one could use the imgui-internal APIs:

for( const auto * w : spirit_widgets )
{
    if( w->imgui_window_ptr )
    {
        if( w->imgui_window_ptr->DockNode )
        {
            ImGuiDockNode * node   = w->imgui_window_ptr->DockNode;
            ImGuiDockNode * parent = node->ParentNode;
            while( parent )
            {
                node = parent;
                parent = node->ParentNode;
            }
            if( node->ID == id_dockspace_right )
                fmt::print( "{} is docked in the sidebar\n", w->title );
        }
    }
}

for which the WidgetBase needs to store its window-pointer, imgui_window_ptr = ImGui::GetCurrentWindow();.
I currently don't see any way to get the same information without using the internal APIs in both classes... 😕

For some reason, it also seems that the evaluation of node->ParentNode->ID only works inside the MainWindow::draw function. If placed into WidgetBase::show, there does not seem to be a parent for windows docked into the sidebar.

GPMueller and others added 5 commits July 3, 2021 14:38
Now, the root docking node id is compared to the id of the sidebar to correctly detect if a window is docked somewhere inside.
Also applied formatting fixes.
…indows metafile

clang on windows complained about version delimited with ".", now they are delimited with "-", i.e. 2.1.1 -> 2-1-1.
The docking now works as one would expect.
Made the dock background transparent when nothing is docked, instead of
the empty docking bar moving around the rendering contents.

Also applied some minor fixes around the place.

Co-authored-by: MSallermann <[email protected]>
 - sidebar height was too large
 - rendering layout was too large when docking on the left
Also added F12 keyboard shortcut for screenshot.
This applies the last used configuration again. This sometimes comes in
handy, for example when using the same starting point for several images
when generating a chain.
@GPMueller
Copy link
Member

Implemented a few of the feature-parity points from issue #600.

GPMueller and others added 3 commits November 6, 2021 17:17
When de-activating and re-activating renderers, all renderers' colormaps
were reset to HSV. This was apparently due to the view being assigned
this colormap.

Also made the colormap cardinal axis gizmo smaller.
The default is now 3 and the maximum is 5. This seems a reasonable range
where a value of 3 is already visually fine in most cases.
@MSallermann MSallermann marked this pull request as ready for review November 6, 2021 17:03
@MSallermann MSallermann merged commit 728b478 into develop Nov 6, 2021
@GPMueller GPMueller deleted the imgui-test branch February 10, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants