mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Improved and added settings for MediaPlayer split view slider
This commit is contained in:
@@ -126,6 +126,7 @@ void Settings::Save(uint64_t runtime)
|
|||||||
widgetsNode->SetAttribute("media_player", application.widget.media_player);
|
widgetsNode->SetAttribute("media_player", application.widget.media_player);
|
||||||
widgetsNode->SetAttribute("media_player_view", application.widget.media_player_view);
|
widgetsNode->SetAttribute("media_player_view", application.widget.media_player_view);
|
||||||
widgetsNode->SetAttribute("timeline_editmode", application.widget.media_player_timeline_editmode);
|
widgetsNode->SetAttribute("timeline_editmode", application.widget.media_player_timeline_editmode);
|
||||||
|
widgetsNode->SetAttribute("media_player_slider", application.widget.media_player_slider);
|
||||||
widgetsNode->SetAttribute("shader_editor", application.widget.shader_editor);
|
widgetsNode->SetAttribute("shader_editor", application.widget.shader_editor);
|
||||||
widgetsNode->SetAttribute("shader_editor_view", application.widget.shader_editor_view);
|
widgetsNode->SetAttribute("shader_editor_view", application.widget.shader_editor_view);
|
||||||
widgetsNode->SetAttribute("stats", application.widget.stats);
|
widgetsNode->SetAttribute("stats", application.widget.stats);
|
||||||
@@ -365,6 +366,7 @@ void Settings::Load()
|
|||||||
widgetsNode->QueryBoolAttribute("media_player", &application.widget.media_player);
|
widgetsNode->QueryBoolAttribute("media_player", &application.widget.media_player);
|
||||||
widgetsNode->QueryIntAttribute("media_player_view", &application.widget.media_player_view);
|
widgetsNode->QueryIntAttribute("media_player_view", &application.widget.media_player_view);
|
||||||
widgetsNode->QueryBoolAttribute("timeline_editmode", &application.widget.media_player_timeline_editmode);
|
widgetsNode->QueryBoolAttribute("timeline_editmode", &application.widget.media_player_timeline_editmode);
|
||||||
|
widgetsNode->QueryFloatAttribute("media_player_slider", &application.widget.media_player_slider);
|
||||||
widgetsNode->QueryBoolAttribute("shader_editor", &application.widget.shader_editor);
|
widgetsNode->QueryBoolAttribute("shader_editor", &application.widget.shader_editor);
|
||||||
widgetsNode->QueryIntAttribute("shader_editor_view", &application.widget.shader_editor_view);
|
widgetsNode->QueryIntAttribute("shader_editor_view", &application.widget.shader_editor_view);
|
||||||
widgetsNode->QueryBoolAttribute("stats", &application.widget.stats);
|
widgetsNode->QueryBoolAttribute("stats", &application.widget.stats);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ struct WidgetsConfig
|
|||||||
bool media_player;
|
bool media_player;
|
||||||
int media_player_view;
|
int media_player_view;
|
||||||
bool media_player_timeline_editmode;
|
bool media_player_timeline_editmode;
|
||||||
|
float media_player_slider;
|
||||||
bool timer;
|
bool timer;
|
||||||
int timer_view;
|
int timer_view;
|
||||||
bool inputs;
|
bool inputs;
|
||||||
@@ -42,6 +43,7 @@ struct WidgetsConfig
|
|||||||
media_player = false;
|
media_player = false;
|
||||||
media_player_view = -1;
|
media_player_view = -1;
|
||||||
media_player_timeline_editmode = false;
|
media_player_timeline_editmode = false;
|
||||||
|
media_player_slider = 1.f;
|
||||||
toolbox = false;
|
toolbox = false;
|
||||||
help = false;
|
help = false;
|
||||||
timer = false;
|
timer = false;
|
||||||
|
|||||||
@@ -2062,7 +2062,7 @@ void WorkspaceWindow::Update()
|
|||||||
///
|
///
|
||||||
SourceController::SourceController() : WorkspaceWindow("SourceController"),
|
SourceController::SourceController() : WorkspaceWindow("SourceController"),
|
||||||
min_width_(0.f), h_space_(0.f), v_space_(0.f), scrollbar_(0.f),
|
min_width_(0.f), h_space_(0.f), v_space_(0.f), scrollbar_(0.f),
|
||||||
timeline_height_(0.f), mediaplayer_height_(0.f), buttons_width_(0.f), buttons_height_(0.f), filter_slider_(0.9),
|
timeline_height_(0.f), mediaplayer_height_(0.f), buttons_width_(0.f), buttons_height_(0.f),
|
||||||
play_toggle_request_(false), replay_request_(false), pending_(false),
|
play_toggle_request_(false), replay_request_(false), pending_(false),
|
||||||
active_label_(LABEL_AUTO_MEDIA_PLAYER), active_selection_(-1),
|
active_label_(LABEL_AUTO_MEDIA_PLAYER), active_selection_(-1),
|
||||||
selection_context_menu_(false), selection_mediaplayer_(nullptr), selection_target_slower_(0), selection_target_faster_(0),
|
selection_context_menu_(false), selection_mediaplayer_(nullptr), selection_target_slower_(0), selection_target_faster_(0),
|
||||||
@@ -2195,12 +2195,15 @@ void SourceController::Render()
|
|||||||
if (ImGui::MenuItem( ICON_FA_PLAY " Play | Pause", "Space"))
|
if (ImGui::MenuItem( ICON_FA_PLAY " Play | Pause", "Space"))
|
||||||
play_toggle_request_ = true;
|
play_toggle_request_ = true;
|
||||||
|
|
||||||
if (ImGui::BeginMenu( ICON_FA_IMAGE " Show"))
|
// Menu section for displayed image
|
||||||
|
if (ImGui::BeginMenu( ICON_FA_IMAGE " Displayed image"))
|
||||||
{
|
{
|
||||||
if (ImGuiToolkit::MenuItemIcon(7, 9, "Pre-processed input"))
|
if (ImGuiToolkit::MenuItemIcon(7, 9, " Pre-processed"))
|
||||||
filter_slider_ = 1.0;
|
Settings::application.widget.media_player_slider = 1.0;
|
||||||
if (ImGuiToolkit::MenuItemIcon(8, 9, "Post-processed image"))
|
if (ImGuiToolkit::MenuItemIcon(6, 9, " Split view"))
|
||||||
filter_slider_ = 0.0;
|
Settings::application.widget.media_player_slider = 0.5;
|
||||||
|
if (ImGuiToolkit::MenuItemIcon(8, 9, " Post-processed"))
|
||||||
|
Settings::application.widget.media_player_slider = 0.0;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3002,15 +3005,18 @@ void SourceController::RenderSingleSource(Source *s)
|
|||||||
///
|
///
|
||||||
top += corner;
|
top += corner;
|
||||||
ImGui::SetCursorScreenPos(top);
|
ImGui::SetCursorScreenPos(top);
|
||||||
ImGui::Image((void*)(uintptr_t) s->texture(), framesize * ImVec2(filter_slider_,1.f), ImVec2(0.f,0.f), ImVec2(filter_slider_,1.f));
|
ImGui::Image((void*)(uintptr_t) s->texture(), framesize * ImVec2(Settings::application.widget.media_player_slider,1.f), ImVec2(0.f,0.f), ImVec2(Settings::application.widget.media_player_slider,1.f));
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(top + ImVec2(filter_slider_ * framesize.x, 0.f));
|
ImGui::SetCursorScreenPos(top + ImVec2(Settings::application.widget.media_player_slider * framesize.x, 0.f));
|
||||||
ImGui::Image((void*)(uintptr_t) s->frame()->texture(), framesize * ImVec2(1.f-filter_slider_,1.f), ImVec2(filter_slider_,0.f), ImVec2(1.f,1.f));
|
ImGui::Image((void*)(uintptr_t) s->frame()->texture(), framesize * ImVec2(1.f-Settings::application.widget.media_player_slider,1.f), ImVec2(Settings::application.widget.media_player_slider,0.f), ImVec2(1.f,1.f));
|
||||||
|
|
||||||
|
draw_list->AddCircleFilled(top + framesize * ImVec2(Settings::application.widget.media_player_slider,0.5f), 20.f, IM_COL32(255, 255, 255, 150), 26);
|
||||||
|
draw_list->AddLine(top + framesize * ImVec2(Settings::application.widget.media_player_slider,0.0f), top + framesize * ImVec2(Settings::application.widget.media_player_slider,1.f), IM_COL32(255, 255, 255, 150), 1);
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(top + ImVec2(0.f, 0.5f * framesize.y - 20.0f));
|
ImGui::SetCursorScreenPos(top + ImVec2(0.f, 0.5f * framesize.y - 20.0f));
|
||||||
ImGuiToolkit::InvisibleSliderFloat("#filter_slider", &filter_slider_, 0.f, 1.f, ImVec2(framesize.x, 40.0f) );
|
ImGuiToolkit::InvisibleSliderFloat("#filter_slider", &Settings::application.widget.media_player_slider, 0.f, 1.f, ImVec2(framesize.x, 40.0f) );
|
||||||
draw_list->AddCircleFilled(top + framesize * ImVec2(filter_slider_,0.5f), 20.f, IM_COL32(255, 255, 255, 150), 26);
|
if (ImGui::IsItemHovered() || ImGui::IsItemFocused())
|
||||||
draw_list->AddLine(top + framesize * ImVec2(filter_slider_,0.0f), top + framesize * ImVec2(filter_slider_,1.f), IM_COL32(255, 255, 255, 150), 1);
|
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Info overlays
|
/// Info overlays
|
||||||
@@ -3087,15 +3093,18 @@ void SourceController::RenderMediaPlayer(MediaSource *ms)
|
|||||||
///
|
///
|
||||||
const ImVec2 top_image = top + corner;
|
const ImVec2 top_image = top + corner;
|
||||||
ImGui::SetCursorScreenPos(top_image);
|
ImGui::SetCursorScreenPos(top_image);
|
||||||
ImGui::Image((void*)(uintptr_t) ms->texture(), framesize * ImVec2(filter_slider_,1.f), ImVec2(0.f,0.f), ImVec2(filter_slider_,1.f));
|
ImGui::Image((void*)(uintptr_t) ms->texture(), framesize * ImVec2(Settings::application.widget.media_player_slider,1.f), ImVec2(0.f,0.f), ImVec2(Settings::application.widget.media_player_slider,1.f));
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(top_image + ImVec2(filter_slider_ * framesize.x, 0.f));
|
ImGui::SetCursorScreenPos(top_image + ImVec2(Settings::application.widget.media_player_slider * framesize.x, 0.f));
|
||||||
ImGui::Image((void*)(uintptr_t) ms->frame()->texture(), framesize * ImVec2(1.f-filter_slider_,1.f), ImVec2(filter_slider_,0.f), ImVec2(1.f,1.f));
|
ImGui::Image((void*)(uintptr_t) ms->frame()->texture(), framesize * ImVec2(1.f-Settings::application.widget.media_player_slider,1.f), ImVec2(Settings::application.widget.media_player_slider,0.f), ImVec2(1.f,1.f));
|
||||||
|
|
||||||
|
draw_list->AddCircleFilled(top_image + framesize * ImVec2(Settings::application.widget.media_player_slider,0.5f), 20.f, IM_COL32(255, 255, 255, 150), 26);
|
||||||
|
draw_list->AddLine(top_image + framesize * ImVec2(Settings::application.widget.media_player_slider,0.0f), top_image + framesize * ImVec2(Settings::application.widget.media_player_slider,1.f), IM_COL32(255, 255, 255, 150), 1);
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(top_image + ImVec2(0.f, 0.5f * framesize.y - 20.0f));
|
ImGui::SetCursorScreenPos(top_image + ImVec2(0.f, 0.5f * framesize.y - 20.0f));
|
||||||
ImGuiToolkit::InvisibleSliderFloat("#filter_slider_2", &filter_slider_, 0.f, 1.f, ImVec2(framesize.x, 40.0f) );
|
ImGuiToolkit::InvisibleSliderFloat("#Settings::application.widget.media_player_slider2", &Settings::application.widget.media_player_slider, 0.f, 1.f, ImVec2(framesize.x, 40.0f) );
|
||||||
draw_list->AddCircleFilled(top_image + framesize * ImVec2(filter_slider_,0.5f), 20.f, IM_COL32(255, 255, 255, 150), 26);
|
if (ImGui::IsItemHovered() || ImGui::IsItemFocused())
|
||||||
draw_list->AddLine(top_image + framesize * ImVec2(filter_slider_,0.0f), top_image + framesize * ImVec2(filter_slider_,1.f), IM_COL32(255, 255, 255, 150), 1);
|
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Info overlays
|
/// Info overlays
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ class SourceController : public WorkspaceWindow
|
|||||||
float mediaplayer_height_;
|
float mediaplayer_height_;
|
||||||
float buttons_width_;
|
float buttons_width_;
|
||||||
float buttons_height_;
|
float buttons_height_;
|
||||||
float filter_slider_;
|
|
||||||
|
|
||||||
bool play_toggle_request_, replay_request_;
|
bool play_toggle_request_, replay_request_;
|
||||||
bool pending_;
|
bool pending_;
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user