mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 18:44:00 +02:00
clean up animations
This commit is contained in:
parent
fa20e8ff95
commit
f6c1d3e635
2 changed files with 20 additions and 1 deletions
|
@ -671,9 +671,26 @@ void ModelItem::adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssi
|
|||
}
|
||||
|
||||
|
||||
QMap<QString, AnimationPointer> ModelItem::_loadedAnimations; // TODO: cleanup??
|
||||
QMap<QString, AnimationPointer> ModelItem::_loadedAnimations; // TODO: improve cleanup by leveraging the AnimationPointer(s)
|
||||
AnimationCache ModelItem::_animationCache;
|
||||
|
||||
// This class/instance will cleanup the animations once unloaded.
|
||||
class ModelAnimationsBookkeeper {
|
||||
public:
|
||||
~ModelAnimationsBookkeeper() {
|
||||
ModelItem::cleanupLoadedAnimations();
|
||||
}
|
||||
};
|
||||
|
||||
ModelAnimationsBookkeeper modelAnimationsBookkeeperInstance;
|
||||
|
||||
void ModelItem::cleanupLoadedAnimations() {
|
||||
foreach(AnimationPointer animation, _loadedAnimations) {
|
||||
animation.clear();
|
||||
}
|
||||
_loadedAnimations.clear();
|
||||
}
|
||||
|
||||
Animation* ModelItem::getAnimation(const QString& url) {
|
||||
AnimationPointer animation;
|
||||
|
||||
|
|
|
@ -278,6 +278,8 @@ public:
|
|||
bool getAnimationIsPlaying() const { return _animationIsPlaying; }
|
||||
float getAnimationFrameIndex() const { return _animationFrameIndex; }
|
||||
float getAnimationFPS() const { return _animationFPS; }
|
||||
|
||||
static void cleanupLoadedAnimations();
|
||||
|
||||
protected:
|
||||
glm::vec3 _position;
|
||||
|
|
Loading…
Reference in a new issue