13
0

Cont'd work on loading old route templates

This builds on top of 51d2bb:
 * v6 routes templates/states have a version per <Route>
 * older route-states are assumed to be from ardour-5
   Stateful::loading_state_version 3002,
   unless specified otherwise
This commit is contained in:
Robin Gareus 2020-01-30 01:08:57 +01:00
parent 51d2bb36ce
commit 6452f62d64
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 22 additions and 7 deletions

View File

@ -2494,9 +2494,13 @@ Route::state (bool save_template)
std::string modified_with = string_compose ("%1 %2", PROGRAM_NAME, revision);
child->set_property("modified-with", modified_with);
node->set_property("version", CURRENT_SESSION_FILE_VERSION);
}
/* This is needed for templates and when duplicating routes, in which case
* the route-state is directly passed to new_route_from_template().
*/
node->set_property("version", CURRENT_SESSION_FILE_VERSION);
node->set_property (X_("id"), id ());
node->set_property (X_("name"), name());
node->set_property (X_("default-type"), _default_type);
@ -2590,9 +2594,6 @@ Route::state (bool save_template)
int
Route::set_state (const XMLNode& node, int version)
{
/* when loading a template, use the version of the Route (if available) */
node.get_property (X_("version"), version);
if (version < 3000) {
return set_state_2X (node, version);
}

View File

@ -2948,7 +2948,23 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
*/
node_copy.remove_node_and_delete (X_("Controllable"), X_("name"), X_("solo"));
boost::shared_ptr<Route> route (XMLRouteFactory (node_copy, Stateful::loading_state_version));
/* New v6 templates do have a version in the Route-Template,
* we assume that all older, unversioned templates are
* from Ardour 5.x
* when Stateful::loading_state_version was 3002
*/
int version = 3002;
node.get_property (X_("version"), version);
boost::shared_ptr<Route> route;
if (version < 3000) {
route = XMLRouteFactory_2X (node_copy, version);
} else if (version < 5000) {
route = XMLRouteFactory_3X (node_copy, version);
} else {
route = XMLRouteFactory (node_copy, version);
}
if (route == 0) {
error << _("Session: cannot create track/bus from template description") << endmsg;

View File

@ -177,8 +177,6 @@ Track::set_state (const XMLNode& node, int version)
return -1;
}
node.get_property (X_("version"), version);
if (version >= 3000 && version < 6000) {
if (XMLNode* ds_node = find_named_node (node, "Diskstream")) {
std::string name;