lottie_animation_from_data uses 'key' as a cache key for parsed models. All LottieIcon instances were created with key="", causing rlottie's model cache to return the first loaded animation for all subsequent requests. Only visible on Windows where rlottie cache is enabled by default. Fix: pass unique animPath as key to each LottieIcon constructor. Also replaced fprintf(stderr) diag with GUI_INFO logging via AnimTimer::logRegisteredIcons() in debug_ui.h.
35 lines
625 B
C++
35 lines
625 B
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
#include <QHash>
|
|
|
|
class LottieIcon;
|
|
|
|
class AnimTimer : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
static AnimTimer *instance();
|
|
|
|
void registerIcon(const QString &key, LottieIcon *icon);
|
|
void unregisterIcon(const QString &key);
|
|
LottieIcon *icon(const QString &key) const;
|
|
void logRegisteredIcons() const;
|
|
|
|
void activate();
|
|
void deactivate();
|
|
static void shutdown();
|
|
|
|
signals:
|
|
void ticked();
|
|
|
|
private slots:
|
|
void onTimer();
|
|
|
|
private:
|
|
AnimTimer();
|
|
QTimer m_timer;
|
|
QHash<QString, LottieIcon *> m_icons;
|
|
int m_activeRef = 0;
|
|
};
|