Skip to content

Commit

Permalink
use Ogre.Overlay.DrawRenderingSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Feb 25, 2024
1 parent 99e9463 commit ea8b50b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Viewer for `.mesh` model files as consumed by OGRE as well as any format [suppor
[Portable Windows Package](https://github.com/OGRECave/ogre-meshviewer/releases)

# Dependencies
* [ogre-python](https://pypi.org/project/ogre-python/) >= 14.0
* [ogre-python](https://pypi.org/project/ogre-python/) >= 14.2
* python3

# Usage
Expand Down
31 changes: 2 additions & 29 deletions ogre_mesh_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ def show_vertex_decl(decl):
ImGui.Text(str(e.getSource()))
ImGui.EndTable()

def config_option_combo(rs, option):
if ImGui.BeginCombo(option.name, option.currentValue):
for val in option.possibleValues:
is_selected = (option.currentValue == val)
if ImGui.Selectable(val, is_selected):
rs.setConfigOption(option.name, val)

ImGui.EndCombo()

def printable(str):
return str.encode("utf-8", "replace").decode()

Expand Down Expand Up @@ -132,8 +123,6 @@ def __init__(self, app):
self.orig_mat = None
self.logwin = app.logwin

self.selected_renderer = app.getRoot().getRenderSystem().getName()

self.lod_idx_override = -1

def draw_about(self):
Expand All @@ -151,27 +140,11 @@ def draw_render_settings(self):
flags = ImGui.WindowFlags_AlwaysAutoResize
self.show_render_settings = ImGui.Begin("Renderer Settings", self.show_render_settings, flags)[1]

#https://ogrecave.github.io/ogre/api/latest/class_ogre_1_1_root.html
if ImGui.BeginCombo("Renderer", self.selected_renderer):
for renderer in app.getRoot().getAvailableRenderers():
rname = renderer.getName()
is_selected = (self.selected_renderer == rname)
if ImGui.Selectable(rname, is_selected):
self.selected_renderer = rname
ImGui.EndCombo()

ImGui.Separator()

rs = app.getRoot().getRenderSystemByName(self.selected_renderer)
config_options = rs.getConfigOptions()
#https://ogrecave.github.io/ogre/api/latest/struct_ogre_1_1_config_option.html
for config_option in config_options.values():
config_option_combo(rs, config_option)
Ogre.Overlay.DrawRenderingSettings(app.next_rendersystem)

ImGui.Separator()

if ImGui.Button("Apply & Restart"):
app.next_rendersystem = self.selected_renderer
app.restart = True
app.getRoot().queueEndRendering()

Expand Down Expand Up @@ -420,7 +393,7 @@ def __init__(self, infile, rescfg):

self.active_controllers = {}

self.next_rendersystem = None
self.next_rendersystem = ""

# in case we want to show the file dialog
root = tk.Tk()
Expand Down

0 comments on commit ea8b50b

Please sign in to comment.