Add scene asset type to editor
This commit is contained in:
parent
9d1cb3254e
commit
b22447a931
2 changed files with 24 additions and 6 deletions
|
@ -84,7 +84,8 @@ enum class AssetType {
|
|||
Unknown,
|
||||
Mesh,
|
||||
Texture,
|
||||
Material
|
||||
Material,
|
||||
Scene
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -95,6 +96,8 @@ AssetType get_asset_type() {
|
|||
return AssetType::Material;
|
||||
} else if constexpr(std::is_same<T, Texture>::value) {
|
||||
return AssetType::Texture;
|
||||
} else if constexpr(std::is_same<T, Scene>::value) {
|
||||
return AssetType::Scene;
|
||||
}
|
||||
|
||||
return AssetType::Unknown;
|
||||
|
@ -296,6 +299,13 @@ public:
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void open_asset(const AssetType type, const std::function<void(prism::path path)> func_ptr) {
|
||||
current_asset_type = type;
|
||||
open_asset_popup = true;
|
||||
on_asset_select = func_ptr;
|
||||
}
|
||||
|
||||
DebugPass* debugPass = nullptr;
|
||||
|
||||
|
|
|
@ -264,7 +264,13 @@ void CommonEditor::begin_frame() {
|
|||
on_asset_select(p);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text(p.c_str());
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
column++;
|
||||
|
||||
if(column != 5)
|
||||
|
@ -760,6 +766,8 @@ void cacheAssetFilesystem() {
|
|||
asset_files[std::filesystem::relative(p, data_directory)] = AssetType::Material;
|
||||
} else if(p.path().extension() == ".png") {
|
||||
asset_files[std::filesystem::relative(p, data_directory)] = AssetType::Texture;
|
||||
} else if(p.path().extension() == ".scene") {
|
||||
asset_files[std::filesystem::relative(p, data_directory)] = AssetType::Scene;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -785,16 +793,16 @@ void CommonEditor::drawAssets() {
|
|||
|
||||
if(ImGui::ImageButton(get_asset_thumbnail(prism::app_domain / p), ImVec2(64, 64)))
|
||||
asset_selected(prism::app_domain / p, type);
|
||||
|
||||
|
||||
if(ImGui::BeginPopupContextItem()) {
|
||||
ImGui::TextDisabled("%s", p.string().c_str());
|
||||
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
if(ImGui::Button("Regenerate thumbnail")) {
|
||||
asset_thumbnails.erase(asset_thumbnails.find((prism::app_domain / p).string()));
|
||||
}
|
||||
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue