Skip to content

Commit

Permalink
Added ability to hide imgui via commandline argument
Browse files Browse the repository at this point in the history
  • Loading branch information
RealDanTheMan committed Jun 8, 2024
1 parent 9d3ccfd commit e185c3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pyrousel/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ApplicationSettings:
window_width: int = 1024
window_height: int = 1024
startup_model: str = None
enable_gui: bool = True

def Main() -> None:
args = ParseArgs()
Expand All @@ -17,18 +18,21 @@ def Main() -> None:
app_settings.window_width = args.width
app_settings.window_height = args.height
app_settings.startup_model = args.model
app_settings.enable_gui = not args.nogui

Run(app_settings)
exit(0)

def Run(settings: ApplicationSettings = ApplicationSettings()) -> None:
print('Running Pyrousel...')
print(f'--Window size: {settings.window_width}x{settings.window_height}')
print(f'--gui: {settings.enable_gui}')
print(f'--Startup model: {settings.startup_model}')
print('\n')

app_window = AppWindow(settings.window_width, settings.window_height)
app_window.Init()
app_window.draw_gui = settings.enable_gui

if settings.startup_model is not None:
app_window.OnModelRequested(settings.startup_model)
Expand Down Expand Up @@ -59,6 +63,13 @@ def ParseArgs():
required=False,
help='filepath to initial model file'
)
arg_parser.add_argument(
'--nogui',
action='store_true',
default=False,
required=False,
help='disable interactive property panel'
)

args = None
try:
Expand Down
6 changes: 5 additions & 1 deletion pyrousel/appwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self, width: int = 1280, height: int = 720):
self.__width = width
self.__height = height
self.__aspec_ratio = self.__width / self.__height
self.draw_gui = True
self.render_hints = RenderHints()
self.render_hints.wireframe_color = Vector4([0.0, 0.55, 0.0, 0.22])
self.material_settings = MaterialSettings()
Expand Down Expand Up @@ -187,7 +188,10 @@ def __RenderScene(self) -> None:
self.graphics.SetPerspectiveMatrix(self.camera.GetPerspectiveMatrix())
self.graphics.light_value = self.light_color * self.light_intensity
self.graphics.RenderModel(self.model, self.render_hints, self.material_settings)
self.gui.Render()

if self.draw_gui:
self.gui.Render()

glfw.swap_buffers(self.__win)

def Run(self) -> None:
Expand Down

0 comments on commit e185c3a

Please sign in to comment.