Skylicht Engine
Loading...
Searching...
No Matches
CAnimationManager.h
1/*
2!@
3MIT License
4
5Copyright (c) 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "Utils/CSingleton.h"
28#include "CAnimation.h"
29#include "CAnimationClip.h"
30
31#include "Importer/IAnimationImporter.h"
32#include "Exporter/IAnimationExporter.h"
33
34namespace Skylicht
35{
52 class SKYLICHT_API CAnimationManager
53 {
54 public:
55 DECLARE_SINGLETON(CAnimationManager)
56
57 protected:
59 std::map<std::string, CAnimationClip*> m_clips;
60
62 std::map<std::string, CAnimation*> m_animations;
63
64 public:
65 CAnimationManager();
66
67 virtual ~CAnimationManager();
68
74 CAnimation* createAnimation(const char* name);
75
81 CAnimation* getAnimation(const char* animName)
82 {
83 return m_animations[animName];
84 }
85
91 CAnimationClip* loadAnimation(const char* resource);
92
99 CAnimationClip* loadAnimation(const char* resource, IAnimationImporter* importer);
100
107 bool exportAnimation(CAnimationClip* clip, const char* output);
108
116 bool exportAnimation(CAnimationClip* clip, const char* output, IAnimationExporter* exporter);
117
122
127 };
128}
Represents an animation clip containing multiple animation tracks for different entities.
Definition CAnimationClip.h:41
Container for a collection of animation clips.
Definition CAnimation.h:36
CAnimationClip * loadAnimation(const char *resource, IAnimationImporter *importer)
Loads an animation clip using a specific importer.
CAnimation * createAnimation(const char *name)
Creates or retrieves a named animation container.
CAnimation * getAnimation(const char *animName)
Gets a named animation container.
Definition CAnimationManager.h:81
void releaseAllClips()
Releases all cached animation clips.
std::map< std::string, CAnimation * > m_animations
Cached animation containers indexed by name.
Definition CAnimationManager.h:62
std::map< std::string, CAnimationClip * > m_clips
Cached animation clips indexed by resource path.
Definition CAnimationManager.h:59
void releaseAllAnimations()
Releases all cached animation containers.
bool exportAnimation(CAnimationClip *clip, const char *output, IAnimationExporter *exporter)
Exports an animation clip using a specific exporter.
CAnimationClip * loadAnimation(const char *resource)
Loads an animation clip from a file.
bool exportAnimation(CAnimationClip *clip, const char *output)
Exports an animation clip to a file.
Definition IAnimationExporter.h:32
Definition IAnimationImporter.h:32
#define DECLARE_SINGLETON(className)
Declare the standard singleton accessors for a class.
Definition CSingleton.h:36
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29