Skylicht Engine
Loading...
Searching...
No Matches
CAnimation.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 "pch.h"
28#include "CAnimationClip.h"
29
30namespace Skylicht
31{
32
35 class SKYLICHT_API CAnimation
36 {
37 protected:
38 std::vector<CAnimationClip*> m_clips;
39 std::map<std::string, CAnimationClip*> m_clipName;
40
41 public:
42 CAnimation();
43
44 virtual ~CAnimation();
45
51 CAnimationClip* getAnim(const char *lpAnimName)
52 {
53 return m_clipName[lpAnimName];
54 }
55
62 {
63 return m_clips[animID];
64 }
65
71 {
72 return (int)m_clips.size();
73 }
74
80 {
81 if (clip == NULL)
82 return;
83
84 m_clips.push_back(clip);
85 m_clipName[clip->AnimName] = clip;
86 }
87
92
97 std::vector<CAnimationClip*>* getAllAnimClip()
98 {
99 return &m_clips;
100 }
101
106 std::map<std::string, CAnimationClip*>* getAllAnimNameClip()
107 {
108 return &m_clipName;
109 }
110
114 void removeAll();
115
120 void removeClip(const std::string& clipName);
121
127 void renameClip(const std::string& oldName, const std::string& newName);
128
129 };
130
131}
Represents an animation clip containing multiple animation tracks for different entities.
Definition CAnimationClip.h:41
std::string AnimName
The name of the animation clip.
Definition CAnimationClip.h:44
void sortAnimByName()
Sorts animation clips alphabetically by name.
CAnimationClip * getAnim(const char *lpAnimName)
Gets an animation clip by name.
Definition CAnimation.h:51
std::vector< CAnimationClip * > * getAllAnimClip()
Returns the internal vector of animation clips.
Definition CAnimation.h:97
void removeClip(const std::string &clipName)
Removes a specific animation clip by name.
void renameClip(const std::string &oldName, const std::string &newName)
Renames an animation clip.
CAnimationClip * getAnim(int animID)
Gets an animation clip by index.
Definition CAnimation.h:61
void addClip(CAnimationClip *clip)
Adds a new animation clip to the collection.
Definition CAnimation.h:79
int getAnimCount()
Gets the total number of animation clips.
Definition CAnimation.h:70
void removeAll()
Removes all animation clips from the collection.
std::map< std::string, CAnimationClip * > * getAllAnimNameClip()
Returns the internal map of animation clips.
Definition CAnimation.h:106
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29