mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:58:27 +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;
|
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) {
|
Animation* ModelItem::getAnimation(const QString& url) {
|
||||||
AnimationPointer animation;
|
AnimationPointer animation;
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,8 @@ public:
|
||||||
bool getAnimationIsPlaying() const { return _animationIsPlaying; }
|
bool getAnimationIsPlaying() const { return _animationIsPlaying; }
|
||||||
float getAnimationFrameIndex() const { return _animationFrameIndex; }
|
float getAnimationFrameIndex() const { return _animationFrameIndex; }
|
||||||
float getAnimationFPS() const { return _animationFPS; }
|
float getAnimationFPS() const { return _animationFPS; }
|
||||||
|
|
||||||
|
static void cleanupLoadedAnimations();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
|
|
Loading…
Reference in a new issue