From 5fbcf8a85932929ba2be46a9d9c8000c50bf58d3 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 22 Apr 2015 16:59:23 +0200 Subject: [PATCH] Mesh filtering fix --- components/sceneutil/attach.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/sceneutil/attach.cpp b/components/sceneutil/attach.cpp index 9f9d63619c..49e2acbd24 100644 --- a/components/sceneutil/attach.cpp +++ b/components/sceneutil/attach.cpp @@ -27,12 +27,14 @@ namespace SceneUtil , mParent(parent) , mFilter(Misc::StringUtils::lowerCase(filter)) { + mFilter2 = "tri " + mFilter; } virtual void apply(osg::Node& node) { std::string lowerName = Misc::StringUtils::lowerCase(node.getName()); - if (lowerName.find(mFilter) != std::string::npos) + if ((lowerName.size() >= mFilter.size() && lowerName.compare(0, mFilter.size(), mFilter) == 0) + || (lowerName.size() >= mFilter2.size() && lowerName.compare(0, mFilter2.size(), mFilter2) == 0)) { mParent->addChild(&node); } @@ -43,6 +45,7 @@ namespace SceneUtil private: osg::ref_ptr mParent; std::string mFilter; + std::string mFilter2; }; osg::ref_ptr attach(osg::ref_ptr toAttach, osg::Node *master, const std::string &filter, const std::string &attachNode)