Added PrintPropertiesAction to osgPresentation
This commit is contained in:
parent
9f5e131203
commit
ccf7bbdb50
@ -27,33 +27,6 @@
|
|||||||
#include <osgGA/TrackballManipulator>
|
#include <osgGA/TrackballManipulator>
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
|
|
||||||
#include <osg/NodeVisitor>
|
|
||||||
|
|
||||||
class PrintSupportedProperties : public osgPresentation::Action
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PrintSupportedProperties() :
|
|
||||||
osgPresentation::Action(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
|
||||||
|
|
||||||
void apply(osgPresentation::Group& group)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"osgPresentation object : "<<group.className()<<std::endl;
|
|
||||||
osgPresentation::PropertyList properties;
|
|
||||||
if (group.getSupportedProperties(properties))
|
|
||||||
{
|
|
||||||
for(osgPresentation::PropertyList::iterator itr = properties.begin();
|
|
||||||
itr != properties.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
osgPresentation::ObjectDescription& od = *itr;
|
|
||||||
OSG_NOTICE<<" "<<od.first->className()<<" : "<<od.first->getName()<<", description = "<<od.second<<std::endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
traverse(group);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@ -157,7 +130,7 @@ int main(int argc, char** argv)
|
|||||||
text->setProperty("width",std::string("103.2"));
|
text->setProperty("width",std::string("103.2"));
|
||||||
|
|
||||||
|
|
||||||
PrintSupportedProperties psp;
|
osgPresentation::PrintSupportedProperties psp(std::cout);
|
||||||
presentation->accept(psp);
|
presentation->accept(psp);
|
||||||
|
|
||||||
osgPresentation::LoadAction load;
|
osgPresentation::LoadAction load;
|
||||||
|
@ -83,6 +83,16 @@ struct OSGPRESENTATION_EXPORT PlayAction : public Action
|
|||||||
void apply(osgPresentation::Element& element);
|
void apply(osgPresentation::Element& element);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PrintSupportedProperties : public osgPresentation::Action
|
||||||
|
{
|
||||||
|
PrintSupportedProperties(std::ostream& output) : osgPresentation::Action(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _output(output) {}
|
||||||
|
|
||||||
|
void apply(osgPresentation::Group& group);
|
||||||
|
|
||||||
|
std::ostream& _output;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,6 +34,7 @@ using namespace osgPresentation;
|
|||||||
void Action::apply(osgPresentation::Group& group)
|
void Action::apply(osgPresentation::Group& group)
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"LoadAction::apply()"<<std::endl;
|
OSG_NOTICE<<"LoadAction::apply()"<<std::endl;
|
||||||
|
|
||||||
osg::NodeVisitor::apply(group);
|
osg::NodeVisitor::apply(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,3 +119,21 @@ void PlayAction::apply(osgPresentation::Element& element)
|
|||||||
{
|
{
|
||||||
element.play();
|
element.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintSupportedProperties::apply(osgPresentation::Group& group)
|
||||||
|
{
|
||||||
|
_output<<"osgPresentation object : "<<group.className()<<std::endl;
|
||||||
|
osgPresentation::PropertyList properties;
|
||||||
|
if (group.getSupportedProperties(properties))
|
||||||
|
{
|
||||||
|
for(osgPresentation::PropertyList::iterator itr = properties.begin();
|
||||||
|
itr != properties.end();
|
||||||
|
++itr)
|
||||||
|
{
|
||||||
|
osgPresentation::ObjectDescription& od = *itr;
|
||||||
|
_output<<" "<<od.first->className()<<" : "<<od.first->getName()<<", description = "<<od.second<<std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
traverse(group);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user