Added <template_layer name="layerbase_1"> and <layer inherit="layerbase_1"> functionality to .p3d functionality.

This commit is contained in:
Robert Osfield
2013-01-22 16:13:59 +00:00
parent 9b08c37373
commit 128eeb9b30

View File

@@ -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<<std::endl;
}
}
else if (!readOnlyHoldingPage && cur->name == "template_layer")
{
std::string name;
if (getProperty(cur, "name", name))
{
_templateMap[name] = cur;
std::cout<<"Defining template layer "<<name<<std::endl;
}
}
else if (!readOnlyHoldingPage && cur->name == "property_animation")
{
osg::ref_ptr<osgPresentation::PropertyAnimation> pa = new osgPresentation::PropertyAnimation;