Merge pull request #11284 from Atlante45/feat/auto-bake

Hide .baked folder in the Asset Browser
This commit is contained in:
Stephen Birarda 2017-09-01 15:43:10 -07:00 committed by GitHub
commit b67f741ce9
3 changed files with 14 additions and 6 deletions

View file

@ -53,8 +53,6 @@ static QStringList BAKEABLE_TEXTURE_EXTENSIONS;
static const QString BAKED_MODEL_SIMPLE_NAME = "asset.fbx";
static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx";
static const QString HIDDEN_BAKED_CONTENT_FOLDER = "/.baked/";
BakeAssetTask::BakeAssetTask(const AssetHash& assetHash, const AssetPath& assetPath, const QString& filePath)
: _assetHash(assetHash), _assetPath(assetPath), _filePath(filePath) {
}
@ -84,7 +82,7 @@ void BakeAssetTask::run() {
loop.exec();
if (baker->hasErrors()) {
qDebug() << "Failed to bake: " << _assetHash << _assetPath;
qDebug() << "Failed to bake: " << _assetHash << _assetPath << baker->getErrors();
} else {
auto vectorOutputFiles = QVector<QString>::fromStdVector(baker->getOutputFiles());
qDebug() << "Finished baking: " << _assetHash << _assetPath << vectorOutputFiles;
@ -521,9 +519,11 @@ void AssetServer::handleGetAllMappingOperation(ReceivedMessage& message, SharedN
replyPacket.writePrimitive(count);
for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++ it) {
replyPacket.writeString(it.key());
replyPacket.write(QByteArray::fromHex(it.value().toString().toUtf8()));
replyPacket.writePrimitive(getAssetStatus(it.key(), it.value().toString()));
auto mapping = it.key();
auto hash = it.value().toString();
replyPacket.writeString(mapping);
replyPacket.write(QByteArray::fromHex(hash.toUtf8()));
replyPacket.writePrimitive(getAssetStatus(mapping, hash));
}
}

View file

@ -202,6 +202,12 @@ void AssetMappingModel::refresh() {
auto existingPaths = _pathToItemMap.keys();
for (auto& mapping : mappings) {
auto& path = mapping.first;
if (path.startsWith(HIDDEN_BAKED_CONTENT_FOLDER)) {
// Hide baked mappings
continue;
}
auto parts = path.split("/");
auto length = parts.length();

View file

@ -33,6 +33,8 @@ const QString ASSET_FILE_PATH_REGEX_STRING = "^(\\/[^\\/\\0]+)+$";
const QString ASSET_PATH_REGEX_STRING = "^\\/([^\\/\\0]+(\\/)?)+$";
const QString ASSET_HASH_REGEX_STRING = QString("^[a-fA-F0-9]{%1}$").arg(SHA256_HASH_HEX_LENGTH);
const QString HIDDEN_BAKED_CONTENT_FOLDER = "/.baked/";
enum AssetServerError : uint8_t {
NoError = 0,
AssetNotFound,