mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
CopyRigVisitor fixes
Make sure it copies all relevant drawable parent nodes (e.g. including the node with the environment map effect) Make sure it doesn't copy nodes multiple times
This commit is contained in:
parent
019c843589
commit
72e5043eda
@ -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,26 @@ 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;
|
||||
if (!node)
|
||||
return;
|
||||
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 +76,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 New Issue
Block a user