mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-29 03:26:38 +00:00 
			
		
		
		
	Add a method to get the Animation from a Ptr
This commit is contained in:
		
							parent
							
								
									c1b32d6006
								
							
						
					
					
						commit
						63e685ea39
					
				
					 7 changed files with 34 additions and 0 deletions
				
			
		|  | @ -36,6 +36,7 @@ namespace ESM | |||
| namespace MWRender | ||||
| { | ||||
|     class ExternalRendering; | ||||
|     class Animation; | ||||
| } | ||||
| 
 | ||||
| namespace MWWorld | ||||
|  | @ -308,6 +309,9 @@ namespace MWBase | |||
|             /// 3 - enemies are nearby (not implemented)
 | ||||
| 
 | ||||
| 
 | ||||
|             /// \todo Probably shouldn't be here
 | ||||
|             virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr) = 0; | ||||
| 
 | ||||
|             /// \todo this does not belong here
 | ||||
|             virtual void playVideo(const std::string& name, bool allowSkipping) = 0; | ||||
|             virtual void stopVideo() = 0; | ||||
|  |  | |||
|  | @ -145,6 +145,14 @@ void Actors::update (float duration) | |||
|         iter->second->runAnimation(duration); | ||||
| } | ||||
| 
 | ||||
| Animation* Actors::getAnimation(const MWWorld::Ptr &ptr) | ||||
| { | ||||
|     PtrAnimationMap::const_iterator iter = mAllActors.find(ptr); | ||||
|     if(iter != mAllActors.end()) | ||||
|         return iter->second; | ||||
|     return NULL; | ||||
| } | ||||
| 
 | ||||
| void Actors::updateObjectCell(const MWWorld::Ptr &ptr) | ||||
| { | ||||
|     Ogre::SceneNode *node; | ||||
|  |  | |||
|  | @ -54,6 +54,8 @@ namespace MWRender | |||
| 
 | ||||
|         /// Updates containing cell for object rendering data
 | ||||
|         void updateObjectCell(const MWWorld::Ptr &ptr); | ||||
| 
 | ||||
|         Animation* getAnimation(const MWWorld::Ptr &ptr); | ||||
|     }; | ||||
| } | ||||
| #endif | ||||
|  |  | |||
|  | @ -929,6 +929,14 @@ void RenderingManager::setupExternalRendering (MWRender::ExternalRendering& rend | |||
|     rendering.setup (mRendering.getScene()); | ||||
| } | ||||
| 
 | ||||
| Animation* RenderingManager::getAnimation(const MWWorld::Ptr &ptr) | ||||
| { | ||||
|     Animation *anim = mActors.getAnimation(ptr); | ||||
|     // TODO: Check mObjects too.
 | ||||
|     return anim; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void RenderingManager::playVideo(const std::string& name, bool allowSkipping) | ||||
| { | ||||
|     mVideoPlayer->playVideo ("video/" + name, allowSkipping); | ||||
|  |  | |||
|  | @ -46,6 +46,7 @@ namespace MWRender | |||
|     class ExternalRendering; | ||||
|     class GlobalMap; | ||||
|     class VideoPlayer; | ||||
|     class Animation; | ||||
| 
 | ||||
| class RenderingManager: private RenderingInterface, public Ogre::WindowEventListener { | ||||
| 
 | ||||
|  | @ -196,6 +197,8 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList | |||
| 
 | ||||
|     void setupExternalRendering (MWRender::ExternalRendering& rendering); | ||||
| 
 | ||||
|     Animation* getAnimation(const MWWorld::Ptr &ptr); | ||||
| 
 | ||||
|     void playVideo(const std::string& name, bool allowSkipping); | ||||
|     void stopVideo(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1374,6 +1374,11 @@ namespace MWWorld | |||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     MWRender::Animation* World::getAnimation(const MWWorld::Ptr &ptr) | ||||
|     { | ||||
|         return mRendering->getAnimation(ptr); | ||||
|     } | ||||
| 
 | ||||
|     void World::playVideo (const std::string &name, bool allowSkipping) | ||||
|     { | ||||
|         mRendering->playVideo(name, allowSkipping); | ||||
|  |  | |||
|  | @ -37,6 +37,7 @@ namespace MWRender | |||
| { | ||||
|     class SkyManager; | ||||
|     class CellRender; | ||||
|     class Animation; | ||||
| } | ||||
| 
 | ||||
| namespace MWWorld | ||||
|  | @ -352,6 +353,9 @@ namespace MWWorld | |||
|             /// 2 - player is underwater \n
 | ||||
|             /// 3 - enemies are nearby (not implemented)
 | ||||
| 
 | ||||
|             /// \todo Probably shouldn't be here
 | ||||
|             virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr); | ||||
| 
 | ||||
|             /// \todo this does not belong here
 | ||||
|             virtual void playVideo(const std::string& name, bool allowSkipping); | ||||
|             virtual void stopVideo(); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue