mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 00:38:47 +02:00
Update AnimationCache to use new ResourceCache
This commit is contained in:
parent
ae93d74d8b
commit
2d938f2d0a
2 changed files with 8 additions and 9 deletions
|
@ -43,28 +43,27 @@ Animation::Animation(const QUrl& url) : Resource(url) {}
|
|||
class AnimationReader : public QRunnable {
|
||||
public:
|
||||
|
||||
AnimationReader(const QWeakPointer<Resource>& animation, QNetworkReply* reply);
|
||||
AnimationReader(const QWeakPointer<Resource>& animation, QByteArray data);
|
||||
|
||||
virtual void run();
|
||||
|
||||
private:
|
||||
|
||||
QWeakPointer<Resource> _animation;
|
||||
QNetworkReply* _reply;
|
||||
QByteArray _data;
|
||||
};
|
||||
|
||||
AnimationReader::AnimationReader(const QWeakPointer<Resource>& animation, QNetworkReply* reply) :
|
||||
AnimationReader::AnimationReader(const QWeakPointer<Resource>& animation, QByteArray data) :
|
||||
_animation(animation),
|
||||
_reply(reply) {
|
||||
_data(data) {
|
||||
}
|
||||
|
||||
void AnimationReader::run() {
|
||||
QSharedPointer<Resource> animation = _animation.toStrongRef();
|
||||
if (!animation.isNull()) {
|
||||
QMetaObject::invokeMethod(animation.data(), "setGeometry",
|
||||
Q_ARG(const FBXGeometry&, readFBX(_reply->readAll(), QVariantHash())));
|
||||
Q_ARG(const FBXGeometry&, readFBX(QByteArray(_data), QVariantHash())));
|
||||
}
|
||||
_reply->deleteLater();
|
||||
}
|
||||
|
||||
QStringList Animation::getJointNames() const {
|
||||
|
@ -96,9 +95,9 @@ void Animation::setGeometry(const FBXGeometry& geometry) {
|
|||
finishedLoading(true);
|
||||
}
|
||||
|
||||
void Animation::downloadFinished(QNetworkReply* reply) {
|
||||
void Animation::downloadFinished(const QByteArray& data) {
|
||||
// send the reader off to the thread pool
|
||||
QThreadPool::globalInstance()->start(new AnimationReader(_self, reply));
|
||||
QThreadPool::globalInstance()->start(new AnimationReader(_self, data));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
|||
|
||||
Q_INVOKABLE void setGeometry(const FBXGeometry& geometry);
|
||||
|
||||
virtual void downloadFinished(QNetworkReply* reply);
|
||||
virtual void downloadFinished(const QByteArray& data) override;
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in a new issue