def draw(self): imgui.begin("Example: item indenting") imgui.text("Some text with bullets:") imgui.bullet_text("Bullet A") imgui.indent() imgui.bullet_text("Bullet B (first indented)") imgui.bullet_text("Bullet C (indent continues)") imgui.unindent() imgui.bullet_text("Bullet D (indent cleared)") imgui.end()
def draw(self): imgui.new_frame() imgui.set_next_window_position(16, 32, imgui.ONCE) imgui.set_next_window_size(512, 512, imgui.ONCE) imgui.begin("Example: item indenting") imgui.text("Some text with bullets:") imgui.bullet_text("Bullet A") imgui.indent() imgui.bullet_text("Bullet B (first indented)") imgui.bullet_text("Bullet C (indent continues)") imgui.unindent() imgui.bullet_text("Bullet D (indent cleared)") imgui.end() imgui.end_frame() imgui.render() self.renderer.render(imgui.get_draw_data())
def make_gui(self, width, height): imgui.begin("Lighting", True) imgui.collapsing_header("Shadows") imgui.indent() ch, val = imgui.checkbox("Render Shadows", self.scene.shadowsEnabled) if ch: self.scene.shadowsEnabled = val if not val: self.scene.shadows.clear() ch, val = imgui.slider_float("Shadow Strength", self.lightingStage.shadowStrength, 0, 1) if ch: self.lightingStage.shadowStrength = val ch, val = imgui.slider_int("Shadows Update Frequency", self.scene.shadows.exponent, 1, 10) if ch: self.scene.shadows.exponent = val ch, val = imgui.slider_float("Shadows range", self.scene.shadows.rng, 0.01, 20) if ch: self.scene.shadows.rng = val imgui.unindent() imgui.collapsing_header("Ambient Occlusion") imgui.indent() ch, val = imgui.slider_float("Occlusion Strength", self.lightingStage.occlusionStrength, 0, 1) if ch: self.lightingStage.occlusionStrength = val ch, val = imgui.slider_float( "SSAO blur radius", self.lightingStage.SSAOBlurAmount, 0, 0.01, display_format="%.4f", ) if ch: self.lightingStage.SSAOBlurAmount = val ch, val = imgui.slider_int("SSAO Samples", self.lightingStage.SSAOSamples, 0, 20) if ch: self.lightingStage.SSAOSamples = val ch, val = imgui.slider_float("SSAO Radius", self.lightingStage.SSAORadius, 0, 2) if ch: self.lightingStage.SSAORadius = val ch, val = imgui.slider_float("SSAO Min Cutoff", self.lightingStage.SSAOMin, 0, 1) if ch: self.lightingStage.SSAOMin = val ch, val = imgui.slider_float("SSAO Max Cutoff", self.lightingStage.SSAOMax, 0, 1) if ch: self.lightingStage.SSAOMax = val imgui.unindent() imgui.collapsing_header("Raytracing") imgui.indent() ch, val = imgui.slider_int("Raytrace Count", self.lightingStage.raytraceCount, 0, 100) if ch: self.lightingStage.raytraceCount = val ch, val = imgui.slider_float("Raytrace Strength", self.lightingStage.raytraceStrength, 0, 1) if ch: self.lightingStage.raytraceStrength = val imgui.unindent() imgui.collapsing_header("Other") imgui.indent() ch, val = imgui.slider_float("Ambient light strength", self.lightingStage.ambientStrength, 0, 1) if ch: self.lightingStage.ambientStrength = val ch, val = imgui.slider_float("Sun Intesnity", self.lightingStage.sunIntensity, 0, 1) if ch: self.lightingStage.sunIntensity = val ch, val = imgui.slider_float("Specularity", self.lightingStage.specularity, 1, 10000, power=10) if ch: self.lightingStage.specularity = val imgui.unindent() imgui.end()
def displayInterface(self): imgui.begin_child("left_bottom", width=606, height=370) imgui.text("Watch Paths") imgui.begin_child("left_bottom", width=606, height=310, border=True) for path in list(self.watchInformation.keys()): imgui.push_text_wrap_position() imgui.text(path) imgui.same_line() if (imgui.button("- Remove Path")): del self.watchInformation[path] self.saveWatchInformation() imgui.end_child() imgui.text("Add new path:") addNewPathInputChanged, self.addingPathText = imgui.input_text( "##Path input", self.addingPathText, 2048) imgui.same_line() if (imgui.button("+ Add Path")): self.handleNewPathAdding() imgui.end_child() imgui.same_line() imgui.begin_child("file_dir_alerts") imgui.text("File/Directory Change Alerts") imgui.begin_child("file_dir_alerts_logger", border=True) for alert in self.alertsData: data = self.alertsData[alert] if (imgui.tree_node(data["timestamp"] + " " + data["path"])): imgui.indent() imgui.push_text_wrap_position() imgui.text("Change Path: " + data["path"]) if (os.path.isfile(data["path"])): if (imgui.tree_node("Last Content")): imgui.push_text_wrap_position() imgui.text(data["last-content"]) imgui.tree_pop() if (imgui.tree_node("New Content")): imgui.push_text_wrap_position() imgui.text(data["new-content"]) imgui.tree_pop() if (os.path.isdir(data["path"])): if (imgui.tree_node("Last Content")): if (imgui.tree_node( "Files (" + str(len(data["last-content"]["files"])) + ")")): for file in data["last-content"]["files"]: imgui.push_text_wrap_position() imgui.text(file) imgui.tree_pop() if (imgui.tree_node( "Directories (" + str(len(data["last-content"]["directories"])) + ")")): for file in data["last-content"]["directories"]: imgui.push_text_wrap_position() imgui.text(file) imgui.tree_pop() imgui.tree_pop() if (imgui.tree_node("New Content")): if (imgui.tree_node( "Files (" + str(len(data["new-content"]["files"])) + ")")): for file in data["new-content"]["files"]: imgui.push_text_wrap_position() imgui.text(file) imgui.tree_pop() if (imgui.tree_node( "Directories (" + str(len(data["new-content"]["directories"])) + ")")): for file in data["new-content"]["directories"]: imgui.push_text_wrap_position() imgui.text(file) imgui.tree_pop() imgui.tree_pop() imgui.tree_pop() imgui.unindent() imgui.end_child() imgui.end_child()
def indent(width): try: yield imgui.indent(width) finally: imgui.unindent(width)
def interface(): imgui.new_frame() if imgui.begin_main_menu_bar(): if imgui.begin_menu("File", True): clicked_quit, selected_quit = imgui.menu_item( "Quit", 'Cmd+Q', False, True) if clicked_quit: exit(1) imgui.end_menu() if imgui.begin_menu('Windows', True): clicked_fixtureC, selected_fixtureC = imgui.menu_item( 'Fixture Controls', shortcut=None) if clicked_fixtureC: if values.showFixtureControl: values.showFixtureControl = False else: values.showFixtureControl = True imgui.end_menu() imgui.end_main_menu_bar() if values.showFixtureControl: imgui.begin("Fixture Control", True) for r in patch.rooms.values(): expanded, visible = imgui.collapsing_header(r.name) if expanded: imgui.indent() for f in r.fixtureList: expanded, visible = imgui.collapsing_header(f.name) rgb = values.values[f.name] if expanded: imgui.columns(2, f.name) imgui.indent() imgui.text('Red') changed, value = imgui.slider_int( '##int%sred' % f.name, rgb[0], 0, 255) if changed: rgb[0] = value ui.cache(f.setColor, [rgb, 0.2]) ui.update() imgui.text('Green') changed, value = imgui.slider_int( '##int%sgreen' % f.name, rgb[1], 0, 255) if changed: rgb[1] = value ui.cache(f.setColor, [rgb, 0.2]) ui.update() imgui.text('Blue') changed, value = imgui.slider_int( '##int%sblue' % f.name, rgb[2], 0, 255) if changed: rgb[2] = value ui.cache(f.setColor, [rgb, 0.2]) ui.update() imgui.next_column() imgui.color_button('Color Sample', rgb[0] / 255, rgb[1] / 255, rgb[2] / 255, width=100, height=100) imgui.columns(1) imgui.unindent() imgui.unindent() imgui.same_line(spacing=50) imgui.end()