Assets bugfix #190

Merged
XiaoQiDigipen merged 1 commits from SP3-13-Assets-Manager into main 2022-11-11 10:07:20 +08:00
4 changed files with 3 additions and 48 deletions

View File

@ -51,8 +51,8 @@ enum class AssetType : AssetTypeMeta
SCENE,
PREFAB,
MATERIAL,
SCRIPT,
MESH,
SCRIPT,
MAX_COUNT
};
constexpr size_t TYPE_COUNT{ static_cast<size_t>(AssetType::MAX_COUNT) };
@ -97,6 +97,7 @@ constexpr std::string_view EXTENSIONS[] = {
SCENE_EXTENSION,
PREFAB_EXTENSION,
MATERIAL_EXTENSION,
"dummy",
SCRIPT_EXTENSION,
AUDIO_WAV_EXTENSION,
};

View File

@ -405,51 +405,6 @@ namespace SHADE
return result;
}
void SHAssetManager::CompileAll() noexcept
{
std::vector<AssetPath> paths;
for (auto const& dir : std::filesystem::recursive_directory_iterator{ ASSET_ROOT })
{
if (dir.is_regular_file())
{
for (auto const& ext : EXTERNALS)
{
if (dir.path().extension().string() == ext.data())
{
paths.push_back(dir.path());
}
}
}
}
for (auto const& path : paths)
{
AssetPath newPath;
auto const ext{ path.extension().string() };
if (ext == GLSL_EXTENSION.data())
{
newPath = SHShaderSourceCompiler::LoadAndCompileShader(path).value();
}
else if (ext == DDS_EXTENSION.data())
{
newPath = SHTextureCompiler::CompileTextureAsset(path).value();
}
else if (ext == GLTF_EXTENSION.data() || ext == FBX_EXTENSION.data())
{
std::string command = MODEL_COMPILER_EXE.data();
command += " " + path.string();
std::system(command.c_str());
std::string modelPath = path.string().substr(0, path.string().find_last_of('.'));
modelPath += MODEL_EXTENSION;
newPath = modelPath;
}
GenerateNewMeta(newPath);
}
}
bool SHAssetManager::DeleteLocalFile(AssetPath path) noexcept
{
//TODO Move this to dedicated library

View File

@ -107,8 +107,6 @@ namespace SHADE
static SHAsset CreateAssetFromPath(AssetPath path) noexcept;
static void CompileAll() noexcept;
static bool DeleteLocalFile(AssetPath path) noexcept;
//TODO use this function to create asset data internall at all calls to generate id

View File

@ -98,6 +98,7 @@ namespace SHADE
meta.type = static_cast<AssetType>(type);
meta.isSubAsset = false;
meta.parent = 0;
// Burn Line
if (std::getline(metaFile, line))