Fix inconsistent header and colors in frame extraction dialog#1089
Fix inconsistent header and colors in frame extraction dialog#1089dylantirandaz wants to merge 12 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Video Extractor “Frame Extraction” UI to better match other floating/modal panels and to respect the active theme, addressing issue #1005 (inconsistent styling and inability to close).
Changes:
- Replaced hardcoded
ImVec4colors in the extractor dialog with theme palette colors (dim/warning/success/error). - Wrapped the extractor widget in a proper
ImGui::Begin/Endfloating window with modal styling and a standard title-bar close button. - Ensured the panel disables itself when closed via the window close button (or when the widget requests closure).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/visualizer/gui/windows/video_extractor_dialog.cpp |
Swaps hardcoded text/status colors to theme palette references inside the extractor widget rendering. |
src/visualizer/gui/native_panels.cpp |
Hosts the extractor widget in a self-managed ImGui window using modal theme styling and an open close button. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const char* ext = format_selection_ == 0 ? ".png" : ".jpg"; | ||
| char preview[128]; | ||
| std::snprintf(preview, sizeof(preview), filename_pattern_.data(), 1); | ||
| ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), LOC(VideoExtractor::EXAMPLE), preview, ext); | ||
| ImGui::TextColored(t.palette.text_dim, LOC(VideoExtractor::EXAMPLE), preview, ext); |
There was a problem hiding this comment.
filename_pattern_ is user-editable and is being passed directly as the std::snprintf format string for the preview. If the user enters an invalid/hostile printf pattern (e.g. "%s", "%n", or mismatched specifiers), this is undefined behavior and can crash or worse. Consider generating the preview without treating user input as a format string (e.g. replace a known token like "%d"/"{frame}" manually), or validate/sanitize the pattern so only an allowed placeholder is accepted before calling snprintf.
| if (ImGui::Begin(LOC(lichtfeld::Strings::VideoExtractor::TITLE), &open)) { | ||
| if (!widget_->render()) | ||
| open = false; | ||
| } | ||
| ImGui::End(); | ||
| t.popModalStyle(); |
There was a problem hiding this comment.
t.pushModalStyle()/t.popModalStyle() are not exception-safe. PanelRegistry::draw_panels() catches exceptions from panel->draw(), so if widget_->render() throws, the style stack will remain unbalanced and can corrupt styling for the rest of the frame. Please ensure popModalStyle() executes on all exit paths (e.g. wrap the Begin/render/End in a try/catch that pops then rethrows, or use a small scope-guard RAII helper).
| if (ImGui::Begin(LOC(lichtfeld::Strings::VideoExtractor::TITLE), &open)) { | |
| if (!widget_->render()) | |
| open = false; | |
| } | |
| ImGui::End(); | |
| t.popModalStyle(); | |
| bool began = false; | |
| try { | |
| const bool visible = ImGui::Begin(LOC(lichtfeld::Strings::VideoExtractor::TITLE), &open); | |
| began = true; | |
| if (visible) { | |
| if (!widget_->render()) | |
| open = false; | |
| } | |
| ImGui::End(); | |
| began = false; | |
| t.popModalStyle(); | |
| } catch (...) { | |
| if (began) | |
| ImGui::End(); | |
| t.popModalStyle(); | |
| throw; | |
| } |
|
Similar to my previous comments. I was not able to test it since the mesh-2-splat doesn't open, please make sure to sync with master and provide some screenshots of the before and after the UI to make it a bit easier to review :p Thanks! |
f30ab46 to
dca534d
Compare
dca534d to
6284324
Compare
|
basically move away from imgui to rmlui. At the current state this implementation kills the entire preview Window. It should match the old version just in rmlui! |
23cee8e to
6284324
Compare
3fdd397 to
7e11da0
Compare
|
I think so. I can't test now. I will check it tomorrow. |
|
Sounds good |
|
okay sounds good, im still working on it u can ignore the latest push i havent tested yet and its late here so ill finish tmrw |
|
fixed, ran into some issues with rewind/fast forward but i fixed those too |
|
Okay fixed the playback, not sure if I am able to recreate the UI one of one though |
|
@dylantirandaz, apologies for my late reply on this PR. Could you please check the builds and resolve the conflicts. Thanks! |
Replace all hardcoded ImGui text colors with theme palette references so the dialog respects the active theme (dark, light, gruvbox, etc.): - Secondary/info text now uses palette.text_dim instead of inline grays - Warning, success, and error messages use palette.warning/success/error Wrap the dialog content in a proper ImGui::Begin/End window with modal styling and a title-bar close button, matching how other floating panels (Input Settings, Marketplace) present themselves. Closes MrNeRF#1005
Replace the native ImGui video extractor panel with a Python-managed RmlUI panel. Add a custom VideoPreviewElement for GL texture rendering with aspect-ratio letterboxing via CallbackTextureSource. Wire video player and frame extraction through python_runtime callbacks so the Python module avoids linking lfs_video directly.
- Fix locale keys to use correct translation strings - Add separator line styling on section headers - Make transport controls always visible (not just when video open) - Use 28dp round buttons with triangle icons matching old ImGui - Set panel width to 750dp matching old ImGui window size - Set preview area to 300dp with dark background and border - Add test data files to .gitignore
Video player functions are registered on the lichtfeld.io submodule but the panel was calling them on the root lichtfeld module, causing AttributeError on video load. Use lf.io.* prefix for all video player, feed_preview, and video_extract calls.
VideoPlayer::update() expects wall clock time (seconds since reference point), not delta time. The old ImGui code passed ImGui::GetTime(). Fix the callback to use steady_clock relative to app start. Also fix preview updates after step/seek by adding a _needs_preview_update flag that triggers feed_preview_element even when the player isn't playing.
Drive playback from Python using seek-based frame advancing instead of VideoPlayer::update() which auto-pauses at EOF. Fix CallbackTextureSource recreation causing black frames. Fix step forward/backward using seek with 1/fps offset.
Drive playback from Python using stepForward with frame-rate accumulator instead of broken VideoPlayer::update(). Fix seek- based rewind with retry for keyframe snapping. Fix EOF auto- pause by seeking to current position before play. Fix texture source recreation causing black frames during playback.
6ec922d to
078fa3f
Compare
|
Hey @dylantirandaz what's the state here given your last commits? |
Replace direct OpenGL texture management (glad/glGenTextures/ glTexImage2D) with Rml::CallbackTextureInterface::GenerateTexture so the element works with the project's Vulkan rmlui backend. Frame data is converted from RGB to RGBA in CPU and uploaded through a freshly-constructed CallbackTextureSource whenever new pixels arrive. The previous source is released by move-assign, freeing the cached backend texture.
|
Im working on fixing some stuff but Im swamped with final exams so not sure on the timeline, just pushing code when I have free time |
|
hey @dylantirandaz, I was wondering if you have any updates regarding this PR (: |
|






Summary
ImVec4text colors in the video extractor dialog with theme palette references (palette.text_dim,palette.warning,palette.success,palette.error) so the dialog respects the active themeImGui::Begin/Endwindow with modal styling and a title-bar close button, matching the presentation of other floating panels (Input Settings, Marketplace)Test plan
×close buttonCloses #1005