add invalidateJointIndicesCache method

This commit is contained in:
Seth Alves 2017-07-06 18:16:41 -07:00
parent ef4a04b9cf
commit 57ba2c5cd6
2 changed files with 8 additions and 4 deletions

View file

@ -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 result = getFauxJointIndex(name);
if (result != -1) {
@ -1090,10 +1095,8 @@ void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
}
void Avatar::setModelURLFinished(bool success) {
{
QWriteLocker writeLock(&_jointIndicesCacheLock);
_jointsCached = false;
}
invalidateJointIndicesCache();
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
if (_skeletonModel->getResourceDownloadAttemptsRemaining() <= 0 ||

View file

@ -269,6 +269,7 @@ protected:
SkeletonModelPointer _skeletonModel;
void cacheJoints() const;
void invalidateJointIndicesCache() const;
mutable QHash<QString, int> _jointIndicesCache;
mutable QReadWriteLock _jointIndicesCacheLock;
mutable bool _jointsCached { false };