mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 05:57:29 +02:00
Move BakingStatus
This commit is contained in:
parent
fac6015bb0
commit
fd3156b57c
6 changed files with 54 additions and 8 deletions
|
@ -489,6 +489,7 @@ void AssetServer::handleGetAllMappingOperation(ReceivedMessage& message, SharedN
|
||||||
for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++ it) {
|
for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++ it) {
|
||||||
replyPacket.writeString(it.key());
|
replyPacket.writeString(it.key());
|
||||||
replyPacket.write(QByteArray::fromHex(it.value().toString().toUtf8()));
|
replyPacket.write(QByteArray::fromHex(it.value().toString().toUtf8()));
|
||||||
|
replyPacket.writePrimitive(_baker.getAssetStatus(it.value().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,18 +18,11 @@
|
||||||
|
|
||||||
class AutoBaker {
|
class AutoBaker {
|
||||||
public:
|
public:
|
||||||
enum Status {
|
|
||||||
NotBaked,
|
|
||||||
Pending,
|
|
||||||
Baking,
|
|
||||||
Baked
|
|
||||||
};
|
|
||||||
|
|
||||||
void addPendingBake(AssetHash hash);
|
void addPendingBake(AssetHash hash);
|
||||||
|
|
||||||
bool assetNeedsBaking(AssetHash hash);
|
bool assetNeedsBaking(AssetHash hash);
|
||||||
|
|
||||||
Status getAssetStatus(AssetHash hash);
|
BakingStatus getAssetStatus(AssetHash hash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<AssetHash> _pendingBakes;
|
std::vector<AssetHash> _pendingBakes;
|
||||||
|
|
|
@ -84,3 +84,16 @@ bool isValidHash(const AssetHash& hash) {
|
||||||
QRegExp hashRegex { ASSET_HASH_REGEX_STRING };
|
QRegExp hashRegex { ASSET_HASH_REGEX_STRING };
|
||||||
return hashRegex.exactMatch(hash);
|
return hashRegex.exactMatch(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString bakingStatusToString(BakingStatus status) {
|
||||||
|
switch (status) {
|
||||||
|
case NotBaked:
|
||||||
|
return "Not Baked";
|
||||||
|
case Pending:
|
||||||
|
return "Pending";
|
||||||
|
case Baking:
|
||||||
|
return "Baking";
|
||||||
|
case Baked:
|
||||||
|
return "Baked";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -52,6 +52,13 @@ enum AssetMappingOperationType : uint8_t {
|
||||||
Rename
|
Rename
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum BakingStatus {
|
||||||
|
NotBaked,
|
||||||
|
Pending,
|
||||||
|
Baking,
|
||||||
|
Baked
|
||||||
|
};
|
||||||
|
|
||||||
QUrl getATPUrl(const QString& hash);
|
QUrl getATPUrl(const QString& hash);
|
||||||
|
|
||||||
QByteArray hashData(const QByteArray& data);
|
QByteArray hashData(const QByteArray& data);
|
||||||
|
@ -63,4 +70,6 @@ bool isValidFilePath(const AssetPath& path);
|
||||||
bool isValidPath(const AssetPath& path);
|
bool isValidPath(const AssetPath& path);
|
||||||
bool isValidHash(const QString& hashString);
|
bool isValidHash(const QString& hashString);
|
||||||
|
|
||||||
|
QString bakingStatusToString(BakingStatus status);
|
||||||
|
|
||||||
#endif // hifi_AssetUtils_h
|
#endif // hifi_AssetUtils_h
|
||||||
|
|
|
@ -136,6 +136,8 @@ void GetAllMappingsRequest::doStart() {
|
||||||
for (auto i = 0; i < numberOfMappings; ++i) {
|
for (auto i = 0; i < numberOfMappings; ++i) {
|
||||||
auto path = message->readString();
|
auto path = message->readString();
|
||||||
auto hash = message->read(SHA256_HASH_LENGTH).toHex();
|
auto hash = message->read(SHA256_HASH_LENGTH).toHex();
|
||||||
|
BakingStatus status;
|
||||||
|
message->readPrimitive(&status);
|
||||||
_mappings[path] = hash;
|
_mappings[path] = hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
28
libraries/shared/src/shared/Algorithms.h
Normal file
28
libraries/shared/src/shared/Algorithms.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Algorithms.h
|
||||||
|
// libraries/shared/src/shared
|
||||||
|
//
|
||||||
|
// Created by Clement Brisset on 8/9/17
|
||||||
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef Algorithms_h
|
||||||
|
#define Algorithms_h
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace alg {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* Algorithms_hpp */
|
Loading…
Reference in a new issue