13
0

properly copy plugin state when duplicating routes. #6709

This is not a really elegant solution. Something had to come up and
ruin the neatness of the thread-private regenerate_xml_or_string_ids :)
This commit is contained in:
Robin Gareus 2015-12-17 23:47:50 +01:00
parent b48d87b3ea
commit 7383ea6a35

View File

@ -1113,6 +1113,18 @@ PluginInsert::set_state(const XMLNode& node, int version)
} }
} }
PBD::ID this_id = this->id();
if (regenerate_xml_or_string_ids ()) {
/* when duplicating a track, we need to use the
* original ID for loading plugin state (from file)
*/
const XMLProperty* prop;
if ((prop = node.property ("id")) != 0) {
plugin->set_insert_id (prop->value ());
}
}
Processor::set_state (node, version); Processor::set_state (node, version);
for (niter = nlist.begin(); niter != nlist.end(); ++niter) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
@ -1124,14 +1136,23 @@ PluginInsert::set_state(const XMLNode& node, int version)
if ((*niter)->name() == plugin->state_node_name()) { if ((*niter)->name() == plugin->state_node_name()) {
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
if (!regenerate_xml_or_string_ids ()) {
(*i)->set_insert_id (this->id()); (*i)->set_insert_id (this->id());
}
(*i)->set_state (**niter, version); (*i)->set_state (**niter, version);
if (regenerate_xml_or_string_ids ()) {
(*i)->set_insert_id (this_id);
}
} }
break; break;
} }
} }
if (regenerate_xml_or_string_ids ()) {
plugin->set_insert_id (this_id);
}
if (version < 3000) { if (version < 3000) {
/* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above /* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above