Update NiPathController

Support 10.1.0.0+ NiPathController loading
macos_ci_fix
Alexei Kotov 1 year ago
parent ca85820431
commit 04d3f6a42d

@ -267,20 +267,25 @@ namespace Nif
{ {
Controller::read(nif); Controller::read(nif);
bankDir = nif->getInt(); if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
maxBankAngle = nif->getFloat(); nif->read(mPathFlags);
smoothing = nif->getFloat(); else
nif->read(followAxis); mPathFlags = (flags >> 16);
posData.read(nif);
floatData.read(nif); nif->read(mBankDirection);
nif->read(mMaxBankAngle);
nif->read(mSmoothing);
nif->read(mFollowAxis);
mPathData.read(nif);
mPercentData.read(nif);
} }
void NiPathController::post(Reader& nif) void NiPathController::post(Reader& nif)
{ {
Controller::post(nif); Controller::post(nif);
posData.post(nif); mPathData.post(nif);
floatData.post(nif); mPercentData.post(nif);
} }
void NiUVController::read(NIFStream* nif) void NiUVController::read(NIFStream* nif)

@ -174,22 +174,24 @@ namespace Nif
struct NiPathController : public Controller struct NiPathController : public Controller
{ {
NiPosDataPtr posData;
NiFloatDataPtr floatData;
enum Flags enum Flags
{ {
Flag_OpenCurve = 0x020, Flag_CVDataNeedsUpdate = 0x01,
Flag_AllowFlip = 0x040, Flag_OpenCurve = 0x02,
Flag_Bank = 0x080, Flag_AllowFlip = 0x04,
Flag_ConstVelocity = 0x100, Flag_Bank = 0x08,
Flag_Follow = 0x200, Flag_ConstVelocity = 0x10,
Flag_FlipFollowAxis = 0x400 Flag_Follow = 0x20,
Flag_FlipFollowAxis = 0x40,
}; };
int bankDir; uint16_t mPathFlags;
float maxBankAngle, smoothing; int32_t mBankDirection;
uint16_t followAxis; float mMaxBankAngle;
float mSmoothing;
uint16_t mFollowAxis;
NiPosDataPtr mPathData;
NiFloatDataPtr mPercentData;
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
void post(Reader& nif) override; void post(Reader& nif) override;

@ -598,9 +598,9 @@ namespace NifOsg
} }
PathController::PathController(const Nif::NiPathController* ctrl) PathController::PathController(const Nif::NiPathController* ctrl)
: mPath(ctrl->posData->mKeyList, osg::Vec3f()) : mPath(ctrl->mPathData->mKeyList, osg::Vec3f())
, mPercent(ctrl->floatData->mKeyList, 1.f) , mPercent(ctrl->mPercentData->mKeyList, 1.f)
, mFlags(ctrl->flags) , mFlags(ctrl->mPathFlags)
{ {
} }

@ -907,7 +907,7 @@ namespace NifOsg
else if (ctrl->recType == Nif::RC_NiPathController) else if (ctrl->recType == Nif::RC_NiPathController)
{ {
const Nif::NiPathController* path = static_cast<const Nif::NiPathController*>(ctrl.getPtr()); const Nif::NiPathController* path = static_cast<const Nif::NiPathController*>(ctrl.getPtr());
if (path->posData.empty() || path->floatData.empty()) if (path->mPathData.empty() || path->mPercentData.empty())
continue; continue;
osg::ref_ptr<PathController> callback(new PathController(path)); osg::ref_ptr<PathController> callback(new PathController(path));
setupController(path, callback, animflags); setupController(path, callback, animflags);

Loading…
Cancel
Save