Fix duplicate control-ID when copying processors or proc state

Ideally we'd use a "retain ID when present", so that GUI object
state of automation lanes and inline controls will be retained.
This commit is contained in:
Robin Gareus 2020-02-28 00:59:21 +01:00
parent 4eba86b503
commit 54911a0ee2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1985,7 +1985,10 @@ ProcessorBox::object_drop (DnDVBox<ProcessorEntry>* source, ProcessorEntry* posi
* (this needs a better solution which retains connections)
*/
state.remove_nodes_and_delete ("Processor");
/* Controllable and automation IDs should not be copied */
PBD::Stateful::ForceIDRegeneration force_ids;
proc->set_state (state, Stateful::loading_state_version);
/* but retain the processor's ID (LV2 state save) */
boost::dynamic_pointer_cast<PluginInsert>(proc)->update_id (id);
return;
}
@ -3492,12 +3495,14 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
/* strip side-chain state (processor inside processor must be a side-chain)
* otherwise we'll end up with duplicate ports-names.
* (this needs a better solution which retains connections)
* We really would want Stateful::ForceIDRegeneration here :(
*/
XMLNode state (**niter);
state.remove_nodes_and_delete ("Processor");
/* Controllable and automation IDs should not be copied */
PBD::Stateful::ForceIDRegeneration force_ids;
p->set_state (state, Stateful::current_state_version);
/* but retain the processor's ID (LV2 state save) */
boost::dynamic_pointer_cast<PluginInsert>(p)->update_id (id);
}