Skip inactive controllers. Fixes those bloody bone boots again.

actorid
scrawl 11 years ago
parent 4ec86d1c68
commit bbd15b185d

@ -140,6 +140,9 @@ struct NiNode : Node
ParticleFlag_AutoPlay = 0x0020, ParticleFlag_AutoPlay = 0x0020,
ParticleFlag_LocalSpace = 0x0080 ParticleFlag_LocalSpace = 0x0080
}; };
enum ControllerFlags {
ControllerFlag_Active = 0x8
};
void read(NIFStream *nif) void read(NIFStream *nif)
{ {

@ -341,7 +341,7 @@ void NIFMeshLoader::createSubMesh(Ogre::Mesh *mesh, const Nif::NiTriShape *shape
Nif::ControllerPtr ctrl = shape->controller; Nif::ControllerPtr ctrl = shape->controller;
do { do {
// Load GeomMorpherController into an Ogre::Pose and Animation // Load GeomMorpherController into an Ogre::Pose and Animation
if(ctrl->recType == Nif::RC_NiGeomMorpherController) if(ctrl->recType == Nif::RC_NiGeomMorpherController && ctrl->flags & Nif::NiNode::ControllerFlag_Active)
{ {
const Nif::NiGeomMorpherController *geom = const Nif::NiGeomMorpherController *geom =
static_cast<const Nif::NiGeomMorpherController*>(ctrl.getPtr()); static_cast<const Nif::NiGeomMorpherController*>(ctrl.getPtr());

@ -635,6 +635,8 @@ class NIFObjectLoader
Nif::ControllerPtr ctrl = node->controller; Nif::ControllerPtr ctrl = node->controller;
while(!ctrl.empty()) while(!ctrl.empty())
{
if (ctrl->flags & Nif::NiNode::ControllerFlag_Active)
{ {
if(ctrl->recType == Nif::RC_NiUVController) if(ctrl->recType == Nif::RC_NiUVController)
{ {
@ -667,6 +669,7 @@ class NIFObjectLoader
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func)); scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
} }
}
ctrl = ctrl->next; ctrl = ctrl->next;
} }
@ -852,7 +855,7 @@ class NIFObjectLoader
Nif::ControllerPtr ctrl = partnode->controller; Nif::ControllerPtr ctrl = partnode->controller;
while(!ctrl.empty()) while(!ctrl.empty())
{ {
if(ctrl->recType == Nif::RC_NiParticleSystemController) if(ctrl->recType == Nif::RC_NiParticleSystemController && ctrl->flags & Nif::NiNode::ControllerFlag_Active)
{ {
const Nif::NiParticleSystemController *partctrl = static_cast<const Nif::NiParticleSystemController*>(ctrl.getPtr()); const Nif::NiParticleSystemController *partctrl = static_cast<const Nif::NiParticleSystemController*>(ctrl.getPtr());
@ -893,6 +896,8 @@ class NIFObjectLoader
static void createNodeControllers(const std::string &name, Nif::ControllerPtr ctrl, ObjectScenePtr scene, int animflags) static void createNodeControllers(const std::string &name, Nif::ControllerPtr ctrl, ObjectScenePtr scene, int animflags)
{ {
do { do {
if (ctrl->flags & Nif::NiNode::ControllerFlag_Active)
{
if(ctrl->recType == Nif::RC_NiVisController) if(ctrl->recType == Nif::RC_NiVisController)
{ {
const Nif::NiVisController *vis = static_cast<const Nif::NiVisController*>(ctrl.getPtr()); const Nif::NiVisController *vis = static_cast<const Nif::NiVisController*>(ctrl.getPtr());
@ -930,6 +935,7 @@ class NIFObjectLoader
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func)); scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
} }
} }
}
ctrl = ctrl->next; ctrl = ctrl->next;
} while(!ctrl.empty()); } while(!ctrl.empty());
} }
@ -1151,6 +1157,9 @@ public:
continue; continue;
} }
if (!(ctrl->flags & Nif::NiNode::ControllerFlag_Active))
continue;
const Nif::NiStringExtraData *strdata = static_cast<const Nif::NiStringExtraData*>(extra.getPtr()); const Nif::NiStringExtraData *strdata = static_cast<const Nif::NiStringExtraData*>(extra.getPtr());
const Nif::NiKeyframeController *key = static_cast<const Nif::NiKeyframeController*>(ctrl.getPtr()); const Nif::NiKeyframeController *key = static_cast<const Nif::NiKeyframeController*>(ctrl.getPtr());

@ -97,7 +97,7 @@ bool NIFSkeletonLoader::needSkeleton(const Nif::Node *node)
{ {
Nif::ControllerPtr ctrl = node->controller; Nif::ControllerPtr ctrl = node->controller;
do { do {
if(ctrl->recType == Nif::RC_NiKeyframeController) if(ctrl->recType == Nif::RC_NiKeyframeController && ctrl->flags & Nif::NiNode::ControllerFlag_Active)
return true; return true;
} while(!(ctrl=ctrl->next).empty()); } while(!(ctrl=ctrl->next).empty());
} }

Loading…
Cancel
Save