From 124400c420acd02590add9a1d8c105cf9492a3e6 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Mon, 6 Jul 2020 21:40:01 +0200 Subject: [PATCH] Fixes transition --- UserInterfaceManager.cpp | 15 ++++++---- View.cpp | 59 +++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index ce3bdf3..7f249bc 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -613,11 +613,11 @@ void UserInterface::Terminate() void UserInterface::showMenuOptions() { - ImGui::MenuItem( ICON_FA_CLOCK " Smooth transition", nullptr, &Settings::application.smooth_transition); + ImGui::MenuItem( ICON_FA_PLAY " Smooth transition", nullptr, &Settings::application.smooth_transition); ImGui::Separator(); ImGui::MenuItem( ICON_FA_HISTORY " Load most recent on start", nullptr, &Settings::application.recentSessions.load_at_start); - ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save on exit", nullptr, &Settings::application.recentSessions.save_on_exit); + ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save on exit", nullptr, &Settings::application.recentSessions.save_on_exit); } void UserInterface::showMenuFile() @@ -1241,7 +1241,7 @@ void Navigator::Render() } else { // the "=" icon for menu - if (ImGui::Selectable( ICON_FA_GREATER_THAN, &selected_button[NAV_TRANS], 0, iconsize)) + if (ImGui::Selectable( ICON_FA_PLAY, &selected_button[NAV_TRANS], 0, iconsize)) { // Mixer::manager().unsetCurrentSource(); applyButtonSelection(NAV_TRANS); @@ -1543,9 +1543,14 @@ void Navigator::RenderTransitionPannel() ImGui::SameLine(0, 10); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::Combo("Curve", &Settings::application.transition.profile, "Linear\0Quadratic\0IExponent\0"); + if ( ImGui::Button( ICON_FA_PLAY " Start", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) { + TransitionView *tv = static_cast(Mixer::manager().view(View::TRANSITION)); + if (tv) tv->play(); + } - if ( ImGui::Button("Start", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) - Settings::application.widget.media_player = true; + ImGui::Text(" "); + if ( ImGui::Button( ICON_FA_DOOR_OPEN " Exit", ImVec2(ImGui::GetContentRegionAvail().x, 0)) ) + Mixer::manager().setView(View::MIXING); } ImGui::End(); diff --git a/View.cpp b/View.cpp index 7d2d158..f397b63 100644 --- a/View.cpp +++ b/View.cpp @@ -754,33 +754,6 @@ TransitionView::TransitionView() : View(TRANSITION), transition_source_(nullptr) void TransitionView::update(float dt) { - View::update(dt); - - // reorder depth if needed - if (View::need_deep_update_) { - - // update rendering of render frame - FrameBuffer *output = Mixer::manager().session()->frame(); - if (output){ - float aspect_ratio = output->aspectRatio(); - for (NodeSet::iterator node = scene.bg()->begin(); node != scene.bg()->end(); node++) { - (*node)->scale_.x = aspect_ratio; - } - output_surface_->setTextureIndex( output->texture() ); - } - } - -} - - -void TransitionView::draw() -{ - // update the GUI depending on changes in settings - mark_half_->visible_ = !Settings::application.transition.cross_fade; - - // draw scene of this view - scene.root()->draw(glm::identity(), Rendering::manager().Projection()); - // Update transition source if ( transition_source_ != nullptr) { @@ -815,6 +788,36 @@ void TransitionView::draw() Mixer::manager().setView(View::MIXING); } + + // update scene + View::update(dt); + + // reorder depth if needed + if (View::need_deep_update_) { + + // update rendering of render frame + FrameBuffer *output = Mixer::manager().session()->frame(); + if (output){ + float aspect_ratio = output->aspectRatio(); + for (NodeSet::iterator node = scene.bg()->begin(); node != scene.bg()->end(); node++) { + (*node)->scale_.x = aspect_ratio; + } + output_surface_->setTextureIndex( output->texture() ); + } + } + +} + + +void TransitionView::draw() +{ + // update the GUI depending on changes in settings + mark_half_->visible_ = !Settings::application.transition.cross_fade; + + // draw scene of this view + scene.root()->draw(glm::identity(), Rendering::manager().Projection()); + + } void TransitionView::attach(SessionSource *ts) @@ -909,7 +912,7 @@ View::Cursor TransitionView::grab (Source *s, glm::vec2 from, glm::vec2 to, std: float d = s->stored_status_->translation_.x + gl_Position_to.x - gl_Position_from.x; if (d > 0.2) { s->group(View::TRANSITION)->translation_.x = 0.4; - info << "Make current"; + info << "Open session"; } else { s->group(View::TRANSITION)->translation_.x = CLAMP(d, -1.f, 0.f);