Parse bhkRagdollTemplate/bhkRagdollTemplateData

pull/3236/head
Alexei Kotov 3 months ago
parent b9cb028809
commit 5f7fa640b0

@ -477,6 +477,10 @@ namespace Nif
{ "bhkLiquidAction", &construct<bhkLiquidAction, RC_bhkLiquidAction> }, { "bhkLiquidAction", &construct<bhkLiquidAction, RC_bhkLiquidAction> },
{ "bhkOrientHingedBodyAction", &construct<bhkOrientHingedBodyAction, RC_bhkOrientHingedBodyAction> }, { "bhkOrientHingedBodyAction", &construct<bhkOrientHingedBodyAction, RC_bhkOrientHingedBodyAction> },
// Ragdoll template records
{ "bhkRagdollTemplate", &construct<bhkRagdollTemplate, RC_bhkRagdollTemplate> },
{ "bhkRagdollTemplateData", &construct<bhkRagdollTemplateData, RC_bhkRagdollTemplateData> },
// PROPERTIES // PROPERTIES
// 4.0.0.2 // 4.0.0.2

@ -986,4 +986,31 @@ namespace Nif
nif->skip(8); // Unused nif->skip(8); // Unused
} }
void bhkRagdollTemplate::read(NIFStream* nif)
{
Extra::read(nif);
readRecordList(nif, mBones);
}
void bhkRagdollTemplate::post(Reader& nif)
{
Extra::post(nif);
postRecordList(nif, mBones);
}
void bhkRagdollTemplateData::read(NIFStream* nif)
{
nif->read(mName);
nif->read(mMass);
nif->read(mRestitution);
nif->read(mFriction);
nif->read(mRadius);
mHavokMaterial.read(nif);
mConstraints.resize(nif->get<uint32_t>());
for (bhkWrappedConstraintData& constraint : mConstraints)
constraint.read(nif);
}
} // Namespace } // Namespace

@ -1,6 +1,7 @@
#ifndef OPENMW_COMPONENTS_NIF_PHYSICS_HPP #ifndef OPENMW_COMPONENTS_NIF_PHYSICS_HPP
#define OPENMW_COMPONENTS_NIF_PHYSICS_HPP #define OPENMW_COMPONENTS_NIF_PHYSICS_HPP
#include "extra.hpp"
#include "niftypes.hpp" #include "niftypes.hpp"
#include "record.hpp" #include "record.hpp"
#include "recordptr.hpp" #include "recordptr.hpp"
@ -908,5 +909,26 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct bhkRagdollTemplate : Extra
{
NiAVObjectList mBones;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct bhkRagdollTemplateData : Record
{
std::string mName;
float mMass;
float mRestitution;
float mFriction;
float mRadius;
HavokMaterial mHavokMaterial;
std::vector<bhkWrappedConstraintData> mConstraints;
void read(NIFStream* nif) override;
};
} // Namespace } // Namespace
#endif #endif

@ -68,6 +68,8 @@ namespace Nif
RC_bhkPrismaticConstraint, RC_bhkPrismaticConstraint,
RC_bhkRagdollConstraint, RC_bhkRagdollConstraint,
RC_bhkRagdollSystem, RC_bhkRagdollSystem,
RC_bhkRagdollTemplate,
RC_bhkRagdollTemplateData,
RC_bhkRigidBody, RC_bhkRigidBody,
RC_bhkRigidBodyT, RC_bhkRigidBodyT,
RC_bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom,

Loading…
Cancel
Save