mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Emit an event when failing to load an avatar.
Previously, MyAvatar only emitted an event (onLoadComplete) if the load succeeded. Now it also emits an event (onLoadFailed) if the load failed.
This commit is contained in:
parent
99aeb4aa2f
commit
70c3bb2748
4 changed files with 18 additions and 3 deletions
|
@ -349,7 +349,8 @@ MyAvatar::MyAvatar(QThread* thread) :
|
|||
}
|
||||
});
|
||||
|
||||
connect(&(_skeletonModel->getRig()), SIGNAL(onLoadComplete()), this, SIGNAL(onLoadComplete()));
|
||||
connect(&(_skeletonModel->getRig()), &Rig::onLoadComplete, this, &MyAvatar::onLoadComplete);
|
||||
connect(&(_skeletonModel->getRig()), &Rig::onLoadFailed, this, &MyAvatar::onLoadFailed);
|
||||
|
||||
_characterController.setDensity(_density);
|
||||
}
|
||||
|
@ -2626,6 +2627,8 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN
|
|||
if (urlString.isEmpty() || (fullAvatarURL != getSkeletonModelURL())) {
|
||||
setSkeletonModelURL(fullAvatarURL);
|
||||
UserActivityLogger::getInstance().changedModel("skeleton", urlString);
|
||||
} else {
|
||||
emit onLoadComplete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2435,10 +2435,17 @@ signals:
|
|||
/**jsdoc
|
||||
* Triggered when the avatar's model finishes loading.
|
||||
* @function MyAvatar.onLoadComplete
|
||||
* @returns {Signal}
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void onLoadComplete();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the avatar's model has failed to load.
|
||||
* @function MyAvatar.onLoadFailed
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void onLoadFailed();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when your avatar changes from being active to being away.
|
||||
* @function MyAvatar.wentAway
|
||||
|
|
|
@ -2353,6 +2353,7 @@ void Rig::initAnimGraph(const QUrl& url) {
|
|||
// abort load if the previous skeleton was deleted.
|
||||
auto sharedSkeletonPtr = weakSkeletonPtr.lock();
|
||||
if (!sharedSkeletonPtr) {
|
||||
emit onLoadFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2386,8 +2387,9 @@ void Rig::initAnimGraph(const QUrl& url) {
|
|||
}
|
||||
emit onLoadComplete();
|
||||
});
|
||||
connect(_animLoader.get(), &AnimNodeLoader::error, [url](int error, QString str) {
|
||||
connect(_animLoader.get(), &AnimNodeLoader::error, [this, url](int error, QString str) {
|
||||
qCritical(animation) << "Error loading: code = " << error << "str =" << str;
|
||||
emit onLoadFailed();
|
||||
});
|
||||
|
||||
connect(_networkLoader.get(), &AnimNodeLoader::success, [this, weakSkeletonPtr, networkUrl](AnimNode::Pointer nodeIn) {
|
||||
|
@ -2415,6 +2417,8 @@ void Rig::initAnimGraph(const QUrl& url) {
|
|||
connect(_networkLoader.get(), &AnimNodeLoader::error, [networkUrl](int error, QString str) {
|
||||
qCritical(animation) << "Error loading: code = " << error << "str =" << str;
|
||||
});
|
||||
} else {
|
||||
emit onLoadComplete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -260,6 +260,7 @@ public:
|
|||
|
||||
signals:
|
||||
void onLoadComplete();
|
||||
void onLoadFailed();
|
||||
|
||||
protected:
|
||||
bool isIndexValid(int index) const { return _animSkeleton && index >= 0 && index < _animSkeleton->getNumJoints(); }
|
||||
|
|
Loading…
Reference in a new issue