diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 9db672d9e..874ca9eaa 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -387,6 +387,15 @@ namespace NifOsg toSetup->setFunction(boost::shared_ptr(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(new SceneUtil::FrameTimeSource)); + + toSetup->setFunction(boost::shared_ptr(new ControllerFunction(ctrl))); + } + void optimize (const Nif::Node* nifNode, osg::Group* node, bool skipMeshes) { // For nodes with an identity transform, remove the redundant Transform node @@ -984,7 +993,7 @@ namespace NifOsg emitterNode->addChild(emitter); osg::ref_ptr callback(new ParticleSystemController(partctrl)); - setupController(partctrl, callback, animflags); + setupParticleController(partctrl, callback, particleflags); emitter->setUpdateCallback(callback); }