From 128eeb9b306030d7cf621dfb5a0537df94fa4919 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 Jan 2013 16:13:59 +0000 Subject: [PATCH] Added and functionality to .p3d functionality. --- src/osgPlugins/p3d/ReaderWriterP3D.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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;