mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:26:43 +00:00 
			
		
		
		
	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) : | ||||
|                                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) | ||||
|     { | ||||
|         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->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) | ||||
|     { | ||||
|         Ogre::AnimationStateSet *aset = objects->mSkelBase->getAllAnimationStates(); | ||||
|  |  | |||
|  | @ -916,8 +916,10 @@ class NIFObjectLoader | |||
| 
 | ||||
|                 scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func)); | ||||
| 
 | ||||
|                 if (partflags&Nif::NiNode::ParticleFlag_AutoPlay) | ||||
|                     partsys->fastForward(1, 0.1); | ||||
|                 // Emitting state will be overwritten on frame update by the ParticleSystemController,
 | ||||
|                 // 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; | ||||
|         } | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue