forked from mirror/openmw-tes3mp
Move fast-forward of particle systems outside of OgreNifLoader (Fixes #1830)
Particle systems were being fast-forwarded before the skeleton base was attached, so particles without the LocalSpace flag would spawn at an incorrect position.
This commit is contained in:
parent
03cb66c342
commit
83037a1a91
3 changed files with 13 additions and 2 deletions
|
@ -110,6 +110,11 @@ void Animation::setObjectRoot(const std::string &model, bool baseonly)
|
||||||
|
|
||||||
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, mdlname) :
|
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, mdlname) :
|
||||||
NifOgre::Loader::createObjectBase(mInsert, mdlname));
|
NifOgre::Loader::createObjectBase(mInsert, mdlname));
|
||||||
|
|
||||||
|
// Fast forward auto-play particles, which will have been set up as Emitting by the loader.
|
||||||
|
for (unsigned int i=0; i<mObjectRoot->mParticles.size(); ++i)
|
||||||
|
mObjectRoot->mParticles[i]->fastForward(1, 0.1);
|
||||||
|
|
||||||
if(mObjectRoot->mSkelBase)
|
if(mObjectRoot->mSkelBase)
|
||||||
{
|
{
|
||||||
mSkelBase = mObjectRoot->mSkelBase;
|
mSkelBase = mObjectRoot->mSkelBase;
|
||||||
|
|
|
@ -552,6 +552,10 @@ NifOgre::ObjectScenePtr NpcAnimation::insertBoundedPart(const std::string &model
|
||||||
std::for_each(objects->mEntities.begin(), objects->mEntities.end(), SetObjectGroup(group));
|
std::for_each(objects->mEntities.begin(), objects->mEntities.end(), SetObjectGroup(group));
|
||||||
std::for_each(objects->mParticles.begin(), objects->mParticles.end(), SetObjectGroup(group));
|
std::for_each(objects->mParticles.begin(), objects->mParticles.end(), SetObjectGroup(group));
|
||||||
|
|
||||||
|
// Fast forward auto-play particles, which will have been set up as Emitting by the loader.
|
||||||
|
for (unsigned int i=0; i<objects->mParticles.size(); ++i)
|
||||||
|
objects->mParticles[i]->fastForward(1, 0.1);
|
||||||
|
|
||||||
if(objects->mSkelBase)
|
if(objects->mSkelBase)
|
||||||
{
|
{
|
||||||
Ogre::AnimationStateSet *aset = objects->mSkelBase->getAllAnimationStates();
|
Ogre::AnimationStateSet *aset = objects->mSkelBase->getAllAnimationStates();
|
||||||
|
|
|
@ -916,8 +916,10 @@ class NIFObjectLoader
|
||||||
|
|
||||||
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
|
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
|
||||||
|
|
||||||
if (partflags&Nif::NiNode::ParticleFlag_AutoPlay)
|
// Emitting state will be overwritten on frame update by the ParticleSystemController,
|
||||||
partsys->fastForward(1, 0.1);
|
// but set up an initial value anyway so the user can fast-forward particle systems
|
||||||
|
// immediately after creation if desired.
|
||||||
|
partsys->setEmitting(partflags&Nif::NiNode::ParticleFlag_AutoPlay);
|
||||||
}
|
}
|
||||||
ctrl = ctrl->next;
|
ctrl = ctrl->next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue