mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-15 20:29:58 +01:00
Improved Transition view
Update Transition panel to natch new navigator panel style. Add curse selection in view.
This commit is contained in:
@@ -263,6 +263,7 @@ SessionFileSource::SessionFileSource(uint64_t id) : SessionSource(id), path_("")
|
||||
|
||||
Symbol *loader = new Symbol(Symbol::DOTS);
|
||||
loader->scale_ = glm::vec3(2.f, 2.f, 1.f);
|
||||
loader->translation_.y = -0.8;
|
||||
loader->update_callbacks_.push_back(new InfiniteGlowCallback);
|
||||
overlays_[View::TRANSITION]->attach(loader);
|
||||
|
||||
|
||||
@@ -547,7 +547,7 @@ void Settings::Load(const string &filename)
|
||||
if (transitionnode != nullptr) {
|
||||
transitionnode->QueryBoolAttribute("cross_fade", &application.transition.cross_fade);
|
||||
transitionnode->QueryFloatAttribute("duration", &application.transition.duration);
|
||||
transitionnode->QueryIntAttribute("profile", &application.transition.profile);
|
||||
transitionnode->QueryBoolAttribute("profile", &application.transition.profile);
|
||||
}
|
||||
|
||||
// Windows
|
||||
|
||||
@@ -165,12 +165,12 @@ struct TransitionConfig
|
||||
{
|
||||
bool cross_fade;
|
||||
float duration;
|
||||
int profile;
|
||||
bool profile;
|
||||
|
||||
TransitionConfig() {
|
||||
cross_fade = true;
|
||||
duration = 1.f;
|
||||
profile = 0;
|
||||
profile = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ TransitionView::TransitionView() : View(TRANSITION), transition_source_(nullptr)
|
||||
scene.bg()->attach(output_surface_);
|
||||
|
||||
fastopenicon = new Symbol(Symbol::FFWRD);
|
||||
fastopenicon->color = glm::vec4( COLOR_FRAME_LIGHT, 1.0f );
|
||||
fastopenicon->color = glm::vec4( COLOR_TRANSITION_SOURCE, 1.0f );
|
||||
scene.bg()->attach(fastopenicon);
|
||||
|
||||
Frame *border = new Frame(Frame::ROUND, Frame::THIN, Frame::GLOW);
|
||||
@@ -130,13 +130,12 @@ void TransitionView::update(float dt)
|
||||
{
|
||||
float f = 0.f;
|
||||
// change alpha of session:
|
||||
if (Settings::application.transition.profile == 0)
|
||||
if (!Settings::application.transition.profile)
|
||||
// linear => identical coordinates in Mixing View
|
||||
f = d;
|
||||
else {
|
||||
else
|
||||
// quadratic => square coordinates in Mixing View
|
||||
f = (d+1.f)*(d+1.f) -1.f;
|
||||
}
|
||||
transition_source_->group(View::MIXING)->translation_.x = CLAMP(f, -1.f, 0.f);
|
||||
transition_source_->group(View::MIXING)->translation_.y = 0.f;
|
||||
|
||||
@@ -152,7 +151,7 @@ void TransitionView::update(float dt)
|
||||
|
||||
// fade to black at 50% : fade-out [-1.0 -0.5], fade-in [-0.5 0.0]
|
||||
float f = 0.f;
|
||||
if (Settings::application.transition.profile == 0)
|
||||
if (!Settings::application.transition.profile)
|
||||
f = ABS(2.f * d + 1.f); // linear
|
||||
else {
|
||||
f = ( 2.f * d + 1.f); // quadratic
|
||||
@@ -177,7 +176,7 @@ void TransitionView::update(float dt)
|
||||
void TransitionView::draw()
|
||||
{
|
||||
// update the GUI depending on changes in settings
|
||||
gradient_->setActive( 2*Settings::application.transition.profile + (Settings::application.transition.cross_fade ? 0 : 1) );
|
||||
gradient_->setActive( 2 * (Settings::application.transition.profile ? 1 : 0) + (Settings::application.transition.cross_fade ? 0 : 1) );
|
||||
|
||||
// draw scene of this view
|
||||
View::draw();
|
||||
@@ -233,10 +232,14 @@ void TransitionView::draw()
|
||||
}
|
||||
|
||||
// toggle transition mode
|
||||
ImGui::SetCursorScreenPos(ImVec2(pos_tran.x - 20.f, pos_tran.y +2.f));
|
||||
ImGui::SetCursorScreenPos(ImVec2(pos_tran.x - 60.f, pos_tran.y +2.f));
|
||||
const char *tooltip[2] = {"Fade to black", "Cross fading"};
|
||||
ImGuiToolkit::IconToggle(0,2,0,8, &Settings::application.transition.cross_fade, tooltip );
|
||||
|
||||
ImGui::SetCursorScreenPos(ImVec2(pos_tran.x + 10.f, pos_tran.y + 2.f));
|
||||
const char *_tooltip[2] = {"Linear", "Quadratic"};
|
||||
ImGuiToolkit::IconToggle(18,3,19,3, &Settings::application.transition.profile, _tooltip );
|
||||
|
||||
// Duration slider (adjusted width)
|
||||
const float width = (pos_play.x - pos_canl.x) / 5.0;
|
||||
ImGui::SetCursorScreenPos(ImVec2(pos_play.x - width, pos_play.y +2.f));
|
||||
@@ -274,7 +277,7 @@ void TransitionView::attach(SessionFileSource *ts)
|
||||
|
||||
// reverse calculate x position to match actual fading of session
|
||||
float d = 0.f;
|
||||
if (Settings::application.transition.profile == 0)
|
||||
if (!Settings::application.transition.profile)
|
||||
d = -1.f + 0.5f * Mixer::manager().session()->fading(); // linear
|
||||
else {
|
||||
d = -1.f - 0.5f * ( sqrt(1.f - Mixer::manager().session()->fading()) - 1.f); // quadratic
|
||||
|
||||
@@ -5807,20 +5807,40 @@ void Navigator::RenderTransitionPannel(const ImVec2 &iconsize)
|
||||
// Transition options
|
||||
ImGuiToolkit::Spacing();
|
||||
ImGui::Text("Parameters");
|
||||
if (ImGuiToolkit::IconButton(0, 8)) Settings::application.transition.cross_fade = true;
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
|
||||
static std::vector< std::tuple<int, int, std::string> > profile_fading = {
|
||||
{0, 8, "Cross fading"},
|
||||
{0, 2, "Fade to black"}
|
||||
};
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
int mode = Settings::application.transition.cross_fade ? 0 : 1;
|
||||
if (ImGui::Combo("Fading", &mode, "Cross fading\0Fade to black\0") )
|
||||
Settings::application.transition.cross_fade = mode < 1;
|
||||
if (ImGuiToolkit::IconButton(4, 13)) Settings::application.transition.duration = 1.f;
|
||||
int tmp = Settings::application.transition.cross_fade ? 0 : 1;
|
||||
if (ImGuiToolkit::ComboIcon("##Fading", &tmp, profile_fading))
|
||||
Settings::application.transition.cross_fade = tmp < 1;
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Fading "))
|
||||
Settings::application.transition.cross_fade = true;
|
||||
|
||||
static std::vector< std::tuple<int, int, std::string> > profile_options = {
|
||||
{18, 3, "Linear"},
|
||||
{19, 3, "Quadratic"}
|
||||
};
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Duration", &Settings::application.transition.duration, TRANSITION_MIN_DURATION, TRANSITION_MAX_DURATION, "%.1f s");
|
||||
if (ImGuiToolkit::IconButton(9, 1)) Settings::application.transition.profile = 0;
|
||||
tmp = Settings::application.transition.profile ? 1 : 0;
|
||||
if (ImGuiToolkit::ComboIcon("##Curve", &tmp, profile_options))
|
||||
Settings::application.transition.profile = tmp > 0;
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Curve "))
|
||||
Settings::application.transition.profile = false;
|
||||
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::Combo("Curve", &Settings::application.transition.profile, "Linear\0Quadratic\0");
|
||||
ImGui::SliderFloat("##Duration",
|
||||
&Settings::application.transition.duration,
|
||||
TRANSITION_MIN_DURATION,
|
||||
TRANSITION_MAX_DURATION,
|
||||
"%.1f s");
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Duration "))
|
||||
Settings::application.transition.duration = 1.f;
|
||||
|
||||
// transition actions
|
||||
ImGuiToolkit::Spacing();
|
||||
|
||||
Reference in New Issue
Block a user