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

Feat dockspace size #20

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Feat dockspace size #20

merged 1 commit into from
Aug 21, 2024

Conversation

joruof
Copy link
Owner

@joruof joruof commented Aug 21, 2024

On the docker branch. The main dockspace can be split into nodes. Windows can be assigned to these nodes to code the layout of the window on startup.
This is done by dock_builder_split_node and dock_builder_dock_window.
However, the main dock space has size 0 at the beginning. Hence, it can't be split.
Therefore, ImGui::DockBuilderSetNodeSize was python-binded to set the size prior to the split.

Now, the layout can be preset like in the following (must be executed only once at startup):

dockspace_id = viz.get_main_dockspace_id()
viz.dock_builder_remove_node(dockspace_id)
viz.dock_builder_add_node(dockspace_id)
viz.dock_builder_set_node_size(dockspace_id, viz.get_window_size())

left, middle = viz.dock_builder_split_node(dockspace_id, viz.Dir.LEFT, 0.2)
left, left_bottom = viz.dock_builder_split_node(left, viz.Dir.UP, 0.7)
middle, right = viz.dock_builder_split_node(middle, viz.Dir.LEFT, 0.8)
middle, middle_bottom = viz.dock_builder_split_node(middle, viz.Dir.UP, 0.7)

viz.dock_builder_dock_window("debug", left)
viz.dock_builder_dock_window("map", middle)
viz.dock_builder_dock_window("map_details", middle_bottom)
viz.dock_builder_dock_window("params", right)
viz.dock_builder_dock_window("debug_details", left_bottom)

viz.dock_builder_finish(dockspace_id)

@oliver-schumann oliver-schumann changed the base branch from main to develop August 21, 2024 09:07
@oliver-schumann oliver-schumann added the enhancement New feature or request label Aug 21, 2024
@joruof joruof merged commit dd0cfba into develop Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants