mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-25 00:53:11 +00:00
Merge branch 'recindex' into 'master'
Rename all remaining recIndex variations to recordIndex See merge request OpenMW/openmw!5059
This commit is contained in:
commit
dbcedf614d
6 changed files with 34 additions and 35 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -118,25 +118,25 @@ namespace MWPhysics
|
|||
|
||||
btCompoundShape* compound = static_cast<btCompoundShape*>(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;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace MWPhysics
|
|||
|
||||
private:
|
||||
osg::ref_ptr<Resource::BulletShapeInstance> mShapeInstance;
|
||||
std::map<int, osg::NodePath> mRecIndexToNodePath;
|
||||
std::map<int, osg::NodePath> mRecordIndexToNodePath;
|
||||
bool mSolid;
|
||||
btVector3 mScale;
|
||||
osg::Vec3f mPosition;
|
||||
|
|
|
|||
|
|
@ -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<std::pair<size_t, osg::ref_ptr<Emitter>>> mEmitterQueue;
|
||||
std::vector<std::pair<unsigned int, osg::ref_ptr<Emitter>>> 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<unsigned>(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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<int> recIndex) { mGeometryEmitterTarget = recIndex; }
|
||||
void setGeometryEmitterTarget(std::optional<int> recordIndex) { mGeometryEmitterTarget = recordIndex; }
|
||||
void setFlags(int flags) { mFlags = flags; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in a new issue