Handle NiKeyframeController for NiTriShape (feature #5224)

pull/556/head
Andrei Kortunov 5 years ago
parent 1e62115800
commit 5b5c52d92e

@ -231,6 +231,7 @@
Feature #5147: Show spell magicka cost in spell buying window
Feature #5170: Editor: Land shape editing, land selection
Feature #5193: Weapon sheathing
Feature #5224: Handle NiKeyframeController for NiTriShape
Task #4686: Upgrade media decoder to a more current FFmpeg API
Task #4695: Optimize Distant Terrain memory consumption
Task #4789: Optimize cell transitions

@ -614,8 +614,6 @@ namespace NifOsg
if (composite->getNumControllers() > 0)
node->addUpdateCallback(composite);
// Note: NiTriShapes are not allowed to have KeyframeControllers (the vanilla engine just crashes when there is one).
// We can take advantage of this constraint for optimizations later.
if (nifNode->recType != Nif::RC_NiTriShape && nifNode->recType != Nif::RC_NiTriStrips
&& !nifNode->controller.empty() && node->getDataVariance() == osg::Object::DYNAMIC)
handleNodeControllers(nifNode, static_cast<osg::MatrixTransform*>(node.get()), animflags);
@ -676,6 +674,17 @@ namespace NifOsg
setupController(niuvctrl, uvctrl, animflags);
composite->addController(uvctrl);
}
else if (ctrl->recType == Nif::RC_NiKeyframeController)
{
const Nif::NiKeyframeController *key = static_cast<const Nif::NiKeyframeController*>(ctrl.getPtr());
if(!key->data.empty())
{
osg::ref_ptr<KeyframeController> callback(new KeyframeController(key->data.getPtr()));
setupController(key, callback, animflags);
node->addUpdateCallback(callback);
}
}
else if (ctrl->recType == Nif::RC_NiVisController)
{
handleVisController(static_cast<const Nif::NiVisController*>(ctrl.getPtr()), node, animflags);

Loading…
Cancel
Save