changeset 451:dc1a360f2b69

Allow layers to be loaded without models if their layer class explicitly says it's OK (otherwise default template won't load, as it has an empty waveform layer)
author Chris Cannam
date Mon, 20 Apr 2015 10:10:26 +0100
parents 12d982e52190
children c651a736ebc4 3e2a2ca24d90
files framework/SVFileReader.cpp
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/framework/SVFileReader.cpp	Mon Apr 20 09:21:08 2015 +0100
+++ b/framework/SVFileReader.cpp	Mon Apr 20 10:10:26 2015 +0100
@@ -886,12 +886,14 @@
 	    } else {
 		cerr << "WARNING: SV-XML: Unknown model id " << modelId
 			  << " in layer definition" << endl;
-
-                // Don't add a layer with an unknown model id
-                m_document->deleteLayer(layer);
-                m_layers[id] = layer = 0;
-                return false;
-	    }
+                if (!layer->canExistWithoutModel()) {
+                    // Don't add a layer with an unknown model id
+                    // unless it explicitly supports this state
+                    m_document->deleteLayer(layer);
+                    m_layers[id] = layer = 0;
+                    return false;
+                }
+            }
 	}
 
         if (layer) layer->setProperties(attributes);