diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index f7d9bed04..3bc7086a1 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -2124,17 +2124,33 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons if (cur->name == "base") { constructor.addLayer(true, true); + std::string inherit; + if (getProperty(cur, "inherit", inherit) && !inherit.empty() && _templateMap.count(inherit)!=0) + { + parseLayer(constructor, _templateMap[inherit].get()); + } parseLayer (constructor, cur); } else if (cur->name == "layer") { constructor.addLayer(true, false); + std::string inherit; + if (getProperty(cur, "inherit", inherit) && !inherit.empty() && _templateMap.count(inherit)!=0) + { + parseLayer(constructor, _templateMap[inherit].get()); + } + parseLayer (constructor, cur); } else if (cur->name == "clean_layer") { constructor.addLayer(false, false); + std::string inherit; + if (getProperty(cur, "inherit", inherit) && !inherit.empty() && _templateMap.count(inherit)!=0) + { + parseLayer(constructor, _templateMap[inherit].get()); + } parseLayer (constructor, cur); } else if (cur->name == "modify_layer") @@ -2881,6 +2897,15 @@ osg::Node* ReaderWriterP3DXML::parseXmlGraph(osgDB::XmlNode* root, bool readOnly std::cout<<"Defining template slide "<name == "template_layer") + { + std::string name; + if (getProperty(cur, "name", name)) + { + _templateMap[name] = cur; + std::cout<<"Defining template layer "<name == "property_animation") { osg::ref_ptr pa = new osgPresentation::PropertyAnimation;