mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Merge branch 'master' of github.com:xivDev/Penumbra
This commit is contained in:
commit
3dc04293eb
7 changed files with 64 additions and 19 deletions
|
|
@ -173,7 +173,6 @@ public partial class TexToolsImporter
|
||||||
{
|
{
|
||||||
var name = numGroups == 1 ? _currentGroupName : $"{_currentGroupName}, Part {groupId + 1}";
|
var name = numGroups == 1 ? _currentGroupName : $"{_currentGroupName}, Part {groupId + 1}";
|
||||||
options.Clear();
|
options.Clear();
|
||||||
var description = new StringBuilder();
|
|
||||||
var groupFolder = Mod.NewSubFolderName( _currentModDirectory, name )
|
var groupFolder = Mod.NewSubFolderName( _currentModDirectory, name )
|
||||||
?? new DirectoryInfo( Path.Combine( _currentModDirectory.FullName,
|
?? new DirectoryInfo( Path.Combine( _currentModDirectory.FullName,
|
||||||
numGroups == 1 ? $"Group {groupPriority + 1}" : $"Group {groupPriority + 1}, Part {groupId + 1}" ) );
|
numGroups == 1 ? $"Group {groupPriority + 1}" : $"Group {groupPriority + 1}, Part {groupId + 1}" ) );
|
||||||
|
|
@ -188,12 +187,6 @@ public partial class TexToolsImporter
|
||||||
?? new DirectoryInfo( Path.Combine( groupFolder.FullName, $"Option {i + optionIdx + 1}" ) );
|
?? new DirectoryInfo( Path.Combine( groupFolder.FullName, $"Option {i + optionIdx + 1}" ) );
|
||||||
ExtractSimpleModList( optionFolder, option.ModsJsons );
|
ExtractSimpleModList( optionFolder, option.ModsJsons );
|
||||||
options.Add( Mod.CreateSubMod( _currentModDirectory, optionFolder, option ) );
|
options.Add( Mod.CreateSubMod( _currentModDirectory, optionFolder, option ) );
|
||||||
description.Append( option.Description );
|
|
||||||
if( !string.IsNullOrEmpty( option.Description ) )
|
|
||||||
{
|
|
||||||
description.Append( '\n' );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( option.IsChecked )
|
if( option.IsChecked )
|
||||||
{
|
{
|
||||||
defaultSettings = group.SelectionType == GroupType.Multi
|
defaultSettings = group.SelectionType == GroupType.Multi
|
||||||
|
|
@ -220,7 +213,7 @@ public partial class TexToolsImporter
|
||||||
}
|
}
|
||||||
|
|
||||||
Mod.CreateOptionGroup( _currentModDirectory, group.SelectionType, name, groupPriority, groupPriority,
|
Mod.CreateOptionGroup( _currentModDirectory, group.SelectionType, name, groupPriority, groupPriority,
|
||||||
defaultSettings ?? 0, description.ToString(), options );
|
defaultSettings ?? 0, string.Empty, options );
|
||||||
++groupPriority;
|
++groupPriority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,23 @@ public sealed partial class Mod
|
||||||
ModOptionChanged.Invoke( ModOptionChangeType.DisplayChange, mod, groupIdx, -1, -1 );
|
ModOptionChanged.Invoke( ModOptionChangeType.DisplayChange, mod, groupIdx, -1, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeOptionDescription( Mod mod, int groupIdx, int optionIdx, string newDescription )
|
||||||
|
{
|
||||||
|
var group = mod._groups[ groupIdx ];
|
||||||
|
var option = group[ optionIdx ];
|
||||||
|
if( option.Description == newDescription )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ = option switch
|
||||||
|
{
|
||||||
|
SubMod s => s.Description = newDescription,
|
||||||
|
};
|
||||||
|
|
||||||
|
ModOptionChanged.Invoke( ModOptionChangeType.DisplayChange, mod, groupIdx, optionIdx, -1 );
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeGroupPriority( Mod mod, int groupIdx, int newPriority )
|
public void ChangeGroupPriority( Mod mod, int groupIdx, int newPriority )
|
||||||
{
|
{
|
||||||
var group = mod._groups[ groupIdx ];
|
var group = mod._groups[ groupIdx ];
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ public partial class Mod
|
||||||
var mod = new SubMod( null! ) // Mod is irrelevant here, only used for saving.
|
var mod = new SubMod( null! ) // Mod is irrelevant here, only used for saving.
|
||||||
{
|
{
|
||||||
Name = option.Name,
|
Name = option.Name,
|
||||||
|
Description = option.Description,
|
||||||
};
|
};
|
||||||
foreach( var (_, gamePath, file) in list )
|
foreach( var (_, gamePath, file) in list )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ public interface ISubMod
|
||||||
{
|
{
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public string FullName { get; }
|
public string FullName { get; }
|
||||||
|
public string Description { get; }
|
||||||
|
|
||||||
public IReadOnlyDictionary< Utf8GamePath, FullPath > Files { get; }
|
public IReadOnlyDictionary< Utf8GamePath, FullPath > Files { get; }
|
||||||
public IReadOnlyDictionary< Utf8GamePath, FullPath > FileSwaps { get; }
|
public IReadOnlyDictionary< Utf8GamePath, FullPath > FileSwaps { get; }
|
||||||
|
|
@ -22,6 +23,8 @@ public interface ISubMod
|
||||||
j.WriteStartObject();
|
j.WriteStartObject();
|
||||||
j.WritePropertyName( nameof( Name ) );
|
j.WritePropertyName( nameof( Name ) );
|
||||||
j.WriteValue( mod.Name );
|
j.WriteValue( mod.Name );
|
||||||
|
j.WritePropertyName( nameof(Description) );
|
||||||
|
j.WriteValue( mod.Description );
|
||||||
if( priority != null )
|
if( priority != null )
|
||||||
{
|
{
|
||||||
j.WritePropertyName( nameof( IModGroup.Priority ) );
|
j.WritePropertyName( nameof( IModGroup.Priority ) );
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,8 @@ public partial class Mod
|
||||||
public string FullName
|
public string FullName
|
||||||
=> GroupIdx < 0 ? "Default Option" : $"{ParentMod.Groups[ GroupIdx ].Name}: {Name}";
|
=> GroupIdx < 0 ? "Default Option" : $"{ParentMod.Groups[ GroupIdx ].Name}: {Name}";
|
||||||
|
|
||||||
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
internal IMod ParentMod { get; private init; }
|
internal IMod ParentMod { get; private init; }
|
||||||
internal int GroupIdx { get; private set; }
|
internal int GroupIdx { get; private set; }
|
||||||
internal int OptionIdx { get; private set; }
|
internal int OptionIdx { get; private set; }
|
||||||
|
|
@ -144,6 +146,7 @@ public partial class Mod
|
||||||
|
|
||||||
// Every option has a name, but priorities are only relevant for multi group options.
|
// Every option has a name, but priorities are only relevant for multi group options.
|
||||||
Name = json[ nameof( ISubMod.Name ) ]?.ToObject< string >() ?? string.Empty;
|
Name = json[ nameof( ISubMod.Name ) ]?.ToObject< string >() ?? string.Empty;
|
||||||
|
Description = json[ nameof( ISubMod.Description ) ]?.ToObject< string >() ?? string.Empty;
|
||||||
priority = json[ nameof( IModGroup.Priority ) ]?.ToObject< int >() ?? 0;
|
priority = json[ nameof( IModGroup.Priority ) ]?.ToObject< int >() ?? 0;
|
||||||
|
|
||||||
var files = ( JObject? )json[ nameof( Files ) ];
|
var files = ( JObject? )json[ nameof( Files ) ];
|
||||||
|
|
|
||||||
|
|
@ -304,12 +304,14 @@ public partial class ConfigWindow
|
||||||
private const string PopupName = "Edit Description";
|
private const string PopupName = "Edit Description";
|
||||||
private static string _newDescription = string.Empty;
|
private static string _newDescription = string.Empty;
|
||||||
private static int _newDescriptionIdx = -1;
|
private static int _newDescriptionIdx = -1;
|
||||||
|
private static int _newDesriptionOptionIdx = -1;
|
||||||
private static Mod? _mod;
|
private static Mod? _mod;
|
||||||
|
|
||||||
public static void OpenPopup( Mod mod, int groupIdx )
|
public static void OpenPopup( Mod mod, int groupIdx, int optionIdx = -1 )
|
||||||
{
|
{
|
||||||
_newDescriptionIdx = groupIdx;
|
_newDescriptionIdx = groupIdx;
|
||||||
_newDescription = groupIdx < 0 ? mod.Description : mod.Groups[ groupIdx ].Description;
|
_newDesriptionOptionIdx = optionIdx;
|
||||||
|
_newDescription = groupIdx < 0 ? mod.Description : optionIdx < 0 ? mod.Groups[ groupIdx ].Description : mod.Groups[ groupIdx ][ optionIdx ].Description;
|
||||||
_mod = mod;
|
_mod = mod;
|
||||||
ImGui.OpenPopup( PopupName );
|
ImGui.OpenPopup( PopupName );
|
||||||
}
|
}
|
||||||
|
|
@ -355,7 +357,14 @@ public partial class ConfigWindow
|
||||||
Penumbra.ModManager.ChangeModDescription( _mod.Index, _newDescription );
|
Penumbra.ModManager.ChangeModDescription( _mod.Index, _newDescription );
|
||||||
break;
|
break;
|
||||||
case >= 0:
|
case >= 0:
|
||||||
|
if( _newDesriptionOptionIdx < 0 )
|
||||||
|
{
|
||||||
Penumbra.ModManager.ChangeGroupDescription( _mod, _newDescriptionIdx, _newDescription );
|
Penumbra.ModManager.ChangeGroupDescription( _mod, _newDescriptionIdx, _newDescription );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Penumbra.ModManager.ChangeOptionDescription( _mod, _newDescriptionIdx, _newDesriptionOptionIdx, _newDescription );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -468,7 +477,7 @@ public partial class ConfigWindow
|
||||||
|
|
||||||
public static void Draw( ModPanel panel, int groupIdx )
|
public static void Draw( ModPanel panel, int groupIdx )
|
||||||
{
|
{
|
||||||
using var table = ImRaii.Table( string.Empty, 5, ImGuiTableFlags.SizingFixedFit );
|
using var table = ImRaii.Table( string.Empty, 6, ImGuiTableFlags.SizingFixedFit );
|
||||||
if( !table )
|
if( !table )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -478,6 +487,7 @@ public partial class ConfigWindow
|
||||||
ImGui.TableSetupColumn( "default", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight() );
|
ImGui.TableSetupColumn( "default", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight() );
|
||||||
ImGui.TableSetupColumn( "name", ImGuiTableColumnFlags.WidthFixed,
|
ImGui.TableSetupColumn( "name", ImGuiTableColumnFlags.WidthFixed,
|
||||||
panel._window._inputTextWidth.X - 68 * ImGuiHelpers.GlobalScale - ImGui.GetFrameHeight() );
|
panel._window._inputTextWidth.X - 68 * ImGuiHelpers.GlobalScale - ImGui.GetFrameHeight() );
|
||||||
|
ImGui.TableSetupColumn( "description", ImGuiTableColumnFlags.WidthFixed, panel._window._iconButtonSize.X );
|
||||||
ImGui.TableSetupColumn( "delete", ImGuiTableColumnFlags.WidthFixed, panel._window._iconButtonSize.X );
|
ImGui.TableSetupColumn( "delete", ImGuiTableColumnFlags.WidthFixed, panel._window._iconButtonSize.X );
|
||||||
ImGui.TableSetupColumn( "priority", ImGuiTableColumnFlags.WidthFixed, 50 * ImGuiHelpers.GlobalScale );
|
ImGui.TableSetupColumn( "priority", ImGuiTableColumnFlags.WidthFixed, 50 * ImGuiHelpers.GlobalScale );
|
||||||
|
|
||||||
|
|
@ -532,6 +542,11 @@ public partial class ConfigWindow
|
||||||
Penumbra.ModManager.RenameOption( panel._mod, groupIdx, optionIdx, newOptionName );
|
Penumbra.ModManager.RenameOption( panel._mod, groupIdx, optionIdx, newOptionName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Edit.ToIconString(), panel._window._iconButtonSize, "Edit option description.", false, true ) )
|
||||||
|
{
|
||||||
|
panel._delayedActions.Enqueue( () => DescriptionEdit.OpenPopup( panel._mod, groupIdx, optionIdx ) );
|
||||||
|
}
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Trash.ToIconString(), panel._window._iconButtonSize,
|
if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Trash.ToIconString(), panel._window._iconButtonSize,
|
||||||
"Delete this option.\nHold Control while clicking to delete.", !ImGui.GetIO().KeyCtrl, true ) )
|
"Delete this option.\nHold Control while clicking to delete.", !ImGui.GetIO().KeyCtrl, true ) )
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
|
using Dalamud.Interface.Components;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
|
|
@ -179,6 +180,12 @@ public partial class ConfigWindow
|
||||||
Penumbra.CollectionManager.Current.SetModSetting( _mod.Index, groupIdx, ( uint )idx2 );
|
Penumbra.CollectionManager.Current.SetModSetting( _mod.Index, groupIdx, ( uint )idx2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !string.IsNullOrEmpty( group[ idx2 ].Description ) )
|
||||||
|
{
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.HelpMarker(group[idx2].Description);
|
||||||
|
}
|
||||||
|
|
||||||
id.Pop();
|
id.Pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -213,6 +220,12 @@ public partial class ConfigWindow
|
||||||
Penumbra.CollectionManager.Current.SetModSetting( _mod.Index, groupIdx, flags );
|
Penumbra.CollectionManager.Current.SetModSetting( _mod.Index, groupIdx, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !string.IsNullOrEmpty( group[ idx2 ].Description ) )
|
||||||
|
{
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.HelpMarker(group[idx2].Description);
|
||||||
|
}
|
||||||
|
|
||||||
id.Pop();
|
id.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue