Fixes transition

This commit is contained in:
brunoherbelin
2020-07-06 21:40:01 +02:00
parent b5985847bf
commit 124400c420
2 changed files with 41 additions and 33 deletions

View File

@@ -613,11 +613,11 @@ void UserInterface::Terminate()
void UserInterface::showMenuOptions() 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::Separator();
ImGui::MenuItem( ICON_FA_HISTORY " Load most recent on start", nullptr, &Settings::application.recentSessions.load_at_start); 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() void UserInterface::showMenuFile()
@@ -1241,7 +1241,7 @@ void Navigator::Render()
} }
else { else {
// the "=" icon for menu // 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(); // Mixer::manager().unsetCurrentSource();
applyButtonSelection(NAV_TRANS); applyButtonSelection(NAV_TRANS);
@@ -1543,9 +1543,14 @@ void Navigator::RenderTransitionPannel()
ImGui::SameLine(0, 10); ImGui::SameLine(0, 10);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Curve", &Settings::application.transition.profile, "Linear\0Quadratic\0IExponent\0"); 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<TransitionView *>(Mixer::manager().view(View::TRANSITION));
if (tv) tv->play();
}
if ( ImGui::Button("Start", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) ImGui::Text(" ");
Settings::application.widget.media_player = true; if ( ImGui::Button( ICON_FA_DOOR_OPEN " Exit", ImVec2(ImGui::GetContentRegionAvail().x, 0)) )
Mixer::manager().setView(View::MIXING);
} }
ImGui::End(); ImGui::End();

View File

@@ -754,33 +754,6 @@ TransitionView::TransitionView() : View(TRANSITION), transition_source_(nullptr)
void TransitionView::update(float dt) 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<glm::mat4>(), Rendering::manager().Projection());
// Update transition source // Update transition source
if ( transition_source_ != nullptr) { if ( transition_source_ != nullptr) {
@@ -815,6 +788,36 @@ void TransitionView::draw()
Mixer::manager().setView(View::MIXING); 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<glm::mat4>(), Rendering::manager().Projection());
} }
void TransitionView::attach(SessionSource *ts) 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; float d = s->stored_status_->translation_.x + gl_Position_to.x - gl_Position_from.x;
if (d > 0.2) { if (d > 0.2) {
s->group(View::TRANSITION)->translation_.x = 0.4; s->group(View::TRANSITION)->translation_.x = 0.4;
info << "Make current"; info << "Open session";
} }
else { else {
s->group(View::TRANSITION)->translation_.x = CLAMP(d, -1.f, 0.f); s->group(View::TRANSITION)->translation_.x = CLAMP(d, -1.f, 0.f);