From 5a9d4dd55e66002651724134bfd5d796c1c9060c Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Wed, 7 Apr 2021 23:00:09 +0200 Subject: [PATCH] Temporary disabling feature 'follow image processing' --- ImGuiVisitor.cpp | 38 +++++++++++++++++++------------------- SessionCreator.cpp | 7 +++++++ SessionVisitor.cpp | 1 + SourceList.cpp | 6 +++--- SourceList.h | 1 + 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index 92a1874..3d1fc24 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -500,24 +500,24 @@ void ImGuiVisitor::visit (Source& s) oss << s.name() << ": " << "Change Filter"; Action::manager().store(oss.str()); } - ImGui::Separator(); - if (ImGui::BeginMenu("Follow")) - { - for (auto mpit = Mixer::manager().session()->begin(); - mpit != Mixer::manager().session()->end(); mpit++ ) - { - std::string label = (*mpit)->name(); - if ( (*mpit)->id() != s.id() && - (*mpit)->imageProcessingEnabled() && - !(*mpit)->processingshader_link_.connected()) { - if (ImGui::MenuItem( label.c_str() )){ - s.processingshader_link_.connect(*mpit); - s.touch(); - } - } - } - ImGui::EndMenu(); - } +// ImGui::Separator(); +// if (ImGui::BeginMenu("Follow")) +// { +// for (auto mpit = Mixer::manager().session()->begin(); +// mpit != Mixer::manager().session()->end(); mpit++ ) +// { +// std::string label = (*mpit)->name(); +// if ( (*mpit)->id() != s.id() && +// (*mpit)->imageProcessingEnabled() && +// !(*mpit)->processingshader_link_.connected()) { +// if (ImGui::MenuItem( label.c_str() )){ +// s.processingshader_link_.connect(*mpit); +// s.touch(); +// } +// } +// } +// ImGui::EndMenu(); +// } } ImGui::EndPopup(); @@ -532,7 +532,7 @@ void ImGuiVisitor::visit (Source& s) ImGui::Text("Filters"); Source *target = s.processingshader_link_.source(); ImGui::Text("Following"); - if ( ImGui::Button(target->name().c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) + if ( target != nullptr && ImGui::Button(target->name().c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) Mixer::manager().setCurrentSource(target); } else diff --git a/SessionCreator.cpp b/SessionCreator.cpp index 2c000b9..f8e45c4 100644 --- a/SessionCreator.cpp +++ b/SessionCreator.cpp @@ -276,6 +276,10 @@ void SessionLoader::load(XMLElement *sessionNode) } } } + + // loop over SourceLinks and resolve them + // NB: this could become the mechanism for clone sources too + } } @@ -664,8 +668,11 @@ void SessionLoader::visit (Source& s) xmlCurrent_ = sourceNode->FirstChildElement("ImageProcessing"); if (xmlCurrent_) { bool on = xmlCurrent_->BoolAttribute("enabled", true); + uint64_t id__ = 0; + xmlCurrent_->QueryUnsigned64Attribute("follow", &id__); s.processingShader()->accept(*this); s.setImageProcessingEnabled(on); + s.processingshader_link_.connect(id__, session_); } xmlCurrent_ = sourceNode->FirstChildElement("MixingGroup"); diff --git a/SessionVisitor.cpp b/SessionVisitor.cpp index 56c6f96..2cd576f 100644 --- a/SessionVisitor.cpp +++ b/SessionVisitor.cpp @@ -441,6 +441,7 @@ void SessionVisitor::visit (Source& s) xmlCurrent_ = xmlDoc_->NewElement( "ImageProcessing" ); xmlCurrent_->SetAttribute("enabled", s.imageProcessingEnabled()); + xmlCurrent_->SetAttribute("follow", s.processingshader_link_.id()); sourceNode->InsertEndChild(xmlCurrent_); s.processingShader()->accept(*this); diff --git a/SourceList.cpp b/SourceList.cpp index f0d33da..978cb66 100644 --- a/SourceList.cpp +++ b/SourceList.cpp @@ -169,9 +169,9 @@ Source *SourceLink::source() target_ = *it; target_->links_.push_back(this); } - // not found: invalidate link - else - disconnect(); +// // not found: invalidate link +// else +// disconnect(); } // no host: invalidate link else diff --git a/SourceList.h b/SourceList.h index 59bb871..1c27b60 100644 --- a/SourceList.h +++ b/SourceList.h @@ -38,6 +38,7 @@ public: bool connected() { return id_ > 0; } Source *source(); + inline uint64_t id() { return id_; } protected: Session *host_;