Skip to content

Commit dbcedf6

Browse files
committed
Merge branch 'recindex' into 'master'
Rename all remaining recIndex variations to recordIndex See merge request OpenMW/openmw!5059
2 parents fc2e1b5 + a619569 commit dbcedf6

File tree

6 files changed

+34
-35
lines changed

6 files changed

+34
-35
lines changed

apps/components_tests/nifosg/testnifloader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ osg::Group {
100100
UDC_UserObjects 1 {
101101
osg::UIntValueObject {
102102
UniqueID 6
103-
Name "recIndex"
103+
Name "recordIndex"
104104
Value 4294967295
105105
}
106106
}
@@ -140,7 +140,7 @@ osg::Group {
140140
UDC_UserObjects 3 {
141141
osg::UIntValueObject {
142142
UniqueID 6
143-
Name "recIndex"
143+
Name "recordIndex"
144144
Value 4294967295
145145
}
146146
osg::StringValueObject {
@@ -197,7 +197,7 @@ osg::Group {
197197
UDC_UserObjects 3 {
198198
osg::UIntValueObject {
199199
UniqueID 6
200-
Name "recIndex"
200+
Name "recordIndex"
201201
Value 4294967295
202202
}
203203
osg::StringValueObject {

apps/openmw/mwphysics/object.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,25 @@ namespace MWPhysics
118118

119119
btCompoundShape* compound = static_cast<btCompoundShape*>(mShapeInstance->mCollisionShape.get());
120120
bool result = false;
121-
for (const auto& [recIndex, shapeIndex] : mShapeInstance->mAnimatedShapes)
121+
for (const auto& [recordIndex, shapeIndex] : mShapeInstance->mAnimatedShapes)
122122
{
123-
auto nodePathFound = mRecIndexToNodePath.find(recIndex);
124-
if (nodePathFound == mRecIndexToNodePath.end())
123+
auto nodePathFound = mRecordIndexToNodePath.find(recordIndex);
124+
if (nodePathFound == mRecordIndexToNodePath.end())
125125
{
126-
NifOsg::FindGroupByRecIndex visitor(recIndex);
126+
NifOsg::FindGroupByRecordIndex visitor(recordIndex);
127127
mPtr.getRefData().getBaseNode()->accept(visitor);
128128
if (!visitor.mFound)
129129
{
130-
Log(Debug::Warning) << "Warning: animateCollisionShapes can't find node " << recIndex << " for "
130+
Log(Debug::Warning) << "Warning: animateCollisionShapes can't find node " << recordIndex << " for "
131131
<< mPtr.getCellRef().getRefId();
132132

133133
// Remove nonexistent nodes from animated shapes map and early out
134-
mShapeInstance->mAnimatedShapes.erase(recIndex);
134+
mShapeInstance->mAnimatedShapes.erase(recordIndex);
135135
return false;
136136
}
137137
osg::NodePath nodePath = visitor.mFoundPath;
138138
nodePath.erase(nodePath.begin());
139-
nodePathFound = mRecIndexToNodePath.emplace(recIndex, nodePath).first;
139+
nodePathFound = mRecordIndexToNodePath.emplace(recordIndex, nodePath).first;
140140
}
141141

142142
osg::NodePath& nodePath = nodePathFound->second;

apps/openmw/mwphysics/object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace MWPhysics
5252

5353
private:
5454
osg::ref_ptr<Resource::BulletShapeInstance> mShapeInstance;
55-
std::map<int, osg::NodePath> mRecIndexToNodePath;
55+
std::map<int, osg::NodePath> mRecordIndexToNodePath;
5656
bool mSolid;
5757
btVector3 mScale;
5858
osg::Vec3f mPosition;

components/nifosg/nifloader.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ namespace NifOsg
305305
const Nif::NiSortAdjustNode* mLastAppliedNoInheritSorter = nullptr;
306306

307307
// This is used to queue emitters that weren't attached to their node yet.
308-
std::vector<std::pair<size_t, osg::ref_ptr<Emitter>>> mEmitterQueue;
308+
std::vector<std::pair<unsigned int, osg::ref_ptr<Emitter>>> mEmitterQueue;
309309

310310
void loadKf(Nif::FileView nif, SceneUtil::KeyframeHolder& target) const
311311
{
@@ -690,7 +690,7 @@ namespace NifOsg
690690
// - finding the correct emitter node for a particle system
691691
// - establishing connections to the animated collision shapes, which are handled in a separate loader
692692
// - finding a random child NiNode in NiBspArrayController
693-
node->setUserValue("recIndex", nifNode->mRecordIndex);
693+
node->setUserValue("recordIndex", nifNode->mRecordIndex);
694694

695695
std::string extraData;
696696

@@ -1347,24 +1347,23 @@ namespace NifOsg
13471347

13481348
void handleQueuedParticleEmitters(osg::Group* rootNode, Nif::FileView nif)
13491349
{
1350-
for (const auto& emitterPair : mEmitterQueue)
1350+
for (const auto& [recordIndex, emitter] : mEmitterQueue)
13511351
{
1352-
auto recIndex = static_cast<unsigned>(emitterPair.first);
1353-
FindGroupByRecIndex findEmitterNode(recIndex);
1352+
FindGroupByRecordIndex findEmitterNode(recordIndex);
13541353
rootNode->accept(findEmitterNode);
13551354
osg::Group* emitterNode = findEmitterNode.mFound;
13561355
if (!emitterNode)
13571356
{
13581357
Log(Debug::Warning)
13591358
<< "NIFFile Warning: Failed to find particle emitter emitter node (node record index "
1360-
<< recIndex << "). File: " << nif.getFilename();
1359+
<< recordIndex << "). File: " << nif.getFilename();
13611360
continue;
13621361
}
13631362

13641363
// Emitter attached to the emitter node. Note one side effect of the emitter using the CullVisitor is
13651364
// that hiding its node actually causes the emitter to stop firing. Convenient, because MW behaves this
13661365
// way too!
1367-
emitterNode->addChild(emitterPair.second);
1366+
emitterNode->addChild(emitter);
13681367

13691368
DisableOptimizer disableOptimizer;
13701369
emitterNode->accept(disableOptimizer);

components/nifosg/particle.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -476,28 +476,28 @@ namespace NifOsg
476476

477477
if (useGeometryEmitter || !mTargets.empty())
478478
{
479-
int recIndex;
479+
int recordIndex;
480480

481481
if (useGeometryEmitter)
482482
{
483483
if (!mGeometryEmitterTarget.has_value())
484484
return;
485485

486-
recIndex = mGeometryEmitterTarget.value();
486+
recordIndex = mGeometryEmitterTarget.value();
487487
}
488488
else
489489
{
490490
size_t randomIndex = Misc::Rng::rollDice(mTargets.size());
491-
recIndex = mTargets[randomIndex];
491+
recordIndex = mTargets[randomIndex];
492492
}
493493

494494
// we could use a map here for faster lookup
495-
FindGroupByRecIndex visitor(recIndex);
495+
FindGroupByRecordIndex visitor(recordIndex);
496496
getParent(0)->accept(visitor);
497497

498498
if (!visitor.mFound)
499499
{
500-
Log(Debug::Info) << "Can't find emitter node" << recIndex;
500+
Log(Debug::Info) << "Can't find emitter node" << recordIndex;
501501
return;
502502
}
503503

@@ -565,32 +565,32 @@ namespace NifOsg
565565
}
566566
}
567567

568-
FindGroupByRecIndex::FindGroupByRecIndex(unsigned int recIndex)
568+
FindGroupByRecordIndex::FindGroupByRecordIndex(unsigned int recordIndex)
569569
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
570570
, mFound(nullptr)
571-
, mRecIndex(recIndex)
571+
, mRecordIndex(recordIndex)
572572
{
573573
}
574574

575-
void FindGroupByRecIndex::apply(osg::Node& node)
575+
void FindGroupByRecordIndex::apply(osg::Node& node)
576576
{
577577
applyNode(node);
578578
}
579579

580-
void FindGroupByRecIndex::apply(osg::MatrixTransform& node)
580+
void FindGroupByRecordIndex::apply(osg::MatrixTransform& node)
581581
{
582582
applyNode(node);
583583
}
584584

585-
void FindGroupByRecIndex::apply(osg::Geometry& node)
585+
void FindGroupByRecordIndex::apply(osg::Geometry& node)
586586
{
587587
applyNode(node);
588588
}
589589

590-
void FindGroupByRecIndex::applyNode(osg::Node& searchNode)
590+
void FindGroupByRecordIndex::applyNode(osg::Node& searchNode)
591591
{
592-
unsigned int recIndex;
593-
if (searchNode.getUserValue("recIndex", recIndex) && mRecIndex == recIndex)
592+
unsigned int recordIndex;
593+
if (searchNode.getUserValue("recordIndex", recordIndex) && mRecordIndex == recordIndex)
594594
{
595595
osg::Group* group = searchNode.asGroup();
596596
if (!group)

components/nifosg/particle.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ namespace NifOsg
226226

227227
// NodeVisitor to find a Group node with the given record index, stored in the node's user data container.
228228
// Alternatively, returns the node's parent Group if that node is not a Group (i.e. a leaf node).
229-
class FindGroupByRecIndex : public osg::NodeVisitor
229+
class FindGroupByRecordIndex : public osg::NodeVisitor
230230
{
231231
public:
232-
FindGroupByRecIndex(unsigned int recIndex);
232+
FindGroupByRecordIndex(unsigned int recordIndex);
233233

234234
void apply(osg::Node& node) override;
235235

@@ -244,7 +244,7 @@ namespace NifOsg
244244
osg::NodePath mFoundPath;
245245

246246
private:
247-
unsigned int mRecIndex;
247+
unsigned int mRecordIndex;
248248
};
249249

250250
// 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
263263
void setShooter(osgParticle::Shooter* shooter) { mShooter = shooter; }
264264
void setPlacer(osgParticle::Placer* placer) { mPlacer = placer; }
265265
void setCounter(osgParticle::Counter* counter) { mCounter = counter; }
266-
void setGeometryEmitterTarget(std::optional<int> recIndex) { mGeometryEmitterTarget = recIndex; }
266+
void setGeometryEmitterTarget(std::optional<int> recordIndex) { mGeometryEmitterTarget = recordIndex; }
267267
void setFlags(int flags) { mFlags = flags; }
268268

269269
private:

0 commit comments

Comments
 (0)