mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 07:51:01 +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 {
|
class AnimationReader : public QRunnable {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AnimationReader(const QWeakPointer<Resource>& animation, QNetworkReply* reply);
|
AnimationReader(const QWeakPointer<Resource>& animation, QByteArray data);
|
||||||
|
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QWeakPointer<Resource> _animation;
|
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),
|
_animation(animation),
|
||||||
_reply(reply) {
|
_data(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationReader::run() {
|
void AnimationReader::run() {
|
||||||
QSharedPointer<Resource> animation = _animation.toStrongRef();
|
QSharedPointer<Resource> animation = _animation.toStrongRef();
|
||||||
if (!animation.isNull()) {
|
if (!animation.isNull()) {
|
||||||
QMetaObject::invokeMethod(animation.data(), "setGeometry",
|
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 {
|
QStringList Animation::getJointNames() const {
|
||||||
|
@ -96,9 +95,9 @@ void Animation::setGeometry(const FBXGeometry& geometry) {
|
||||||
finishedLoading(true);
|
finishedLoading(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::downloadFinished(QNetworkReply* reply) {
|
void Animation::downloadFinished(const QByteArray& data) {
|
||||||
// send the reader off to the thread pool
|
// 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);
|
Q_INVOKABLE void setGeometry(const FBXGeometry& geometry);
|
||||||
|
|
||||||
virtual void downloadFinished(QNetworkReply* reply);
|
virtual void downloadFinished(const QByteArray& data) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue