mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add default settings to mods.
This commit is contained in:
parent
8d48fcff42
commit
3ad811a1d0
11 changed files with 141 additions and 74 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
|||
Subproject commit 98064e790042c90c82a58fbfa79201bd69800758
|
||||
Subproject commit c84ff1b1c313c5f4ae28645a2e3fcb4d214f240a
|
||||
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using OtterGui;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Util;
|
||||
using SharpCompress.Archives.Zip;
|
||||
|
|
@ -166,16 +167,17 @@ public partial class TexToolsImporter
|
|||
: ( 1 + allOptions.Count / IModGroup.MaxMultiOptions, IModGroup.MaxMultiOptions );
|
||||
_currentGroupName = GetGroupName( group.GroupName, groupNames );
|
||||
|
||||
var optionIdx = 0;
|
||||
var optionIdx = 0;
|
||||
for( var groupId = 0; groupId < numGroups; ++groupId )
|
||||
{
|
||||
var name = numGroups == 1 ? _currentGroupName : $"{_currentGroupName}, Part {groupId + 1}";
|
||||
var name = numGroups == 1 ? _currentGroupName : $"{_currentGroupName}, Part {groupId + 1}";
|
||||
options.Clear();
|
||||
var description = new StringBuilder();
|
||||
var groupFolder = Mod.NewSubFolderName( _currentModDirectory, name )
|
||||
?? new DirectoryInfo( Path.Combine( _currentModDirectory.FullName,
|
||||
numGroups == 1 ? $"Group {groupPriority + 1}" : $"Group {groupPriority + 1}, Part {groupId + 1}" ) );
|
||||
|
||||
uint? defaultSettings = group.SelectionType == SelectType.Multi ? 0u : null;
|
||||
for( var i = 0; i + optionIdx < allOptions.Count && i < maxOptions; ++i )
|
||||
{
|
||||
var option = allOptions[ i + optionIdx ];
|
||||
|
|
@ -191,6 +193,13 @@ public partial class TexToolsImporter
|
|||
description.Append( '\n' );
|
||||
}
|
||||
|
||||
if( option.IsChecked )
|
||||
{
|
||||
defaultSettings = group.SelectionType == SelectType.Multi
|
||||
? ( defaultSettings!.Value | ( 1u << i ) )
|
||||
: ( uint )i;
|
||||
}
|
||||
|
||||
++_currentOptionIdx;
|
||||
}
|
||||
|
||||
|
|
@ -205,11 +214,12 @@ public partial class TexToolsImporter
|
|||
{
|
||||
_currentOptionName = empty.Name;
|
||||
options.Insert( 0, Mod.CreateEmptySubMod( empty.Name ) );
|
||||
defaultSettings = defaultSettings == null ? 0 : defaultSettings.Value + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Mod.CreateOptionGroup( _currentModDirectory, group.SelectionType, name, groupPriority, groupPriority,
|
||||
description.ToString(), options );
|
||||
defaultSettings ?? 0, description.ToString(), options );
|
||||
++groupPriority;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,18 @@ public sealed partial class Mod
|
|||
ModOptionChanged.Invoke( ModOptionChangeType.GroupTypeChanged, mod, groupIdx, -1, -1 );
|
||||
}
|
||||
|
||||
public void ChangeModGroupDefaultOption( Mod mod, int groupIdx, uint defaultOption )
|
||||
{
|
||||
var group = mod._groups[groupIdx];
|
||||
if( group.DefaultSettings == defaultOption )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
group.DefaultSettings = defaultOption;
|
||||
ModOptionChanged.Invoke( ModOptionChangeType.DefaultOptionChanged, mod, groupIdx, -1, -1 );
|
||||
}
|
||||
|
||||
public void RenameModGroup( Mod mod, int groupIdx, string newName )
|
||||
{
|
||||
var group = mod._groups[ groupIdx ];
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public enum ModOptionChangeType
|
|||
OptionMetaChanged,
|
||||
DisplayChange,
|
||||
PrepareChange,
|
||||
DefaultOptionChanged,
|
||||
}
|
||||
|
||||
public static class ModOptionChangeTypeExtension
|
||||
|
|
@ -30,21 +31,22 @@ public static class ModOptionChangeTypeExtension
|
|||
{
|
||||
( requiresSaving, requiresReloading, wasPrepared ) = type switch
|
||||
{
|
||||
ModOptionChangeType.GroupRenamed => ( true, false, false ),
|
||||
ModOptionChangeType.GroupAdded => ( true, false, false ),
|
||||
ModOptionChangeType.GroupDeleted => ( true, true, false ),
|
||||
ModOptionChangeType.GroupMoved => ( true, false, false ),
|
||||
ModOptionChangeType.GroupTypeChanged => ( true, true, true ),
|
||||
ModOptionChangeType.PriorityChanged => ( true, true, true ),
|
||||
ModOptionChangeType.OptionAdded => ( true, true, true ),
|
||||
ModOptionChangeType.OptionDeleted => ( true, true, false ),
|
||||
ModOptionChangeType.OptionMoved => ( true, false, false ),
|
||||
ModOptionChangeType.OptionFilesChanged => ( false, true, false ),
|
||||
ModOptionChangeType.OptionFilesAdded => ( false, true, true ),
|
||||
ModOptionChangeType.OptionSwapsChanged => ( false, true, false ),
|
||||
ModOptionChangeType.OptionMetaChanged => ( false, true, false ),
|
||||
ModOptionChangeType.DisplayChange => ( false, false, false ),
|
||||
_ => ( false, false, false ),
|
||||
ModOptionChangeType.GroupRenamed => ( true, false, false ),
|
||||
ModOptionChangeType.GroupAdded => ( true, false, false ),
|
||||
ModOptionChangeType.GroupDeleted => ( true, true, false ),
|
||||
ModOptionChangeType.GroupMoved => ( true, false, false ),
|
||||
ModOptionChangeType.GroupTypeChanged => ( true, true, true ),
|
||||
ModOptionChangeType.PriorityChanged => ( true, true, true ),
|
||||
ModOptionChangeType.OptionAdded => ( true, true, true ),
|
||||
ModOptionChangeType.OptionDeleted => ( true, true, false ),
|
||||
ModOptionChangeType.OptionMoved => ( true, false, false ),
|
||||
ModOptionChangeType.OptionFilesChanged => ( false, true, false ),
|
||||
ModOptionChangeType.OptionFilesAdded => ( false, true, true ),
|
||||
ModOptionChangeType.OptionSwapsChanged => ( false, true, false ),
|
||||
ModOptionChangeType.OptionMetaChanged => ( false, true, false ),
|
||||
ModOptionChangeType.DisplayChange => ( false, false, false ),
|
||||
ModOptionChangeType.DefaultOptionChanged => ( true, false, false ),
|
||||
_ => ( false, false, false ),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ public partial class Mod
|
|||
|
||||
// Create a file for an option group from given data.
|
||||
internal static void CreateOptionGroup( DirectoryInfo baseFolder, SelectType type, string name,
|
||||
int priority, int index, string desc, IEnumerable< ISubMod > subMods )
|
||||
int priority, int index, uint defaultSettings, string desc, IEnumerable< ISubMod > subMods )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
|
|
@ -67,9 +67,10 @@ public partial class Mod
|
|||
{
|
||||
var group = new MultiModGroup()
|
||||
{
|
||||
Name = name,
|
||||
Description = desc,
|
||||
Priority = priority,
|
||||
Name = name,
|
||||
Description = desc,
|
||||
Priority = priority,
|
||||
DefaultSettings = defaultSettings,
|
||||
};
|
||||
group.PrioritizedOptions.AddRange( subMods.OfType< SubMod >().Select( ( s, idx ) => ( s, idx ) ) );
|
||||
IModGroup.Save( group, baseFolder, index );
|
||||
|
|
@ -79,9 +80,10 @@ public partial class Mod
|
|||
{
|
||||
var group = new SingleModGroup()
|
||||
{
|
||||
Name = name,
|
||||
Description = desc,
|
||||
Priority = priority,
|
||||
Name = name,
|
||||
Description = desc,
|
||||
Priority = priority,
|
||||
DefaultSettings = defaultSettings,
|
||||
};
|
||||
group.OptionData.AddRange( subMods.OfType< SubMod >() );
|
||||
IModGroup.Save( group, baseFolder, index );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public interface IModGroup : IEnumerable< ISubMod >
|
|||
public string Description { get; }
|
||||
public SelectType Type { get; }
|
||||
public int Priority { get; }
|
||||
public uint DefaultSettings { get; set; }
|
||||
|
||||
public int OptionPriority( Index optionIdx );
|
||||
|
||||
|
|
@ -60,7 +61,8 @@ public interface IModGroup : IEnumerable< ISubMod >
|
|||
|
||||
public static void SaveDelayed( IModGroup group, DirectoryInfo basePath, int groupIdx )
|
||||
{
|
||||
Penumbra.Framework.RegisterDelayed( $"{nameof( SaveModGroup )}_{basePath.Name}_{group.Name}", () => SaveModGroup( group, basePath, groupIdx ) );
|
||||
Penumbra.Framework.RegisterDelayed( $"{nameof( SaveModGroup )}_{basePath.Name}_{group.Name}",
|
||||
() => SaveModGroup( group, basePath, groupIdx ) );
|
||||
}
|
||||
|
||||
public static void Save( IModGroup group, DirectoryInfo basePath, int groupIdx )
|
||||
|
|
@ -82,6 +84,8 @@ public interface IModGroup : IEnumerable< ISubMod >
|
|||
j.WriteValue( group.Priority );
|
||||
j.WritePropertyName( nameof( Type ) );
|
||||
j.WriteValue( group.Type.ToString() );
|
||||
j.WritePropertyName( nameof( group.DefaultSettings ) );
|
||||
j.WriteValue( group.DefaultSettings );
|
||||
j.WritePropertyName( "Options" );
|
||||
j.WriteStartArray();
|
||||
for( var idx = 0; idx < group.Count; ++idx )
|
||||
|
|
@ -96,5 +100,5 @@ public interface IModGroup : IEnumerable< ISubMod >
|
|||
|
||||
public IModGroup Convert( SelectType type );
|
||||
public bool MoveOption( int optionIdxFrom, int optionIdxTo );
|
||||
public void UpdatePositions(int from = 0);
|
||||
public void UpdatePositions( int from = 0 );
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
|
|
@ -20,6 +21,7 @@ public partial class Mod
|
|||
public string Name { get; set; } = "Group";
|
||||
public string Description { get; set; } = "A non-exclusive group of settings.";
|
||||
public int Priority { get; set; }
|
||||
public uint DefaultSettings { get; set; }
|
||||
|
||||
public int OptionPriority( Index idx )
|
||||
=> PrioritizedOptions[ idx ].Priority;
|
||||
|
|
@ -44,9 +46,10 @@ public partial class Mod
|
|||
var options = json[ "Options" ];
|
||||
var ret = new MultiModGroup()
|
||||
{
|
||||
Name = json[ nameof( Name ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Description = json[ nameof( Description ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Priority = json[ nameof( Priority ) ]?.ToObject< int >() ?? 0,
|
||||
Name = json[ nameof( Name ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Description = json[ nameof( Description ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Priority = json[ nameof( Priority ) ]?.ToObject< int >() ?? 0,
|
||||
DefaultSettings = json[ nameof( DefaultSettings ) ]?.ToObject< uint >() ?? 0,
|
||||
};
|
||||
if( ret.Name.Length == 0 )
|
||||
{
|
||||
|
|
@ -71,6 +74,8 @@ public partial class Mod
|
|||
}
|
||||
}
|
||||
|
||||
ret.DefaultSettings = (uint) (ret.DefaultSettings & ( ( 1ul << ret.Count ) - 1 ));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -82,9 +87,10 @@ public partial class Mod
|
|||
case SelectType.Single:
|
||||
var multi = new SingleModGroup()
|
||||
{
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
Priority = Priority,
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
Priority = Priority,
|
||||
DefaultSettings = ( uint )Math.Max( Math.Min( Count - 1, BitOperations.TrailingZeroCount( DefaultSettings) ), 0 ),
|
||||
};
|
||||
multi.OptionData.AddRange( PrioritizedOptions.Select( p => p.Mod ) );
|
||||
return multi;
|
||||
|
|
@ -99,6 +105,7 @@ public partial class Mod
|
|||
return false;
|
||||
}
|
||||
|
||||
DefaultSettings = Functions.MoveBit( DefaultSettings, optionIdxFrom, optionIdxTo );
|
||||
UpdatePositions( Math.Min( optionIdxFrom, optionIdxTo ) );
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public partial class Mod
|
|||
public string Name { get; set; } = "Option";
|
||||
public string Description { get; set; } = "A mutually exclusive group of settings.";
|
||||
public int Priority { get; set; }
|
||||
public uint DefaultSettings { get; set; }
|
||||
|
||||
public readonly List< SubMod > OptionData = new();
|
||||
|
||||
|
|
@ -44,9 +45,10 @@ public partial class Mod
|
|||
var options = json[ "Options" ];
|
||||
var ret = new SingleModGroup
|
||||
{
|
||||
Name = json[ nameof( Name ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Description = json[ nameof( Description ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Priority = json[ nameof( Priority ) ]?.ToObject< int >() ?? 0,
|
||||
Name = json[ nameof( Name ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Description = json[ nameof( Description ) ]?.ToObject< string >() ?? string.Empty,
|
||||
Priority = json[ nameof( Priority ) ]?.ToObject< int >() ?? 0,
|
||||
DefaultSettings = json[ nameof( DefaultSettings ) ]?.ToObject< uint >() ?? 0u,
|
||||
};
|
||||
if( ret.Name.Length == 0 )
|
||||
{
|
||||
|
|
@ -64,6 +66,9 @@ public partial class Mod
|
|||
}
|
||||
}
|
||||
|
||||
if( ( int )ret.DefaultSettings >= ret.Count )
|
||||
ret.DefaultSettings = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -75,9 +80,10 @@ public partial class Mod
|
|||
case SelectType.Multi:
|
||||
var multi = new MultiModGroup()
|
||||
{
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
Priority = Priority,
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
Priority = Priority,
|
||||
DefaultSettings = 1u << ( int )DefaultSettings,
|
||||
};
|
||||
multi.PrioritizedOptions.AddRange( OptionData.Select( ( o, i ) => ( o, i ) ) );
|
||||
return multi;
|
||||
|
|
@ -92,6 +98,23 @@ public partial class Mod
|
|||
return false;
|
||||
}
|
||||
|
||||
// Update default settings with the move.
|
||||
if( DefaultSettings == optionIdxFrom )
|
||||
{
|
||||
DefaultSettings = ( uint )optionIdxTo;
|
||||
}
|
||||
else if( optionIdxFrom < optionIdxTo )
|
||||
{
|
||||
if( DefaultSettings > optionIdxFrom && DefaultSettings <= optionIdxTo )
|
||||
{
|
||||
--DefaultSettings;
|
||||
}
|
||||
}
|
||||
else if( DefaultSettings < optionIdxFrom && DefaultSettings >= optionIdxTo )
|
||||
{
|
||||
++DefaultSettings;
|
||||
}
|
||||
|
||||
UpdatePositions( Math.Min( optionIdxFrom, optionIdxTo ) );
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class ModSettings
|
|||
{
|
||||
Enabled = false,
|
||||
Priority = 0,
|
||||
Settings = Enumerable.Repeat( 0u, mod.Groups.Count ).ToList(),
|
||||
Settings = mod.Groups.Select( g => g.DefaultSettings ).ToList(),
|
||||
};
|
||||
|
||||
// Automatically react to changes in a mods available options.
|
||||
|
|
@ -41,7 +41,7 @@ public class ModSettings
|
|||
case ModOptionChangeType.GroupRenamed: return true;
|
||||
case ModOptionChangeType.GroupAdded:
|
||||
// Add new empty setting for new mod.
|
||||
Settings.Insert( groupIdx, 0 );
|
||||
Settings.Insert( groupIdx, mod.Groups[groupIdx].DefaultSettings );
|
||||
return true;
|
||||
case ModOptionChangeType.GroupDeleted:
|
||||
// Remove setting for deleted mod.
|
||||
|
|
@ -70,8 +70,8 @@ public class ModSettings
|
|||
var config = Settings[ groupIdx ];
|
||||
Settings[ groupIdx ] = group.Type switch
|
||||
{
|
||||
SelectType.Single => config >= optionIdx ? (config > 1 ? config - 1 : 0) : config,
|
||||
SelectType.Multi => RemoveBit( config, optionIdx ),
|
||||
SelectType.Single => config >= optionIdx ? config > 1 ? config - 1 : 0 : config,
|
||||
SelectType.Multi => Functions.RemoveBit( config, optionIdx ),
|
||||
_ => config,
|
||||
};
|
||||
return config != Settings[ groupIdx ];
|
||||
|
|
@ -88,7 +88,7 @@ public class ModSettings
|
|||
Settings[ groupIdx ] = group.Type switch
|
||||
{
|
||||
SelectType.Single => config == optionIdx ? ( uint )movedToIdx : config,
|
||||
SelectType.Multi => MoveBit( config, optionIdx, movedToIdx ),
|
||||
SelectType.Multi => Functions.MoveBit( config, optionIdx, movedToIdx ),
|
||||
_ => config,
|
||||
};
|
||||
return config != Settings[ groupIdx ];
|
||||
|
|
@ -114,27 +114,6 @@ public class ModSettings
|
|||
Settings[ groupIdx ] = FixSetting( group, newValue );
|
||||
}
|
||||
|
||||
// Remove a single bit, moving all further bits one down.
|
||||
private static uint RemoveBit( uint config, int bit )
|
||||
{
|
||||
var lowMask = ( 1u << bit ) - 1u;
|
||||
var highMask = ~( ( 1u << ( bit + 1 ) ) - 1u );
|
||||
var low = config & lowMask;
|
||||
var high = ( config & highMask ) >> 1;
|
||||
return low | high;
|
||||
}
|
||||
|
||||
// Move a bit in an uint from its position to another, shifting other bits accordingly.
|
||||
private static uint MoveBit( uint config, int bit1, int bit2 )
|
||||
{
|
||||
var enabled = ( config & ( 1 << bit1 ) ) != 0 ? 1u << bit2 : 0u;
|
||||
config = RemoveBit( config, bit1 );
|
||||
var lowMask = ( 1u << bit2 ) - 1u;
|
||||
var low = config & lowMask;
|
||||
var high = ( config & ~lowMask ) << 1;
|
||||
return low | enabled | high;
|
||||
}
|
||||
|
||||
// Add defaulted settings up to the required count.
|
||||
private bool AddMissingSettings( int totalCount )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public partial class ConfigWindow
|
|||
ImGui.Dummy( _window._defaultSpace );
|
||||
}
|
||||
|
||||
private void DrawUpdateBibo( Vector2 buttonSize)
|
||||
private void DrawUpdateBibo( Vector2 buttonSize )
|
||||
{
|
||||
if( ImGui.Button( "Update Bibo Material", buttonSize ) )
|
||||
{
|
||||
|
|
@ -108,7 +108,8 @@ public partial class ConfigWindow
|
|||
_window.ModEditPopup.UpdateModels();
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip( "For every model in this mod, change all material names that end in a _b or _c suffix to a _bibo or _bibopube suffix respectively.\n"
|
||||
ImGuiUtil.HoverTooltip(
|
||||
"For every model in this mod, change all material names that end in a _b or _c suffix to a _bibo or _bibopube suffix respectively.\n"
|
||||
+ "Does nothing if the mod does not contain any such models or no model contains such materials.\n"
|
||||
+ "Use this for outdated mods made for old Bibo bodies.\n"
|
||||
+ "Go to Advanced Editing for more fine-tuned control over material assignment." );
|
||||
|
|
@ -459,15 +460,16 @@ public partial class ConfigWindow
|
|||
|
||||
public static void Draw( ModPanel panel, int groupIdx )
|
||||
{
|
||||
using var table = ImRaii.Table( string.Empty, 4, ImGuiTableFlags.SizingFixedFit );
|
||||
using var table = ImRaii.Table( string.Empty, 5, ImGuiTableFlags.SizingFixedFit );
|
||||
if( !table )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.TableSetupColumn( "idx", ImGuiTableColumnFlags.WidthFixed, 60 * ImGuiHelpers.GlobalScale );
|
||||
ImGui.TableSetupColumn( "default", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight() );
|
||||
ImGui.TableSetupColumn( "name", ImGuiTableColumnFlags.WidthFixed,
|
||||
panel._window._inputTextWidth.X - 62 * ImGuiHelpers.GlobalScale );
|
||||
panel._window._inputTextWidth.X - 68 * ImGuiHelpers.GlobalScale - ImGui.GetFrameHeight() );
|
||||
ImGui.TableSetupColumn( "delete", ImGuiTableColumnFlags.WidthFixed, panel._window._iconButtonSize.X );
|
||||
ImGui.TableSetupColumn( "priority", ImGuiTableColumnFlags.WidthFixed, 50 * ImGuiHelpers.GlobalScale );
|
||||
|
||||
|
|
@ -491,6 +493,31 @@ public partial class ConfigWindow
|
|||
Source( group, groupIdx, optionIdx );
|
||||
Target( panel, group, groupIdx, optionIdx );
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
|
||||
if( group.Type == SelectType.Single )
|
||||
{
|
||||
if( ImGui.RadioButton( "##default", group.DefaultSettings == optionIdx ) )
|
||||
{
|
||||
Penumbra.ModManager.ChangeModGroupDefaultOption( panel._mod, groupIdx, ( uint )optionIdx );
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip( $"Set {option.Name} as the default choice for this group." );
|
||||
}
|
||||
else
|
||||
{
|
||||
var isDefaultOption = ( ( group.DefaultSettings >> optionIdx ) & 1 ) != 0;
|
||||
if( ImGui.Checkbox( "##default", ref isDefaultOption ) )
|
||||
{
|
||||
Penumbra.ModManager.ChangeModGroupDefaultOption( panel._mod, groupIdx, isDefaultOption
|
||||
? group.DefaultSettings | ( 1u << optionIdx )
|
||||
: group.DefaultSettings & ~( 1u << optionIdx ) );
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip( $"{( isDefaultOption ? "Disable" : "Enable" )} {option.Name} per default in this group." );
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
if( Input.Text( "##Name", groupIdx, optionIdx, option.Name, out var newOptionName, 256, -1 ) )
|
||||
{
|
||||
|
|
@ -527,6 +554,7 @@ public partial class ConfigWindow
|
|||
ImGui.Selectable( $"Option #{group.Count + 1}" );
|
||||
Target( panel, group, groupIdx, group.Count );
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.SetNextItemWidth( -1 );
|
||||
var tmp = _newOptionNameIdx == groupIdx ? _newOptionName : string.Empty;
|
||||
if( ImGui.InputTextWithHint( "##newOption", "Add new option...", ref tmp, 256 ) )
|
||||
|
|
@ -575,7 +603,7 @@ public partial class ConfigWindow
|
|||
return;
|
||||
}
|
||||
|
||||
if( _dragDropGroupIdx >= 0 && _dragDropOptionIdx >= 0 )
|
||||
if( _dragDropGroupIdx >= 0 && _dragDropOptionIdx >= 0 )
|
||||
{
|
||||
if( _dragDropGroupIdx == groupIdx )
|
||||
{
|
||||
|
|
@ -589,7 +617,7 @@ public partial class ConfigWindow
|
|||
var sourceOption = _dragDropOptionIdx;
|
||||
var sourceGroup = panel._mod.Groups[ sourceGroupIdx ];
|
||||
var currentCount = group.Count;
|
||||
var option = sourceGroup[sourceOption];
|
||||
var option = sourceGroup[ sourceOption ];
|
||||
var priority = sourceGroup.OptionPriority( _dragDropGroupIdx );
|
||||
panel._delayedActions.Enqueue( () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ public partial class ConfigWindow
|
|||
}
|
||||
|
||||
using var id = ImRaii.PushId( groupIdx );
|
||||
var selectedOption = _emptySetting ? 0 : ( int )_settings.Settings[ groupIdx ];
|
||||
var selectedOption = _emptySetting ? (int) group.DefaultSettings : ( int )_settings.Settings[ groupIdx ];
|
||||
ImGui.SetNextItemWidth( _window._inputTextWidth.X * 3 / 4 );
|
||||
using var combo = ImRaii.Combo( string.Empty, group[ selectedOption ].Name );
|
||||
if( combo )
|
||||
|
|
@ -199,7 +199,7 @@ public partial class ConfigWindow
|
|||
}
|
||||
|
||||
using var id = ImRaii.PushId( groupIdx );
|
||||
var flags = _emptySetting ? 0u : _settings.Settings[ groupIdx ];
|
||||
var flags = _emptySetting ? group.DefaultSettings : _settings.Settings[ groupIdx ];
|
||||
Widget.BeginFramedGroup( group.Name, group.Description );
|
||||
for( var idx2 = 0; idx2 < group.Count; ++idx2 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue