BugFix changing resolution of session

This commit is contained in:
Bruno
2021-08-14 23:15:18 +02:00
parent bc8c4e3c7b
commit ef5f3efd2e
4 changed files with 48 additions and 36 deletions

View File

@@ -1269,6 +1269,17 @@ void Mixer::set(Session *s)
sessionSwapRequested_ = true; sessionSwapRequested_ = true;
} }
void Mixer::setResolution(glm::vec3 res)
{
if (session_) {
session_->setResolution(res);
++View::need_deep_update_;
std::ostringstream info;
info << "Session resolution changed to " << res.x << "x" << res.y;
Log::Info("%s", info.str().c_str());
}
}
void Mixer::paste(const std::string& clipboard) void Mixer::paste(const std::string& clipboard)
{ {
tinyxml2::XMLDocument xmlDoc; tinyxml2::XMLDocument xmlDoc;

View File

@@ -107,6 +107,7 @@ public:
void merge (Session *session); void merge (Session *session);
void merge (SessionSource *source); void merge (SessionSource *source);
void set (Session *session); void set (Session *session);
void setResolution(glm::vec3 res);
// operations depending on transition mode // operations depending on transition mode
void close (bool smooth = false); void close (bool smooth = false);

View File

@@ -831,8 +831,9 @@ void RenderingWindow::draw(FrameBuffer *fb)
// attach the 2D texture to local FBO // attach the 2D texture to local FBO
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0);
#ifndef NDEBUG
Log::Info("Blit to output window enabled."); Log::Info("Blit to output window enabled.");
#endif
} }
// calculate scaling factor of frame buffer inside window // calculate scaling factor of frame buffer inside window

View File

@@ -4136,13 +4136,9 @@ void Navigator::RenderMainPannelVimix()
const FrameBuffer *output = Mixer::manager().session()->frame(); const FrameBuffer *output = Mixer::manager().session()->frame();
if (output) if (output)
{ {
// get parameters to edit resolution // Show info text bloc (dark background)
glm::ivec2 p = FrameBuffer::getParametersFromResolution(output->resolution());
ImGuiTextBuffer info; ImGuiTextBuffer info;
info.appendf("%s", SystemToolkit::filename(sessionfilename).c_str()); info.appendf("%s", SystemToolkit::filename(sessionfilename).c_str());
// Show info text bloc (dark background)
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::InputText("##Info", (char *)info.c_str(), info.size(), ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##Info", (char *)info.c_str(), info.size(), ImGuiInputTextFlags_ReadOnly);
@@ -4178,6 +4174,8 @@ void Navigator::RenderMainPannelVimix()
// ImGui::PopFont(); // ImGui::PopFont();
// change resolution (height only) // change resolution (height only)
// get parameters to edit resolution
glm::ivec2 p = FrameBuffer::getParametersFromResolution(output->resolution());
if (p.y > -1) { if (p.y > -1) {
// cannot change resolution when recording // cannot change resolution when recording
if ( UserInterface::manager().isRecording() ) { if ( UserInterface::manager().isRecording() ) {
@@ -4192,19 +4190,20 @@ void Navigator::RenderMainPannelVimix()
ImGui::InputText("Height", dummy_str, IM_ARRAYSIZE(dummy_str), ImGuiInputTextFlags_ReadOnly); ImGui::InputText("Height", dummy_str, IM_ARRAYSIZE(dummy_str), ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
} }
// offer to change ratio and resolution
else { else {
// combo boxes to select Rario and Height // combo boxes to select Rario and Height
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if (ImGui::Combo("Ratio", &p.x, FrameBuffer::aspect_ratio_name, IM_ARRAYSIZE(FrameBuffer::aspect_ratio_name) ) ) if (ImGui::Combo("Ratio", &p.x, FrameBuffer::aspect_ratio_name, IM_ARRAYSIZE(FrameBuffer::aspect_ratio_name) ) )
{ {
glm::vec3 res = FrameBuffer::getResolutionFromParameters(p.x, p.y); glm::vec3 res = FrameBuffer::getResolutionFromParameters(p.x, p.y);
Mixer::manager().session()->setResolution(res); Mixer::manager().setResolution(res);
} }
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if (ImGui::Combo("Height", &p.y, FrameBuffer::resolution_name, IM_ARRAYSIZE(FrameBuffer::resolution_name) ) ) if (ImGui::Combo("Height", &p.y, FrameBuffer::resolution_name, IM_ARRAYSIZE(FrameBuffer::resolution_name) ) )
{ {
glm::vec3 res = FrameBuffer::getResolutionFromParameters(p.x, p.y); glm::vec3 res = FrameBuffer::getResolutionFromParameters(p.x, p.y);
Mixer::manager().session()->setResolution(res); Mixer::manager().setResolution(res);
} }
} }
} }