diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-28 12:00:47 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-28 12:00:47 -0500 |
| commit | cf0fac0eab12421f407d3acc1f1c84faead248bc (patch) | |
| tree | c5b174085ebcd1bccaa29d20334e4123ade73f6b /src/project.cpp | |
| parent | 41b5dafb1a3bf80db48abeb235ce00ec8e1c566f (diff) | |
add asset type for filtering
Diffstat (limited to 'src/project.cpp')
| -rw-r--r-- | src/project.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/project.cpp b/src/project.cpp index 143f5ab..fdde6e0 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -40,6 +40,7 @@ const char* const PKE_PROJ_FILE_ENTITY_TYPE_PHYSICS_STARTING_COLLISION_MASK = "B const char* const PKE_PROJ_FILE_ASSET_KEY = "Asset::Key: "; const char* const PKE_PROJ_FILE_ASSET_BASE_PATH = "Asset::BasePath: "; +const char* const PKE_PROJ_FILE_ASSET_TYPE = "Asset::Type: "; /* void Proj_SerializeProjectSettings(std::ofstream &stream) { @@ -112,6 +113,9 @@ void Proj_SerializeAsset(std::ofstream &stream, const Asset &asset) { if (asset.basePath != nullptr) { stream << PKE_PROJ_FILE_ASSET_BASE_PATH << asset.basePath << std::endl; } + if (asset.type != a.type) { + stream << PKE_PROJ_FILE_ASSET_TYPE << static_cast<AssetType_T>(asset.type) << std::endl; + } } /* @@ -262,9 +266,10 @@ void Proj_ParseAssset(std::ifstream &stream) { char basePath[256]; basePath[0] = '\0'; basePath[255] = '\0'; + AssetType at{PKE_ASSET_TYPE_UNSET}; while (stream.getline(projReadLine, projReadLineLength)) { if (strcmp(projReadLine, PKE_PROJ_FILE_OBJ_END) == 0) { - AM_Register(keyStr, basePath); + AM_Register(keyStr, at, basePath); return; } if (strstr(projReadLine, PKE_PROJ_FILE_ASSET_KEY) != nullptr) { @@ -278,6 +283,14 @@ void Proj_ParseAssset(std::ifstream &stream) { strncpy(basePath, projReadLine + prefixLen, strLen + 1); continue; } + if (strstr(projReadLine, PKE_PROJ_FILE_ASSET_TYPE) != nullptr) { + uint64_t prefixLen = strlen(PKE_PROJ_FILE_ASSET_TYPE); + AssetType_T val{}; + STR2NUM_ERROR result = str2num(val, projReadLine + prefixLen); + at = AssetType{val}; + assert(result == STR2NUM_ERROR::SUCCESS); + continue; + } } } |
