mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-16 11:39:41 +00:00
Merge pull request #2846 from Capostrophic/envmap
CopyRigVisitor fixes (bug #5415)
This commit is contained in:
commit
f9fca8675b
2 changed files with 22 additions and 12 deletions
|
@ -13,6 +13,7 @@
|
|||
Bug #5369: Spawnpoint in the Grazelands doesn't produce oversized creatures
|
||||
Bug #5370: Opening an unlocked but trapped door uses the key
|
||||
Bug #5400: Editor: Verifier checks race of non-skin bodyparts
|
||||
Bug #5415: Environment maps in ebony cuirass and HiRez Armors Indoril cuirass don't work
|
||||
Bug #5416: Junk non-node records before the root node are not handled gracefully
|
||||
Feature #5362: Show the soul gems' trapped soul in count dialog
|
||||
|
||||
|
|
|
@ -45,23 +45,24 @@ namespace SceneUtil
|
|||
|
||||
virtual void apply(osg::Drawable& drawable)
|
||||
{
|
||||
std::string lowerName = Misc::StringUtils::lowerCase(drawable.getName());
|
||||
if ((lowerName.size() >= mFilter.size() && lowerName.compare(0, mFilter.size(), mFilter) == 0)
|
||||
|| (lowerName.size() >= mFilter2.size() && lowerName.compare(0, mFilter2.size(), mFilter2) == 0))
|
||||
if (!filterMatches(drawable.getName()))
|
||||
return;
|
||||
|
||||
osg::Node* node = &drawable;
|
||||
while (node->getNumParents())
|
||||
{
|
||||
osg::Node* node = &drawable;
|
||||
while (node && node->getNumParents() && !node->getStateSet())
|
||||
node = node->getParent(0);
|
||||
if (node)
|
||||
mToCopy.push_back(node);
|
||||
osg::Group* parent = node->getParent(0);
|
||||
if (!parent || !filterMatches(parent->getName()))
|
||||
break;
|
||||
node = parent;
|
||||
}
|
||||
mToCopy.emplace(node);
|
||||
}
|
||||
|
||||
void doCopy()
|
||||
{
|
||||
for (std::vector<osg::ref_ptr<osg::Node> >::iterator it = mToCopy.begin(); it != mToCopy.end(); ++it)
|
||||
for (const osg::ref_ptr<osg::Node>& node : mToCopy)
|
||||
{
|
||||
osg::ref_ptr<osg::Node> node = *it;
|
||||
if (node->getNumParents() > 1)
|
||||
Log(Debug::Error) << "Error CopyRigVisitor: node has multiple parents";
|
||||
while (node->getNumParents())
|
||||
|
@ -73,8 +74,16 @@ namespace SceneUtil
|
|||
}
|
||||
|
||||
private:
|
||||
typedef std::vector<osg::ref_ptr<osg::Node> > NodeVector;
|
||||
NodeVector mToCopy;
|
||||
|
||||
bool filterMatches(const std::string& name) const
|
||||
{
|
||||
std::string lowerName = Misc::StringUtils::lowerCase(name);
|
||||
return (lowerName.size() >= mFilter.size() && lowerName.compare(0, mFilter.size(), mFilter) == 0)
|
||||
|| (lowerName.size() >= mFilter2.size() && lowerName.compare(0, mFilter2.size(), mFilter2) == 0);
|
||||
}
|
||||
|
||||
using NodeSet = std::set<osg::ref_ptr<osg::Node>>;
|
||||
NodeSet mToCopy;
|
||||
|
||||
osg::ref_ptr<osg::Group> mParent;
|
||||
std::string mFilter;
|
||||
|
|
Loading…
Reference in a new issue