Clone with copy attributes

Two modes of cloning: from the source panel with 'Clone & filter' clones with copy of attributes (geometry, alpha, etc.), from the Insert source panel with 'Internal' source creates a fresh new copy.
This commit is contained in:
Bruno Herbelin
2022-08-07 11:13:45 +02:00
parent 8cb0d57ffe
commit bdc1920166
3 changed files with 14 additions and 6 deletions

View File

@@ -396,7 +396,7 @@ Source * Mixer::createSourceGroup()
return s;
}
Source * Mixer::createSourceClone(const std::string &namesource)
Source * Mixer::createSourceClone(const std::string &namesource, bool copy_attributes)
{
// ready to create a source
Source *s = nullptr;
@@ -412,9 +412,17 @@ Source * Mixer::createSourceClone(const std::string &namesource)
if (origin != session_->end()) {
// create a source
s = (*origin)->clone();
// if clone operation asks to copy attributes
if (copy_attributes) {
// place clone next to origin
s->group(View::MIXING)->translation_ = (*origin)->group(View::MIXING)->translation_;
s->group(View::LAYER)->translation_ = (*origin)->group(View::LAYER)->translation_ + LAYER_STEP;
// copy geometry (overlap)
s->group(View::GEOMETRY)->translation_ = (*origin)->group(View::GEOMETRY)->translation_;
s->group(View::GEOMETRY)->scale_ = (*origin)->group(View::GEOMETRY)->scale_;
s->group(View::GEOMETRY)->rotation_ = (*origin)->group(View::GEOMETRY)->rotation_;
}
}
return s;

View File

@@ -49,7 +49,7 @@ public:
// creation of sources
Source * createSourceFile (const std::string &path);
Source * createSourceMultifile(const std::list<std::string> &list_files, uint fps);
Source * createSourceClone (const std::string &namesource = "");
Source * createSourceClone (const std::string &namesource = "", bool copy_attributes = true);
Source * createSourceRender ();
Source * createSourceStream (const std::string &gstreamerpipeline);
Source * createSourcePattern(uint pattern, glm::ivec2 res);

View File

@@ -6652,7 +6652,7 @@ void Navigator::RenderNewPannel()
label = std::string("Source ") + (*iter)->initials() + " - " + (*iter)->name();
if (ImGui::Selectable( label.c_str() )) {
label = std::string("Clone of ") + label;
new_source_preview_.setSource( Mixer::manager().createSourceClone((*iter)->name()),label);
new_source_preview_.setSource( Mixer::manager().createSourceClone((*iter)->name(), false),label);
}
}
ImGui::EndCombo();