mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:41:10 +02:00
Cleanup asset server versioning changes
This commit is contained in:
parent
df8a25cbdc
commit
6ed89fb9cc
2 changed files with 14 additions and 23 deletions
|
@ -33,8 +33,6 @@
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <image/Image.h>
|
#include <image/Image.h>
|
||||||
void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) {
|
|
||||||
void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) {
|
|
||||||
|
|
||||||
#include "AssetServerLogging.h"
|
#include "AssetServerLogging.h"
|
||||||
#include "BakeAssetTask.h"
|
#include "BakeAssetTask.h"
|
||||||
|
@ -56,9 +54,9 @@ static const QString BAKED_MODEL_SIMPLE_NAME = "asset.fbx";
|
||||||
static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx";
|
static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx";
|
||||||
static const QString BAKED_SCRIPT_SIMPLE_NAME = "asset.js";
|
static const QString BAKED_SCRIPT_SIMPLE_NAME = "asset.js";
|
||||||
|
|
||||||
static const ModelBakeVersion CURRENT_MODEL_BAKE_VERSION = ModelBakeVersion::BetterModelBaking;
|
static const ModelBakeVersion CURRENT_MODEL_BAKE_VERSION = (ModelBakeVersion)((BakeVersion)ModelBakeVersion::COUNT - 1);
|
||||||
static const TextureBakeVersion CURRENT_TEXTURE_BAKE_VERSION = TextureBakeVersion::Initial;
|
static const TextureBakeVersion CURRENT_TEXTURE_BAKE_VERSION = (TextureBakeVersion)((BakeVersion)TextureBakeVersion::COUNT - 1);
|
||||||
static const ScriptBakeVersion CURRENT_SCRIPT_BAKE_VERSION = ScriptBakeVersion::Initial;
|
static const ScriptBakeVersion CURRENT_SCRIPT_BAKE_VERSION = (ScriptBakeVersion)((BakeVersion)ScriptBakeVersion::COUNT - 1);
|
||||||
|
|
||||||
BakedAssetType assetTypeForExtension(const QString& extension) {
|
BakedAssetType assetTypeForExtension(const QString& extension) {
|
||||||
auto extensionLower = extension.toLower();
|
auto extensionLower = extension.toLower();
|
||||||
|
@ -98,11 +96,11 @@ QString bakedFilenameForAssetType(BakedAssetType type) {
|
||||||
BakeVersion currentBakeVersionForAssetType(BakedAssetType type) {
|
BakeVersion currentBakeVersionForAssetType(BakedAssetType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Model:
|
case Model:
|
||||||
return (BakeVersion)ModelBakeVersion::Initial;
|
return (BakeVersion)CURRENT_MODEL_BAKE_VERSION;
|
||||||
case Texture:
|
case Texture:
|
||||||
return (BakeVersion)TextureBakeVersion::Initial;
|
return (BakeVersion)CURRENT_TEXTURE_BAKE_VERSION;
|
||||||
case Script:
|
case Script:
|
||||||
return (BakeVersion)ScriptBakeVersion::FixEmptyScripts;
|
return (BakeVersion)CURRENT_SCRIPT_BAKE_VERSION;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +227,7 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU
|
||||||
}
|
}
|
||||||
|
|
||||||
QString bakedFilename = bakedFilenameForAssetType(type);
|
QString bakedFilename = bakedFilenameForAssetType(type);
|
||||||
auto bakedPath = HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename;
|
auto bakedPath = AssetUtils::HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename;
|
||||||
auto mappingIt = _fileMappings.find(bakedPath);
|
auto mappingIt = _fileMappings.find(bakedPath);
|
||||||
bool bakedMappingExists = mappingIt != _fileMappings.end();
|
bool bakedMappingExists = mappingIt != _fileMappings.end();
|
||||||
|
|
||||||
|
@ -257,10 +255,6 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString bakedFilename = bakedFilenameForAssetType(type);
|
|
||||||
auto bakedPath = HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename;
|
|
||||||
auto bakedPath = AssetUtils::HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename;
|
|
||||||
bool bakedMappingExists = _fileMappings.find(bakedPath) == _fileMappings.end();
|
|
||||||
return !bakedMappingExists || (meta.bakeVersion < currentVersion);
|
return !bakedMappingExists || (meta.bakeVersion < currentVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,6 @@
|
||||||
|
|
||||||
#include "RegisteredMetaTypes.h"
|
#include "RegisteredMetaTypes.h"
|
||||||
|
|
||||||
#include <BakingVersion.h>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
template <>
|
|
||||||
struct hash<QString> {
|
|
||||||
size_t operator()(const QString& v) const { return qHash(v); }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
using BakeVersion = int;
|
using BakeVersion = int;
|
||||||
static const BakeVersion INITIAL_BAKE_VERSION = 0;
|
static const BakeVersion INITIAL_BAKE_VERSION = 0;
|
||||||
static const BakeVersion NEEDS_BAKING_BAKE_VERSION = -1;
|
static const BakeVersion NEEDS_BAKING_BAKE_VERSION = -1;
|
||||||
|
@ -48,18 +39,24 @@ enum BakedAssetType : int {
|
||||||
// ATTENTION! If you change the current version for an asset type, you will also
|
// ATTENTION! If you change the current version for an asset type, you will also
|
||||||
// need to update the function currentBakeVersionForAssetType() inside of AssetServer.cpp.
|
// need to update the function currentBakeVersionForAssetType() inside of AssetServer.cpp.
|
||||||
enum class ModelBakeVersion : BakeVersion {
|
enum class ModelBakeVersion : BakeVersion {
|
||||||
Initial = INITIAL_BAKE_VERSION
|
Initial = INITIAL_BAKE_VERSION,
|
||||||
|
|
||||||
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
// ATTENTION! See above.
|
// ATTENTION! See above.
|
||||||
enum class TextureBakeVersion : BakeVersion {
|
enum class TextureBakeVersion : BakeVersion {
|
||||||
Initial = INITIAL_BAKE_VERSION,
|
Initial = INITIAL_BAKE_VERSION,
|
||||||
|
|
||||||
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
// ATTENTION! See above.
|
// ATTENTION! See above.
|
||||||
enum class ScriptBakeVersion : BakeVersion {
|
enum class ScriptBakeVersion : BakeVersion {
|
||||||
Initial = INITIAL_BAKE_VERSION,
|
Initial = INITIAL_BAKE_VERSION,
|
||||||
FixEmptyScripts,
|
FixEmptyScripts,
|
||||||
|
|
||||||
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AssetMeta {
|
struct AssetMeta {
|
||||||
|
|
Loading…
Reference in a new issue