diff --git a/apps/components_tests/nifosg/testnifloader.cpp b/apps/components_tests/nifosg/testnifloader.cpp index 23ba742e45..0d903e5366 100644 --- a/apps/components_tests/nifosg/testnifloader.cpp +++ b/apps/components_tests/nifosg/testnifloader.cpp @@ -100,7 +100,7 @@ osg::Group { UDC_UserObjects 1 { osg::UIntValueObject { UniqueID 6 - Name "recIndex" + Name "recordIndex" Value 4294967295 } } @@ -140,7 +140,7 @@ osg::Group { UDC_UserObjects 3 { osg::UIntValueObject { UniqueID 6 - Name "recIndex" + Name "recordIndex" Value 4294967295 } osg::StringValueObject { @@ -197,7 +197,7 @@ osg::Group { UDC_UserObjects 3 { osg::UIntValueObject { UniqueID 6 - Name "recIndex" + Name "recordIndex" Value 4294967295 } osg::StringValueObject { diff --git a/apps/openmw/mwphysics/object.cpp b/apps/openmw/mwphysics/object.cpp index 5936083f1d..376a9d7541 100644 --- a/apps/openmw/mwphysics/object.cpp +++ b/apps/openmw/mwphysics/object.cpp @@ -118,25 +118,25 @@ namespace MWPhysics btCompoundShape* compound = static_cast(mShapeInstance->mCollisionShape.get()); bool result = false; - for (const auto& [recIndex, shapeIndex] : mShapeInstance->mAnimatedShapes) + for (const auto& [recordIndex, shapeIndex] : mShapeInstance->mAnimatedShapes) { - auto nodePathFound = mRecIndexToNodePath.find(recIndex); - if (nodePathFound == mRecIndexToNodePath.end()) + auto nodePathFound = mRecordIndexToNodePath.find(recordIndex); + if (nodePathFound == mRecordIndexToNodePath.end()) { - NifOsg::FindGroupByRecIndex visitor(recIndex); + NifOsg::FindGroupByRecordIndex visitor(recordIndex); mPtr.getRefData().getBaseNode()->accept(visitor); if (!visitor.mFound) { - Log(Debug::Warning) << "Warning: animateCollisionShapes can't find node " << recIndex << " for " + Log(Debug::Warning) << "Warning: animateCollisionShapes can't find node " << recordIndex << " for " << mPtr.getCellRef().getRefId(); // Remove nonexistent nodes from animated shapes map and early out - mShapeInstance->mAnimatedShapes.erase(recIndex); + mShapeInstance->mAnimatedShapes.erase(recordIndex); return false; } osg::NodePath nodePath = visitor.mFoundPath; nodePath.erase(nodePath.begin()); - nodePathFound = mRecIndexToNodePath.emplace(recIndex, nodePath).first; + nodePathFound = mRecordIndexToNodePath.emplace(recordIndex, nodePath).first; } osg::NodePath& nodePath = nodePathFound->second; diff --git a/apps/openmw/mwphysics/object.hpp b/apps/openmw/mwphysics/object.hpp index 15b7c46926..bacf68f7f8 100644 --- a/apps/openmw/mwphysics/object.hpp +++ b/apps/openmw/mwphysics/object.hpp @@ -52,7 +52,7 @@ namespace MWPhysics private: osg::ref_ptr mShapeInstance; - std::map mRecIndexToNodePath; + std::map mRecordIndexToNodePath; bool mSolid; btVector3 mScale; osg::Vec3f mPosition; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 6cc1b84fd2..a77620db61 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -305,7 +305,7 @@ namespace NifOsg const Nif::NiSortAdjustNode* mLastAppliedNoInheritSorter = nullptr; // This is used to queue emitters that weren't attached to their node yet. - std::vector>> mEmitterQueue; + std::vector>> mEmitterQueue; void loadKf(Nif::FileView nif, SceneUtil::KeyframeHolder& target) const { @@ -690,7 +690,7 @@ namespace NifOsg // - finding the correct emitter node for a particle system // - establishing connections to the animated collision shapes, which are handled in a separate loader // - finding a random child NiNode in NiBspArrayController - node->setUserValue("recIndex", nifNode->mRecordIndex); + node->setUserValue("recordIndex", nifNode->mRecordIndex); std::string extraData; @@ -1347,24 +1347,23 @@ namespace NifOsg void handleQueuedParticleEmitters(osg::Group* rootNode, Nif::FileView nif) { - for (const auto& emitterPair : mEmitterQueue) + for (const auto& [recordIndex, emitter] : mEmitterQueue) { - auto recIndex = static_cast(emitterPair.first); - FindGroupByRecIndex findEmitterNode(recIndex); + FindGroupByRecordIndex findEmitterNode(recordIndex); rootNode->accept(findEmitterNode); osg::Group* emitterNode = findEmitterNode.mFound; if (!emitterNode) { Log(Debug::Warning) << "NIFFile Warning: Failed to find particle emitter emitter node (node record index " - << recIndex << "). File: " << nif.getFilename(); + << recordIndex << "). File: " << nif.getFilename(); continue; } // Emitter attached to the emitter node. Note one side effect of the emitter using the CullVisitor is // that hiding its node actually causes the emitter to stop firing. Convenient, because MW behaves this // way too! - emitterNode->addChild(emitterPair.second); + emitterNode->addChild(emitter); DisableOptimizer disableOptimizer; emitterNode->accept(disableOptimizer); diff --git a/components/nifosg/particle.cpp b/components/nifosg/particle.cpp index f64116eb9c..585b758d8f 100644 --- a/components/nifosg/particle.cpp +++ b/components/nifosg/particle.cpp @@ -476,28 +476,28 @@ namespace NifOsg if (useGeometryEmitter || !mTargets.empty()) { - int recIndex; + int recordIndex; if (useGeometryEmitter) { if (!mGeometryEmitterTarget.has_value()) return; - recIndex = mGeometryEmitterTarget.value(); + recordIndex = mGeometryEmitterTarget.value(); } else { size_t randomIndex = Misc::Rng::rollDice(mTargets.size()); - recIndex = mTargets[randomIndex]; + recordIndex = mTargets[randomIndex]; } // we could use a map here for faster lookup - FindGroupByRecIndex visitor(recIndex); + FindGroupByRecordIndex visitor(recordIndex); getParent(0)->accept(visitor); if (!visitor.mFound) { - Log(Debug::Info) << "Can't find emitter node" << recIndex; + Log(Debug::Info) << "Can't find emitter node" << recordIndex; return; } @@ -565,32 +565,32 @@ namespace NifOsg } } - FindGroupByRecIndex::FindGroupByRecIndex(unsigned int recIndex) + FindGroupByRecordIndex::FindGroupByRecordIndex(unsigned int recordIndex) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) , mFound(nullptr) - , mRecIndex(recIndex) + , mRecordIndex(recordIndex) { } - void FindGroupByRecIndex::apply(osg::Node& node) + void FindGroupByRecordIndex::apply(osg::Node& node) { applyNode(node); } - void FindGroupByRecIndex::apply(osg::MatrixTransform& node) + void FindGroupByRecordIndex::apply(osg::MatrixTransform& node) { applyNode(node); } - void FindGroupByRecIndex::apply(osg::Geometry& node) + void FindGroupByRecordIndex::apply(osg::Geometry& node) { applyNode(node); } - void FindGroupByRecIndex::applyNode(osg::Node& searchNode) + void FindGroupByRecordIndex::applyNode(osg::Node& searchNode) { - unsigned int recIndex; - if (searchNode.getUserValue("recIndex", recIndex) && mRecIndex == recIndex) + unsigned int recordIndex; + if (searchNode.getUserValue("recordIndex", recordIndex) && mRecordIndex == recordIndex) { osg::Group* group = searchNode.asGroup(); if (!group) diff --git a/components/nifosg/particle.hpp b/components/nifosg/particle.hpp index 272bc5baed..203bdd8863 100644 --- a/components/nifosg/particle.hpp +++ b/components/nifosg/particle.hpp @@ -226,10 +226,10 @@ namespace NifOsg // NodeVisitor to find a Group node with the given record index, stored in the node's user data container. // Alternatively, returns the node's parent Group if that node is not a Group (i.e. a leaf node). - class FindGroupByRecIndex : public osg::NodeVisitor + class FindGroupByRecordIndex : public osg::NodeVisitor { public: - FindGroupByRecIndex(unsigned int recIndex); + FindGroupByRecordIndex(unsigned int recordIndex); void apply(osg::Node& node) override; @@ -244,7 +244,7 @@ namespace NifOsg osg::NodePath mFoundPath; private: - unsigned int mRecIndex; + unsigned int mRecordIndex; }; // Subclass emitter to support randomly choosing one of the child node's transforms for the emit position of new @@ -263,7 +263,7 @@ namespace NifOsg void setShooter(osgParticle::Shooter* shooter) { mShooter = shooter; } void setPlacer(osgParticle::Placer* placer) { mPlacer = placer; } void setCounter(osgParticle::Counter* counter) { mCounter = counter; } - void setGeometryEmitterTarget(std::optional recIndex) { mGeometryEmitterTarget = recIndex; } + void setGeometryEmitterTarget(std::optional recordIndex) { mGeometryEmitterTarget = recordIndex; } void setFlags(int flags) { mFlags = flags; } private: