From b073226df6f4451500d46346a5531d5efb3ca9ee Mon Sep 17 00:00:00 2001 From: Florian Barthel Date: Tue, 9 Jul 2024 10:33:06 +0200 Subject: [PATCH 1/5] styling + edit presets --- gui_utils/imgui_utils.py | 132 ++++++++++++++++++++++++++++--------- presets.json | 1 + run_main.py | 30 ++++++++- widgets/cam_widget.py | 10 +-- widgets/edit_widget.py | 118 +++++++++++++++++++++++++-------- widgets/load_widget_ply.py | 2 +- 6 files changed, 225 insertions(+), 68 deletions(-) create mode 100644 presets.json diff --git a/gui_utils/imgui_utils.py b/gui_utils/imgui_utils.py index b786274..2b14396 100644 --- a/gui_utils/imgui_utils.py +++ b/gui_utils/imgui_utils.py @@ -11,34 +11,93 @@ import contextlib import imgui -#---------------------------------------------------------------------------- -def set_default_style(color_scheme='dark', spacing=5, indent=10, scrollbar=10): +# ---------------------------------------------------------------------------- + +def set_default_style(color_scheme='dark', spacing=5, indent=15, scrollbar=10): s = imgui.get_style() - s.window_padding = [spacing, spacing] - s.item_spacing = [spacing, spacing] - s.item_inner_spacing = [spacing, spacing] - s.columns_min_spacing = spacing - s.indent_spacing = indent - s.scrollbar_size = scrollbar - s.frame_padding = [3, 3] - s.window_border_size = 1 - s.child_border_size = 1 - s.popup_border_size = 1 - s.frame_border_size = 1 - s.window_rounding = 0 - s.child_rounding = 0 - s.popup_rounding = 1 - s.frame_rounding = 0 - s.scrollbar_rounding = 1 - s.grab_rounding = 1 + s.window_padding = [spacing, spacing] + s.item_spacing = [spacing, spacing] + s.item_inner_spacing = [spacing, spacing] + s.columns_min_spacing = spacing + s.indent_spacing = indent + s.scrollbar_size = scrollbar + s.frame_padding = [3, 3] + # s.window_border_size = 1 + # s.child_border_size = 1 + # s.popup_border_size = 1 + # s.frame_border_size = 1 + # s.window_rounding = 0 + # s.child_rounding = 0 + # s.popup_rounding = 1 + s.frame_rounding = 5 + # s.scrollbar_rounding = 1 + # s.grab_rounding = 1 getattr(imgui, f'style_colors_{color_scheme}')(s) c0 = s.colors[imgui.COLOR_MENUBAR_BACKGROUND] c1 = s.colors[imgui.COLOR_FRAME_BACKGROUND] s.colors[imgui.COLOR_POPUP_BACKGROUND] = [x * 0.7 + y * 0.3 for x, y in zip(c0, c1)][:3] + [1] -#---------------------------------------------------------------------------- + s.colors[imgui.COLOR_TEXT] = [1.00, 1.00, 1.00, 1.00] + s.colors[imgui.COLOR_TEXT_DISABLED] = [0.50, 0.50, 0.50, 1.00] + + s.colors[imgui.COLOR_WINDOW_BACKGROUND] = [0.30, 0.30, 0.30, 1.00] + s.colors[imgui.COLOR_CHILD_BACKGROUND] = [0.20, 0.20, 0.20, 1.00] + s.colors[imgui.COLOR_POPUP_BACKGROUND] = [0.19, 0.19, 0.19, 0.92] + + s.colors[imgui.COLOR_BORDER] = [0.19, 0.19, 0.19, 0.29] + s.colors[imgui.COLOR_BORDER_SHADOW] = [0.00, 0.00, 0.00, 0.24] + s.colors[imgui.COLOR_FRAME_BACKGROUND] = [0.05, 0.05, 0.05, 0.54] + s.colors[imgui.COLOR_FRAME_BACKGROUND_HOVERED] = [0.19, 0.19, 0.19, 0.54] + s.colors[imgui.COLOR_FRAME_BACKGROUND_ACTIVE] = [0.20, 0.22, 0.23, 1.00] + s.colors[imgui.COLOR_TITLE_BACKGROUND] = [0.00, 0.00, 0.00, 1.00] + s.colors[imgui.COLOR_TITLE_BACKGROUND_ACTIVE] = [0.06, 0.06, 0.06, 1.00] + s.colors[imgui.COLOR_TITLE_BACKGROUND_COLLAPSED] = [0.00, 0.00, 0.00, 1.00] + s.colors[imgui.COLOR_MENUBAR_BACKGROUND] = [0.14, 0.14, 0.14, 1.00] + s.colors[imgui.COLOR_SCROLLBAR_BACKGROUND] = [0.05, 0.05, 0.05, 0.54] + s.colors[imgui.COLOR_SCROLLBAR_GRAB] = [0.34, 0.34, 0.34, 0.54] + s.colors[imgui.COLOR_SCROLLBAR_GRAB_HOVERED] = [0.40, 0.40, 0.40, 0.54] + s.colors[imgui.COLOR_SCROLLBAR_GRAB_ACTIVE] = [0.56, 0.56, 0.56, 0.54] + s.colors[imgui.COLOR_CHECK_MARK] = [0.33, 0.67, 0.86, 1.00] + s.colors[imgui.COLOR_SLIDER_GRAB] = [0.34, 0.34, 0.34, 0.74] + s.colors[imgui.COLOR_SLIDER_GRAB_ACTIVE] = [0.56, 0.56, 0.56, 0.74] + + s.colors[imgui.COLOR_BUTTON] = [0.9, 0.7, 0.0, 0.75] + s.colors[imgui.COLOR_BUTTON_HOVERED] = [0.9, 0.7, 0.0, 0.9] + s.colors[imgui.COLOR_BUTTON_ACTIVE] = [0.9, 0.7, 0.0, 1.0] + + s.colors[imgui.COLOR_HEADER] = [0.00, 0.00, 0.00, 0.52] + s.colors[imgui.COLOR_HEADER_HOVERED] = [0.00, 0.00, 0.00, 0.36] + s.colors[imgui.COLOR_HEADER_ACTIVE] = [0.20, 0.22, 0.23, 0.33] + s.colors[imgui.COLOR_SEPARATOR] = [0.28, 0.28, 0.28, 0.29] + s.colors[imgui.COLOR_SEPARATOR_HOVERED] = [0.44, 0.44, 0.44, 0.29] + s.colors[imgui.COLOR_SEPARATOR_ACTIVE] = [0.40, 0.44, 0.47, 1.00] + s.colors[imgui.COLOR_RESIZE_GRIP] = [0.28, 0.28, 0.28, 0.29] + s.colors[imgui.COLOR_RESIZE_GRIP_HOVERED] = [0.44, 0.44, 0.44, 0.29] + s.colors[imgui.COLOR_RESIZE_GRIP_ACTIVE] = [0.40, 0.44, 0.47, 1.00] + + s.colors[imgui.COLOR_TAB] = [1.00, 0.00, 0.00, 0.52] + s.colors[imgui.COLOR_TAB_HOVERED] = [0.14, 0.14, 0.14, 1.00] + s.colors[imgui.COLOR_TAB_ACTIVE] = [0.20, 0.20, 0.20, 0.36] + s.colors[imgui.COLOR_TAB_UNFOCUSED] = [0.00, 0.00, 0.00, 0.52] + s.colors[imgui.COLOR_TAB_UNFOCUSED_ACTIVE] = [0.14, 0.14, 0.14, 1.00] + + s.colors[imgui.COLOR_PLOT_LINES] = [1.00, 0.80, 0.00, 0.90] + s.colors[imgui.COLOR_PLOT_LINES_HOVERED] = [1.00, 0.80, 0.00, 1.00] + + s.colors[imgui.COLOR_PLOT_HISTOGRAM] = [1.00, 0.80, 0.00, 0.90] + s.colors[imgui.COLOR_PLOT_HISTOGRAM_HOVERED] = [1.00, 0.80, 0.00, 1.00] + + s.colors[imgui.COLOR_TEXT_SELECTED_BACKGROUND] = [0.20, 0.22, 0.23, 1.00] + + s.colors[imgui.COLOR_NAV_HIGHLIGHT] = [1.00, 0.00, 0.00, 1.00] + s.colors[imgui.COLOR_NAV_WINDOWING_HIGHLIGHT] = [1.00, 0.00, 0.00, 0.70] + s.colors[imgui.COLOR_NAV_WINDOWING_HIGHLIGHT] = [1.00, 0.00, 0.00, 0.20] + s.colors[imgui.COLOR_NAV_WINDOWING_DIM_BACKGROUND] = [1.00, 0.00, 0.00, 0.35] + + +# ---------------------------------------------------------------------------- @contextlib.contextmanager def grayed_out(cond=True): @@ -66,7 +125,8 @@ def grayed_out(cond=True): else: yield -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- @contextlib.contextmanager def item_width(width=None): @@ -77,7 +137,8 @@ def item_width(width=None): else: yield -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def scoped_by_object_id(method): def decorator(self, *args, **kwargs): @@ -85,9 +146,11 @@ def decorator(self, *args, **kwargs): res = method(self, *args, **kwargs) imgui.pop_id() return res + return decorator -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def button(label, width=0, enabled=True): with grayed_out(not enabled): @@ -95,7 +158,8 @@ def button(label, width=0, enabled=True): clicked = clicked and enabled return clicked -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def collapsing_header(text, visible=None, flags=0, default=False, enabled=True, show=True): expanded = False @@ -109,7 +173,8 @@ def collapsing_header(text, visible=None, flags=0, default=False, enabled=True, expanded = expanded and enabled return expanded, visible -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def popup_button(label, width=0, enabled=True): if button(label, width, enabled): @@ -117,7 +182,8 @@ def popup_button(label, width=0, enabled=True): opened = imgui.begin_popup(label) return opened -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def input_text(label, value, buffer_length, flags, width=None, help_text=''): old_value = value @@ -134,7 +200,8 @@ def input_text(label, value, buffer_length, flags, width=None, help_text=''): changed = (value != old_value) return changed, value -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def drag_previous_control(enabled=True): dragging = False @@ -148,24 +215,27 @@ def drag_previous_control(enabled=True): imgui.end_drag_drop_source() return dragging, dx, dy -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def drag_button(label, width=0, enabled=True): clicked = button(label, width=width, enabled=enabled) dragging, dx, dy = drag_previous_control(enabled=enabled) return clicked, dragging, dx, dy -#---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- def drag_hidden_window(label, x, y, width, height, enabled=True): imgui.push_style_color(imgui.COLOR_WINDOW_BACKGROUND, 0, 0, 0, 0) imgui.push_style_color(imgui.COLOR_BORDER, 0, 0, 0, 0) imgui.set_next_window_position(x, y) imgui.set_next_window_size(width, height) - imgui.begin(label, closable=False, flags=(imgui.WINDOW_NO_TITLE_BAR | imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_MOVE)) + imgui.begin(label, closable=False, + flags=(imgui.WINDOW_NO_TITLE_BAR | imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_MOVE)) dragging, dx, dy = drag_previous_control(enabled=enabled) imgui.end() imgui.pop_style_color(2) return dragging, dx, dy -#---------------------------------------------------------------------------- +# ---------------------------------------------------------------------------- diff --git a/presets.json b/presets.json new file mode 100644 index 0000000..9d0416e --- /dev/null +++ b/presets.json @@ -0,0 +1 @@ +{"Default": "gaussian._xyz = gaussian._xyz\ngaussian._rotation = gaussian._rotation\ngaussian._scaling = gaussian._scaling\ngaussian._opacity = gaussian._opacity\ngaussian._features_dc = gaussian._features_dc\ngaussian._features_rest = gaussian._features_rest\nself.bg_color[:] = 0\n", "Point Cloud": "gaussian._xyz = gaussian._xyz\ngaussian._rotation = gaussian._rotation\ngaussian._scaling = gaussian._scaling*0 - 8\ngaussian._opacity = gaussian._opacity*0 + 10\ngaussian._features_dc = gaussian._features_dc\ngaussian._features_rest = gaussian._features_rest\nself.bg_color[:] = 1\n", "Only SH": "gaussian._xyz = gaussian._xyz\ngaussian._rotation = gaussian._rotation\ngaussian._scaling = gaussian._scaling\ngaussian._opacity = gaussian._opacity\ngaussian._features_dc = gaussian._features_dc * 0\ngaussian._features_rest = gaussian._features_rest\nself.bg_color[:] = 1\n", "Mask Sphere": "mask = torch.linalg.norm(gaussian._xyz, dim=-1) < slider.x\n\ngaussian._xyz = gaussian._xyz[mask]\ngaussian._rotation = gaussian._rotation[mask]\ngaussian._scaling = gaussian._scaling[mask]\ngaussian._opacity = gaussian._opacity[mask]\ngaussian._features_dc = gaussian._features_dc[mask]\ngaussian._features_rest = gaussian._features_rest[mask]\nself.bg_color[:] = 1\n", "Mask Small Gaussians": "mask = torch.linalg.norm(gaussian._scaling, dim=-1) < slider.x * 2\n\ngaussian._xyz = gaussian._xyz[mask]\ngaussian._rotation = gaussian._rotation[mask]\ngaussian._scaling = gaussian._scaling[mask]\ngaussian._opacity = gaussian._opacity[mask]\ngaussian._features_dc = gaussian._features_dc[mask]\ngaussian._features_rest = gaussian._features_rest[mask]\nself.bg_color[:] = 1\n"} \ No newline at end of file diff --git a/run_main.py b/run_main.py index 0a30d80..2bfe8b0 100644 --- a/run_main.py +++ b/run_main.py @@ -105,22 +105,46 @@ def draw_frame(self): ) # Widgets. - self.load_widget(True) + expanded, _visible = imgui_utils.collapsing_header("Load", default=True) + imgui.indent() + self.load_widget(expanded) + imgui.unindent() + expanded, _visible = imgui_utils.collapsing_header("Performance", default=False) + imgui.indent() self.perf_widget(expanded) + imgui.unindent() + expanded, _visible = imgui_utils.collapsing_header("Camera", default=False) + imgui.indent() self.cam_widget(expanded) + imgui.unindent() + if self.use_gan_decoder: expanded, _visible = imgui_utils.collapsing_header("Latent", default=False) + imgui.indent() self.latent_widget(expanded) + imgui.unindent() + expanded, _visible = imgui_utils.collapsing_header("Video", default=False) + imgui.indent() self.video_widget(expanded) + imgui.unindent() + expanded, _visible = imgui_utils.collapsing_header("Save", default=False) + imgui.indent() self.capture_widget(expanded) - expanded, _visible = imgui_utils.collapsing_header("Edit", default=True) + imgui.unindent() + + expanded, _visible = imgui_utils.collapsing_header("Edit", default=False) + imgui.indent() self.edit_widget(expanded) - expanded, _visible = imgui_utils.collapsing_header("Eval", default=True) + imgui.unindent() + + expanded, _visible = imgui_utils.collapsing_header("Eval", default=False) + imgui.indent() self.eval_widget(expanded) + imgui.unindent() # Render. if self.is_skipping_frames(): diff --git a/widgets/cam_widget.py b/widgets/cam_widget.py index 73afcd3..8803fdc 100644 --- a/widgets/cam_widget.py +++ b/widgets/cam_widget.py @@ -23,7 +23,7 @@ class CamWidget: def __init__(self, viz): self.viz = viz self.fov = 45 - self.size = 1024 + self.size = 512 self.radius = 3 self.lookat_point = torch.tensor((0.0, 0.0, 0.0), device="cuda") self.cam_pos = torch.tensor([0.0, 0.0, 1.0], device="cuda") @@ -102,11 +102,13 @@ def __call__(self, show=True): imgui.same_line() _changed, self.size = imgui.input_int("##size", self.size, 128) + imgui.text("Camera Mode") + imgui.same_line() _clicked, self.current_control_mode = imgui.combo( - "Camera Modes", self.current_control_mode, self.control_modes + "##Camera Modes", self.current_control_mode, self.control_modes ) - imgui.push_item_width(150) + imgui.push_item_width(200) imgui.text("Up Vector") imgui.same_line() _changed, up_vector_tuple = imgui.input_float3("##up_vector", *self.up_vector, format="%.1f") @@ -136,7 +138,7 @@ def __call__(self, show=True): imgui.same_line() if imgui.button("Set to xyz mean") and "mean_xyz" in viz.result.keys(): self.lookat_point = viz.result.mean_xyz - imgui.pop_item_width() + imgui.pop_item_width() _, self.invert_x = imgui.checkbox("invert x", self.invert_x) _, self.invert_y = imgui.checkbox("invert y", self.invert_y) diff --git a/widgets/edit_widget.py b/widgets/edit_widget.py index a6cf48c..0a8ae52 100644 --- a/widgets/edit_widget.py +++ b/widgets/edit_widget.py @@ -1,14 +1,10 @@ +import os.path + import imgui from gui_utils import imgui_utils -from viz_utils.dict import EasyDict - +import json -class EditWidget: - def __init__(self, viz): - self.viz = viz - - # Add a button to create slider that can be used in the code - self.text = """gaussian._xyz = gaussian._xyz +default_preset = """gaussian._xyz = gaussian._xyz gaussian._rotation = gaussian._rotation gaussian._scaling = gaussian._scaling gaussian._opacity = gaussian._opacity @@ -17,26 +13,60 @@ def __init__(self, viz): self.bg_color[:] = 0 """ - self.slider_values = EasyDict() - self.slider_ranges = EasyDict() + +class Slider: + def __init__(self, key, value, min_value, max_value): + self.key = key + self.value = value + self.min_value = min_value + self.max_value = max_value + + def render(self): + _changed, self.value = imgui.slider_float( + self.key, + self.value, + self.min_value, + self.max_value, + ) + + +class EditWidget: + def __init__(self, viz): + self.viz = viz + + self.presets = {} + self.load_presets() + self.text = self.presets["Default"] + self.var_names = "xyzijklmnuvwabcdefghopqrst" self.var_name_index = 1 self._cur_min_slider = -10 self._cur_max_slider = 10 self._cur_val_slider = 0 - self._cur_name_slider = "x" + self._cur_name_slider = self.var_names[self.var_name_index] + self._cur_preset_name = "" + + self.sliders: list[Slider] = [ + Slider( + key=self.var_names[0], + value=5, + min_value=0, + max_value=10 + ) + ] self.render_alpha = False self.render_depth = False self.render_gan_image = False @imgui_utils.scoped_by_object_id - def __call__(self, show=True): + def __call__(self, show=True, decoder=False): viz = self.viz if show: alpha_changed, self.render_alpha = imgui.checkbox("Render alpha", self.render_alpha) depth_changed, self.render_depth = imgui.checkbox("Render depth", self.render_depth) - _, self.render_gan_image = imgui.checkbox("Render GAN", self.render_gan_image) + if decoder: + _, self.render_gan_image = imgui.checkbox("Render GAN", self.render_gan_image) if self.render_alpha and alpha_changed: self.render_depth = False @@ -46,32 +76,56 @@ def __call__(self, show=True): self.render_sliders() imgui.new_line() + if imgui_utils.button("Browse Presets", enabled=True): + imgui.open_popup("browse_presets") + self.all_presets = self.presets.keys() + + if imgui.begin_popup("browse_presets"): + for preset in self.all_presets: + clicked, _state = imgui.menu_item(preset) + if clicked: + self.text = self.presets[preset] + imgui.end_popup() + dynamic_height = 10 + viz.font_size * (self.text.count("\n") + 2) _changed, self.text = imgui.input_text_multiline( "##input_text", self.text, width=viz.pane_w, height=dynamic_height ) + + imgui.text("Preset Name") + imgui.same_line() + _changed, self._cur_preset_name = imgui.input_text("##preset_name", self._cur_preset_name) + imgui.same_line() + if imgui.button("Save as Preset"): + self.presets[self._cur_preset_name] = self.text + with open("./presets.json", "w", encoding='utf-8') as f: + json.dump(self.presets, f) + self._cur_preset_name = "" + viz.args.edit_text = self.text viz.args.render_alpha = self.render_alpha viz.args.render_depth = self.render_depth viz.args.render_gan_image = self.render_gan_image - viz.args.update(self.slider_values) + viz.args.update({slider.key: slider.value for slider in self.sliders}) + + def load_presets(self): + if not os.path.exists("./presets.json"): + with open("./presets.json", "w", encoding='utf-8') as f: + json.dump(dict(default=default_preset), f) + + with open("./presets.json", "r", encoding='utf-8') as f: + self.presets = json.load(f) def render_sliders(self): delete_keys = [] - for slider_key in self.slider_values.keys(): - _changed, self.slider_values[slider_key] = imgui.slider_float( - slider_key, - self.slider_values[slider_key], - self.slider_ranges[slider_key][0], - self.slider_ranges[slider_key][1], - ) + for i, slider in enumerate(self.sliders): + slider.render() imgui.same_line() - if imgui.button("Remove " + slider_key): - delete_keys.append(slider_key) + if imgui.button("Remove " + slider.key): + delete_keys.append(i) - for key in delete_keys: - del self.slider_values[key] - del self.slider_ranges[key] + for i in delete_keys[::-1]: + del self.sliders[i] imgui.push_item_width(70) imgui.text("Var name") @@ -96,7 +150,13 @@ def render_sliders(self): imgui.same_line() if imgui.button("Add Slider"): - self.slider_values[self._cur_name_slider] = self._cur_val_slider - self.slider_ranges[self._cur_name_slider] = [self._cur_min_slider, self._cur_max_slider] - self._cur_name_slider = self.var_names[self.var_name_index % len(self.var_names)] + self.sliders.append( + Slider( + key=self._cur_name_slider, + value=self._cur_val_slider, + min_value=self._cur_min_slider, + max_value=self._cur_max_slider + ) + ) self.var_name_index += 1 + self._cur_name_slider = self.var_names[self.var_name_index % len(self.var_names)] diff --git a/widgets/load_widget_ply.py b/widgets/load_widget_ply.py index 314af59..181e7dd 100644 --- a/widgets/load_widget_ply.py +++ b/widgets/load_widget_ply.py @@ -44,7 +44,7 @@ def __call__(self, show=True): imgui.same_line() imgui.text(f"Scene {i + 1}: " + ply[len(self.root):]) - if imgui_utils.button("Add Scene", width=viz.button_w): + if imgui_utils.button("Add Scene"): self.plys.append(self.plys[-1]) use_splitscreen, self.use_splitscreen = imgui.checkbox("Splitscreen", self.use_splitscreen) From c16e9eacdac21a27e395a50278e25796506e927f Mon Sep 17 00:00:00 2001 From: Florian Barthel Date: Thu, 11 Jul 2024 16:35:48 +0200 Subject: [PATCH 2/5] minor style changes --- gui_utils/imgui_utils.py | 2 +- widgets/cam_widget.py | 33 +++++++++++++++++++-------------- widgets/capture_widget.py | 13 +++++-------- widgets/video_widget.py | 24 +++++++++++++++++++----- 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/gui_utils/imgui_utils.py b/gui_utils/imgui_utils.py index 2b14396..54af048 100644 --- a/gui_utils/imgui_utils.py +++ b/gui_utils/imgui_utils.py @@ -14,7 +14,7 @@ # ---------------------------------------------------------------------------- -def set_default_style(color_scheme='dark', spacing=5, indent=15, scrollbar=10): +def set_default_style(color_scheme='dark', spacing=5, indent=20, scrollbar=10): s = imgui.get_style() s.window_padding = [spacing, spacing] s.item_spacing = [spacing, spacing] diff --git a/widgets/cam_widget.py b/widgets/cam_widget.py index 8803fdc..aa4c204 100644 --- a/widgets/cam_widget.py +++ b/widgets/cam_widget.py @@ -35,7 +35,7 @@ def __init__(self, viz): self.invert_x = False self.invert_y = False self.move_speed = 0.02 - self.control_modes = ["orbit", "free"] + self.control_modes = ["Orbit", "WASD"] self.current_control_mode = 0 def drag(self, dx, dy): @@ -46,7 +46,7 @@ def drag(self, dx, dy): self.pose.pitch = np.clip(self.pose.pitch + y_dir * dy / viz.font_size * 3e-2, -np.pi / 2, np.pi / 2) def handle_wasd(self): - if self.control_modes[self.current_control_mode] == "free": + if self.control_modes[self.current_control_mode] == "WASD": self.forward = get_forward_vector( lookat_position=self.cam_pos, horizontal_mean=self.pose.yaw + np.pi / 2, @@ -69,7 +69,7 @@ def handle_wasd(self): if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 3): # D self.cam_pos += self.sideways * self.move_speed * multiply - elif self.control_modes[self.current_control_mode] == "orbit": + elif self.control_modes[self.current_control_mode] == "Orbit": self.cam_pos = get_origin(self.pose.yaw + np.pi / 2, self.pose.pitch + np.pi / 2, self.radius, self.lookat_point, device=torch.device("cuda"), up_vector=self.up_vector) self.forward = normalize_vecs(self.lookat_point - self.cam_pos) if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 22): # W @@ -85,9 +85,9 @@ def handle_mouse(self): mouse_pos = imgui.get_io().mouse_pos if mouse_pos.x >= self.viz.pane_w: wheel = imgui.get_io().mouse_wheel - if self.control_modes[self.current_control_mode] == "free": + if self.control_modes[self.current_control_mode] == "WASD": self.cam_pos += self.forward * self.move_speed * wheel - elif self.control_modes[self.current_control_mode] == "orbit": + elif self.control_modes[self.current_control_mode] == "Orbit": self.radius -= wheel / 10 @imgui_utils.scoped_by_object_id @@ -99,18 +99,18 @@ def __call__(self, show=True): if show: imgui.text("Resolution") - imgui.same_line() + imgui.same_line(viz.label_w) _changed, self.size = imgui.input_int("##size", self.size, 128) imgui.text("Camera Mode") - imgui.same_line() + imgui.same_line(viz.label_w) _clicked, self.current_control_mode = imgui.combo( "##Camera Modes", self.current_control_mode, self.control_modes ) imgui.push_item_width(200) imgui.text("Up Vector") - imgui.same_line() + imgui.same_line(viz.label_w) _changed, up_vector_tuple = imgui.input_float3("##up_vector", *self.up_vector, format="%.1f") if _changed: self.up_vector = torch.tensor(up_vector_tuple, device="cuda") @@ -121,18 +121,18 @@ def __call__(self, show=True): self.pose.pitch = 0 imgui.text("FOV") - imgui.same_line() + imgui.same_line(viz.label_w) _changed, self.fov = imgui.slider_float("##fov", self.fov, 1, 180, format="%.1f °") - if self.control_modes[self.current_control_mode] == "orbit": + if self.control_modes[self.current_control_mode] == "Orbit": imgui.text("Radius") - imgui.same_line() + imgui.same_line(viz.label_w) _changed, self.radius = imgui.slider_float("##radius", self.radius, 0, 10, format="%.1f") imgui.same_line() if imgui.button("Set to xyz stddev") and "std_xyz" in viz.result.keys(): self.radius = viz.result.std_xyz.item() imgui.text("Look at point") - imgui.same_line() + imgui.same_line(viz.label_w) _changed, look_at_point_tuple = imgui.input_float3("##lookat", *self.lookat_point, format="%.1f") self.lookat_point = torch.tensor(look_at_point_tuple, device=torch.device("cuda")) imgui.same_line() @@ -140,8 +140,13 @@ def __call__(self, show=True): self.lookat_point = viz.result.mean_xyz imgui.pop_item_width() - _, self.invert_x = imgui.checkbox("invert x", self.invert_x) - _, self.invert_y = imgui.checkbox("invert y", self.invert_y) + imgui.text("Invert X") + imgui.same_line(viz.label_w) + _, self.invert_x = imgui.checkbox("##invert_x", self.invert_x) + + imgui.text("Invert Y") + imgui.same_line(viz.label_w) + _, self.invert_y = imgui.checkbox("##invert_y", self.invert_y) self.cam_params = create_cam2world_matrix(self.forward, self.cam_pos, self.up_vector).to("cuda")[0] diff --git a/widgets/capture_widget.py b/widgets/capture_widget.py index 3d2d188..a49fd12 100644 --- a/widgets/capture_widget.py +++ b/widgets/capture_widget.py @@ -24,20 +24,17 @@ def __call__(self, show=True): viz = self.viz if show: with imgui_utils.grayed_out(self.disabled_time != 0): - imgui.text('Capture') + imgui.text('Save Screenshot') imgui.same_line(viz.label_w) - _changed, self.path = imgui_utils.input_text('##path', self.path, 1024, - flags=(imgui.INPUT_TEXT_AUTO_SELECT_ALL | imgui.INPUT_TEXT_ENTER_RETURNS_TRUE), - width=(-1 - viz.button_w * 2 - viz.spacing * 2), - help_text='PATH') if imgui.is_item_hovered() and not imgui.is_item_active() and self.path != '': imgui.set_tooltip(self.path) - imgui.same_line() - if imgui_utils.button('Save image', width=viz.button_w, enabled=(self.disabled_time == 0 and 'image' in viz.result)): + if imgui_utils.button('Save', width=viz.button_w, enabled=(self.disabled_time == 0 and 'image' in viz.result)): if 'image' in viz.result: self.save_png(viz.result.image) - if imgui_utils.button('Save ply', width=viz.button_w): + imgui.text('Save PLY') + imgui.same_line(viz.label_w) + if imgui_utils.button('Save', width=viz.button_w): viz.args.save_ply_path = self.path_ply else: viz.args.save_ply_path = None diff --git a/widgets/video_widget.py b/widgets/video_widget.py index 2d27285..815a18b 100644 --- a/widgets/video_widget.py +++ b/widgets/video_widget.py @@ -20,11 +20,25 @@ def __call__(self, show=True): viz = self.viz viz.args.video_cams = [] if show: - _changed, self.num_frames = imgui.input_int("num frames", self.num_frames) - _changed, self.cam_height = imgui.input_float("camera height", self.cam_height) - _changed, self.radius = imgui.input_float("radius", self.radius) - _changed, self.resolution = imgui.input_int("resolution", self.resolution) - _changed, self.fov = imgui.input_int("fov", self.fov) + imgui.text("Num Frames") + imgui.same_line(viz.label_w) + _changed, self.num_frames = imgui.input_int("##num_frames", self.num_frames) + + imgui.text("Camera Height") + imgui.same_line(viz.label_w) + _changed, self.cam_height = imgui.input_float("##camera_height", self.cam_height) + + imgui.text("Radius") + imgui.same_line(viz.label_w) + _changed, self.radius = imgui.input_float("##radius", self.radius) + + imgui.text("Resolution") + imgui.same_line(viz.label_w) + _changed, self.resolution = imgui.input_int("##resolution", self.resolution) + + imgui.text("FOV") + imgui.same_line(viz.label_w) + _changed, self.fov = imgui.input_int("##fov", self.fov) if imgui.button("Render"): xs = np.linspace(0, 2 * np.pi, self.num_frames, endpoint=False) From 96404d7dcfb2fb16cc3dbbd4cc1c03270671e981 Mon Sep 17 00:00:00 2001 From: Florian Barthel Date: Fri, 12 Jul 2024 01:58:45 +0200 Subject: [PATCH 3/5] using imgui bundle --- gaussian-splatting/scene/gaussian_model.py | 1 - gui_utils/constants.py | 863 +++++++++++++++++++++ gui_utils/imgui_utils.py | 178 ++--- gui_utils/imgui_window.py | 7 +- run_main.py | 21 +- widgets/cam_widget.py | 38 +- widgets/capture_widget.py | 2 +- widgets/edit_widget.py | 21 +- widgets/eval_widget.py | 4 +- widgets/latent_widget.py | 2 +- widgets/load_widget_pkl.py | 2 +- widgets/load_widget_ply.py | 4 +- widgets/performance_widget.py | 17 +- widgets/video_widget.py | 2 +- 14 files changed, 1011 insertions(+), 151 deletions(-) create mode 100644 gui_utils/constants.py diff --git a/gaussian-splatting/scene/gaussian_model.py b/gaussian-splatting/scene/gaussian_model.py index 0bca656..6a84bd8 100644 --- a/gaussian-splatting/scene/gaussian_model.py +++ b/gaussian-splatting/scene/gaussian_model.py @@ -25,7 +25,6 @@ def log_transform(x): return torch.sign(x) * torch.log1p(torch.abs(x)) def inverse_log_transform(y): - assert y.max() < 20, "Probably mixed up linear and log values for xyz. These going in here are supposed to be quite small (log scale)" return torch.sign(y) * (torch.expm1(torch.abs(y))) diff --git a/gui_utils/constants.py b/gui_utils/constants.py new file mode 100644 index 0000000..f70f583 --- /dev/null +++ b/gui_utils/constants.py @@ -0,0 +1,863 @@ + +from imgui.core import * # noqa +from imgui import core +from imgui.extra import * # noqa +from imgui import extra + + +# TODO: Complete and correcte doc text for ImGui v1.79 + +VERTEX_BUFFER_POS_OFFSET = extra.vertex_buffer_vertex_pos_offset() +VERTEX_BUFFER_UV_OFFSET = extra.vertex_buffer_vertex_uv_offset() +VERTEX_BUFFER_COL_OFFSET = extra.vertex_buffer_vertex_col_offset() + +VERTEX_SIZE = extra.vertex_buffer_vertex_size() + +INDEX_SIZE = extra.index_buffer_index_size() + +# ==== Condition constants (redefines for autodoc) +#: No condition (always set the variable), same as _Always +NONE = core.NONE +#: No condition (always set the variable) +ALWAYS = core.ALWAYS +#: Set the variable once per runtime session (only the first call will succeed) +ONCE = core.ONCE +#: Set the variable if the object/window has no persistently saved data (no entry in .ini file) +FIRST_USE_EVER = core.FIRST_USE_EVER +#: Set the variable if the object/window is appearing after being hidden/inactive (or the first time) +APPEARING = core.APPEARING + + +# === Key map constants (redefines for autodoc) +#: for tabbing through fields +KEY_TAB = core.KEY_TAB +#: for text edit +KEY_LEFT_ARROW = core.KEY_LEFT_ARROW +#: for text edit +KEY_RIGHT_ARROW = core.KEY_RIGHT_ARROW +#: for text edit +KEY_UP_ARROW = core.KEY_UP_ARROW +#: for text edit +KEY_DOWN_ARROW = core.KEY_DOWN_ARROW +KEY_PAGE_UP = core.KEY_PAGE_UP +KEY_PAGE_DOWN = core.KEY_PAGE_DOWN +#: for text edit +KEY_HOME = core.KEY_HOME +#: for text edit +KEY_END = core.KEY_END +#: for text edit +KEY_INSERT = core.KEY_INSERT +#: for text edit +KEY_DELETE = core.KEY_DELETE +#: for text edit +KEY_BACKSPACE = core.KEY_BACKSPACE +#: for text edit +KEY_SPACE = core.KEY_SPACE +#: for text edit +KEY_ENTER = core.KEY_ENTER +#: for text edit +KEY_ESCAPE = core.KEY_ESCAPE +KEY_PAD_ENTER = core.KEY_PAD_ENTER +#: for text edit CTRL+A: select all +KEY_A = core.KEY_A +#: for text edit CTRL+C: copy +KEY_C = core.KEY_C +#: for text edit CTRL+V: paste +KEY_V = core.KEY_V +#: for text edit CTRL+X: cut +KEY_X = core.KEY_X +#: for text edit CTRL+Y: redo +KEY_Y = core.KEY_Y +#: for text edit CTRL+Z: undo +KEY_Z = core.KEY_Z + +# === Nav Input (redefines for autodoc) +#: activate / open / toggle / tweak value e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) +NAV_INPUT_ACTIVATE = core.NAV_INPUT_ACTIVATE +#: cancel / close / exit e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) +NAV_INPUT_CANCEL = core.NAV_INPUT_CANCEL +#: text input / on-screen keyboard e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) +NAV_INPUT_INPUT = core.NAV_INPUT_INPUT +#: tap: toggle menu / hold: focus, move, resize e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) +NAV_INPUT_MENU = core.NAV_INPUT_MENU +#: move / tweak / resize window (w/ PadMenu) e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) +NAV_INPUT_DPAD_LEFT = core.NAV_INPUT_DPAD_LEFT +NAV_INPUT_DPAD_RIGHT = core.NAV_INPUT_DPAD_RIGHT +NAV_INPUT_DPAD_UP = core.NAV_INPUT_DPAD_UP +NAV_INPUT_DPAD_DOWN = core.NAV_INPUT_DPAD_DOWN +#: scroll / move window (w/ PadMenu) e.g. Left Analog Stick Left/Right/Up/Down +NAV_INPUT_L_STICK_LEFT = core.NAV_INPUT_L_STICK_LEFT +NAV_INPUT_L_STICK_RIGHT = core.NAV_INPUT_L_STICK_RIGHT +NAV_INPUT_L_STICK_UP = core.NAV_INPUT_L_STICK_UP +NAV_INPUT_L_STICK_DOWN = core.NAV_INPUT_L_STICK_DOWN +#: next window (w/ PadMenu) e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) +NAV_INPUT_FOCUS_PREV = core.NAV_INPUT_FOCUS_PREV +#: prev window (w/ PadMenu) e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) +NAV_INPUT_FOCUS_NEXT = core.NAV_INPUT_FOCUS_NEXT +#: slower tweaks e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) +NAV_INPUT_TWEAK_SLOW = core.NAV_INPUT_TWEAK_SLOW +#: faster tweaks e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) +NAV_INPUT_TWEAK_FAST = core.NAV_INPUT_TWEAK_FAST + + +# === Key Mode Flags (redefines for autodoc) +KEY_MOD_NONE = core.KEY_MOD_NONE +KEY_MOD_CTRL = core.KEY_MOD_CTRL +KEY_MOD_SHIFT = core.KEY_MOD_SHIFT +KEY_MOD_ALT = core.KEY_MOD_ALT +KEY_MOD_SUPER = core.KEY_MOD_SUPER + +# === Style var constants (redefines for autodoc) +#: associated type: ``float``. +STYLE_ALPHA = core.STYLE_ALPHA +#: associated type: ``Vec2``. +STYLE_WINDOW_PADDING = core.STYLE_WINDOW_PADDING +#: associated type: ``float``. +STYLE_WINDOW_ROUNDING = core.STYLE_WINDOW_ROUNDING +#: associated type: ``float``. +STYLE_WINDOW_BORDERSIZE = core.STYLE_WINDOW_BORDERSIZE +#: associated type: ``Vec2``. +STYLE_WINDOW_MIN_SIZE = core.STYLE_WINDOW_MIN_SIZE +#: associated type: ``Vec2``. +STYLE_WINDOW_TITLE_ALIGN = core.STYLE_WINDOW_TITLE_ALIGN +#: associated type: ``float``. +STYLE_CHILD_ROUNDING = core.STYLE_CHILD_ROUNDING +#: associated type: ``float``. +STYLE_CHILD_BORDERSIZE = core.STYLE_CHILD_BORDERSIZE +#: associated type: ``float``. +STYLE_POPUP_ROUNDING = core.STYLE_POPUP_ROUNDING +#: associated type: ``float``. +STYLE_POPUP_BORDERSIZE = core.STYLE_POPUP_BORDERSIZE +#: associated type: ``Vec2``. +STYLE_FRAME_PADDING = core.STYLE_FRAME_PADDING +#: associated type: ``float``. +STYLE_FRAME_ROUNDING = core.STYLE_FRAME_ROUNDING +#: associated type: ``float``. +STYLE_FRAME_BORDERSIZE = core.STYLE_FRAME_BORDERSIZE +#: associated type: ``Vec2``. +STYLE_ITEM_SPACING = core.STYLE_ITEM_SPACING +#: associated type: ``Vec2``. +STYLE_ITEM_INNER_SPACING = core.STYLE_ITEM_INNER_SPACING +#: associated type: ``float``. +STYLE_INDENT_SPACING = core.STYLE_INDENT_SPACING +#: associated type: ``Vec2``. +STYLE_CELL_PADDING = core.STYLE_CELL_PADDING +#: associated type: ``float``. +STYLE_SCROLLBAR_SIZE = core.STYLE_SCROLLBAR_SIZE +#: associated type: ``float``. +STYLE_SCROLLBAR_ROUNDING = core.STYLE_SCROLLBAR_ROUNDING +#: associated type: ``float``. +STYLE_GRAB_MIN_SIZE = core.STYLE_GRAB_MIN_SIZE +#: associated type: ``float``. +STYLE_GRAB_ROUNDING = core.STYLE_GRAB_ROUNDING +#: associated type: ``float`` +STYLE_TAB_ROUNDING = core.STYLE_TAB_ROUNDING +#: associated type: flags ImGuiAlign_*. +STYLE_BUTTON_TEXT_ALIGN = core.STYLE_BUTTON_TEXT_ALIGN +#: associated type: Vec2 +STYLE_SELECTABLE_TEXT_ALIGN = core.STYLE_SELECTABLE_TEXT_ALIGN + +# === Button Flags (redefines for autodoc) +BUTTON_NONE = core.BUTTON_NONE +#: React on left mouse button (default) +BUTTON_MOUSE_BUTTON_LEFT = core.BUTTON_MOUSE_BUTTON_LEFT +#: React on right mouse button +BUTTON_MOUSE_BUTTON_RIGHT = core.BUTTON_MOUSE_BUTTON_RIGHT +#: React on center mouse button +BUTTON_MOUSE_BUTTON_MIDDLE = core.BUTTON_MOUSE_BUTTON_MIDDLE + +# === Window flag constants (redefines for autodoc) +WINDOW_NONE = core.WINDOW_NONE +#: Disable title-bar. +WINDOW_NO_TITLE_BAR = core.WINDOW_NO_TITLE_BAR +#: Disable user resizing with the lower-right grip. +WINDOW_NO_RESIZE = core.WINDOW_NO_RESIZE +#: Disable user moving the window. +WINDOW_NO_MOVE = core.WINDOW_NO_MOVE +#: Disable scrollbars (window can still scroll with mouse or programmatically). +WINDOW_NO_SCROLLBAR = core.WINDOW_NO_SCROLLBAR +#: Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. +WINDOW_NO_SCROLL_WITH_MOUSE = core.WINDOW_NO_SCROLL_WITH_MOUSE +#: Disable user collapsing window by double-clicking on it. +WINDOW_NO_COLLAPSE = core.WINDOW_NO_COLLAPSE +#: Resize every window to its content every frame. +WINDOW_ALWAYS_AUTO_RESIZE = core.WINDOW_ALWAYS_AUTO_RESIZE +#: Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f). +WINDOW_NO_BACKGROUND = core.WINDOW_NO_BACKGROUND +#: Never load/save settings in ``.ini`` file. +WINDOW_NO_SAVED_SETTINGS = core.WINDOW_NO_SAVED_SETTINGS +#: Disable catching mouse, hovering test with pass through. +WINDOW_NO_MOUSE_INPUTS = core.WINDOW_NO_MOUSE_INPUTS +#: Has a menu-bar. +WINDOW_MENU_BAR = core.WINDOW_MENU_BAR +#: Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. +WINDOW_HORIZONTAL_SCROLLING_BAR = core.WINDOW_HORIZONTAL_SCROLLING_BAR +#: Disable taking focus when transitioning from hidden to visible state. +WINDOW_NO_FOCUS_ON_APPEARING = core.WINDOW_NO_FOCUS_ON_APPEARING +#: Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus). +WINDOW_NO_BRING_TO_FRONT_ON_FOCUS = core.WINDOW_NO_BRING_TO_FRONT_ON_FOCUS +#: Always show vertical scrollbar (even if ContentSize.y < Size.y). +WINDOW_ALWAYS_VERTICAL_SCROLLBAR = core.WINDOW_ALWAYS_VERTICAL_SCROLLBAR +#: Always show horizontal scrollbar (even if ContentSize.x < Size.x). +WINDOW_ALWAYS_HORIZONTAL_SCROLLBAR = core.WINDOW_ALWAYS_HORIZONTAL_SCROLLBAR +#: Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient). +WINDOW_ALWAYS_USE_WINDOW_PADDING = core.WINDOW_ALWAYS_USE_WINDOW_PADDING +#: No gamepad/keyboard navigation within the window. +WINDOW_NO_NAV_INPUTS = core.WINDOW_NO_NAV_INPUTS +#: No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB). +WINDOW_NO_NAV_FOCUS = core.WINDOW_NO_NAV_FOCUS +#: Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. When used in a tab/docking context, tab is selected on closure and closure is deferred by one frame to allow code to cancel the closure (with a confirmation popup, etc.) without flicker. +WINDOW_UNSAVED_DOCUMENT = core.WINDOW_UNSAVED_DOCUMENT +#: Shortcut: ``imgui.WINDOW_NO_NAV_INPUTS | imgui.WINDOW_NO_NAV_FOCUS``. +WINDOW_NO_NAV = core.WINDOW_NO_NAV +#: Shortcut: ``imgui.WINDOW_NO_TITLE_BAR | imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_SCROLLBAR | imgui.WINDOW_NO_COLLAPSE``. +WINDOW_NO_DECORATION = core.WINDOW_NO_DECORATION +#: Shortcut: ``imgui.WINDOW_NO_MOUSE_INPUTS | imgui.WINDOW_NO_NAV_INPUTS | imgui.WINDOW_NO_NAV_FOCUS``. +WINDOW_NO_INPUTS = core.WINDOW_NO_INPUTS + +# === Color Edit Flags (redefines for autodoc) +COLOR_EDIT_NONE = core.COLOR_EDIT_NONE +#: ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer). +COLOR_EDIT_NO_ALPHA = core.COLOR_EDIT_NO_ALPHA +#: ColorEdit: disable picker when clicking on color square. +COLOR_EDIT_NO_PICKER = core.COLOR_EDIT_NO_PICKER +#: ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. +COLOR_EDIT_NO_OPTIONS = core.COLOR_EDIT_NO_OPTIONS +#: ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs) +COLOR_EDIT_NO_SMALL_PREVIEW = core.COLOR_EDIT_NO_SMALL_PREVIEW +#: ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square). +COLOR_EDIT_NO_INPUTS = core.COLOR_EDIT_NO_INPUTS +#: ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. +COLOR_EDIT_NO_TOOLTIP = core.COLOR_EDIT_NO_TOOLTIP +#: ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). +COLOR_EDIT_NO_LABEL = core.COLOR_EDIT_NO_LABEL +#: ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead. +COLOR_EDIT_NO_SIDE_PREVIEW = core.COLOR_EDIT_NO_SIDE_PREVIEW +#: ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source. +COLOR_EDIT_NO_DRAG_DROP = core.COLOR_EDIT_NO_DRAG_DROP +#: ColorButton: disable border (which is enforced by default) +COLOR_EDIT_NO_BORDER = core.COLOR_EDIT_NO_BORDER + +#: ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. +COLOR_EDIT_ALPHA_BAR = core.COLOR_EDIT_ALPHA_BAR +#: ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. +COLOR_EDIT_ALPHA_PREVIEW = core.COLOR_EDIT_ALPHA_PREVIEW +#: ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. +COLOR_EDIT_ALPHA_PREVIEW_HALF = core.COLOR_EDIT_ALPHA_PREVIEW_HALF +#: (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). +COLOR_EDIT_HDR = core.COLOR_EDIT_HDR +#: ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. +COLOR_EDIT_DISPLAY_RGB = core.COLOR_EDIT_DISPLAY_RGB +#: ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. +COLOR_EDIT_DISPLAY_HSV = core.COLOR_EDIT_DISPLAY_HSV +#: ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. +COLOR_EDIT_DISPLAY_HEX = core.COLOR_EDIT_DISPLAY_HEX +#: ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. +COLOR_EDIT_UINT8 = core.COLOR_EDIT_UINT8 +#: ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. +COLOR_EDIT_FLOAT = core.COLOR_EDIT_FLOAT +#: ColorPicker: bar for Hue, rectangle for Sat/Value. +COLOR_EDIT_PICKER_HUE_BAR = core.COLOR_EDIT_PICKER_HUE_BAR +#: ColorPicker: wheel for Hue, triangle for Sat/Value. +COLOR_EDIT_PICKER_HUE_WHEEL = core.COLOR_EDIT_PICKER_HUE_WHEEL +#: ColorEdit, ColorPicker: input and output data in RGB format. +COLOR_EDIT_INPUT_RGB = core.COLOR_EDIT_INPUT_RGB +#: ColorEdit, ColorPicker: input and output data in HSV format. +COLOR_EDIT_INPUT_HSV = core.COLOR_EDIT_INPUT_HSV + +#: Shortcut: ``imgui.COLOR_EDIT_UINT8 | imgui.COLOR_EDIT_DISPLAY_RGB | imgui.COLOR_EDIT_INPUT_RGB | imgui.COLOR_EDIT_PICKER_HUE_BAR``. +COLOR_EDIT_DEFAULT_OPTIONS = core.COLOR_EDIT_DEFAULT_OPTIONS + +# === Tree node flag constants (redefines for autodoc) +TREE_NODE_NONE = core.TREE_NODE_NONE +#: Draw as selected +TREE_NODE_SELECTED = core.TREE_NODE_SELECTED +#: Draw frame with background (e.g. for :func:`imgui.core.collapsing_header`). +TREE_NODE_FRAMED = core.TREE_NODE_FRAMED +#: Hit testing to allow subsequent widgets to overlap this one +TREE_NODE_ALLOW_ITEM_OVERLAP = core.TREE_NODE_ALLOW_ITEM_OVERLAP +#: Don't do a ``TreePush()`` when open +#: (e.g. for :func:`imgui.core.collapsing_header`). +#: No extra indent nor pushing on ID stack. +TREE_NODE_NO_TREE_PUSH_ON_OPEN = core.TREE_NODE_NO_TREE_PUSH_ON_OPEN +#: Don't automatically and temporarily open node when Logging is active +#: (by default logging will automatically open tree nodes). +TREE_NODE_NO_AUTO_OPEN_ON_LOG = core.TREE_NODE_NO_AUTO_OPEN_ON_LOG +#: Default node to be open +TREE_NODE_DEFAULT_OPEN = core.TREE_NODE_DEFAULT_OPEN +#: Need double-click to open node. +TREE_NODE_OPEN_ON_DOUBLE_CLICK = core.TREE_NODE_OPEN_ON_DOUBLE_CLICK +#: Only open when clicking on the arrow part. If +#: :py:data:`TREE_NODE_OPEN_ON_DOUBLE_CLICK` is also set, +#: single-click arrow or double-click all box to open. +TREE_NODE_OPEN_ON_ARROW = core.TREE_NODE_OPEN_ON_ARROW +#: No collapsing, no arrow (use as a convenience for leaf nodes). +TREE_NODE_LEAF = core.TREE_NODE_LEAF +#: Display a bullet instead of arrow. +TREE_NODE_BULLET = core.TREE_NODE_BULLET +#: Use FramePadding (even for an unframed text node) to vertically align +#: text baseline to regular widget height. Equivalent to calling +#: ``align_text_to_frame_padding()`` +TREE_NODE_FRAME_PADDING = core.TREE_NODE_FRAME_PADDING +#: Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default. +TREE_NODE_SPAN_AVAILABLE_WIDTH = core.TREE_NODE_SPAN_AVAILABLE_WIDTH +#: Extend hit box to the left-most and right-most edges (bypass the indented area). +TREE_NODE_SPAN_FULL_WIDTH = core.TREE_NODE_SPAN_FULL_WIDTH +#: (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) +TREE_NODE_NAV_LEFT_JUPS_BACK_HERE = core.TREE_NODE_NAV_LEFT_JUPS_BACK_HERE +#: Shortcut: ``imgui.TREE_NODE_FRAMED | imgui.TREE_NODE_NO_AUTO_OPEN_ON_LOG``. +TREE_NODE_COLLAPSING_HEADER = core.TREE_NODE_COLLAPSING_HEADER + +# === Popup Flags (redefines for autodoc) +POPUP_NONE = core.POPUP_NONE +POPUP_MOUSE_BUTTON_LEFT = core.POPUP_MOUSE_BUTTON_LEFT +POPUP_MOUSE_BUTTON_RIGHT = core.POPUP_MOUSE_BUTTON_RIGHT +POPUP_MOUSE_BUTTON_MIDDLE = core.POPUP_MOUSE_BUTTON_MIDDLE +POPUP_MOUSE_BUTTON_MASK = core.POPUP_MOUSE_BUTTON_MASK +POPUP_MOUSE_BUTTON_DEFAULT = core.POPUP_MOUSE_BUTTON_DEFAULT +POPUP_NO_OPEN_OVER_EXISTING_POPUP = core.POPUP_NO_OPEN_OVER_EXISTING_POPUP +POPUP_NO_OPEN_OVER_ITEMS = core.POPUP_NO_OPEN_OVER_ITEMS +POPUP_ANY_POPUP_ID = core.POPUP_ANY_POPUP_ID +POPUP_ANY_POPUP_LEVEL = core.POPUP_ANY_POPUP_LEVEL +POPUP_ANY_POPUP = core.POPUP_ANY_POPUP + +# === Color flag constants (redefines for autodoc) +COLOR_TEXT = core.COLOR_TEXT +COLOR_TEXT_DISABLED = core.COLOR_TEXT_DISABLED +COLOR_WINDOW_BACKGROUND = core.COLOR_WINDOW_BACKGROUND +COLOR_CHILD_BACKGROUND = core.COLOR_CHILD_BACKGROUND +COLOR_POPUP_BACKGROUND = core.COLOR_POPUP_BACKGROUND +COLOR_BORDER = core.COLOR_BORDER +COLOR_BORDER_SHADOW = core.COLOR_BORDER_SHADOW +COLOR_FRAME_BACKGROUND = core.COLOR_FRAME_BACKGROUND +COLOR_FRAME_BACKGROUND_HOVERED = core.COLOR_FRAME_BACKGROUND_HOVERED +COLOR_FRAME_BACKGROUND_ACTIVE = core.COLOR_FRAME_BACKGROUND_ACTIVE +COLOR_TITLE_BACKGROUND = core.COLOR_TITLE_BACKGROUND +COLOR_TITLE_BACKGROUND_ACTIVE = core.COLOR_TITLE_BACKGROUND_ACTIVE +COLOR_TITLE_BACKGROUND_COLLAPSED = core.COLOR_TITLE_BACKGROUND_COLLAPSED +COLOR_MENUBAR_BACKGROUND = core.COLOR_MENUBAR_BACKGROUND +COLOR_SCROLLBAR_BACKGROUND = core.COLOR_SCROLLBAR_BACKGROUND +COLOR_SCROLLBAR_GRAB = core.COLOR_SCROLLBAR_GRAB +COLOR_SCROLLBAR_GRAB_HOVERED = core.COLOR_SCROLLBAR_GRAB_HOVERED +COLOR_SCROLLBAR_GRAB_ACTIVE = core.COLOR_SCROLLBAR_GRAB_ACTIVE +COLOR_CHECK_MARK = core.COLOR_CHECK_MARK +COLOR_SLIDER_GRAB = core.COLOR_SLIDER_GRAB +COLOR_SLIDER_GRAB_ACTIVE = core.COLOR_SLIDER_GRAB_ACTIVE +COLOR_BUTTON = core.COLOR_BUTTON +COLOR_BUTTON_HOVERED = core.COLOR_BUTTON_HOVERED +COLOR_BUTTON_ACTIVE = core.COLOR_BUTTON_ACTIVE +COLOR_HEADER = core.COLOR_HEADER +COLOR_HEADER_HOVERED = core.COLOR_HEADER_HOVERED +COLOR_HEADER_ACTIVE = core.COLOR_HEADER_ACTIVE +COLOR_SEPARATOR = core.COLOR_SEPARATOR +COLOR_SEPARATOR_HOVERED = core.COLOR_SEPARATOR_HOVERED +COLOR_SEPARATOR_ACTIVE = core.COLOR_SEPARATOR_ACTIVE +COLOR_RESIZE_GRIP = core.COLOR_RESIZE_GRIP +COLOR_RESIZE_GRIP_HOVERED = core.COLOR_RESIZE_GRIP_HOVERED +COLOR_RESIZE_GRIP_ACTIVE = core.COLOR_RESIZE_GRIP_ACTIVE +COLOR_TAB = COLOR_TAB +COLOR_TAB_HOVERED = COLOR_TAB_HOVERED +COLOR_TAB_ACTIVE = COLOR_TAB_ACTIVE +COLOR_TAB_UNFOCUSED = COLOR_TAB_UNFOCUSED +COLOR_TAB_UNFOCUSED_ACTIVE = COLOR_TAB_UNFOCUSED_ACTIVE +COLOR_PLOT_LINES = core.COLOR_PLOT_LINES +COLOR_PLOT_LINES_HOVERED = core.COLOR_PLOT_LINES_HOVERED +COLOR_PLOT_HISTOGRAM = core.COLOR_PLOT_HISTOGRAM +COLOR_PLOT_HISTOGRAM_HOVERED = core.COLOR_PLOT_HISTOGRAM_HOVERED +COLOR_TABLE_HEADER_BACKGROUND = core.COLOR_TABLE_HEADER_BACKGROUND +COLOR_TABLE_BORDER_STRONG = core.COLOR_TABLE_BORDER_STRONG +COLOR_TABLE_BORDER_LIGHT = core.COLOR_TABLE_BORDER_LIGHT +COLOR_TABLE_ROW_BACKGROUND = core.COLOR_TABLE_ROW_BACKGROUND +COLOR_TABLE_ROW_BACKGROUND_ALT = core.COLOR_TABLE_ROW_BACKGROUND_ALT +COLOR_TEXT_SELECTED_BACKGROUND = core.COLOR_TEXT_SELECTED_BACKGROUND +COLOR_DRAG_DROP_TARGET = core.COLOR_DRAG_DROP_TARGET +COLOR_NAV_HIGHLIGHT = core.COLOR_NAV_HIGHLIGHT +COLOR_NAV_WINDOWING_HIGHLIGHT = core.COLOR_NAV_WINDOWING_HIGHLIGHT +COLOR_NAV_WINDOWING_DIM_BACKGROUND = core.COLOR_NAV_WINDOWING_DIM_BACKGROUND +COLOR_MODAL_WINDOW_DIM_BACKGROUND = core.COLOR_MODAL_WINDOW_DIM_BACKGROUND +COLOR_COUNT = core.COLOR_COUNT + +# === Data Type (redefines for autodoc) +DATA_TYPE_S8 = core.DATA_TYPE_S8 +DATA_TYPE_U8 = core.DATA_TYPE_U8 +DATA_TYPE_S16 = core.DATA_TYPE_S16 +DATA_TYPE_U16 = core.DATA_TYPE_U16 +DATA_TYPE_S32 = core.DATA_TYPE_S32 +DATA_TYPE_U32 = core.DATA_TYPE_U32 +DATA_TYPE_S64 = core.DATA_TYPE_S64 +DATA_TYPE_U64 = core.DATA_TYPE_U64 +DATA_TYPE_FLOAT = core.DATA_TYPE_FLOAT +DATA_TYPE_DOUBLE = core.DATA_TYPE_DOUBLE + + +# === Selectable flag constants (redefines for autodoc) +SELECTABLE_NONE = core.SELECTABLE_NONE +#: Clicking this don't close parent popup window. +SELECTABLE_DONT_CLOSE_POPUPS = core.SELECTABLE_DONT_CLOSE_POPUPS +#: Selectable frame can span all columns +#: (text will still fit in current column). +SELECTABLE_SPAN_ALL_COLUMNS = core.SELECTABLE_SPAN_ALL_COLUMNS +#: Generate press events on double clicks too. +SELECTABLE_ALLOW_DOUBLE_CLICK = core.SELECTABLE_ALLOW_DOUBLE_CLICK +SELECTABLE_DISABLED = core.SELECTABLE_DISABLED +SELECTABLE_ALLOW_ITEM_OVERLAP = core.SELECTABLE_ALLOW_ITEM_OVERLAP + +# === Combo flag constants (redefines for autodoc) +COMBO_NONE = core.COMBO_NONE +#: Align the popup toward the left by default +COMBO_POPUP_ALIGN_LEFT = core.COMBO_POPUP_ALIGN_LEFT +#: Max ~4 items visible. Tip: If you want your combo popup to be a +#: specific size you can use SetNextWindowSizeConstraints() prior +#: to calling BeginCombo() +COMBO_HEIGHT_SMALL = core.COMBO_HEIGHT_SMALL +#: Max ~8 items visible (default) +COMBO_HEIGHT_REGULAR = core.COMBO_HEIGHT_REGULAR +#: Max ~20 items visible +COMBO_HEIGHT_LARGE = core.COMBO_HEIGHT_LARGE +#: As many fitting items as possible +COMBO_HEIGHT_LARGEST = core.COMBO_HEIGHT_LARGEST +#: Display on the preview box without the square arrow button +COMBO_NO_ARROW_BUTTON = core.COMBO_NO_ARROW_BUTTON +#: Display only a square arrow button +COMBO_NO_PREVIEW = core.COMBO_NO_PREVIEW +#: Shortcut: ``imgui.COMBO_HEIGHT_SMALL | imgui.COMBO_HEIGHT_REGULAR | imgui.COMBO_HEIGHT_LARGE | imgui.COMBO_HEIGHT_LARGEST``. +COMBO_HEIGHT_MASK = COMBO_HEIGHT_SMALL | COMBO_HEIGHT_REGULAR | COMBO_HEIGHT_LARGE | COMBO_HEIGHT_LARGEST + +# === Tab Bar Flags (redefines for autodoc) +TAB_BAR_NONE = core.TAB_BAR_NONE +#: Allow manually dragging tabs to re-order them + New tabs are appended at the end of list +TAB_BAR_REORDERABLE = core.TAB_BAR_REORDERABLE +#: Automatically select new tabs when they appear +TAB_BAR_AUTO_SELECT_NEW_TABS = core.TAB_BAR_AUTO_SELECT_NEW_TABS +#: Disable buttons to open the tab list popup +TAB_BAR_TAB_LIST_POPUP_BUTTON = core.TAB_BAR_TAB_LIST_POPUP_BUTTON +#: Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. +TAB_BAR_NO_CLOSE_WITH_MIDDLE_MOUSE_BUTTON = core.TAB_BAR_NO_CLOSE_WITH_MIDDLE_MOUSE_BUTTON #You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. +#: Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll) +TAB_BAR_NO_TAB_LIST_SCROLLING_BUTTONS = core.TAB_BAR_NO_TAB_LIST_SCROLLING_BUTTONS +#: Disable tooltips when hovering a tab +TAB_BAR_NO_TOOLTIP = core.TAB_BAR_NO_TOOLTIP +#: Resize tabs when they don't fit +TAB_BAR_FITTING_POLICY_RESIZE_DOWN = core.TAB_BAR_FITTING_POLICY_RESIZE_DOWN +#: Add scroll buttons when tabs don't fit +TAB_BAR_FITTING_POLICY_SCROLL = core.TAB_BAR_FITTING_POLICY_SCROLL +#: TAB_BAR_FITTING_POLICY_RESIZE_DOWN | TAB_BAR_FITTING_POLICY_SCROLL +TAB_BAR_FITTING_POLICY_MASK = core.TAB_BAR_FITTING_POLICY_MASK +#: TAB_BAR_FITTING_POLICY_RESIZE_DOWN +TAB_BAR_FITTING_POLICY_DEFAULT = core.TAB_BAR_FITTING_POLICY_DEFAULT + +# === Tab Item Flags (redefines for autodoc) +TAB_ITEM_NONE = core.TAB_ITEM_NONE +#: Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it without flicker. +TAB_ITEM_UNSAVED_DOCUMENT = core.TAB_ITEM_UNSAVED_DOCUMENT +#: Trigger flag to programmatically make the tab selected when calling BeginTabItem() +TAB_ITEM_SET_SELECTED = core.TAB_ITEM_SET_SELECTED +#: Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. +TAB_ITEM_NO_CLOSE_WITH_MIDDLE_MOUSE_BUTTON = core.TAB_ITEM_NO_CLOSE_WITH_MIDDLE_MOUSE_BUTTON # You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. +#: Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() +TAB_ITEM_NO_PUSH_ID = core.TAB_ITEM_NO_PUSH_ID +#: Disable tooltip for the given tab +TAB_ITEM_NO_TOOLTIP = core.TAB_ITEM_NO_TOOLTIP +#: Disable reordering this tab or having another tab cross over this tab +TAB_ITEM_NO_REORDER = core.TAB_ITEM_NO_REORDER +#: Enforce the tab position to the left of the tab bar (after the tab list popup button) +TAB_ITEM_LEADING = core.TAB_ITEM_LEADING +#: Enforce the tab position to the right of the tab bar (before the scrolling buttons) +TAB_ITEM_TRAILING = core.TAB_ITEM_TRAILING + + +# === Table Flags === +#: # Features +#: None +TABLE_NONE = core.TABLE_NONE +#: Enable resizing columns. +TABLE_RESIZABLE = core.TABLE_RESIZABLE +#: Enable reordering columns in header row (need calling TableSetupColumn() + TableHeadersRow() to display headers) +TABLE_REORDERABLE = core.TABLE_REORDERABLE +#: Enable hiding/disabling columns in context menu. +TABLE_HIDEABLE = core.TABLE_HIDEABLE +#: Enable sorting. Call TableGetSortSpecs() to obtain sort specs. Also see ImGuiTableFlags_SortMulti and ImGuiTableFlags_SortTristate. +TABLE_SORTABLE = core.TABLE_SORTABLE +#: Disable persisting columns order, width and sort settings in the .ini file. +TABLE_NO_SAVED_SETTINGS = core.TABLE_NO_SAVED_SETTINGS +#: Right-click on columns body/contents will display table context menu. By default it is available in TableHeadersRow(). +TABLE_CONTEXT_MENU_IN_BODY = core.TABLE_CONTEXT_MENU_IN_BODY +#: # Decorations +#: Set each RowBg color with ImGuiCol_TableRowBg or ImGuiCol_TableRowBgAlt (equivalent of calling TableSetBgColor with ImGuiTableBgFlags_RowBg0 on each row manually) +TABLE_ROW_BACKGROUND = core.TABLE_ROW_BACKGROUND +#: Draw horizontal borders between rows. +TABLE_BORDERS_INNER_HORIZONTAL = core.TABLE_BORDERS_INNER_HORIZONTAL +#: Draw horizontal borders at the top and bottom. +TABLE_BORDERS_OUTER_HORIZONTAL = core.TABLE_BORDERS_OUTER_HORIZONTAL +#: Draw vertical borders between columns. +TABLE_BORDERS_INNER_VERTICAL = core.TABLE_BORDERS_INNER_VERTICAL +#: Draw vertical borders on the left and right sides. +TABLE_BORDERS_OUTER_VERTICAL = core.TABLE_BORDERS_OUTER_VERTICAL +#: Draw horizontal borders. +TABLE_BORDERS_HORIZONTAL = core.TABLE_BORDERS_HORIZONTAL +#: Draw vertical borders. +TABLE_BORDERS_VERTICAL = core.TABLE_BORDERS_VERTICAL +#: Draw inner borders. +TABLE_BORDERS_INNER = core.TABLE_BORDERS_INNER +#: Draw outer borders. +TABLE_BORDERS_OUTER = core.TABLE_BORDERS_OUTER +#: Draw all borders. +TABLE_BORDERS = core.TABLE_BORDERS +#: [ALPHA] Disable vertical borders in columns Body (borders will always appears in Headers). -> May move to style +TABLE_NO_BORDERS_IN_BODY = core.TABLE_NO_BORDERS_IN_BODY +#: [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style +TABLE_NO_BORDERS_IN_BODY_UTIL_RESIZE = core.TABLE_NO_BORDERS_IN_BODY_UTIL_RESIZE +#: # Sizing Policy (read above for defaults) +#: Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width. +TABLE_SIZING_FIXED_FIT = core.TABLE_SIZING_FIXED_FIT +#: Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible. +TABLE_SIZING_FIXED_SAME = core.TABLE_SIZING_FIXED_SAME +#: Columns default to _WidthStretch with default weights proportional to each columns contents widths. +TABLE_SIZING_STRETCH_PROP = core.TABLE_SIZING_STRETCH_PROP +#: Columns default to _WidthStretch with default weights all equal, unless overriden by TableSetupColumn(). +TABLE_SIZING_STRETCH_SAME = core.TABLE_SIZING_STRETCH_SAME +#: # Sizing Extra Options +#: Make outer width auto-fit to columns, overriding outer_size.x value. Only available when ScrollX/ScrollY are disabled and Stretch columns are not used. +TABLE_NO_HOST_EXTEND_X = core.TABLE_NO_HOST_EXTEND_X +#: Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible. +TABLE_NO_HOST_EXTEND_Y = core.TABLE_NO_HOST_EXTEND_Y +#: Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable. +TABLE_NO_KEEP_COLUMNS_VISIBLE = core.TABLE_NO_KEEP_COLUMNS_VISIBLE +#: Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth. +TABLE_PRECISE_WIDTHS = core.TABLE_PRECISE_WIDTHS +#: # Clipping +#: Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze(). +TABLE_NO_CLIP = core.TABLE_NO_CLIP +#: # Padding +#: Default if BordersOuterV is on. Enable outer-most padding. Generally desirable if you have headers. +TABLE_PAD_OUTER_X = core.TABLE_PAD_OUTER_X +#: Default if BordersOuterV is off. Disable outer-most padding. +TABLE_NO_PAD_OUTER_X = core.TABLE_NO_PAD_OUTER_X +#: Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off). +TABLE_NO_PAD_INNER_X = core.TABLE_NO_PAD_INNER_X +#: # Scrolling +#: Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX. +TABLE_SCROLL_X = core.TABLE_SCROLL_X +#: Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. +TABLE_SCROLL_Y = core.TABLE_SCROLL_Y +#: # Sorting +#: Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1). +TABLE_SORT_MULTI = core.TABLE_SORT_MULTI +#: Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0). +TABLE_SORT_TRISTATE = core.TABLE_SORT_TRISTATE + +# === Table Column Flags === +#: # Input configuration flags +#: None +TABLE_COLUMN_NONE = core.TABLE_COLUMN_NONE +#: Default as a hidden/disabled column. +TABLE_COLUMN_DEFAULT_HIDE = core.TABLE_COLUMN_DEFAULT_HIDE +#: Default as a sorting column. +TABLE_COLUMN_DEFAULT_SORT = core.TABLE_COLUMN_DEFAULT_SORT +#: Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp). +TABLE_COLUMN_WIDTH_STRETCH = core.TABLE_COLUMN_WIDTH_STRETCH +#: Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable). +TABLE_COLUMN_WIDTH_FIXED = core.TABLE_COLUMN_WIDTH_FIXED +#: Disable manual resizing. +TABLE_COLUMN_NO_RESIZE = core.TABLE_COLUMN_NO_RESIZE +#: Disable manual reordering this column, this will also prevent other columns from crossing over this column. +TABLE_COLUMN_NO_REORDER = core.TABLE_COLUMN_NO_REORDER +#: Disable ability to hide/disable this column. +TABLE_COLUMN_NO_HIDE = core.TABLE_COLUMN_NO_HIDE +#: Disable clipping for this column (all NoClip columns will render in a same draw command). +TABLE_COLUMN_NO_CLIP = core.TABLE_COLUMN_NO_CLIP +#: Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table). +TABLE_COLUMN_NO_SORT = core.TABLE_COLUMN_NO_SORT +#: Disable ability to sort in the ascending direction. +TABLE_COLUMN_NO_SORT_ASCENDING = core.TABLE_COLUMN_NO_SORT_ASCENDING +#: Disable ability to sort in the descending direction. +TABLE_COLUMN_NO_SORT_DESCENDING = core.TABLE_COLUMN_NO_SORT_DESCENDING +#: Disable header text width contribution to automatic column width. +TABLE_COLUMN_NO_HEADER_WIDTH = core.TABLE_COLUMN_NO_HEADER_WIDTH +#: Make the initial sort direction Ascending when first sorting on this column (default). +TABLE_COLUMN_PREFER_SORT_ASCENDING = core.TABLE_COLUMN_PREFER_SORT_ASCENDING +#: Make the initial sort direction Descending when first sorting on this column. +TABLE_COLUMN_PREFER_SORT_DESCENDING = core.TABLE_COLUMN_PREFER_SORT_DESCENDING +#: Use current Indent value when entering cell (default for column 0). +TABLE_COLUMN_INDENT_ENABLE = core.TABLE_COLUMN_INDENT_ENABLE +#: Ignore current Indent value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored. +TABLE_COLUMN_INDENT_DISABLE = core.TABLE_COLUMN_INDENT_DISABLE +#: # Output status flags, read-only via TableGetColumnFlags() +#: Status: is enabled == not hidden by user/api (referred to as "Hide" in _DefaultHide and _NoHide) flags. +TABLE_COLUMN_IS_ENABLED = core.TABLE_COLUMN_IS_ENABLED +#: Status: is visible == is enabled AND not clipped by scrolling. +TABLE_COLUMN_IS_VISIBLE = core.TABLE_COLUMN_IS_VISIBLE +#: Status: is currently part of the sort specs +TABLE_COLUMN_IS_SORTED = core.TABLE_COLUMN_IS_SORTED +#: Status: is hovered by mouse +TABLE_COLUMN_IS_HOVERED = core.TABLE_COLUMN_IS_HOVERED + +# === Table Row Flags === +#: None +TABLE_ROW_NONE = core.TABLE_ROW_NONE +#: Identify header row (set default background color + width of its contents accounted different for auto column width) +TABLE_ROW_HEADERS = core.TABLE_ROW_HEADERS + +# === Table Background Target === +#: None +TABLE_BACKGROUND_TARGET_NONE = core.TABLE_BACKGROUND_TARGET_NONE +#: Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used) +TABLE_BACKGROUND_TARGET_ROW_BG0 = core.TABLE_BACKGROUND_TARGET_ROW_BG0 +#: Set row background color 1 (generally used for selection marking) +TABLE_BACKGROUND_TARGET_ROW_BG1 = core.TABLE_BACKGROUND_TARGET_ROW_BG1 +#: Set cell background color (top-most color) +TABLE_BACKGROUND_TARGET_CELL_BG = core.TABLE_BACKGROUND_TARGET_CELL_BG + +# === Focus flag constants (redefines for autodoc) +FOCUS_NONE = core.FOCUS_NONE +#: IsWindowFocused(): Return true if any children of the window is focused +FOCUS_CHILD_WINDOWS = core.FOCUS_CHILD_WINDOWS +#: IsWindowFocused(): Test from root window (top most parent of the current hierarchy) +FOCUS_ROOT_WINDOW = core.FOCUS_ROOT_WINDOW +#: IsWindowFocused(): Return true if any window is focused +FOCUS_ANY_WINDOW = core.FOCUS_ANY_WINDOW +#: Shortcut: ``imgui.FOCUS_CHILD_WINDOWS | imgui.FOCUS_ROOT_WINDOW``. +FOCUS_ROOT_AND_CHILD_WINDOWS = core.FOCUS_CHILD_WINDOWS | core.FOCUS_ROOT_WINDOW + +# === Hovered flag constants (redefines for autodoc) +#: Return true if directly over the item/window, not obstructed by +#: another window, not obstructed by an active popup or modal +#: blocking inputs under them. +HOVERED_NONE = core.HOVERED_NONE +#: IsWindowHovered() only: Return true if any children of the window is hovered +HOVERED_CHILD_WINDOWS = core.HOVERED_CHILD_WINDOWS +#: IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) +HOVERED_ROOT_WINDOW = core.HOVERED_ROOT_WINDOW +#: IsWindowHovered() only: Return true if any window is hovered +HOVERED_ANY_WINDOW = core.HOVERED_ANY_WINDOW +#: Return true even if a popup window is normally blocking access to this item/window +HOVERED_ALLOW_WHEN_BLOCKED_BY_POPUP = core.HOVERED_ALLOW_WHEN_BLOCKED_BY_POPUP +#: Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. +HOVERED_ALLOW_WHEN_BLOCKED_BY_ACTIVE_ITEM = core.HOVERED_ALLOW_WHEN_BLOCKED_BY_ACTIVE_ITEM +#: Return true even if the position is overlapped by another window +HOVERED_ALLOW_WHEN_OVERLAPPED = core.HOVERED_ALLOW_WHEN_OVERLAPPED +HOVERED_ALLOW_WHEN_DISABLED = core.HOVERED_ALLOW_WHEN_DISABLED +#: Shortcut: ``imgui.HOVERED_ALLOW_WHEN_BLOCKED_BY_POPUP | imgui.HOVERED_ALLOW_WHEN_BLOCKED_BY_ACTIVE_ITEM | imgui.HOVERED_ALLOW_WHEN_OVERLAPPED``. +HOVERED_RECT_ONLY = core.HOVERED_ALLOW_WHEN_BLOCKED_BY_POPUP | core.HOVERED_ALLOW_WHEN_BLOCKED_BY_ACTIVE_ITEM | core.HOVERED_ALLOW_WHEN_OVERLAPPED +#: Shortcut: ``imgui.HOVERED_ROOT_WINDOW | imgui.HOVERED_CHILD_WINDOWS``. +HOVERED_ROOT_AND_CHILD_WINDOWS = core.HOVERED_ROOT_WINDOW | core.HOVERED_CHILD_WINDOWS + +# === Drag Drop flag constants (redefines for autodoc) +DRAG_DROP_NONE = core.DRAG_DROP_NONE +#: By default, a successful call to BeginDragDropSource opens a tooltip +#: so you can display a preview or description of the source contents. +#: This flag disable this behavior. +DRAG_DROP_SOURCE_NO_PREVIEW_TOOLTIP = core.DRAG_DROP_SOURCE_NO_PREVIEW_TOOLTIP +#: By default, when dragging we clear data so that IsItemHovered() will +#: return true, to avoid subsequent user code submitting tooltips. This +#: flag disable this behavior so you can still call IsItemHovered() on +#: the source item. +DRAG_DROP_SOURCE_NO_DISABLE_HOVER = core.DRAG_DROP_SOURCE_NO_DISABLE_HOVER +#: Disable the behavior that allows to open tree nodes and collapsing +#: header by holding over them while dragging a source item. +DRAG_DROP_SOURCE_NO_HOLD_TO_OPEN_OTHERS = core.DRAG_DROP_SOURCE_NO_HOLD_TO_OPEN_OTHERS +#: Allow items such as Text(), Image() that have no unique identifier to +#: be used as drag source, by manufacturing a temporary identifier based +#: on their window-relative position. This is extremely unusual within the +#: dear imgui ecosystem and so we made it explicit. +DRAG_DROP_SOURCE_ALLOW_NULL_ID = core.DRAG_DROP_SOURCE_ALLOW_NULL_ID +#: External source (from outside of imgui), won't attempt to read current +#: item/window info. Will always return true. Only one Extern source can +#: be active simultaneously. +DRAG_DROP_SOURCE_EXTERN = core.DRAG_DROP_SOURCE_EXTERN +#: Automatically expire the payload if the source cease to be submitted +#: (otherwise payloads are persisting while being dragged) +DRAG_DROP_SOURCE_AUTO_EXPIRE_PAYLOAD = core.DRAG_DROP_SOURCE_AUTO_EXPIRE_PAYLOAD + +# === Accept Drag Drop Payload flag constants (redefines for autodoc) +#: AcceptDragDropPayload() will returns true even before the mouse button +#: is released. You can then call IsDelivery() to test if the payload +#: needs to be delivered. +DRAG_DROP_ACCEPT_BEFORE_DELIVERY = core.DRAG_DROP_ACCEPT_BEFORE_DELIVERY +#: Do not draw the default highlight rectangle when hovering over target. +DRAG_DROP_ACCEPT_NO_DRAW_DEFAULT_RECT = core.DRAG_DROP_ACCEPT_NO_DRAW_DEFAULT_RECT +DRAG_DROP_ACCEPT_NO_PREVIEW_TOOLTIP = core.DRAG_DROP_ACCEPT_NO_PREVIEW_TOOLTIP +#: For peeking ahead and inspecting the payload before delivery. +DRAG_DROP_ACCEPT_PEEK_ONLY = core.DRAG_DROP_ACCEPT_PEEK_ONLY + +# === Cardinal Direction +#: Direction None +DIRECTION_NONE = core.DIRECTION_NONE +#: Direction Left +DIRECTION_LEFT = core.DIRECTION_LEFT +#: Direction Right +DIRECTION_RIGHT = core.DIRECTION_RIGHT +#: Direction Up +DIRECTION_UP = core.DIRECTION_UP +#: Direction Down +DIRECTION_DOWN = core.DIRECTION_DOWN + +# === Sorting direction +SORT_DIRECTION_NONE = core.SORT_DIRECTION_NONE +#: Ascending = 0->9, A->Z etc. +SORT_DIRECTION_ASCENDING = core.SORT_DIRECTION_ASCENDING +#: Descending = 9->0, Z->A etc. +SORT_DIRECTION_DESCENDING = core.SORT_DIRECTION_DESCENDING + +# === Mouse cursor flag constants (redefines for autodoc) +MOUSE_CURSOR_NONE = core.MOUSE_CURSOR_NONE +MOUSE_CURSOR_ARROW = core.MOUSE_CURSOR_ARROW +#: When hovering over InputText, etc. +MOUSE_CURSOR_TEXT_INPUT = core.MOUSE_CURSOR_TEXT_INPUT +#: Unused +MOUSE_CURSOR_RESIZE_ALL = core.MOUSE_CURSOR_RESIZE_ALL +#: When hovering over an horizontal border +MOUSE_CURSOR_RESIZE_NS = core.MOUSE_CURSOR_RESIZE_NS +#: When hovering over a vertical border or a column +MOUSE_CURSOR_RESIZE_EW = core.MOUSE_CURSOR_RESIZE_EW +#: When hovering over the bottom-left corner of a window +MOUSE_CURSOR_RESIZE_NESW = core.MOUSE_CURSOR_RESIZE_NESW +#: When hovering over the bottom-right corner of a window +MOUSE_CURSOR_RESIZE_NWSE = core.MOUSE_CURSOR_RESIZE_NWSE +#: (Unused by imgui functions. Use for e.g. hyperlinks) +MOUSE_CURSOR_HAND = core.MOUSE_CURSOR_HAND +MOUSE_CURSOR_NOT_ALLOWED = core.MOUSE_CURSOR_NOT_ALLOWED + +# === Text input flag constants (redefines for autodoc) +INPUT_TEXT_NONE = core.INPUT_TEXT_NONE +#: Allow ``0123456789.+-*/`` +INPUT_TEXT_CHARS_DECIMAL = core.INPUT_TEXT_CHARS_DECIMAL +#: Allow ``0123456789ABCDEFabcdef`` +INPUT_TEXT_CHARS_HEXADECIMAL = core.INPUT_TEXT_CHARS_HEXADECIMAL +#: Turn a..z into A..Z +INPUT_TEXT_CHARS_UPPERCASE = core.INPUT_TEXT_CHARS_UPPERCASE +#: Filter out spaces, tabs +INPUT_TEXT_CHARS_NO_BLANK = core.INPUT_TEXT_CHARS_NO_BLANK +#: Select entire text when first taking mouse focus +INPUT_TEXT_AUTO_SELECT_ALL = core.INPUT_TEXT_AUTO_SELECT_ALL +#: Return 'true' when Enter is pressed (as opposed to when the +#: value was modified) +INPUT_TEXT_ENTER_RETURNS_TRUE = core.INPUT_TEXT_ENTER_RETURNS_TRUE +#: Call user function on pressing TAB (for completion handling) +INPUT_TEXT_CALLBACK_COMPLETION = core.INPUT_TEXT_CALLBACK_COMPLETION +#: Call user function on pressing Up/Down arrows (for history handling) +INPUT_TEXT_CALLBACK_HISTORY = core.INPUT_TEXT_CALLBACK_HISTORY +#: Call user function every time. User code may query cursor position, +#: modify text buffer. +INPUT_TEXT_CALLBACK_ALWAYS = core.INPUT_TEXT_CALLBACK_ALWAYS +#: Call user function to filter character. Modify data->EventChar to +#: replace/filter input, or return 1 to discard character. +INPUT_TEXT_CALLBACK_CHAR_FILTER = core.INPUT_TEXT_CALLBACK_CHAR_FILTER +#: Pressing TAB input a '\t' character into the text field +INPUT_TEXT_ALLOW_TAB_INPUT = core.INPUT_TEXT_ALLOW_TAB_INPUT +#: In multi-line mode, allow exiting edition by pressing Enter. +#: Ctrl+Enter to add new line (by default adds new lines with Enter). +INPUT_TEXT_CTRL_ENTER_FOR_NEW_LINE = core.INPUT_TEXT_CTRL_ENTER_FOR_NEW_LINE +#: Disable following the cursor horizontally +INPUT_TEXT_NO_HORIZONTAL_SCROLL = core.INPUT_TEXT_NO_HORIZONTAL_SCROLL +#: Overwrite mode +INPUT_TEXT_ALWAYS_OVERWRITE = core.INPUT_TEXT_ALWAYS_OVERWRITE +#: OBSOLETED in 1.82 (from Mars 2021) +INPUT_TEXT_ALWAYS_INSERT_MODE = core.INPUT_TEXT_ALWAYS_INSERT_MODE +#: Read-only mode +INPUT_TEXT_READ_ONLY = core.INPUT_TEXT_READ_ONLY +#: Password mode, display all characters as '*' +INPUT_TEXT_PASSWORD = core.INPUT_TEXT_PASSWORD +#: Disable undo/redo. Note that input text owns the text data while +#: active, if you want to provide your own undo/redo stack you need +#: e.g. to call clear_active_id(). +INPUT_TEXT_NO_UNDO_REDO = core.INPUT_TEXT_NO_UNDO_REDO +INPUT_TEXT_CHARS_SCIENTIFIC = core.INPUT_TEXT_CHARS_SCIENTIFIC +INPUT_TEXT_CALLBACK_RESIZE = core.INPUT_TEXT_CALLBACK_RESIZE +INPUT_TEXT_CALLBACK_EDIT = core.INPUT_TEXT_CALLBACK_EDIT + +# === Draw Corner Flags (redefines for autodoc) +DRAW_CORNER_NONE = core.DRAW_CORNER_NONE +DRAW_CORNER_TOP_LEFT = core.DRAW_CORNER_TOP_LEFT +DRAW_CORNER_TOP_RIGHT = core.DRAW_CORNER_TOP_RIGHT +DRAW_CORNER_BOTTOM_LEFT = core.DRAW_CORNER_BOTTOM_LEFT +DRAW_CORNER_BOTTOM_RIGHT = core.DRAW_CORNER_BOTTOM_RIGHT +DRAW_CORNER_TOP = core.DRAW_CORNER_TOP +DRAW_CORNER_BOTTOM = core.DRAW_CORNER_BOTTOM +DRAW_CORNER_LEFT = core.DRAW_CORNER_LEFT +DRAW_CORNER_RIGHT = core.DRAW_CORNER_RIGHT +DRAW_CORNER_ALL = core.DRAW_CORNER_ALL + +# === Draw Flags (redifines for autodoc) +#: None +DRAW_NONE = core.DRAW_NONE +#: path_stroke(), add_polyline(): specify that shape should be closed (Important: this is always == 1 for legacy reason) +DRAW_CLOSED = core.DRAW_CLOSED +#: add_rect(), add_rect_filled(), path_rect(): enable rounding top-left corner only (when rounding > 0.0f, we default to all corners). Was 0x01. +DRAW_ROUND_CORNERS_TOP_LEFT = core.DRAW_ROUND_CORNERS_TOP_LEFT +#: add_rect(), add_rect_filled(), path_rect(): enable rounding top-right corner only (when rounding > 0.0f, we default to all corners). Was 0x02. +DRAW_ROUND_CORNERS_TOP_RIGHT = core.DRAW_ROUND_CORNERS_TOP_RIGHT +#: add_rect(), add_rect_filled(), path_rect(): enable rounding bottom-left corner only (when rounding > 0.0f, we default to all corners). Was 0x04. +DRAW_ROUND_CORNERS_BOTTOM_LEFT = core.DRAW_ROUND_CORNERS_BOTTOM_LEFT +#: add_rect(), add_rect_filled(), path_rect(): enable rounding bottom-right corner only (when rounding > 0.0f, we default to all corners). Wax 0x08. +DRAW_ROUND_CORNERS_BOTTOM_RIGHT = core.DRAW_ROUND_CORNERS_BOTTOM_RIGHT +#: add_rect(), add_rect_filled(), path_rect(): disable rounding on all corners (when rounding > 0.0f). This is NOT zero, NOT an implicit flag! +DRAW_ROUND_CORNERS_NONE = core.DRAW_ROUND_CORNERS_NONE +#: DRAW_ROUND_CORNERS_TOP_LEFT | DRAW_ROUND_CORNERS_TOP_RIGHT +DRAW_ROUND_CORNERS_TOP = core.DRAW_ROUND_CORNERS_TOP +#: DRAW_ROUND_CORNERS_BOTTOM_LEFT | DRAW_ROUND_CORNERS_BOTTOM_RIGHT +DRAW_ROUND_CORNERS_BOTTOM = core.DRAW_ROUND_CORNERS_BOTTOM +#: DRAW_ROUND_CORNERS_BOTTOM_LEFT | DRAW_ROUND_CORNERS_TOP_LEFT +DRAW_ROUND_CORNERS_LEFT = core.DRAW_ROUND_CORNERS_LEFT +#: DRAW_ROUND_CORNERS_BOTTOM_RIGHT | DRAW_ROUND_CORNERS_TOP_RIGHT +DRAW_ROUND_CORNERS_RIGHT = core.DRAW_ROUND_CORNERS_RIGHT +#: DRAW_ROUND_CORNERS_TOP_LEFT | DRAW_ROUND_CORNERS_TOP_RIGHT | DRAW_ROUND_CORNERS_BOTTOM_LEFT | DRAW_ROUND_CORNERS_BOTTOM_RIGHT +DRAW_ROUND_CORNERS_ALL = core.DRAW_ROUND_CORNERS_ALL + +# === Draw List Flags (redefines for autodoc) +DRAW_LIST_NONE = core.DRAW_LIST_NONE +DRAW_LIST_ANTI_ALIASED_LINES = core.DRAW_LIST_ANTI_ALIASED_LINES +DRAW_LIST_ANTI_ALIASED_LINES_USE_TEX = core.DRAW_LIST_ANTI_ALIASED_LINES_USE_TEX +DRAW_LIST_ANTI_ALIASED_FILL = core.DRAW_LIST_ANTI_ALIASED_FILL +DRAW_LIST_ALLOW_VTX_OFFSET = core.DRAW_LIST_ALLOW_VTX_OFFSET + +# === Font Atlas Flags (redefines for autodoc) +FONT_ATLAS_NONE = core.FONT_ATLAS_NONE +FONT_ATLAS_NO_POWER_OF_TWO_HEIGHT = core.FONT_ATLAS_NO_POWER_OF_TWO_HEIGHT +FONT_ATLAS_NO_MOUSE_CURSOR = core.FONT_ATLAS_NO_MOUSE_CURSOR +FONT_ATLAS_NO_BAKED_LINES = core.FONT_ATLAS_NO_BAKED_LINES + +# === Config Flags (redefines for autodoc) +CONFIG_NONE = core.CONFIG_NONE +CONFIG_NAV_ENABLE_KEYBOARD = core.CONFIG_NAV_ENABLE_KEYBOARD +CONFIG_NAV_ENABLE_GAMEPAD = core.CONFIG_NAV_ENABLE_GAMEPAD +CONFIG_NAV_ENABLE_SET_MOUSE_POS = core.CONFIG_NAV_ENABLE_SET_MOUSE_POS +CONFIG_NAV_NO_CAPTURE_KEYBOARD = core.CONFIG_NAV_NO_CAPTURE_KEYBOARD +CONFIG_NO_MOUSE = core.CONFIG_NO_MOUSE +CONFIG_NO_MOUSE_CURSOR_CHANGE = core.CONFIG_NO_MOUSE_CURSOR_CHANGE +CONFIG_IS_RGB = core.CONFIG_IS_RGB +CONFIG_IS_TOUCH_SCREEN = core.CONFIG_IS_TOUCH_SCREEN + +# === Backend Flags (redefines for autodoc) +BACKEND_NONE = core.BACKEND_NONE +BACKEND_HAS_GAMEPAD = core.BACKEND_HAS_GAMEPAD +BACKEND_HAS_MOUSE_CURSORS = core.BACKEND_HAS_MOUSE_CURSORS +BACKEND_HAS_SET_MOUSE_POS = core.BACKEND_HAS_SET_MOUSE_POS +BACKEND_RENDERER_HAS_VTX_OFFSET = core.BACKEND_RENDERER_HAS_VTX_OFFSET + +# === Slider flag (redefines for autodoc) +SLIDER_FLAGS_NONE +#: Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds. +SLIDER_FLAGS_ALWAYS_CLAMP +#: Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits. +SLIDER_FLAGS_LOGARITHMIC +#: Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits) +SLIDER_FLAGS_NO_ROUND_TO_FORMAT +#: Disable CTRL+Click or Enter key allowing to input text directly into the widget +SLIDER_FLAGS_NO_INPUT + +# === Mouse Button (redefines for autodoc) +MOUSE_BUTTON_LEFT = core.MOUSE_BUTTON_LEFT +MOUSE_BUTTON_RIGHT = core.MOUSE_BUTTON_RIGHT +MOUSE_BUTTON_MIDDLE = core.MOUSE_BUTTON_MIDDLE + +# === Viewport Flags (redifines for autodoc) +#: None +VIEWPORT_FLAGS_NONE = core.VIEWPORT_FLAGS_NONE +#: Represent a Platform Window +VIEWPORT_FLAGS_IS_PLATFORM_WINDOW = core.VIEWPORT_FLAGS_IS_PLATFORM_WINDOW +#: Represent a Platform Monitor (unused yet) +VIEWPORT_FLAGS_IS_PLATFORM_MONITOR = core.VIEWPORT_FLAGS_IS_PLATFORM_MONITOR +#: Platform Window: is created/managed by the application (rather than a dear imgui backend) +VIEWPORT_FLAGS_OWNED_BY_APP = core.VIEWPORT_FLAGS_OWNED_BY_APP + diff --git a/gui_utils/imgui_utils.py b/gui_utils/imgui_utils.py index 54af048..b32d62a 100644 --- a/gui_utils/imgui_utils.py +++ b/gui_utils/imgui_utils.py @@ -9,7 +9,8 @@ # its affiliates is strictly prohibited. import contextlib -import imgui +from imgui_bundle import imgui +from gui_utils.constants import * # ---------------------------------------------------------------------------- @@ -35,66 +36,58 @@ def set_default_style(color_scheme='dark', spacing=5, indent=20, scrollbar=10): # s.grab_rounding = 1 getattr(imgui, f'style_colors_{color_scheme}')(s) - c0 = s.colors[imgui.COLOR_MENUBAR_BACKGROUND] - c1 = s.colors[imgui.COLOR_FRAME_BACKGROUND] - s.colors[imgui.COLOR_POPUP_BACKGROUND] = [x * 0.7 + y * 0.3 for x, y in zip(c0, c1)][:3] + [1] - - s.colors[imgui.COLOR_TEXT] = [1.00, 1.00, 1.00, 1.00] - s.colors[imgui.COLOR_TEXT_DISABLED] = [0.50, 0.50, 0.50, 1.00] - - s.colors[imgui.COLOR_WINDOW_BACKGROUND] = [0.30, 0.30, 0.30, 1.00] - s.colors[imgui.COLOR_CHILD_BACKGROUND] = [0.20, 0.20, 0.20, 1.00] - s.colors[imgui.COLOR_POPUP_BACKGROUND] = [0.19, 0.19, 0.19, 0.92] - - s.colors[imgui.COLOR_BORDER] = [0.19, 0.19, 0.19, 0.29] - s.colors[imgui.COLOR_BORDER_SHADOW] = [0.00, 0.00, 0.00, 0.24] - s.colors[imgui.COLOR_FRAME_BACKGROUND] = [0.05, 0.05, 0.05, 0.54] - s.colors[imgui.COLOR_FRAME_BACKGROUND_HOVERED] = [0.19, 0.19, 0.19, 0.54] - s.colors[imgui.COLOR_FRAME_BACKGROUND_ACTIVE] = [0.20, 0.22, 0.23, 1.00] - s.colors[imgui.COLOR_TITLE_BACKGROUND] = [0.00, 0.00, 0.00, 1.00] - s.colors[imgui.COLOR_TITLE_BACKGROUND_ACTIVE] = [0.06, 0.06, 0.06, 1.00] - s.colors[imgui.COLOR_TITLE_BACKGROUND_COLLAPSED] = [0.00, 0.00, 0.00, 1.00] - s.colors[imgui.COLOR_MENUBAR_BACKGROUND] = [0.14, 0.14, 0.14, 1.00] - s.colors[imgui.COLOR_SCROLLBAR_BACKGROUND] = [0.05, 0.05, 0.05, 0.54] - s.colors[imgui.COLOR_SCROLLBAR_GRAB] = [0.34, 0.34, 0.34, 0.54] - s.colors[imgui.COLOR_SCROLLBAR_GRAB_HOVERED] = [0.40, 0.40, 0.40, 0.54] - s.colors[imgui.COLOR_SCROLLBAR_GRAB_ACTIVE] = [0.56, 0.56, 0.56, 0.54] - s.colors[imgui.COLOR_CHECK_MARK] = [0.33, 0.67, 0.86, 1.00] - s.colors[imgui.COLOR_SLIDER_GRAB] = [0.34, 0.34, 0.34, 0.74] - s.colors[imgui.COLOR_SLIDER_GRAB_ACTIVE] = [0.56, 0.56, 0.56, 0.74] - - s.colors[imgui.COLOR_BUTTON] = [0.9, 0.7, 0.0, 0.75] - s.colors[imgui.COLOR_BUTTON_HOVERED] = [0.9, 0.7, 0.0, 0.9] - s.colors[imgui.COLOR_BUTTON_ACTIVE] = [0.9, 0.7, 0.0, 1.0] - - s.colors[imgui.COLOR_HEADER] = [0.00, 0.00, 0.00, 0.52] - s.colors[imgui.COLOR_HEADER_HOVERED] = [0.00, 0.00, 0.00, 0.36] - s.colors[imgui.COLOR_HEADER_ACTIVE] = [0.20, 0.22, 0.23, 0.33] - s.colors[imgui.COLOR_SEPARATOR] = [0.28, 0.28, 0.28, 0.29] - s.colors[imgui.COLOR_SEPARATOR_HOVERED] = [0.44, 0.44, 0.44, 0.29] - s.colors[imgui.COLOR_SEPARATOR_ACTIVE] = [0.40, 0.44, 0.47, 1.00] - s.colors[imgui.COLOR_RESIZE_GRIP] = [0.28, 0.28, 0.28, 0.29] - s.colors[imgui.COLOR_RESIZE_GRIP_HOVERED] = [0.44, 0.44, 0.44, 0.29] - s.colors[imgui.COLOR_RESIZE_GRIP_ACTIVE] = [0.40, 0.44, 0.47, 1.00] - - s.colors[imgui.COLOR_TAB] = [1.00, 0.00, 0.00, 0.52] - s.colors[imgui.COLOR_TAB_HOVERED] = [0.14, 0.14, 0.14, 1.00] - s.colors[imgui.COLOR_TAB_ACTIVE] = [0.20, 0.20, 0.20, 0.36] - s.colors[imgui.COLOR_TAB_UNFOCUSED] = [0.00, 0.00, 0.00, 0.52] - s.colors[imgui.COLOR_TAB_UNFOCUSED_ACTIVE] = [0.14, 0.14, 0.14, 1.00] - - s.colors[imgui.COLOR_PLOT_LINES] = [1.00, 0.80, 0.00, 0.90] - s.colors[imgui.COLOR_PLOT_LINES_HOVERED] = [1.00, 0.80, 0.00, 1.00] - - s.colors[imgui.COLOR_PLOT_HISTOGRAM] = [1.00, 0.80, 0.00, 0.90] - s.colors[imgui.COLOR_PLOT_HISTOGRAM_HOVERED] = [1.00, 0.80, 0.00, 1.00] - - s.colors[imgui.COLOR_TEXT_SELECTED_BACKGROUND] = [0.20, 0.22, 0.23, 1.00] - - s.colors[imgui.COLOR_NAV_HIGHLIGHT] = [1.00, 0.00, 0.00, 1.00] - s.colors[imgui.COLOR_NAV_WINDOWING_HIGHLIGHT] = [1.00, 0.00, 0.00, 0.70] - s.colors[imgui.COLOR_NAV_WINDOWING_HIGHLIGHT] = [1.00, 0.00, 0.00, 0.20] - s.colors[imgui.COLOR_NAV_WINDOWING_DIM_BACKGROUND] = [1.00, 0.00, 0.00, 0.35] + + # c0 = colors[COLOR_MENUBAR_BACKGROUND] + # c1 = colors[COLOR_FRAME_BACKGROUND] + # s.set_color_(COLOR_POPUP_BACKGROUND] = [x * 0.7 + y * 0.3 for x, y in zip(c0, c1)][:3] + [1] + + s.set_color_(COLOR_TEXT, imgui.ImVec4(1.00, 1.00, 1.00, 1.00)) + s.set_color_(COLOR_TEXT_DISABLED, imgui.ImVec4(0.50, 0.50, 0.50, 1.00)) + s.set_color_(COLOR_WINDOW_BACKGROUND, imgui.ImVec4(0.30, 0.30, 0.30, 1.00)) + s.set_color_(COLOR_CHILD_BACKGROUND, imgui.ImVec4(0.20, 0.20, 0.20, 1.00)) + s.set_color_(COLOR_POPUP_BACKGROUND, imgui.ImVec4(0.19, 0.19, 0.19, 0.92)) + s.set_color_(COLOR_BORDER, imgui.ImVec4(0.19, 0.19, 0.19, 0.29)) + s.set_color_(COLOR_BORDER_SHADOW, imgui.ImVec4(0.00, 0.00, 0.00, 0.24)) + s.set_color_(COLOR_FRAME_BACKGROUND, imgui.ImVec4(0.05, 0.05, 0.05, 0.54)) + s.set_color_(COLOR_FRAME_BACKGROUND_HOVERED, imgui.ImVec4(0.19, 0.19, 0.19, 0.54)) + s.set_color_(COLOR_FRAME_BACKGROUND_ACTIVE, imgui.ImVec4(0.20, 0.22, 0.23, 1.00)) + s.set_color_(COLOR_TITLE_BACKGROUND, imgui.ImVec4(0.00, 0.00, 0.00, 1.00)) + s.set_color_(COLOR_TITLE_BACKGROUND_ACTIVE, imgui.ImVec4(0.06, 0.06, 0.06, 1.00)) + s.set_color_(COLOR_TITLE_BACKGROUND_COLLAPSED, imgui.ImVec4(0.00, 0.00, 0.00, 1.00)) + s.set_color_(COLOR_MENUBAR_BACKGROUND, imgui.ImVec4(0.14, 0.14, 0.14, 1.00)) + s.set_color_(COLOR_SCROLLBAR_BACKGROUND, imgui.ImVec4(0.05, 0.05, 0.05, 0.54)) + s.set_color_(COLOR_SCROLLBAR_GRAB, imgui.ImVec4(0.34, 0.34, 0.34, 0.54)) + s.set_color_(COLOR_SCROLLBAR_GRAB_HOVERED, imgui.ImVec4(0.40, 0.40, 0.40, 0.54)) + s.set_color_(COLOR_SCROLLBAR_GRAB_ACTIVE, imgui.ImVec4(0.56, 0.56, 0.56, 0.54)) + s.set_color_(COLOR_CHECK_MARK, imgui.ImVec4(0.33, 0.67, 0.86, 1.00)) + s.set_color_(COLOR_SLIDER_GRAB, imgui.ImVec4(0.34, 0.34, 0.34, 0.74)) + s.set_color_(COLOR_SLIDER_GRAB_ACTIVE, imgui.ImVec4(0.56, 0.56, 0.56, 0.74)) + s.set_color_(COLOR_BUTTON, imgui.ImVec4(0.90, 0.70, 0.00, 0.75)) + s.set_color_(COLOR_BUTTON_HOVERED, imgui.ImVec4(0.90, 0.70, 0.00, 0.90)) + s.set_color_(COLOR_BUTTON_ACTIVE, imgui.ImVec4(0.90, 0.70, 0.00, 1.00)) + s.set_color_(COLOR_HEADER, imgui.ImVec4(0.00, 0.00, 0.00, 0.52)) + s.set_color_(COLOR_HEADER_HOVERED, imgui.ImVec4(0.00, 0.00, 0.00, 0.36)) + s.set_color_(COLOR_HEADER_ACTIVE, imgui.ImVec4(0.20, 0.22, 0.23, 0.33)) + s.set_color_(COLOR_SEPARATOR, imgui.ImVec4(0.28, 0.28, 0.28, 0.29)) + s.set_color_(COLOR_SEPARATOR_HOVERED, imgui.ImVec4(0.44, 0.44, 0.44, 0.29)) + s.set_color_(COLOR_SEPARATOR_ACTIVE, imgui.ImVec4(0.40, 0.44, 0.47, 1.00)) + s.set_color_(COLOR_RESIZE_GRIP, imgui.ImVec4(0.28, 0.28, 0.28, 0.29)) + s.set_color_(COLOR_RESIZE_GRIP_HOVERED, imgui.ImVec4(0.44, 0.44, 0.44, 0.29)) + s.set_color_(COLOR_RESIZE_GRIP_ACTIVE, imgui.ImVec4(0.40, 0.44, 0.47, 1.00)) + s.set_color_(COLOR_TAB, imgui.ImVec4(1.00, 0.00, 0.00, 0.52)) + s.set_color_(COLOR_TAB_HOVERED, imgui.ImVec4(0.14, 0.14, 0.14, 1.00)) + s.set_color_(COLOR_TAB_ACTIVE, imgui.ImVec4(0.20, 0.20, 0.20, 0.36)) + s.set_color_(COLOR_TAB_UNFOCUSED, imgui.ImVec4(0.00, 0.00, 0.00, 0.52)) + s.set_color_(COLOR_TAB_UNFOCUSED_ACTIVE, imgui.ImVec4(0.14, 0.14, 0.14, 1.00)) + s.set_color_(COLOR_PLOT_LINES, imgui.ImVec4(1.00, 0.80, 0.00, 0.90)) + s.set_color_(COLOR_PLOT_LINES_HOVERED, imgui.ImVec4(1.00, 0.80, 0.00, 1.00)) + s.set_color_(COLOR_PLOT_HISTOGRAM, imgui.ImVec4(1.00, 0.80, 0.00, 0.90)) + s.set_color_(COLOR_PLOT_HISTOGRAM_HOVERED, imgui.ImVec4(1.00, 0.80, 0.00, 1.00)) + s.set_color_(COLOR_TEXT_SELECTED_BACKGROUND, imgui.ImVec4(0.20, 0.22, 0.23, 1.00)) + s.set_color_(COLOR_NAV_HIGHLIGHT, imgui.ImVec4(1.00, 0.00, 0.00, 1.00)) + s.set_color_(COLOR_NAV_WINDOWING_HIGHLIGHT, imgui.ImVec4(1.00, 0.00, 0.00, 0.70)) + s.set_color_(COLOR_NAV_WINDOWING_HIGHLIGHT, imgui.ImVec4(1.00, 0.00, 0.00, 0.20)) + s.set_color_(COLOR_NAV_WINDOWING_DIM_BACKGROUND, imgui.ImVec4(1.00, 0.00, 0.00, 0.35)) # ---------------------------------------------------------------------------- @@ -103,23 +96,23 @@ def set_default_style(color_scheme='dark', spacing=5, indent=20, scrollbar=10): def grayed_out(cond=True): if cond: s = imgui.get_style() - text = s.colors[imgui.COLOR_TEXT_DISABLED] - grab = s.colors[imgui.COLOR_SCROLLBAR_GRAB] - back = s.colors[imgui.COLOR_MENUBAR_BACKGROUND] - imgui.push_style_color(imgui.COLOR_TEXT, *text) - imgui.push_style_color(imgui.COLOR_CHECK_MARK, *grab) - imgui.push_style_color(imgui.COLOR_SLIDER_GRAB, *grab) - imgui.push_style_color(imgui.COLOR_SLIDER_GRAB_ACTIVE, *grab) - imgui.push_style_color(imgui.COLOR_FRAME_BACKGROUND, *back) - imgui.push_style_color(imgui.COLOR_FRAME_BACKGROUND_HOVERED, *back) - imgui.push_style_color(imgui.COLOR_FRAME_BACKGROUND_ACTIVE, *back) - imgui.push_style_color(imgui.COLOR_BUTTON, *back) - imgui.push_style_color(imgui.COLOR_BUTTON_HOVERED, *back) - imgui.push_style_color(imgui.COLOR_BUTTON_ACTIVE, *back) - imgui.push_style_color(imgui.COLOR_HEADER, *back) - imgui.push_style_color(imgui.COLOR_HEADER_HOVERED, *back) - imgui.push_style_color(imgui.COLOR_HEADER_ACTIVE, *back) - imgui.push_style_color(imgui.COLOR_POPUP_BACKGROUND, *back) + text = s.color_(COLOR_TEXT_DISABLED) + grab = s.color_(COLOR_SCROLLBAR_GRAB) + back = s.color_(COLOR_MENUBAR_BACKGROUND) + imgui.push_style_color(COLOR_TEXT, *text) + imgui.push_style_color(COLOR_CHECK_MARK, *grab) + imgui.push_style_color(COLOR_SLIDER_GRAB, *grab) + imgui.push_style_color(COLOR_SLIDER_GRAB_ACTIVE, *grab) + imgui.push_style_color(COLOR_FRAME_BACKGROUND, *back) + imgui.push_style_color(COLOR_FRAME_BACKGROUND_HOVERED, *back) + imgui.push_style_color(COLOR_FRAME_BACKGROUND_ACTIVE, *back) + imgui.push_style_color(COLOR_BUTTON, *back) + imgui.push_style_color(COLOR_BUTTON_HOVERED, *back) + imgui.push_style_color(COLOR_BUTTON_ACTIVE, *back) + imgui.push_style_color(COLOR_HEADER, *back) + imgui.push_style_color(COLOR_HEADER_HOVERED, *back) + imgui.push_style_color(COLOR_HEADER_ACTIVE, *back) + imgui.push_style_color(COLOR_POPUP_BACKGROUND, *back) yield imgui.pop_style_color(14) else: @@ -154,7 +147,7 @@ def decorator(self, *args, **kwargs): def button(label, width=0, enabled=True): with grayed_out(not enabled): - clicked = imgui.button(label, width=width) + clicked = imgui.button(label) clicked = clicked and enabled return clicked @@ -165,11 +158,11 @@ def collapsing_header(text, visible=None, flags=0, default=False, enabled=True, expanded = False if show: if default: - flags |= imgui.TREE_NODE_DEFAULT_OPEN + flags |= TREE_NODE_DEFAULT_OPEN if not enabled: - flags |= imgui.TREE_NODE_LEAF + flags |= TREE_NODE_LEAF with grayed_out(not enabled): - expanded, visible = imgui.collapsing_header(text, visible=visible, flags=flags) + expanded = imgui.collapsing_header(text, flags=flags) expanded = expanded and enabled return expanded, visible @@ -187,16 +180,16 @@ def popup_button(label, width=0, enabled=True): def input_text(label, value, buffer_length, flags, width=None, help_text=''): old_value = value - color = list(imgui.get_style().colors[imgui.COLOR_TEXT]) + color = list(imgui.get_style().colors[COLOR_TEXT]) if value == '': color[-1] *= 0.5 with item_width(width): - imgui.push_style_color(imgui.COLOR_TEXT, *color) + # imgui.push_style_color(imgui.COLOR_TEXT, *color) value = value if value != '' else help_text changed, value = imgui.input_text(label, value, buffer_length, flags) value = value if value != help_text else '' - imgui.pop_style_color(1) - if not flags & imgui.INPUT_TEXT_ENTER_RETURNS_TRUE: + # imgui.pop_style_color(1) + if not flags & imgui.InputTextFlags_.enter_returns_true: changed = (value != old_value) return changed, value @@ -207,7 +200,7 @@ def drag_previous_control(enabled=True): dragging = False dx = 0 dy = 0 - if imgui.begin_drag_drop_source(imgui.DRAG_DROP_SOURCE_NO_PREVIEW_TOOLTIP): + if imgui.begin_drag_drop_source(imgui.DragDropFlags_.source_no_preview_tooltip.value): if enabled: dragging = True dx, dy = imgui.get_mouse_drag_delta() @@ -227,12 +220,11 @@ def drag_button(label, width=0, enabled=True): # ---------------------------------------------------------------------------- def drag_hidden_window(label, x, y, width, height, enabled=True): - imgui.push_style_color(imgui.COLOR_WINDOW_BACKGROUND, 0, 0, 0, 0) - imgui.push_style_color(imgui.COLOR_BORDER, 0, 0, 0, 0) - imgui.set_next_window_position(x, y) - imgui.set_next_window_size(width, height) - imgui.begin(label, closable=False, - flags=(imgui.WINDOW_NO_TITLE_BAR | imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_MOVE)) + imgui.push_style_color(COLOR_WINDOW_BACKGROUND, 0) + imgui.push_style_color(COLOR_BORDER, 0) + imgui.set_next_window_pos(imgui.ImVec2(x, y)) + imgui.set_next_window_size(imgui.ImVec2(width, height)) + imgui.begin(label, p_open=False, flags=(WINDOW_NO_TITLE_BAR | WINDOW_NO_RESIZE | WINDOW_NO_MOVE)) dragging, dx, dy = drag_previous_control(enabled=enabled) imgui.end() imgui.pop_style_color(2) diff --git a/gui_utils/imgui_window.py b/gui_utils/imgui_window.py index 8b960b8..03d5800 100644 --- a/gui_utils/imgui_window.py +++ b/gui_utils/imgui_window.py @@ -9,9 +9,8 @@ # its affiliates is strictly prohibited. import os -import imgui -import imgui.integrations.glfw -# from imgui_bundle import implot +from imgui_bundle import imgui +from imgui_bundle.python_backends.glfw_backend import GlfwRenderer from . import glfw_window from . import imgui_utils @@ -104,7 +103,7 @@ def end_frame(self): # Wrapper class for GlfwRenderer to fix a mouse wheel bug on Linux. -class _GlfwRenderer(imgui.integrations.glfw.GlfwRenderer): +class _GlfwRenderer(GlfwRenderer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.mouse_wheel_multiplier = 1 diff --git a/run_main.py b/run_main.py index 2bfe8b0..cee05c3 100644 --- a/run_main.py +++ b/run_main.py @@ -1,5 +1,5 @@ import click -import imgui +from imgui_bundle import imgui import numpy as np import torch import sys @@ -12,6 +12,7 @@ from gui_utils import imgui_utils from gui_utils import gl_utils from gui_utils import text_utils +from gui_utils.constants import * from viz_utils.dict import EasyDict from widgets import edit_widget, eval_widget, performance_widget, load_widget_pkl, load_widget_ply, video_widget, cam_widget, capture_widget, latent_widget from viz.async_renderer import AsyncRenderer @@ -22,7 +23,7 @@ class Visualizer(imgui_window.ImguiWindow): def __init__(self, data_path=None, use_gan_decoder=False): super().__init__( - title="Gaussian Machine", window_width=1920, window_height=1080, font="fonts/JetBrainsMono-Regular.ttf" + title="splatviz", window_width=1920, window_height=1080, font="fonts/JetBrainsMono-Regular.ttf" ) # Internals. @@ -84,9 +85,9 @@ def _adjust_font_size(self): def draw_frame(self): self.begin_frame() self.args = EasyDict() - self.pane_w = self.font_size * 50 + self.pane_w = self.content_width - self.content_height self.button_w = self.font_size * 5 - self.label_w = round(self.font_size * 5.5) + self.label_w = round(self.font_size * 5.5) + 100 # Detect mouse dragging in the result area. dragging, dx, dy = imgui_utils.drag_hidden_window( @@ -96,18 +97,16 @@ def draw_frame(self): self.cam_widget.drag(dx, dy) # Begin control pane. - imgui.set_next_window_position(0, 0) - imgui.set_next_window_size(self.pane_w, self.content_height) - imgui.begin( - "##control_pane", - closable=False, - flags=(imgui.WINDOW_NO_TITLE_BAR | imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_MOVE), + imgui.set_next_window_pos(imgui.ImVec2(0, 0)) + imgui.set_next_window_size(imgui.ImVec2(self.pane_w, self.content_height)) + imgui.begin( "##control_pane", p_open=True, + flags=(WINDOW_NO_TITLE_BAR | WINDOW_NO_RESIZE | WINDOW_NO_MOVE), ) # Widgets. expanded, _visible = imgui_utils.collapsing_header("Load", default=True) imgui.indent() - self.load_widget(expanded) + self.load_widget(True) imgui.unindent() expanded, _visible = imgui_utils.collapsing_header("Performance", default=False) diff --git a/widgets/cam_widget.py b/widgets/cam_widget.py index aa4c204..b218b19 100644 --- a/widgets/cam_widget.py +++ b/widgets/cam_widget.py @@ -7,11 +7,12 @@ # disclosure or distribution of this material and related documentation # without an express license agreement from NVIDIA CORPORATION or # its affiliates is strictly prohibited. -import imgui +from imgui_bundle import imgui import torch import numpy as np from gui_utils import imgui_utils +from gui_utils.constants import * from viz_utils.camera_utils import get_forward_vector, create_cam2world_matrix, get_origin, normalize_vecs from viz_utils.dict import EasyDict @@ -55,30 +56,29 @@ def handle_wasd(self): up_vector=self.up_vector ) - multiply = 1 - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_MOD_SHIFT)): - multiply = 2 - self.sideways = torch.cross(self.forward, self.up_vector) - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 22): # W - self.cam_pos += self.forward * self.move_speed * multiply - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A)): # A - self.cam_pos -= self.sideways * self.move_speed * multiply - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 18): # S - self.cam_pos -= self.forward * self.move_speed * multiply - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 3): # D - self.cam_pos += self.sideways * self.move_speed * multiply + if imgui.is_key_down(imgui.Key.w): # W + self.cam_pos += self.forward * self.move_speed + if imgui.is_key_down(imgui.Key.a): # A + self.cam_pos -= self.sideways * self.move_speed + if imgui.is_key_down(imgui.Key.s): # S + self.cam_pos -= self.forward * self.move_speed + if imgui.is_key_down(imgui.Key.d): # D + self.cam_pos += self.sideways * self.move_speed elif self.control_modes[self.current_control_mode] == "Orbit": self.cam_pos = get_origin(self.pose.yaw + np.pi / 2, self.pose.pitch + np.pi / 2, self.radius, self.lookat_point, device=torch.device("cuda"), up_vector=self.up_vector) self.forward = normalize_vecs(self.lookat_point - self.cam_pos) - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 22): # W + if imgui.is_key_down(imgui.Key.w): # W + print("w") self.pose.pitch -= self.move_speed - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A)): # A + if imgui.is_key_down(imgui.Key.a): # A + print(imgui.Key.a, imgui.get_key_name(imgui.Key.a)) + self.pose.yaw -= self.move_speed - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 18): # S + if imgui.is_key_down(imgui.Key.s): # S self.pose.pitch += self.move_speed - if imgui.is_key_down(imgui.get_key_index(imgui.KEY_A) + 3): # D + if imgui.is_key_down(imgui.Key.d): # D self.pose.yaw += self.move_speed def handle_mouse(self): @@ -111,7 +111,7 @@ def __call__(self, show=True): imgui.push_item_width(200) imgui.text("Up Vector") imgui.same_line(viz.label_w) - _changed, up_vector_tuple = imgui.input_float3("##up_vector", *self.up_vector, format="%.1f") + _changed, up_vector_tuple = imgui.input_float3("##up_vector", v=self.up_vector.tolist(), format="%.1f") if _changed: self.up_vector = torch.tensor(up_vector_tuple, device="cuda") imgui.same_line() @@ -133,7 +133,7 @@ def __call__(self, show=True): self.radius = viz.result.std_xyz.item() imgui.text("Look at point") imgui.same_line(viz.label_w) - _changed, look_at_point_tuple = imgui.input_float3("##lookat", *self.lookat_point, format="%.1f") + _changed, look_at_point_tuple = imgui.input_float3("##lookat", self.lookat_point.tolist(), format="%.1f") self.lookat_point = torch.tensor(look_at_point_tuple, device=torch.device("cuda")) imgui.same_line() if imgui.button("Set to xyz mean") and "mean_xyz" in viz.result.keys(): diff --git a/widgets/capture_widget.py b/widgets/capture_widget.py index a49fd12..3163fbd 100644 --- a/widgets/capture_widget.py +++ b/widgets/capture_widget.py @@ -1,7 +1,7 @@ import os import re import PIL -import imgui +from imgui_bundle import imgui import numpy as np from gui_utils import imgui_utils diff --git a/widgets/edit_widget.py b/widgets/edit_widget.py index 0a8ae52..51d9cdc 100644 --- a/widgets/edit_widget.py +++ b/widgets/edit_widget.py @@ -1,9 +1,11 @@ import os.path -import imgui from gui_utils import imgui_utils import json +from imgui_bundle import imgui, imgui_color_text_edit as edit + + default_preset = """gaussian._xyz = gaussian._xyz gaussian._rotation = gaussian._rotation gaussian._scaling = gaussian._scaling @@ -38,6 +40,10 @@ def __init__(self, viz): self.load_presets() self.text = self.presets["Default"] + self.editor = edit.TextEditor() + self.editor.set_language_definition(edit.TextEditor.LanguageDefinition.python()) + self.editor.set_text(self.text) + self.var_names = "xyzijklmnuvwabcdefghopqrst" self.var_name_index = 1 self._cur_min_slider = -10 @@ -82,15 +88,17 @@ def __call__(self, show=True, decoder=False): if imgui.begin_popup("browse_presets"): for preset in self.all_presets: - clicked, _state = imgui.menu_item(preset) + clicked, _state = imgui.menu_item_simple(preset) if clicked: self.text = self.presets[preset] imgui.end_popup() - dynamic_height = 10 + viz.font_size * (self.text.count("\n") + 2) - _changed, self.text = imgui.input_text_multiline( - "##input_text", self.text, width=viz.pane_w, height=dynamic_height - ) + # dynamic_height = 10 + viz.font_size * (self.text.count("\n") + 2) + # _changed, self.text = imgui.input_text_multiline( + # "##input_text", self.text, width=viz.pane_w, height=dynamic_height + # ) + self.editor.render("Code") + # self.editor.(self.text.count("\n")+ 1) imgui.text("Preset Name") imgui.same_line() @@ -102,6 +110,7 @@ def __call__(self, show=True, decoder=False): json.dump(self.presets, f) self._cur_preset_name = "" + self.text = self.editor.get_text() viz.args.edit_text = self.text viz.args.render_alpha = self.render_alpha viz.args.render_depth = self.render_depth diff --git a/widgets/eval_widget.py b/widgets/eval_widget.py index dd0df89..41ca937 100644 --- a/widgets/eval_widget.py +++ b/widgets/eval_widget.py @@ -1,4 +1,4 @@ -import imgui +from imgui_bundle import imgui import numpy as np import torch import pprint @@ -84,7 +84,7 @@ def handle_tensor(self, result, depth, var_name): hist = np.histogram(result.cpu().detach().numpy().reshape(-1), bins=50) self.hist_cache[var_name] = hist imgui.same_line() - imgui.core.plot_histogram("", self.hist_cache[var_name][0].astype(np.float32)) + # imgui.core.plot_histogram("", self.hist_cache[var_name][0].astype(np.float32)) @staticmethod def get_short_info(key, value): diff --git a/widgets/latent_widget.py b/widgets/latent_widget.py index ab0137b..c137cf8 100644 --- a/widgets/latent_widget.py +++ b/widgets/latent_widget.py @@ -1,4 +1,4 @@ -import imgui +from imgui_bundle import imgui import dnnlib from gui_utils import imgui_utils diff --git a/widgets/load_widget_pkl.py b/widgets/load_widget_pkl.py index 334fd60..0ef9750 100644 --- a/widgets/load_widget_pkl.py +++ b/widgets/load_widget_pkl.py @@ -8,7 +8,7 @@ # without an express license agreement from NVIDIA CORPORATION or # its affiliates is strictly prohibited. import os -import imgui +from imgui_bundle import imgui from gui_utils import imgui_utils diff --git a/widgets/load_widget_ply.py b/widgets/load_widget_ply.py index 181e7dd..483b073 100644 --- a/widgets/load_widget_ply.py +++ b/widgets/load_widget_ply.py @@ -8,7 +8,7 @@ # without an express license agreement from NVIDIA CORPORATION or # its affiliates is strictly prohibited. import os -import imgui +from imgui_bundle import imgui from gui_utils import imgui_utils @@ -33,7 +33,7 @@ def __call__(self, show=True): for i, ply in enumerate(self.plys): if imgui.begin_popup(f"browse_pkls_popup{i}"): for item in self.items: - clicked, _state = imgui.menu_item(os.path.relpath(item, self.root)) + clicked = imgui.menu_item_simple(os.path.relpath(item, self.root)) if clicked: self.plys[i] = item imgui.end_popup() diff --git a/widgets/performance_widget.py b/widgets/performance_widget.py index f92a794..0f1e4ac 100644 --- a/widgets/performance_widget.py +++ b/widgets/performance_widget.py @@ -10,17 +10,18 @@ import array import numpy as np -import imgui +from imgui_bundle import imgui from gui_utils import imgui_utils +from gui_utils.constants import * class PerformanceWidget: def __init__(self, viz): self.viz = viz - self.gui_times = [float("nan")] * 60 - self.render_times = [float("nan")] * 30 + self.gui_times = [float("nan")] * 100 + self.render_times = [float("nan")] * 100 self.render_times_smooth = 0 - self.fps_limit = 60 + self.fps_limit = 180 self.use_vsync = False self.fast_render_mode = False @@ -36,7 +37,7 @@ def __call__(self, show=True): imgui.text("GUI") imgui.same_line(viz.label_w) with imgui_utils.item_width(viz.font_size * 8): - imgui.plot_lines("##gui_times", array.array("f", self.gui_times), scale_min=0) + imgui.plot_lines("##gui_times", np.array(array.array("f", self.gui_times)), scale_min=0) imgui.same_line(viz.label_w + viz.font_size * 9) t = [x for x in self.gui_times if x > 0] t = np.mean(t) if len(t) > 0 else 0 @@ -44,9 +45,7 @@ def __call__(self, show=True): imgui.same_line(viz.label_w + viz.font_size * 14) imgui.text(f"{1 / t:.1f} FPS" if t > 0 else "N/A") with imgui_utils.item_width(viz.font_size * 6): - _changed, self.fps_limit = imgui.input_int( - "FPS limit", self.fps_limit, flags=imgui.INPUT_TEXT_ENTER_RETURNS_TRUE - ) + _changed, self.fps_limit = imgui.input_int("FPS limit", self.fps_limit) self.fps_limit = min(max(self.fps_limit, 5), 1000) imgui.same_line(viz.label_w + viz.font_size * 9) _clicked, self.use_vsync = imgui.checkbox("Vertical sync", self.use_vsync) @@ -54,7 +53,7 @@ def __call__(self, show=True): imgui.text("Render") imgui.same_line(viz.label_w) with imgui_utils.item_width(viz.font_size * 8): - imgui.plot_lines("##render_times", array.array("f", self.render_times), scale_min=0) + imgui.plot_lines("##render_times", np.array(array.array("f", self.render_times)), scale_min=0) imgui.same_line(viz.label_w + viz.font_size * 9) t = [x for x in self.render_times if x > 0] t = np.mean(t) if len(t) > 0 else 0 diff --git a/widgets/video_widget.py b/widgets/video_widget.py index 815a18b..a11b7fe 100644 --- a/widgets/video_widget.py +++ b/widgets/video_widget.py @@ -1,4 +1,4 @@ -import imgui +from imgui_bundle import imgui import numpy as np from gui_utils import imgui_utils From fa1fa185d395db1543d76b2b79cc5ef2c4ccac0b Mon Sep 17 00:00:00 2001 From: Florian Barthel Date: Fri, 12 Jul 2024 02:56:56 +0200 Subject: [PATCH 4/5] add plots for tensors --- gui_utils/imgui_window.py | 12 +++++----- widgets/cam_widget.py | 4 ++-- widgets/edit_widget.py | 12 ++++------ widgets/eval_widget.py | 49 +++++++++++++++++++++++++++------------ 4 files changed, 47 insertions(+), 30 deletions(-) diff --git a/gui_utils/imgui_window.py b/gui_utils/imgui_window.py index 03d5800..a84f904 100644 --- a/gui_utils/imgui_window.py +++ b/gui_utils/imgui_window.py @@ -9,7 +9,7 @@ # its affiliates is strictly prohibited. import os -from imgui_bundle import imgui +from imgui_bundle import imgui, implot from imgui_bundle.python_backends.glfw_backend import GlfwRenderer from . import glfw_window @@ -29,7 +29,7 @@ def __init__(self, *, title="ImguiWindow", font=None, font_sizes=range(14, 24), # Init fields. self._imgui_context = None - # self._implot_context = None + self._implot_context = None self._imgui_renderer = None self._imgui_fonts = None self._cur_font_size = max(font_sizes) @@ -40,7 +40,7 @@ def __init__(self, *, title="ImguiWindow", font=None, font_sizes=range(14, 24), # Init ImGui. self._imgui_context = imgui.create_context() - # self._implot_context = implot.create_context() + self._implot_context = implot.create_context() self._imgui_renderer = _GlfwRenderer(self._glfw_window) self._attach_glfw_callbacks() imgui.get_io().ini_saving_rate = 0 # Disable creating imgui.ini at runtime. @@ -57,9 +57,9 @@ def close(self): if self._imgui_context is not None: # imgui.destroy_context(self._imgui_context) # Commented out to avoid creating imgui.ini at the end. self._imgui_context = None - #if self._implot_context is not None: - # implot.destroy_context(self._implot_context) # Commented out to avoid creating imgui.ini at the end. - # self._implot_context = None + if self._implot_context is not None: + implot.destroy_context(self._implot_context) # Commented out to avoid creating imgui.ini at the end. + self._implot_context = None super().close() def _glfw_key_callback(self, *args): diff --git a/widgets/cam_widget.py b/widgets/cam_widget.py index b218b19..74bd0b6 100644 --- a/widgets/cam_widget.py +++ b/widgets/cam_widget.py @@ -75,11 +75,11 @@ def handle_wasd(self): if imgui.is_key_down(imgui.Key.a): # A print(imgui.Key.a, imgui.get_key_name(imgui.Key.a)) - self.pose.yaw -= self.move_speed + self.pose.yaw += self.move_speed if imgui.is_key_down(imgui.Key.s): # S self.pose.pitch += self.move_speed if imgui.is_key_down(imgui.Key.d): # D - self.pose.yaw += self.move_speed + self.pose.yaw -= self.move_speed def handle_mouse(self): mouse_pos = imgui.get_io().mouse_pos diff --git a/widgets/edit_widget.py b/widgets/edit_widget.py index 51d9cdc..c8678da 100644 --- a/widgets/edit_widget.py +++ b/widgets/edit_widget.py @@ -38,11 +38,10 @@ def __init__(self, viz): self.presets = {} self.load_presets() - self.text = self.presets["Default"] self.editor = edit.TextEditor() self.editor.set_language_definition(edit.TextEditor.LanguageDefinition.python()) - self.editor.set_text(self.text) + self.editor.set_text(self.presets["Default"]) self.var_names = "xyzijklmnuvwabcdefghopqrst" self.var_name_index = 1 @@ -88,9 +87,9 @@ def __call__(self, show=True, decoder=False): if imgui.begin_popup("browse_presets"): for preset in self.all_presets: - clicked, _state = imgui.menu_item_simple(preset) + clicked = imgui.menu_item_simple(preset) if clicked: - self.text = self.presets[preset] + self.editor.set_text(self.presets[preset]) imgui.end_popup() # dynamic_height = 10 + viz.font_size * (self.text.count("\n") + 2) @@ -105,13 +104,12 @@ def __call__(self, show=True, decoder=False): _changed, self._cur_preset_name = imgui.input_text("##preset_name", self._cur_preset_name) imgui.same_line() if imgui.button("Save as Preset"): - self.presets[self._cur_preset_name] = self.text + self.presets[self._cur_preset_name] = self.editor.get_text() with open("./presets.json", "w", encoding='utf-8') as f: json.dump(self.presets, f) self._cur_preset_name = "" - self.text = self.editor.get_text() - viz.args.edit_text = self.text + viz.args.edit_text = self.editor.get_text() viz.args.render_alpha = self.render_alpha viz.args.render_depth = self.render_depth viz.args.render_gan_image = self.render_gan_image diff --git a/widgets/eval_widget.py b/widgets/eval_widget.py index 41ca937..992cfdc 100644 --- a/widgets/eval_widget.py +++ b/widgets/eval_widget.py @@ -1,4 +1,4 @@ -from imgui_bundle import imgui +from imgui_bundle import imgui, implot import numpy as np import torch import pprint @@ -62,29 +62,48 @@ def handle_type_rec(self, result, depth, obj_name): imgui.text(pprint.pformat(result, compact=True)) def handle_tensor(self, result, depth, var_name): - imgui.new_line() - imgui.same_line(depth) - imgui.text(pprint.pformat(result, compact=True)) - if np.prod(list(result.shape)) > 0: - imgui.new_line() - imgui.same_line(depth) - imgui.text(pprint.pformat(list(result.shape), compact=True)) - imgui.new_line() - imgui.same_line(depth) - stats_text = f"min: {result.min().item():.2f}, max: {result.max().item():.2f}, mean:{result.float().mean().item():.2f}, std:{result.float().std().item():.2f}" - imgui.text(pprint.pformat(stats_text, compact=True)) + # imgui.new_line() + # imgui.same_line(depth) + # imgui.text(pprint.pformat(result, compact=True)) + # if np.prod(list(result.shape)) > 0: + # imgui.new_line() + # imgui.same_line(depth) + # imgui.text(pprint.pformat(list(result.shape), compact=True)) + # imgui.new_line() + # imgui.same_line(depth) + # stats_text = f"min: {result.min().item():.2f}, max: {result.max().item():.2f}, mean:{result.float().mean().item():.2f}, std:{result.float().std().item():.2f}" + # imgui.text(pprint.pformat(stats_text, compact=True)) + orig_var_name = var_name var_name += self.viz.args.ply_file_paths[0] if var_name not in self.use_cache_dict.keys(): self.use_cache_dict[var_name] = True imgui.new_line() imgui.same_line(depth) _, self.use_cache_dict[var_name] = imgui.checkbox("Use Cache", self.use_cache_dict[var_name]) + bins = 50 if var_name not in self.hist_cache.keys() or not self.use_cache_dict[var_name]: - hist = np.histogram(result.cpu().detach().numpy().reshape(-1), bins=50) + hist = np.histogram(result.cpu().detach().numpy().reshape(-1), bins=bins) self.hist_cache[var_name] = hist - imgui.same_line() - # imgui.core.plot_histogram("", self.hist_cache[var_name][0].astype(np.float32)) + + imgui.new_line() + imgui.same_line(depth) + plot_size = imgui.ImVec2(self.viz.pane_w - 100, 200) + if implot.begin_plot(f"{orig_var_name}", plot_size): + # implot.setup_axes( + # "", + # "", + # implot.AxisFlags_.no_decorations.value, + # implot.AxisFlags_.no_decorations.value, + # ) + bar_size = (max(self.hist_cache[var_name][1].astype(np.float32)) - min(self.hist_cache[var_name][1].astype(np.float32))) / (bins + 1) + implot.plot_bars( + f"##hist{var_name}", + ys=self.hist_cache[var_name][0].astype(np.float32), + xs=self.hist_cache[var_name][1].astype(np.float32), + bar_size=bar_size + ) + implot.end_plot() @staticmethod def get_short_info(key, value): From 1789ac221e125b1ba4544054c2396b6774a3e221 Mon Sep 17 00:00:00 2001 From: Florian Barthel Date: Fri, 12 Jul 2024 03:26:08 +0200 Subject: [PATCH 5/5] small fixes --- run_main.py | 2 +- widgets/eval_widget.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/run_main.py b/run_main.py index cee05c3..5017b23 100644 --- a/run_main.py +++ b/run_main.py @@ -106,7 +106,7 @@ def draw_frame(self): # Widgets. expanded, _visible = imgui_utils.collapsing_header("Load", default=True) imgui.indent() - self.load_widget(True) + self.load_widget(expanded) imgui.unindent() expanded, _visible = imgui_utils.collapsing_header("Performance", default=False) diff --git a/widgets/eval_widget.py b/widgets/eval_widget.py index 992cfdc..f8cda14 100644 --- a/widgets/eval_widget.py +++ b/widgets/eval_widget.py @@ -19,7 +19,7 @@ def __call__(self, show=True): viz = self.viz if show: - _changed, self.text = imgui.input_text("", self.text) + _changed, self.text = imgui.input_text("##input_text", self.text) self.format() viz.args.eval_text = self.text