Handle the particle node's AutoPlay flag (Bug #3390)

pull/1/head
scrawl 9 years ago
parent 3b31e8f66e
commit e30bb31a79

@ -387,6 +387,15 @@ namespace NifOsg
toSetup->setFunction(boost::shared_ptr<ControllerFunction>(new ControllerFunction(ctrl))); toSetup->setFunction(boost::shared_ptr<ControllerFunction>(new ControllerFunction(ctrl)));
} }
void setupParticleController(const Nif::Controller* ctrl, SceneUtil::Controller* toSetup, int particleflags)
{
bool autoPlay = particleflags & Nif::NiNode::ParticleFlag_AutoPlay;
if (autoPlay)
toSetup->setSource(boost::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
toSetup->setFunction(boost::shared_ptr<ControllerFunction>(new ControllerFunction(ctrl)));
}
void optimize (const Nif::Node* nifNode, osg::Group* node, bool skipMeshes) void optimize (const Nif::Node* nifNode, osg::Group* node, bool skipMeshes)
{ {
// For nodes with an identity transform, remove the redundant Transform node // For nodes with an identity transform, remove the redundant Transform node
@ -984,7 +993,7 @@ namespace NifOsg
emitterNode->addChild(emitter); emitterNode->addChild(emitter);
osg::ref_ptr<ParticleSystemController> callback(new ParticleSystemController(partctrl)); osg::ref_ptr<ParticleSystemController> callback(new ParticleSystemController(partctrl));
setupController(partctrl, callback, animflags); setupParticleController(partctrl, callback, particleflags);
emitter->setUpdateCallback(callback); emitter->setUpdateCallback(callback);
} }

Loading…
Cancel
Save