assign new IDs to plugin copies on paste.

when copying a plugin the state is transferred by serializing
XML and setting state from XML. This state includes the unique ID.

This ID needs to be identical at first in order to load
the state from <session-dir>/plugins/<ID>/*
This commit is contained in:
Robin Gareus
2015-07-10 22:09:18 +02:00
parent 9ab76a5cf0
commit 4c608b6e04
3 changed files with 13 additions and 2 deletions

View File

@@ -2155,9 +2155,10 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
/* XXX its a bit limiting to assume that everything else
is a plugin.
*/
p.reset (new PluginInsert (*_session));
p->set_state (**niter, Stateful::current_state_version);
PBD::ID id = p->id();
p->set_state (**niter, Stateful::current_state_version);
boost::dynamic_pointer_cast<PluginInsert>(p)->update_id (id);
}
copies.push_back (p);

View File

@@ -53,6 +53,7 @@ class LIBARDOUR_API PluginInsert : public Processor
XMLNode& state(bool);
XMLNode& get_state(void);
int set_state(const XMLNode&, int version);
void update_id (PBD::ID);
void run (BufferSet& in, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
void silence (framecnt_t nframes);

View File

@@ -1145,6 +1145,15 @@ PluginInsert::set_state(const XMLNode& node, int version)
return 0;
}
void
PluginInsert::update_id (PBD::ID id)
{
set_id (id.to_s());
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->set_insert_id (id);
}
}
void
PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
{