diff options
Diffstat (limited to 'slicer/xml/serializer.cpp')
-rw-r--r-- | slicer/xml/serializer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp index 1ff6058..b08e274 100644 --- a/slicer/xml/serializer.cpp +++ b/slicer/xml/serializer.cpp @@ -167,6 +167,10 @@ namespace Slicer { if (auto element = dynamic_cast<const xmlpp::Element *>(node)) { auto smp = mp->GetChild(element->get_name()); if (smp) { + auto typeAttr = element->get_attribute("slicer-typeid"); + if (typeAttr) { + smp = smp->GetSubclassModelPart(typeAttr->get_value()); + } smp->Create(); auto attrs(element->get_attributes()); if (!attrs.empty()) { @@ -208,6 +212,11 @@ namespace Slicer { } else if (mp) { auto element = n->add_child(name); + auto typeId = mp->GetTypeId(); + if (typeId) { + element->set_attribute("slicer-typeid", *typeId); + mp = mp->GetSubclassModelPart(*typeId); + } mp->GetValue(new XmlContentValueTarget(element)); mp->OnEachChild(boost::bind(&Xml::ModelTreeIterate, element, _1, _2)); } |