Bugfix and cleanup Group source insert

NB: default setAlpha now re-uses the source previous mixing coordinates (does not force default location)
This commit is contained in:
Bruno Herbelin
2022-03-27 15:30:56 +02:00
parent 0f3e856438
commit c6097e0397
3 changed files with 10 additions and 15 deletions

View File

@@ -727,7 +727,7 @@ void Mixer::groupSelection()
info << sessiongroup->name() << " inserted: " << sessiongroup->session()->numSource() << " sources flatten.";
Action::manager().store(info.str());
Log::Notify("Added group source '%s' with %s", sessiongroup->name().c_str(), sessiongroup->info().c_str());
Log::Notify("Added source '%s' with %s", sessiongroup->name().c_str(), sessiongroup->info().c_str());
// give the hand to the user
Mixer::manager().setCurrentSource(sessiongroup);
@@ -772,24 +772,19 @@ void Mixer::groupAll()
sessiongroup->group(View::MIXING)->translation_.x = 0.f;
sessiongroup->group(View::MIXING)->translation_.y = 0.f;
// Add the session-group source to Session
session_->addSource(sessiongroup);
// Attach the session-group source to Mixer
attach(sessiongroup);
// name the session-group source (avoid name duplicates)
renameSource(sessiongroup, SystemToolkit::base_filename(session_->filename()));
// Add the session-group source in the mixer
// NB: sessiongroup will be updated and inserted to Mixing view on next frame
addSource(sessiongroup);
// store in action manager
std::ostringstream info;
info << sessiongroup->name() << " inserted: " << sessiongroup->session()->numSource() << " sources flatten.";
Action::manager().store(info.str());
Log::Notify("Added group source '%s' with %s", sessiongroup->name().c_str(), sessiongroup->info().c_str());
// give the hand to the user
Mixer::manager().setCurrentSource(sessiongroup);
Log::Notify("Added source '%s' with %s", sessiongroup->name().c_str(), sessiongroup->info().c_str());
}
else {
delete sessiongroup;
@@ -834,7 +829,7 @@ void Mixer::flattenSession()
// prevent deletion of session_ (now embedded into session group)
session_ = new Session;
Log::Notify("Created group source '%s' with %s", sessiongroup->name().c_str(), sessiongroup->info().c_str());
Log::Notify("Switched to '%s' with %s", sessiongroup->name().c_str(), sessiongroup->info().c_str());
}
void Mixer::renameSource(Source *s, const std::string &newname)

View File

@@ -688,9 +688,9 @@ void MixingView::setAlpha(Source *s)
if (!s)
return;
// move the layer node of the source
// move the mixing node of the source
Group *sourceNode = s->group(mode_);
glm::vec2 mix_pos = glm::vec2(DEFAULT_MIXING_TRANSLATION);
glm::vec2 mix_pos(sourceNode->translation_);
for(NodeSet::iterator it = scene.ws()->begin(); it != scene.ws()->end(); ++it) {
// avoid superposing icons: distribute equally

View File

@@ -133,7 +133,7 @@ Source::Source(uint64_t id) : SourceCore(), id_(id), ready_(false), symbol_(null
// create groups and overlays for each view
// default mixing nodes
groups_[View::MIXING]->scale_ = glm::vec3(0.15f, 0.15f, 1.f);
groups_[View::MIXING]->scale_ = glm::vec3(MIXING_ICON_SCALE);
groups_[View::MIXING]->translation_ = glm::vec3(DEFAULT_MIXING_TRANSLATION, 0.f);
frames_[View::MIXING] = new Switch;