mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:12:53 +02:00
add invalidateJointIndicesCache method
This commit is contained in:
parent
ef4a04b9cf
commit
57ba2c5cd6
2 changed files with 8 additions and 4 deletions
|
@ -1020,6 +1020,11 @@ void Avatar::cacheJoints() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Avatar::invalidateJointIndicesCache() const {
|
||||||
|
QWriteLocker writeLock(&_jointIndicesCacheLock);
|
||||||
|
_jointsCached = false;
|
||||||
|
}
|
||||||
|
|
||||||
int Avatar::getJointIndex(const QString& name) const {
|
int Avatar::getJointIndex(const QString& name) const {
|
||||||
int result = getFauxJointIndex(name);
|
int result = getFauxJointIndex(name);
|
||||||
if (result != -1) {
|
if (result != -1) {
|
||||||
|
@ -1090,10 +1095,8 @@ void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::setModelURLFinished(bool success) {
|
void Avatar::setModelURLFinished(bool success) {
|
||||||
{
|
invalidateJointIndicesCache();
|
||||||
QWriteLocker writeLock(&_jointIndicesCacheLock);
|
|
||||||
_jointsCached = false;
|
|
||||||
}
|
|
||||||
if (!success && _skeletonModelURL != AvatarData::defaultFullAvatarModelUrl()) {
|
if (!success && _skeletonModelURL != AvatarData::defaultFullAvatarModelUrl()) {
|
||||||
const int MAX_SKELETON_DOWNLOAD_ATTEMPTS = 4; // NOTE: we don't want to be as generous as ResourceCache is, we only want 4 attempts
|
const int MAX_SKELETON_DOWNLOAD_ATTEMPTS = 4; // NOTE: we don't want to be as generous as ResourceCache is, we only want 4 attempts
|
||||||
if (_skeletonModel->getResourceDownloadAttemptsRemaining() <= 0 ||
|
if (_skeletonModel->getResourceDownloadAttemptsRemaining() <= 0 ||
|
||||||
|
|
|
@ -269,6 +269,7 @@ protected:
|
||||||
SkeletonModelPointer _skeletonModel;
|
SkeletonModelPointer _skeletonModel;
|
||||||
|
|
||||||
void cacheJoints() const;
|
void cacheJoints() const;
|
||||||
|
void invalidateJointIndicesCache() const;
|
||||||
mutable QHash<QString, int> _jointIndicesCache;
|
mutable QHash<QString, int> _jointIndicesCache;
|
||||||
mutable QReadWriteLock _jointIndicesCacheLock;
|
mutable QReadWriteLock _jointIndicesCacheLock;
|
||||||
mutable bool _jointsCached { false };
|
mutable bool _jointsCached { false };
|
||||||
|
|
Loading…
Reference in a new issue