Fix filtering bug

c++11
scrawl 10 years ago
parent 57fd18b161
commit 8f6d4fb3e0

@ -12,6 +12,8 @@
#include <osgAnimation/BoneMapVisitor> #include <osgAnimation/BoneMapVisitor>
#include <osgAnimation/Skeleton> #include <osgAnimation/Skeleton>
#include <components/misc/stringops.hpp>
#include "visitor.hpp" #include "visitor.hpp"
namespace SceneUtil namespace SceneUtil
@ -110,13 +112,14 @@ namespace SceneUtil
public: public:
FilterVisitor(const std::string& filter) FilterVisitor(const std::string& filter)
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mFilter(filter) , mFilter(Misc::StringUtils::lowerCase(filter))
{ {
} }
virtual void apply(osg::Geode &node) virtual void apply(osg::Geode &node)
{ {
if (node.getName().find(mFilter) == std::string::npos) std::string lowerName = Misc::StringUtils::lowerCase(node.getName());
if (lowerName.find(mFilter) == std::string::npos)
{ {
mToRemove.push_back(&node); mToRemove.push_back(&node);
} }
@ -133,7 +136,7 @@ namespace SceneUtil
private: private:
std::vector<osg::Geode*> mToRemove; std::vector<osg::Geode*> mToRemove;
const std::string& mFilter; std::string mFilter;
}; };
osg::ref_ptr<osg::Node> attach(osg::ref_ptr<osg::Node> toAttach, osg::Node *master, const std::string &filter, const std::string &attachNode) osg::ref_ptr<osg::Node> attach(osg::ref_ptr<osg::Node> toAttach, osg::Node *master, const std::string &filter, const std::string &attachNode)

Loading…
Cancel
Save