mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Cleanup UI for source info, cleanup code
This commit is contained in:
@@ -141,7 +141,9 @@ void CloneSource::setActive (bool on)
|
||||
|
||||
void CloneSource::update(float dt)
|
||||
{
|
||||
if (active_ && !paused_ && origin_ && cloningsurface_ != nullptr) {
|
||||
Source::update(dt);
|
||||
|
||||
if (!paused_ && origin_ && cloningsurface_ != nullptr) {
|
||||
|
||||
double now = g_timer_elapsed (timer_, NULL) ;
|
||||
|
||||
@@ -179,10 +181,7 @@ void CloneSource::update(float dt)
|
||||
|
||||
// update the source surface to be rendered
|
||||
texturesurface_->setTextureIndex( stack_[read_index_]->texture() );
|
||||
|
||||
}
|
||||
|
||||
Source::update(dt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -702,10 +702,23 @@ void ImGuiVisitor::visit (RenderSource& s)
|
||||
ImGuiToolkit::Icon(s.icon().x, s.icon().y);
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("Rendering Output");
|
||||
if ( ImGui::Button(ICON_FA_DESKTOP " Show window", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||
|
||||
// info
|
||||
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
|
||||
s.accept(info);
|
||||
ImGui::Text("%s", info.str().c_str());
|
||||
ImGui::PopTextWrapPos();
|
||||
|
||||
// icon (>) to open player
|
||||
ImVec2 pos = ImGui::GetCursorPos();
|
||||
ImGui::SameLine(0, 0);
|
||||
ImGui::SameLine(0, 10.f + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
ImGui::SameLine();
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_DESKTOP, "Show Output"))
|
||||
Settings::application.widget.preview = true;
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("Output");
|
||||
ImGui::SetCursorPos(pos);
|
||||
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
int m = (int) s.renderingProvenance();
|
||||
@@ -719,10 +732,25 @@ void ImGuiVisitor::visit (CloneSource& s)
|
||||
ImGuiToolkit::Icon(s.icon().x, s.icon().y);
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("Clone");
|
||||
|
||||
// info
|
||||
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
|
||||
s.accept(info);
|
||||
ImGui::Text("%s", info.str().c_str());
|
||||
ImGui::PopTextWrapPos();
|
||||
|
||||
// icon (>) to open player
|
||||
ImVec2 pos = ImGui::GetCursorPos();
|
||||
ImGui::SameLine(0, 0);
|
||||
ImGui::SameLine(0, 10.f + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
ImGui::SetCursorPos(pos);
|
||||
|
||||
if ( ImGui::Button(s.origin()->name().c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||
Mixer::manager().setCurrentSource(s.origin());
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("Source");
|
||||
ImGui::Text("Origin");
|
||||
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
int m = (int) s.cloningProvenance();
|
||||
|
||||
@@ -174,16 +174,15 @@ void InfoVisitor::visit (RenderSource& s)
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "Rendering Output (";
|
||||
oss << RenderSource::rendering_provenance_label[s.renderingProvenance()];
|
||||
oss << ") " << std::endl;
|
||||
if (!brief_) {
|
||||
oss << "Rendering Output (";
|
||||
oss << RenderSource::rendering_provenance_label[s.renderingProvenance()];
|
||||
oss << ") " << std::endl;
|
||||
}
|
||||
|
||||
if (s.frame()){
|
||||
oss << s.frame()->width() << " x " << s.frame()->height() << ", ";
|
||||
if (s.frame()->use_alpha())
|
||||
oss << "RGBA";
|
||||
else
|
||||
oss << "RGB";
|
||||
oss << (s.frame()->use_alpha() ? "RGBA" : "RGB");
|
||||
}
|
||||
|
||||
information_ = oss.str();
|
||||
@@ -196,16 +195,15 @@ void InfoVisitor::visit (CloneSource& s)
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "Clone of '" << s.origin()->name() << "' (";
|
||||
oss << CloneSource::cloning_provenance_label[s.cloningProvenance()];
|
||||
oss << ") " << std::endl;
|
||||
if (!brief_) {
|
||||
oss << "Clone of '" << s.origin()->name() << "' (";
|
||||
oss << CloneSource::cloning_provenance_label[s.cloningProvenance()];
|
||||
oss << ") " << std::endl;
|
||||
}
|
||||
|
||||
if (s.frame()){
|
||||
oss << s.frame()->width() << " x " << s.frame()->height() << ", ";
|
||||
if (s.frame()->use_alpha())
|
||||
oss << "RGBA";
|
||||
else
|
||||
oss << "RGB";
|
||||
oss << (s.frame()->use_alpha() ? "RGBA" : "RGB");
|
||||
}
|
||||
|
||||
information_ = oss.str();
|
||||
@@ -218,10 +216,12 @@ void InfoVisitor::visit (PatternSource& s)
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << Pattern::get(s.pattern()->type()).label << std::endl;
|
||||
if (!brief_)
|
||||
oss << Pattern::get(s.pattern()->type()).label << " pattern" << std::endl;
|
||||
|
||||
if (s.pattern()) {
|
||||
oss << s.pattern()->width() << " x " << s.pattern()->height();
|
||||
oss << ", RGB";
|
||||
oss << ", RGBA";
|
||||
}
|
||||
|
||||
information_ = oss.str();
|
||||
@@ -313,10 +313,13 @@ void InfoVisitor::visit (GenericStreamSource& s)
|
||||
std::ostringstream oss;
|
||||
if (s.stream()) {
|
||||
std::string src_element = s.gstElements().front();
|
||||
src_element = src_element.substr(0, src_element.find(" "));
|
||||
|
||||
if (brief_)
|
||||
src_element = src_element.substr(0, src_element.find(" "));
|
||||
|
||||
oss << "gstreamer '" << src_element << "'" << std::endl;
|
||||
oss << s.stream()->width() << " x " << s.stream()->height();
|
||||
oss << ", RGB";
|
||||
oss << ", RGBA";
|
||||
}
|
||||
else
|
||||
oss << "Undefined";
|
||||
|
||||
@@ -102,14 +102,15 @@ void RenderSource::init()
|
||||
|
||||
void RenderSource::update(float dt)
|
||||
{
|
||||
static glm::mat4 projection = glm::ortho(-1.f, 1.f, 1.f, -1.f, -SCENE_DEPTH, 1.f);
|
||||
Source::update(dt);
|
||||
|
||||
if (active_ && !paused_ && session_ && rendered_output_) {
|
||||
if (!paused_ && session_ && rendered_output_) {
|
||||
|
||||
if (provenance_ == RENDER_EXCLUSIVE) {
|
||||
// temporarily exclude this RenderSource from the rendering
|
||||
groups_[View::RENDERING]->visible_ = false;
|
||||
// simulate a rendering of the session in a framebuffer
|
||||
static glm::mat4 projection = glm::ortho(-1.f, 1.f, 1.f, -1.f, -SCENE_DEPTH, 1.f);
|
||||
glm::mat4 P = glm::scale( projection, glm::vec3(1.f / rendered_output_->aspectRatio(), 1.f, 1.f));
|
||||
rendered_output_->begin();
|
||||
// access to private RenderView in the session to call draw on the root of the scene
|
||||
@@ -128,7 +129,6 @@ void RenderSource::update(float dt)
|
||||
// rendered_output_->end();
|
||||
}
|
||||
|
||||
Source::update(dt);
|
||||
}
|
||||
|
||||
void RenderSource::play (bool on)
|
||||
|
||||
@@ -133,7 +133,7 @@ void Session::update(float dt)
|
||||
// update the source
|
||||
(*it)->setActive(activation_threshold_);
|
||||
(*it)->update(dt);
|
||||
// render the source // TODO: verify ok to render after update
|
||||
// render the source
|
||||
(*it)->render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,8 @@ void SessionSource::setActive (bool on)
|
||||
|
||||
void SessionSource::update(float dt)
|
||||
{
|
||||
Source::update(dt);
|
||||
|
||||
if (session_ == nullptr)
|
||||
return;
|
||||
|
||||
@@ -115,7 +117,6 @@ void SessionSource::update(float dt)
|
||||
failed_ = true;
|
||||
}
|
||||
|
||||
Source::update(dt);
|
||||
}
|
||||
|
||||
void SessionSource::replay ()
|
||||
|
||||
@@ -616,15 +616,15 @@ void SessionVisitor::visit (SessionGroupSource& s)
|
||||
xmlCurrent_->SetAttribute("type", "GroupSource");
|
||||
|
||||
Session *se = s.session();
|
||||
if (se) {
|
||||
XMLElement *sessionNode = xmlDoc_->NewElement("Session");
|
||||
xmlCurrent_->InsertEndChild(sessionNode);
|
||||
|
||||
XMLElement *sessionNode = xmlDoc_->NewElement("Session");
|
||||
xmlCurrent_->InsertEndChild(sessionNode);
|
||||
|
||||
for (auto iter = se->begin(); iter != se->end(); ++iter){
|
||||
setRoot(sessionNode);
|
||||
(*iter)->accept(*this);
|
||||
for (auto iter = se->begin(); iter != se->end(); ++iter){
|
||||
setRoot(sessionNode);
|
||||
(*iter)->accept(*this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SessionVisitor::visit (RenderSource& s)
|
||||
@@ -636,16 +636,18 @@ void SessionVisitor::visit (RenderSource& s)
|
||||
void SessionVisitor::visit (CloneSource& s)
|
||||
{
|
||||
xmlCurrent_->SetAttribute("type", "CloneSource");
|
||||
xmlCurrent_->SetAttribute("provenance", (int) s.cloningProvenance());
|
||||
xmlCurrent_->SetAttribute("delay", (double) s.delay());
|
||||
|
||||
XMLElement *origin = xmlDoc_->NewElement("origin");
|
||||
origin->SetAttribute("id", s.origin()->id());
|
||||
if (s.origin()) {
|
||||
xmlCurrent_->SetAttribute("provenance", (int) s.cloningProvenance());
|
||||
xmlCurrent_->SetAttribute("delay", (double) s.delay());
|
||||
|
||||
xmlCurrent_->InsertEndChild(origin);
|
||||
XMLText *text = xmlDoc_->NewText( s.origin()->name().c_str() );
|
||||
origin->InsertEndChild( text );
|
||||
XMLElement *origin = xmlDoc_->NewElement("origin");
|
||||
origin->SetAttribute("id", s.origin()->id());
|
||||
|
||||
xmlCurrent_->InsertEndChild(origin);
|
||||
XMLText *text = xmlDoc_->NewText( s.origin()->name().c_str() );
|
||||
origin->InsertEndChild( text );
|
||||
}
|
||||
}
|
||||
|
||||
void SessionVisitor::visit (PatternSource& s)
|
||||
|
||||
Reference in New Issue
Block a user