Atoms Crowd  7.0.0
AnimationClips.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <Atoms/Globals.h>
11 #include <Atoms/AnimationClip.h>
12 #include <map>
13 #include <vector>
14 #include <functional>
15 #include <mutex>
16 
17 namespace Atoms
18 {
20 
22  class ATOMS_EXPORT AnimationClips
23  {
24  public:
25 
28 
30 
34  AnimationClipCPtr animationClip(const std::string& name) const;
35 
37 
41  AnimationClipPtr animationClip(const std::string& name);
42 
44 
48  AnimationClipPtr addAnimationClip(const std::string& name, const std::string& filePath, bool replace = true);
49 
51 
55  AnimationClipPtr addAnimationClip(const std::string& name, AnimationClipPtr& clipPtr, bool replace = true);
56 
58 
61  void removeAnimationClip(const std::string& name);
62 
64 
67  std::vector<std::string> animationClipNames();
68 
70 
74  bool animationClipExists(const std::string& name);
75 
77  unsigned int numAnimationClips();
78 
80  void clear();
81 
82  void registerLoaderCallback(std::function<AnimationClipPtr(const char*)>& callback);
83 
84  private:
85 
88 
91 
93  ~AnimationClips();
94 
96  AnimationClips& operator=(const AnimationClips&);
97 
98  typedef std::map<std::string, AnimationClipPtr> AnimationClipsMap;
99 
101 
104  AnimationClipsMap m_animationClipsMap;
105 
106  std::function<AnimationClipPtr(const char*)> m_loaderCallback;
107 
108  mutable std::mutex m_mutex;
109  };
110 }
Animation clips manager.
Definition: AnimationClips.h:23
std::vector< std::string > animationClipNames()
Get all animation clip names.
bool animationClipExists(const std::string &name)
Check if an animation clip exists.
unsigned int numAnimationClips()
Get number of animation clips.
void clear()
Remove all animation clips.
void removeAnimationClip(const std::string &name)
Remove an animation clip from the map.
AnimationClipPtr addAnimationClip(const std::string &name, const std::string &filePath, bool replace=true)
Add an animation clip to the map.
AnimationClipPtr addAnimationClip(const std::string &name, AnimationClipPtr &clipPtr, bool replace=true)
Add an animation clip to the map.
AnimationClipPtr animationClip(const std::string &name)
Return an animation clips.
AnimationClipCPtr animationClip(const std::string &name) const
Return an animation clips.
static AnimationClips & instance()
Singleton access.
Atoms namespace.
Definition: Agent.h:29
AtomsPtr< const AnimationClip > AnimationClipCPtr
animation clip const pointer
Definition: AnimationClip.h:32
AtomsPtr< AnimationClip > AnimationClipPtr
animation clip pointer
Definition: AnimationClip.h:28