mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 19:29:58 +01:00
BugFix Transition Cross Fading temporarily disabled when faded
When session is already fade to black, the cross fading transition cannot be used. Added an icon in left panel to allow user to set the transition mode
This commit is contained in:
@@ -40,7 +40,8 @@
|
||||
#define POS_TARGET 0.4f
|
||||
|
||||
|
||||
TransitionView::TransitionView() : View(TRANSITION), transition_source_(nullptr)
|
||||
TransitionView::TransitionView() : View(TRANSITION), transition_source_(nullptr),
|
||||
transition_cross_fade(true)
|
||||
{
|
||||
// read default settings
|
||||
if ( Settings::application.views[mode_].name.empty() )
|
||||
@@ -126,7 +127,7 @@ void TransitionView::update(float dt)
|
||||
|
||||
// Transfer this movement to changes in mixing
|
||||
// cross fading
|
||||
if ( Settings::application.transition.cross_fade )
|
||||
if ( transition_cross_fade )
|
||||
{
|
||||
float f = 0.f;
|
||||
// change alpha of session:
|
||||
@@ -176,7 +177,7 @@ void TransitionView::update(float dt)
|
||||
void TransitionView::draw()
|
||||
{
|
||||
// update the GUI depending on changes in settings
|
||||
gradient_->setActive( 2 * (Settings::application.transition.profile ? 1 : 0) + (Settings::application.transition.cross_fade ? 0 : 1) );
|
||||
gradient_->setActive( 2 * (Settings::application.transition.profile ? 1 : 0) + (transition_cross_fade ? 0 : 1) );
|
||||
|
||||
// draw scene of this view
|
||||
View::draw();
|
||||
@@ -234,7 +235,10 @@ void TransitionView::draw()
|
||||
// toggle transition mode
|
||||
ImGui::SetCursorScreenPos(ImVec2(pos_tran.x - 60.f, pos_tran.y +2.f));
|
||||
const char *tooltip[2] = {"Fade to black", "Cross fading"};
|
||||
ImGuiToolkit::IconToggle(9, 8, 0, 8, &Settings::application.transition.cross_fade, tooltip );
|
||||
if (ImGuiToolkit::IconToggle(9, 8, 0, 8,
|
||||
&transition_cross_fade,
|
||||
tooltip))
|
||||
Settings::application.transition.cross_fade = transition_cross_fade;
|
||||
|
||||
ImGui::SetCursorScreenPos(ImVec2(pos_tran.x + 10.f, pos_tran.y + 2.f));
|
||||
const char *_tooltip[2] = {"Linear", "Quadratic"};
|
||||
@@ -272,8 +276,17 @@ void TransitionView::attach(SessionFileSource *ts)
|
||||
tg->visible_ = true;
|
||||
scene.ws()->attach(tg);
|
||||
|
||||
transition_cross_fade = Settings::application.transition.cross_fade;
|
||||
|
||||
// automatically change fading mode to 'fade to black' if
|
||||
// the session is already faded to black
|
||||
if (Mixer::manager().session()->fading() > 0.01
|
||||
&& Settings::application.transition.cross_fade) {
|
||||
transition_cross_fade = false;
|
||||
}
|
||||
|
||||
// in fade to black transition, start transition from current fading value
|
||||
if ( !Settings::application.transition.cross_fade) {
|
||||
if ( !transition_cross_fade) {
|
||||
|
||||
// reverse calculate x position to match actual fading of session
|
||||
float d = 0.f;
|
||||
|
||||
@@ -35,6 +35,7 @@ private:
|
||||
Mesh *mark_100ms_, *mark_1s_;
|
||||
Switch *gradient_;
|
||||
SessionFileSource *transition_source_;
|
||||
bool transition_cross_fade;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -5560,10 +5560,21 @@ void Navigator::RenderMainPannelPlaylist()
|
||||
ImGuiToolkit::HelpToolTip("Double-clic on a filename to open the session.\n\n"
|
||||
ICON_FA_ARROW_CIRCLE_RIGHT " enable Smooth transition "
|
||||
"to perform a cross fading with the current session.");
|
||||
|
||||
// toggle button for smooth transition
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y - ImGui::GetFrameHeightWithSpacing()) );
|
||||
ImGuiToolkit::ButtonToggle(ICON_FA_ARROW_CIRCLE_RIGHT, &Settings::application.smooth_transition, "Smooth transition");
|
||||
|
||||
// transition mode icon if enabled
|
||||
if (Settings::application.smooth_transition) {
|
||||
const char *tooltip[2] = {"Fade to black", "Cross fading"};
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (Mixer::manager().session()->fading() > 0.01)
|
||||
ImGuiToolkit::Icon(9, 8, false);
|
||||
else
|
||||
ImGuiToolkit::IconToggle(9, 8, 0, 8, &Settings::application.transition.cross_fade, tooltip );
|
||||
}
|
||||
|
||||
//
|
||||
// Popup window to create playlist
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user