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);
bankDir = nif->getInt();
maxBankAngle = nif->getFloat();
smoothing = nif->getFloat();
nif->read(followAxis);
posData.read(nif);
floatData.read(nif);
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
nif->read(mPathFlags);
else
mPathFlags = (flags >> 16);
nif->read(mBankDirection);
nif->read(mMaxBankAngle);
nif->read(mSmoothing);
nif->read(mFollowAxis);
mPathData.read(nif);
mPercentData.read(nif);
}
void NiPathController::post(Reader& nif)
{
Controller::post(nif);
posData.post(nif);
floatData.post(nif);
mPathData.post(nif);
mPercentData.post(nif);
}
void NiUVController::read(NIFStream* nif)

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

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

@ -907,7 +907,7 @@ namespace NifOsg
else if (ctrl->recType == Nif::RC_NiPathController)
{
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;
osg::ref_ptr<PathController> callback(new PathController(path));
setupController(path, callback, animflags);

Loading…
Cancel
Save