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

Add option to hide side panel #31

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ogre_mesh_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def __init__(self, app):
self.show_about = False
self.show_metrics = False
self.show_render_settings = False
self.side_panel_visible = True

self.app = app

Expand Down Expand Up @@ -209,6 +210,8 @@ def preRenderTargetUpdate(self, evt):

if entity is not None and ImGui.BeginMenu("View"):
enode = entity.getParentSceneNode()
if ImGui.MenuItem("Show/Hide Side Panel", "N", self.app.axes_visible):
self.side_panel_visible = not self.side_panel_visible
if ImGui.MenuItem("Show Axes", "A", self.app.axes_visible):
self.app._toggle_axes()
if ImGui.MenuItem("Show Bounding Box", "B", enode.getShowBoundingBox()):
Expand Down Expand Up @@ -246,6 +249,10 @@ def preRenderTargetUpdate(self, evt):
# no sidebar yet when loading .scene
return

if self.side_panel_visible is False:
# hide side panel
return

# Mesh Info Sidebar
mesh = entity.getMesh()

Expand Down Expand Up @@ -404,6 +411,8 @@ def keyPressed(self, evt):
self.getRoot().queueEndRendering()
elif evt.keysym.sym == ord("b"):
self._toggle_bbox()
elif evt.keysym.sym == ord("n"):
self.gui.side_panel_visible = not self.gui.side_panel_visible
elif evt.keysym.sym == ord("a"):
self._toggle_axes()
elif evt.keysym.sym == ord("p"):
Expand Down