mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
some initial debugging on tpose avatars
This commit is contained in:
parent
b77917b8d1
commit
e89b6c5d2c
11 changed files with 53 additions and 13 deletions
|
@ -341,6 +341,8 @@ void Avatar::updateAvatarEntities() {
|
|||
void Avatar::simulate(float deltaTime, bool inView) {
|
||||
PROFILE_RANGE(simulation, "simulate");
|
||||
|
||||
//qDebug() << __FUNCTION__ << "skeleton download attempts:" << _skeletonModel->getResourceDownloadAttempts();
|
||||
|
||||
_simulationRate.increment();
|
||||
if (inView) {
|
||||
_simulationInViewRate.increment();
|
||||
|
@ -1112,11 +1114,16 @@ void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
|
||||
void Avatar::setModelURLFinished(bool success) {
|
||||
if (!success && _skeletonModelURL != AvatarData::defaultFullAvatarModelUrl()) {
|
||||
qCWarning(interfaceapp) << "Using default after failing to load Avatar model: " << _skeletonModelURL;
|
||||
// call _skeletonModel.setURL, but leave our copy of _skeletonModelURL alone. This is so that
|
||||
// we don't redo this every time we receive an identity packet from the avatar with the bad url.
|
||||
QMetaObject::invokeMethod(_skeletonModel.get(), "setURL",
|
||||
Qt::QueuedConnection, Q_ARG(QUrl, AvatarData::defaultFullAvatarModelUrl()));
|
||||
// FIXME --
|
||||
if (_skeletonModel->getResourceDownloadAttempts() > 4) {
|
||||
qCWarning(interfaceapp) << "Using default after failing to load Avatar model: " << _skeletonModelURL;
|
||||
// call _skeletonModel.setURL, but leave our copy of _skeletonModelURL alone. This is so that
|
||||
// we don't redo this every time we receive an identity packet from the avatar with the bad url.
|
||||
QMetaObject::invokeMethod(_skeletonModel.get(), "setURL",
|
||||
Qt::QueuedConnection, Q_ARG(QUrl, AvatarData::defaultFullAvatarModelUrl()));
|
||||
} else {
|
||||
qCWarning(interfaceapp) << "Avatar model: " << _skeletonModelURL << "failed to load... attempts:" << _skeletonModel->getResourceDownloadAttempts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1468,6 +1468,7 @@ QUrl AvatarData::cannonicalSkeletonModelURL(const QUrl& emptyURL) const {
|
|||
void AvatarData::processAvatarIdentity(const Identity& identity, bool& identityChanged, bool& displayNameChanged) {
|
||||
|
||||
if (_firstSkeletonCheck || (identity.skeletonModelURL != cannonicalSkeletonModelURL(emptyURL))) {
|
||||
qDebug() << __FUNCTION__ << "about to call setSkeletonModelURL(identity.skeletonModelURL);... identity.skeletonModelURL:" << identity.skeletonModelURL;
|
||||
setSkeletonModelURL(identity.skeletonModelURL);
|
||||
identityChanged = true;
|
||||
if (_firstSkeletonCheck) {
|
||||
|
@ -1514,6 +1515,10 @@ QByteArray AvatarData::identityByteArray() const {
|
|||
}
|
||||
|
||||
void AvatarData::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||
if (skeletonModelURL.isEmpty()) {
|
||||
qDebug() << __FUNCTION__ << "caller called with empty URL.";
|
||||
}
|
||||
|
||||
const QUrl& expanded = skeletonModelURL.isEmpty() ? AvatarData::defaultFullAvatarModelUrl() : skeletonModelURL;
|
||||
if (expanded == _skeletonModelURL) {
|
||||
return;
|
||||
|
|
|
@ -126,6 +126,10 @@ AvatarSharedPointer AvatarHashMap::parseAvatarData(QSharedPointer<ReceivedMessag
|
|||
}
|
||||
|
||||
void AvatarHashMap::processAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode) {
|
||||
qDebug() << __FUNCTION__ << "sendingNode:" << sendingNode << "message.failed():" << message->failed()
|
||||
<< "isComplete:" << message->isComplete()
|
||||
<< "messageNumber:" << message->getMessageNumber();
|
||||
|
||||
AvatarData::Identity identity;
|
||||
AvatarData::parseAvatarIdentityPacket(message->getMessage(), identity);
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ public:
|
|||
void setResource(GeometryResource::Pointer resource);
|
||||
|
||||
QUrl getURL() const { return (bool)_resource ? _resource->getURL() : QUrl(); }
|
||||
int getResourceDownloadAttempts() { return _resource ? _resource->getDownloadAttempts() : 0; }
|
||||
|
||||
private:
|
||||
void startWatching();
|
||||
|
|
|
@ -75,10 +75,19 @@ void HTTPResourceRequest::onRequestFinished() {
|
|||
|
||||
switch(_reply->error()) {
|
||||
case QNetworkReply::NoError:
|
||||
_data = _reply->readAll();
|
||||
_loadedFromCache = _reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool();
|
||||
_result = Success;
|
||||
break;
|
||||
{
|
||||
// For debugging, have a random chance of treating this like a failure
|
||||
bool randFailure = false; // _url.toString().contains(".fst") ? (rand() % 100) > 10 : false;
|
||||
|
||||
if (!randFailure) {
|
||||
_data = _reply->readAll();
|
||||
_loadedFromCache = _reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool();
|
||||
_result = Success;
|
||||
break;
|
||||
}
|
||||
// else fall through to timeout
|
||||
qDebug() << "**** Randomly pretending to timeout instead of successfully download HTTP resource:" << _url << " ******************************";
|
||||
}
|
||||
|
||||
case QNetworkReply::TimeoutError:
|
||||
_result = Timeout;
|
||||
|
|
|
@ -27,7 +27,8 @@ ReceivedMessage::ReceivedMessage(const NLPacketList& packetList)
|
|||
_packetType(packetList.getType()),
|
||||
_packetVersion(packetList.getVersion()),
|
||||
_senderSockAddr(packetList.getSenderSockAddr()),
|
||||
_isComplete(true)
|
||||
_isComplete(true),
|
||||
_messageNumber(packetList.getMessageNumber())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,8 @@ ReceivedMessage::ReceivedMessage(NLPacket& packet)
|
|||
_packetType(packet.getType()),
|
||||
_packetVersion(packet.getVersion()),
|
||||
_senderSockAddr(packet.getSenderSockAddr()),
|
||||
_isComplete(packet.getPacketPosition() == NLPacket::ONLY)
|
||||
_isComplete(packet.getPacketPosition() == NLPacket::ONLY),
|
||||
_messageNumber(packet.getMessageNumber())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
|
||||
qint64 getBytesLeftToRead() const { return _data.size() - _position; }
|
||||
|
||||
qint64 getMessageNumber() const { return _messageNumber; }
|
||||
|
||||
void seek(qint64 position) { _position = position; }
|
||||
|
||||
qint64 peek(char* data, qint64 size);
|
||||
|
@ -98,6 +100,9 @@ private:
|
|||
|
||||
std::atomic<bool> _isComplete { true };
|
||||
std::atomic<bool> _failed { false };
|
||||
|
||||
udt::Packet::MessageNumber _messageNumber { 0 };
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ReceivedMessage*)
|
||||
|
|
|
@ -724,10 +724,11 @@ void Resource::handleReplyFinished() {
|
|||
} else {
|
||||
switch (result) {
|
||||
case ResourceRequest::Result::Timeout: {
|
||||
qCDebug(networking) << "Timed out loading" << _url << "received" << _bytesReceived << "total" << _bytesTotal;
|
||||
qCDebug(networking) << "Timed out loading" << _url << "received" << _bytesReceived << "total" << _bytesTotal << "attempt:" << _attempts << "of" << MAX_ATTEMPTS;
|
||||
// Fall through to other cases
|
||||
}
|
||||
case ResourceRequest::Result::ServerUnavailable: {
|
||||
qCDebug(networking) << "Server Unavailable loading" << _url << "attempt:" << _attempts << "of" << MAX_ATTEMPTS;
|
||||
// retry with increasing delays
|
||||
const int BASE_DELAY_MS = 1000;
|
||||
if (_attempts++ < MAX_ATTEMPTS) {
|
||||
|
@ -742,7 +743,7 @@ void Resource::handleReplyFinished() {
|
|||
// fall through to final failure
|
||||
}
|
||||
default: {
|
||||
qCDebug(networking) << "Error loading " << _url;
|
||||
qCDebug(networking) << "Error loading " << _url << "attempt:" << _attempts << "of" << MAX_ATTEMPTS;
|
||||
auto error = (result == ResourceRequest::Timeout) ? QNetworkReply::TimeoutError
|
||||
: QNetworkReply::UnknownNetworkError;
|
||||
emit failed(error);
|
||||
|
|
|
@ -395,6 +395,9 @@ public:
|
|||
|
||||
const QUrl& getURL() const { return _url; }
|
||||
|
||||
int getDownloadAttempts() { return _attempts; }
|
||||
|
||||
|
||||
signals:
|
||||
/// Fired when the resource begins downloading.
|
||||
void loading();
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
size_t getDataSize() const;
|
||||
size_t getMessageSize() const;
|
||||
QByteArray getMessage() const;
|
||||
udt::Packet::MessageNumber getMessageNumber() const { return _messageNumber; }
|
||||
|
||||
|
||||
QByteArray getExtendedHeader() const { return _extendedHeader; }
|
||||
|
||||
|
|
|
@ -252,6 +252,7 @@ public:
|
|||
|
||||
void renderDebugMeshBoxes(gpu::Batch& batch);
|
||||
|
||||
int getResourceDownloadAttempts() { return _renderWatcher.getResourceDownloadAttempts(); }
|
||||
|
||||
public slots:
|
||||
void loadURLFinished(bool success);
|
||||
|
|
Loading…
Reference in a new issue