mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 20:54:16 +01:00
Keep first empty option in its desired location.
This commit is contained in:
parent
8318a4bd84
commit
4fc763c9aa
1 changed files with 11 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using OtterGui;
|
||||||
using Penumbra.Api.Enums;
|
using Penumbra.Api.Enums;
|
||||||
using Penumbra.Import.Structs;
|
using Penumbra.Import.Structs;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
|
@ -35,7 +36,8 @@ public partial class TexToolsImporter
|
||||||
|
|
||||||
var modList = modListRaw.Select(m => JsonConvert.DeserializeObject<SimpleMod>(m, JsonSettings)!).ToList();
|
var modList = modListRaw.Select(m => JsonConvert.DeserializeObject<SimpleMod>(m, JsonSettings)!).ToList();
|
||||||
|
|
||||||
_currentModDirectory = ModCreator.CreateModFolder(_baseDirectory, Path.GetFileNameWithoutExtension(modPackFile.Name), _config.ReplaceNonAsciiOnImport, true);
|
_currentModDirectory = ModCreator.CreateModFolder(_baseDirectory, Path.GetFileNameWithoutExtension(modPackFile.Name),
|
||||||
|
_config.ReplaceNonAsciiOnImport, true);
|
||||||
// Create a new ModMeta from the TTMP mod list info
|
// Create a new ModMeta from the TTMP mod list info
|
||||||
_modManager.DataEditor.CreateMeta(_currentModDirectory, _currentModName, DefaultTexToolsData.Author, DefaultTexToolsData.Description,
|
_modManager.DataEditor.CreateMeta(_currentModDirectory, _currentModName, DefaultTexToolsData.Author, DefaultTexToolsData.Description,
|
||||||
null, null);
|
null, null);
|
||||||
|
|
@ -193,15 +195,17 @@ public partial class TexToolsImporter
|
||||||
optionIdx += maxOptions;
|
optionIdx += maxOptions;
|
||||||
|
|
||||||
// Handle empty options for single select groups without creating a folder for them.
|
// Handle empty options for single select groups without creating a folder for them.
|
||||||
// We only want one of those at most, and it should usually be the first option.
|
// We only want one of those at most.
|
||||||
if (group.SelectionType == GroupType.Single)
|
if (group.SelectionType == GroupType.Single)
|
||||||
{
|
{
|
||||||
var empty = group.OptionList.FirstOrDefault(o => o.Name.Length > 0 && o.ModsJsons.Length == 0);
|
var idx = group.OptionList.IndexOf(o => o.Name.Length > 0 && o.ModsJsons.Length == 0);
|
||||||
if (empty != null)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
_currentOptionName = empty.Name;
|
var option = group.OptionList[idx];
|
||||||
options.Insert(0, ModCreator.CreateEmptySubMod(empty.Name));
|
_currentOptionName = option.Name;
|
||||||
defaultSettings = defaultSettings == null ? 0 : defaultSettings.Value + 1;
|
options.Insert(idx, ModCreator.CreateEmptySubMod(option.Name));
|
||||||
|
if (option.IsChecked)
|
||||||
|
defaultSettings = (uint) idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue