Fixed major bug when generating new meta files for materials #254

Merged
XiaoQiDigipen merged 5 commits from SP3-13-Assets-Manager into main 2022-11-22 21:55:22 +08:00
4 changed files with 16 additions and 16 deletions
Showing only changes of commit f7cca42e59 - Show all commits

View File

@ -52,7 +52,7 @@ namespace SHADE
std::ifstream file{ path.string(), std::ios::in | std::ios::binary }; std::ifstream file{ path.string(), std::ios::in | std::ios::binary };
if (!file.is_open()) if (!file.is_open())
{ {
SHLOG_ERROR("Unable to open SHMesh File: {}", path.string()); SHLOG_ERROR("[Model Loader] Unable to open SHModel File: {}", path.string());
return; return;
} }

View File

@ -26,7 +26,7 @@ namespace SHADE
if (!file.is_open()) if (!file.is_open())
{ {
SHLOG_ERROR("Unable to open text File: {}", path.string()); SHLOG_ERROR("[Text Loader] Unable to open text File: {}", path.string());
return nullptr; return nullptr;
} }
std::stringstream stream; std::stringstream stream;
@ -70,7 +70,7 @@ namespace SHADE
if (!file.is_open()) if (!file.is_open())
{ {
SHLOG_ERROR("Unable to open text File: {}", path.string()); SHLOG_ERROR("[Text Loader] Unable to open text File: {}", path.string());
return; return;
} }

View File

@ -22,7 +22,7 @@ namespace SHADE
std::ifstream file{ path.string(), std::ios::in | std::ios::binary }; std::ifstream file{ path.string(), std::ios::in | std::ios::binary };
if (!file.is_open()) if (!file.is_open())
{ {
SHLOG_ERROR("Error opening SHTexture file: {}", path.string()); SHLOG_ERROR("[Texture Loader] Error opening SHTexture file: {}", path.string());
} }
auto const intBytes{ sizeof(uint32_t) }; auto const intBytes{ sizeof(uint32_t) };
@ -61,7 +61,7 @@ namespace SHADE
std::ofstream file{ path, std::ios::out | std::ios::binary }; std::ofstream file{ path, std::ios::out | std::ios::binary };
if (!file.is_open()) if (!file.is_open())
{ {
SHLOG_ERROR("Unable to open file for writing texture file: {}", path.string()); SHLOG_ERROR("[Texture Loader] Unable to open file for writing texture file: {}", path.string());
} }
auto asset = *dynamic_cast<SHTextureAsset const*>(data); auto asset = *dynamic_cast<SHTextureAsset const*>(data);

View File

@ -197,7 +197,7 @@ namespace SHADE
break; break;
default: default:
SHLOG_ERROR("Asset type of {} not an internal asset type, cannot be created", name); SHLOG_ERROR("[Asset Manager] Asset type of {} not an internal asset type, cannot be created", name);
return 0; return 0;
} }
@ -249,14 +249,14 @@ namespace SHADE
return true; return true;
} }
SHLOG_ERROR("Asset data has not been written into, cannot be saved: {}", SHLOG_ERROR("[Asset Manager] Asset data has not been written into, cannot be saved: {}",
asset.path.filename().string()); asset.path.filename().string());
return false; return false;
} }
} }
SHLOG_WARNING("Asset id: {} not an internal asset type, save cannot be triggered", id); SHLOG_WARNING("[Asset Manager] Asset id: {} not an internal asset type, save cannot be triggered", id);
return false; return false;
} }
@ -274,10 +274,10 @@ namespace SHADE
{ {
return (DeleteLocalFile(asset.path) && DeleteLocalFile(asset.path.string() + META_EXTENSION.data())); return (DeleteLocalFile(asset.path) && DeleteLocalFile(asset.path.string() + META_EXTENSION.data()));
} }
SHLOG_WARNING("Asset id: {} not an internal asset type, file deletion not allowed", id); SHLOG_WARNING("[Asset Manager] Asset id: {} not an internal asset type, file deletion not allowed", id);
} }
SHLOG_WARNING("Asset id does not exist, nothing was deleted: {}", id); SHLOG_WARNING("[Asset Manager] Asset id does not exist, nothing was deleted: {}", id);
return false; return false;
} }
@ -311,7 +311,7 @@ namespace SHADE
std::filesystem::path const newPath{ GenerateLocalPath(path) }; std::filesystem::path const newPath{ GenerateLocalPath(path) };
if (newPath.empty()) if (newPath.empty())
{ {
SHLOG_WARNING("Unsupported file format for asset: {}", path.string()); SHLOG_WARNING("[Asset Manager] Unsupported file format for asset: {}", path.string());
return 0; return 0;
} }
@ -363,7 +363,7 @@ namespace SHADE
{ {
if (!std::filesystem::exists(path)) if (!std::filesystem::exists(path))
{ {
SHLOG_ERROR("Path provided does not point to a file: {}", path.string()); SHLOG_ERROR("[Asset Manager] Path provided does not point to a file: {}", path.string());
return; return;
} }
AssetPath newPath; AssetPath newPath;
@ -387,14 +387,14 @@ namespace SHADE
auto pathGen = SHTextureCompiler::CompileTextureAsset(path); auto pathGen = SHTextureCompiler::CompileTextureAsset(path);
if (!pathGen.has_value()) if (!pathGen.has_value())
{ {
SHLOG_ERROR("Texture Compilation Failed for: {}", path.string()); SHLOG_ERROR("[Asset Manager] Texture Compilation Failed for: {}", path.string());
return; return;
} }
newPath = pathGen.value(); newPath = pathGen.value();
} }
else else
{ {
SHLOG_WARNING("File Type compilation not yet Implemented: {}", path.string()); SHLOG_WARNING("[Asset Manager] File Type compilation not yet Implemented: {}", path.string());
return; return;
} }
@ -479,7 +479,7 @@ namespace SHADE
SHAssetData* data = loaders[static_cast<size_t>(asset.type)]->Load(asset.path); SHAssetData* data = loaders[static_cast<size_t>(asset.type)]->Load(asset.path);
if (data == nullptr) if (data == nullptr)
{ {
SHLOG_ERROR("Unable to load asset into memory: {}\n", asset.path.string()); SHLOG_ERROR("[Asset Manager] Unable to load asset into memory: {}\n", asset.path.string());
} }
else else
{ {
@ -496,7 +496,7 @@ namespace SHADE
if (parentData == nullptr) if (parentData == nullptr)
{ {
SHLOG_ERROR("Unable to load asset into memory: {}\n", parent.path.string()); SHLOG_ERROR("[Asset Manager] Unable to load asset into memory: {}\n", parent.path.string());
} }
else else
{ {