mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
if the menu list name matches the menu name, embed it directly
This commit is contained in:
parent
a2af7db92b
commit
70c31143f4
@ -53,7 +53,17 @@ bool AssetDumperMenuDef::ShouldDump(XAssetInfo<menuDef_t>* asset)
|
||||
void AssetDumperMenuDef::DumpAsset(AssetDumpingContext& context, XAssetInfo<menuDef_t>* asset)
|
||||
{
|
||||
const auto* menu = asset->Asset();
|
||||
const auto assetFile = context.OpenAssetFile(GetPathForMenu(asset));
|
||||
const auto menuFilePath = GetPathForMenu(asset);
|
||||
|
||||
if(ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST))
|
||||
{
|
||||
// Don't dump menu file separately if the name matches the menu list
|
||||
const auto* menuListParent = GetParentMenuList(asset);
|
||||
if (menuListParent && menuFilePath == menuListParent->name)
|
||||
return;
|
||||
}
|
||||
|
||||
const auto assetFile = context.OpenAssetFile(menuFilePath);
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
@ -12,13 +12,6 @@ using namespace IW4;
|
||||
|
||||
bool AssetDumperMenuList::ShouldDump(XAssetInfo<MenuList>* asset)
|
||||
{
|
||||
const auto* menuList = asset->Asset();
|
||||
const fs::path p(asset->Asset()->name);
|
||||
const auto extension = p.extension().string();
|
||||
|
||||
if (extension == ".menu" && menuList->menuCount == 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -45,6 +38,13 @@ void AssetDumperMenuList::DumpAsset(AssetDumpingContext& context, XAssetInfo<Men
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << parentPath << menu->window.name << ".menu";
|
||||
|
||||
const auto menuName = ss.str();
|
||||
|
||||
// If the menu was embedded directly as menu list write its data in the menu list file
|
||||
if(menuName == menuList->name)
|
||||
menuDumper.WriteMenu(menu);
|
||||
else
|
||||
menuDumper.IncludeMenu(ss.str());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user