Implemented scanline and silhouette effect #363
|
@ -167,6 +167,17 @@ namespace SHADE
|
|||
return {};
|
||||
}
|
||||
|
||||
AssetID SHAssetManager::GetAssetIDFromPath(AssetPath const& path) noexcept
|
||||
{
|
||||
for (auto const& pair : assetCollection)
|
||||
{
|
||||
if (pair.second.path.stem() == path.stem())
|
||||
return pair.first;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* \brief Create record for new asset. CAN ONLY CREATE FOR CUSTOM
|
||||
* ASSETS CREATED BY THE ENGINE.
|
||||
|
@ -383,7 +394,7 @@ namespace SHADE
|
|||
return result;
|
||||
}
|
||||
|
||||
void SHAssetManager::CompileAsset(AssetPath const& path, bool genMeta, AssetID id) noexcept
|
||||
void SHAssetManager::CompileAsset(AssetPath const& path, bool genMeta) noexcept
|
||||
{
|
||||
if (!std::filesystem::exists(path))
|
||||
{
|
||||
|
@ -438,14 +449,19 @@ namespace SHADE
|
|||
return;
|
||||
}
|
||||
|
||||
AssetID target{ 0 };
|
||||
if (genMeta)
|
||||
{
|
||||
GenerateNewMeta(newPath);
|
||||
auto result = GenerateNewMeta(newPath);
|
||||
target = result.has_value() ? result.value() : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//send event here
|
||||
target = GetAssetIDFromPath(path);
|
||||
}
|
||||
|
||||
//TODO SEND EVENT HERE
|
||||
|
||||
}
|
||||
|
||||
FolderPointer SHAssetManager::GetRootFolder() noexcept
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace SHADE
|
|||
* \return const& to unordered_map<AssetName, AssetID>
|
||||
****************************************************************************/
|
||||
static std::vector<SHAsset> GetAllAssets() noexcept;
|
||||
static std::optional<SHAsset> GetAsset(AssetID id) noexcept;
|
||||
static std::optional<SHAsset> GetAsset(AssetID id) noexcept;
|
||||
|
||||
static AssetType GetType(AssetID id) noexcept;
|
||||
|
||||
|
@ -90,13 +90,14 @@ namespace SHADE
|
|||
static std::vector<SHAssetData const*> GetAllDataOfType(AssetType type) noexcept;
|
||||
static std::vector<SHAsset> GetAllRecordOfType(AssetType type) noexcept;
|
||||
|
||||
static void CompileAsset(AssetPath const& path, bool genMeta, AssetID id = 0) noexcept;
|
||||
static void CompileAsset(AssetPath const& path, bool genMeta) noexcept;
|
||||
|
||||
static FolderPointer GetRootFolder() noexcept;
|
||||
static void RefreshDirectory() noexcept;
|
||||
|
||||
private:
|
||||
|
||||
static AssetID GetAssetIDFromPath(AssetPath const& path) noexcept;
|
||||
static void InitLoaders() noexcept;
|
||||
static void LoadAllData() noexcept;
|
||||
static SHAssetData* LoadData(SHAsset const& asset) noexcept;
|
||||
|
|
|
@ -233,7 +233,7 @@ namespace SHADE
|
|||
{
|
||||
if(ImGui::Selectable("Compile"))
|
||||
{
|
||||
SHAssetManager::CompileAsset(file.path, !file.compiled, file.assetMeta ? file.assetMeta->id : 0);
|
||||
SHAssetManager::CompileAsset(file.path, !file.compiled);
|
||||
QueueRefresh();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
|
|
Loading…
Reference in New Issue