From 714e8e862ff927749018e28aa5882ae060dcea87 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Thu, 21 Jul 2022 22:55:19 +0200 Subject: [PATCH] Change a bunch of names and tooltips. --- Penumbra/Collections/ModCollection.cs | 3 + ...ConfigWindow.CollectionsTab.Inheritance.cs | 10 +- Penumbra/UI/ConfigWindow.CollectionsTab.cs | 172 +++++++++++------- Penumbra/UI/ConfigWindow.Tutorial.cs | 50 +++-- 4 files changed, 144 insertions(+), 91 deletions(-) diff --git a/Penumbra/Collections/ModCollection.cs b/Penumbra/Collections/ModCollection.cs index 5394efcc..6ace180e 100644 --- a/Penumbra/Collections/ModCollection.cs +++ b/Penumbra/Collections/ModCollection.cs @@ -42,6 +42,9 @@ public partial class ModCollection public bool HasUnusedSettings => _unusedSettings.Count > 0; + public int NumUnusedSettings + => _unusedSettings.Count; + // Evaluates the settings along the whole inheritance tree. public IEnumerable< ModSettings? > ActualSettings => Enumerable.Range( 0, _settings.Count ).Select( i => this[ i ].Settings ); diff --git a/Penumbra/UI/ConfigWindow.CollectionsTab.Inheritance.cs b/Penumbra/UI/ConfigWindow.CollectionsTab.Inheritance.cs index 92f50d7e..366a5b4f 100644 --- a/Penumbra/UI/ConfigWindow.CollectionsTab.Inheritance.cs +++ b/Penumbra/UI/ConfigWindow.CollectionsTab.Inheritance.cs @@ -33,7 +33,7 @@ public partial class ConfigWindow { using var group = ImRaii.Group(); using var id = ImRaii.PushId( "##Inheritance" ); - ImGui.TextUnformatted( "The current collection inherits from:" ); + ImGui.TextUnformatted( $"The {SelectedCollection} inherits from:" ); DrawCurrentCollectionInheritance(); DrawInheritanceTrashButton(); DrawNewInheritanceSelection(); @@ -187,10 +187,10 @@ public partial class ConfigWindow var tt = inheritance switch { ModCollection.ValidInheritance.Empty => "No valid collection to inherit from selected.", - ModCollection.ValidInheritance.Valid => "Let the current collection inherit from the selected collection.", + ModCollection.ValidInheritance.Valid => $"Let the {SelectedCollection} inherit from this collection.", ModCollection.ValidInheritance.Self => "The collection can not inherit from itself.", - ModCollection.ValidInheritance.Contained => "Already inheriting from the selected collection.", - ModCollection.ValidInheritance.Circle => "Inheriting from selected collection would lead to cyclic inheritance.", + ModCollection.ValidInheritance.Contained => "Already inheriting from this collection.", + ModCollection.ValidInheritance.Circle => "Inheriting from this collection would lead to cyclic inheritance.", _ => string.Empty, }; if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Plus.ToIconString(), _window._iconButtonSize, tt, @@ -311,7 +311,7 @@ public partial class ConfigWindow } } - ImGuiUtil.HoverTooltip( "Control + Right-Click to switch the current collection to this one." + ImGuiUtil.HoverTooltip( $"Control + Right-Click to switch the {SelectedCollection} to this one." + ( withDelete ? "\nControl + Shift + Right-Click to remove this inheritance." : string.Empty ) ); } } diff --git a/Penumbra/UI/ConfigWindow.CollectionsTab.cs b/Penumbra/UI/ConfigWindow.CollectionsTab.cs index 09ad7796..58397133 100644 --- a/Penumbra/UI/ConfigWindow.CollectionsTab.cs +++ b/Penumbra/UI/ConfigWindow.CollectionsTab.cs @@ -55,13 +55,14 @@ public partial class ConfigWindow } // Only gets drawn when actually relevant. - private static void DrawCleanCollectionButton() + private static void DrawCleanCollectionButton( Vector2 width ) { if( Penumbra.Config.ShowAdvanced && Penumbra.CollectionManager.Current.HasUnusedSettings ) { ImGui.SameLine(); - if( ImGuiUtil.DrawDisabledButton( "Clean Settings", Vector2.Zero - , "Remove all stored settings for mods not currently available and fix invalid settings.\nUse at own risk." + if( ImGuiUtil.DrawDisabledButton( + $"Clean {Penumbra.CollectionManager.Current.NumUnusedSettings} Unused Settings###CleanSettings", width + , "Remove all stored settings for mods not currently available and fix invalid settings.\n\nUse at own risk." , false ) ) { Penumbra.CollectionManager.Current.CleanUnavailableSettings(); @@ -70,11 +71,11 @@ public partial class ConfigWindow } // Draw the new collection input as well as its buttons. - private void DrawNewCollectionInput() + private void DrawNewCollectionInput( Vector2 width ) { // Input for new collection name. Also checks for validity when changed. ImGui.SetNextItemWidth( _window._inputTextWidth.X ); - if( ImGui.InputTextWithHint( "##New Collection", "New Collection Name", ref _newCollectionName, 64 ) ) + if( ImGui.InputTextWithHint( "##New Collection", "New Collection Name...", ref _newCollectionName, 64 ) ) { _canAddCollection = Penumbra.CollectionManager.CanAddCollection( _newCollectionName, out _ ); } @@ -82,40 +83,45 @@ public partial class ConfigWindow ImGui.SameLine(); ImGuiComponents.HelpMarker( "A collection is a set of settings for your installed mods, including their enabled status, their priorities and their mod-specific configuration.\n" - + "You can use multiple collections to quickly switch between sets of mods." ); + + "You can use multiple collections to quickly switch between sets of enabled mods." ); // Creation buttons. - var tt = _canAddCollection ? string.Empty : "Please enter a unique name only consisting of symbols valid in a path but no '|' before creating a collection."; - if( ImGuiUtil.DrawDisabledButton( "Create New Empty Collection", Vector2.Zero, tt, !_canAddCollection ) ) + var tt = _canAddCollection + ? string.Empty + : "Please enter a unique name only consisting of symbols valid in a path but no '|' before creating a collection."; + if( ImGuiUtil.DrawDisabledButton( "Create Empty Collection", width, tt, !_canAddCollection ) ) { CreateNewCollection( false ); } ImGui.SameLine(); - if( ImGuiUtil.DrawDisabledButton( "Duplicate Current Collection", Vector2.Zero, tt, !_canAddCollection ) ) + if( ImGuiUtil.DrawDisabledButton( $"Duplicate {SelectedCollection}", width, tt, !_canAddCollection ) ) { CreateNewCollection( true ); } - - // Deletion conditions. - var deleteCondition = Penumbra.CollectionManager.Current.Name != ModCollection.DefaultCollection; - tt = deleteCondition ? string.Empty : "You can not delete the default collection."; - ImGui.SameLine(); - if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Trash.ToIconString(), Vector2.Zero, tt, !deleteCondition, true ) ) - { - Penumbra.CollectionManager.RemoveCollection( Penumbra.CollectionManager.Current ); - } - - DrawCleanCollectionButton(); } - private void DrawCurrentCollectionSelector() + private void DrawCurrentCollectionSelector( Vector2 width ) { using var group = ImRaii.Group(); DrawCollectionSelector( "##current", _window._inputTextWidth.X, CollectionType.Current, false, null ); ImGui.SameLine(); - ImGuiUtil.LabeledHelpMarker( "Current Collection", - "This collection will be modified when using the Installed Mods tab and making changes. It does not apply to anything by itself." ); + ImGuiUtil.LabeledHelpMarker( SelectedCollection, + "This collection will be modified when using the Installed Mods tab and making changes.\nIt is not automatically assigned to anything." ); + + // Deletion conditions. + var deleteCondition = Penumbra.CollectionManager.Current.Name != ModCollection.DefaultCollection; + var modifierHeld = Penumbra.Config.DeleteModModifier.IsActive(); + var tt = deleteCondition + ? modifierHeld ? string.Empty : $"Hold {Penumbra.Config.DeleteModModifier} while clicking to delete the collection." + : $"You can not delete the collection {ModCollection.DefaultCollection}."; + + if( ImGuiUtil.DrawDisabledButton( $"Delete {SelectedCollection}", width, tt, !deleteCondition || !modifierHeld ) ) + { + Penumbra.CollectionManager.RemoveCollection( Penumbra.CollectionManager.Current ); + } + + DrawCleanCollectionButton( width ); } private void DrawDefaultCollectionSelector() @@ -123,16 +129,17 @@ public partial class ConfigWindow using var group = ImRaii.Group(); DrawCollectionSelector( "##default", _window._inputTextWidth.X, CollectionType.Default, true, null ); ImGui.SameLine(); - ImGuiUtil.LabeledHelpMarker( "Default Collection", - "Mods in the default collection are loaded for any character that is not explicitly named in the character collections below.\n" ); + ImGuiUtil.LabeledHelpMarker( DefaultCollection, + $"Mods in the {DefaultCollection} are loaded for anything that is not associated with a character in the game " + + "as well as any character for whom no more specific conditions from below apply." ); } // We do not check for valid character names. private void DrawNewSpecialCollection() { - const string description = "Special Collections apply to certain types of characters.\n" - + "All of them take precedence before the Default collection,\n" - + "but all character collections take precedence before them."; + const string description = $"{CharacterGroups} apply to certain types of characters based on a condition.\n" + + $"All of them take precedence before the {DefaultCollection},\n" + + $"but all {IndividualAssignments} take precedence before them."; ImGui.SetNextItemWidth( _window._inputTextWidth.X ); if( _currentType == null || Penumbra.CollectionManager.ByType( _currentType.Value ) != null ) @@ -163,8 +170,10 @@ public partial class ConfigWindow ImGui.SameLine(); var disabled = _currentType == null; - var tt = disabled ? "Please select a special collection type before creating the collection.\n\n" + description : description; - if( ImGuiUtil.DrawDisabledButton( "Create New Special Collection", Vector2.Zero, tt, disabled ) ) + var tt = disabled + ? $"Please select a condition for a {GroupAssignment} before creating the collection.\n\n" + description + : description; + if( ImGuiUtil.DrawDisabledButton( $"Assign {ConditionalGroup}", new Vector2( 120 * ImGuiHelpers.GlobalScale, 0 ), tt, disabled ) ) { Penumbra.CollectionManager.CreateSpecialCollection( _currentType!.Value ); _currentType = null; @@ -174,36 +183,27 @@ public partial class ConfigWindow // We do not check for valid character names. private void DrawNewCharacterCollection() { - const string description = "Character Collections apply specifically to game objects of the given name.\n" - + "The default collection does not apply to any character that has a character collection specified.\n" + const string description = "Character Collections apply specifically to individual game objects of the given name.\n" + + $"More general {GroupAssignment} or the {DefaultCollection} do not apply if an .\n" + "Certain actors - like the ones in cutscenes or preview windows - will try to use appropriate character collections.\n"; ImGui.SetNextItemWidth( _window._inputTextWidth.X ); - ImGui.InputTextWithHint( "##NewCharacter", "New Character Name", ref _newCharacterName, 32 ); + ImGui.InputTextWithHint( "##NewCharacter", "Character Name...", ref _newCharacterName, 32 ); ImGui.SameLine(); var disabled = _newCharacterName.Length == 0; - var tt = disabled ? "Please enter a Character name before creating the collection.\n\n" + description : description; - if( ImGuiUtil.DrawDisabledButton( "Create New Character Collection", Vector2.Zero, tt, disabled ) ) + var tt = disabled + ? $"Please enter the name of a {ConditionalIndividual} before assigning the collection.\n\n" + description + : description; + if( ImGuiUtil.DrawDisabledButton( $"Assign {ConditionalIndividual}", new Vector2( 120 * ImGuiHelpers.GlobalScale, 0 ), tt, + disabled ) ) { Penumbra.CollectionManager.CreateCharacterCollection( _newCharacterName ); _newCharacterName = string.Empty; } } - private void DrawActiveCollectionSelectors() + private void DrawSpecialCollections() { - ImGui.Dummy( _window._defaultSpace ); - var open = ImGui.CollapsingHeader( "Active Collections", ImGuiTreeNodeFlags.DefaultOpen ); - OpenTutorial( BasicTutorialSteps.ActiveCollections ); - if( !open ) - { - return; - } - - ImGui.Dummy( _window._defaultSpace ); - DrawDefaultCollectionSelector(); - OpenTutorial( BasicTutorialSteps.DefaultCollection ); - ImGui.Dummy( _window._defaultSpace ); foreach( var type in CollectionTypeExtensions.Special ) { var collection = Penumbra.CollectionManager.ByType( type ); @@ -223,32 +223,65 @@ public partial class ConfigWindow ImGuiUtil.LabeledHelpMarker( type.ToName(), type.ToDescription() ); } } + } - using( var group = ImRaii.Group() ) + private void DrawSpecialAssignments() + { + using var _ = ImRaii.Group(); + ImGui.TextUnformatted( CharacterGroups ); + ImGui.Separator(); + DrawSpecialCollections(); + ImGui.Dummy( Vector2.Zero ); + DrawNewSpecialCollection(); + } + + private void DrawIndividualAssignments() + { + using var _ = ImRaii.Group(); + ImGui.TextUnformatted( $"Individual {ConditionalIndividual}s" ); + ImGui.Separator(); + foreach( var name in Penumbra.CollectionManager.Characters.Keys.OrderBy( k => k ).ToArray() ) { - DrawNewSpecialCollection(); - ImGui.Dummy( _window._defaultSpace ); - - foreach( var name in Penumbra.CollectionManager.Characters.Keys.OrderBy( k => k ).ToArray() ) + using var id = ImRaii.PushId( name ); + DrawCollectionSelector( string.Empty, _window._inputTextWidth.X, CollectionType.Character, true, name ); + ImGui.SameLine(); + if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Trash.ToIconString(), _window._iconButtonSize, string.Empty, + false, true ) ) { - using var id = ImRaii.PushId( name ); - DrawCollectionSelector( string.Empty, _window._inputTextWidth.X, CollectionType.Character, true, name ); - ImGui.SameLine(); - if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Trash.ToIconString(), _window._iconButtonSize, string.Empty, - false, true ) ) - { - Penumbra.CollectionManager.RemoveCharacterCollection( name ); - } - - ImGui.SameLine(); - ImGui.AlignTextToFramePadding(); - ImGui.TextUnformatted( name ); + Penumbra.CollectionManager.RemoveCharacterCollection( name ); } - DrawNewCharacterCollection(); + ImGui.SameLine(); + ImGui.AlignTextToFramePadding(); + ImGui.TextUnformatted( name ); } - OpenTutorial( BasicTutorialSteps.SpecialCollections ); + ImGui.Dummy( Vector2.Zero ); + DrawNewCharacterCollection(); + } + + private void DrawActiveCollectionSelectors() + { + ImGui.Dummy( _window._defaultSpace ); + var open = ImGui.CollapsingHeader( ActiveCollections, ImGuiTreeNodeFlags.DefaultOpen ); + OpenTutorial( BasicTutorialSteps.ActiveCollections ); + if( !open ) + { + return; + } + + ImGui.Dummy( _window._defaultSpace ); + DrawDefaultCollectionSelector(); + OpenTutorial( BasicTutorialSteps.DefaultCollection ); + ImGui.Dummy( _window._defaultSpace ); + + DrawSpecialAssignments(); + OpenTutorial( BasicTutorialSteps.SpecialCollections1 ); + + ImGui.Dummy( _window._defaultSpace ); + + DrawIndividualAssignments(); + OpenTutorial( BasicTutorialSteps.SpecialCollections2 ); ImGui.Dummy( _window._defaultSpace ); } @@ -263,11 +296,12 @@ public partial class ConfigWindow return; } + var width = new Vector2( ( _window._inputTextWidth.X - ImGui.GetStyle().ItemSpacing.X ) / 2, 0 ); ImGui.Dummy( _window._defaultSpace ); - DrawCurrentCollectionSelector(); + DrawCurrentCollectionSelector( width ); OpenTutorial( BasicTutorialSteps.CurrentCollection ); ImGui.Dummy( _window._defaultSpace ); - DrawNewCollectionInput(); + DrawNewCollectionInput( width ); ImGui.Dummy( _window._defaultSpace ); DrawInheritanceBlock(); OpenTutorial( BasicTutorialSteps.Inheritance ); diff --git a/Penumbra/UI/ConfigWindow.Tutorial.cs b/Penumbra/UI/ConfigWindow.Tutorial.cs index e352a91c..6962a84e 100644 --- a/Penumbra/UI/ConfigWindow.Tutorial.cs +++ b/Penumbra/UI/ConfigWindow.Tutorial.cs @@ -1,12 +1,22 @@ using System; using System.Runtime.CompilerServices; using OtterGui.Widgets; +using Penumbra.Collections; using Penumbra.UI.Classes; namespace Penumbra.UI; public partial class ConfigWindow { + public const string SelectedCollection = "Selected Collection"; + public const string DefaultCollection = "Base Collection"; + public const string ActiveCollections = "Active Collections"; + public const string GroupAssignment = "Group Assignment"; + public const string CharacterGroups = "Character Groups"; + public const string ConditionalGroup = "Group"; + public const string ConditionalIndividual = "Character"; + public const string IndividualAssignments = "Individual Assignments"; + private static void UpdateTutorialStep() { var tutorial = Tutorial.CurrentEnabledId( Penumbra.Config.TutorialStep ); @@ -38,7 +48,8 @@ public partial class ConfigWindow Inheritance, ActiveCollections, DefaultCollection, - SpecialCollections, + SpecialCollections1, + SpecialCollections2, Mods, ModImport, AdvancedHelp, @@ -75,24 +86,29 @@ public partial class ConfigWindow + "Go here after setting up your root folder to continue the tutorial!" ) .Register( "Initial Setup, Step 4: Editing Collections", "First, we need to open the Collection Settings.\n\n" + "In here, we can create new collections, delete collections, or make them inherit from each other." ) - .Register( "Initial Setup, Step 5: Current Collection", - "We should already have a Default Collection, and for our simple setup, we do not need to do anything here.\n\n" - + "The current collection is the one we are currently editing. Any changes we make in our mod settings later in the next tab will edit this collection." ) + .Register( $"Initial Setup, Step 5: {SelectedCollection}", + $"The {SelectedCollection} is the one we are currently editing. Any changes we make in our mod settings later in the next tab will edit this collection." + + $"We should already have a collection named {ModCollection.DefaultCollection} selected, and for our simple setup, we do not need to do anything here.\n\n" ) .Register( "Inheritance", "This is a more advanced feature. Click the help button for more information, but we will ignore this for now." ) - .Register( "Initial Setup, Step 6: Active Collections", "Active Collections are those that are actually in use at the moment.\n\n" - + "Any collection in use will apply to the game under certain conditions.\n\n" - + "The Current Collection is also active for technical reasons.\n\n" + .Register( $"Initial Setup, Step 6: {ActiveCollections}", + $"{ActiveCollections} are those that are actually assigned to conditions at the moment.\n\n" + + "Any collection assigned here will apply to the game under certain conditions.\n\n" + + $"The {SelectedCollection} is also active for technical reasons, while not necessarily being assigned to anything.\n\n" + "Open this now to continue." ) - .Register( "Initial Setup, Step 7: Default Collection", - "The Default Collection - which should currently also be set to a collection named Default - is the main one.\n\n" - + "As long as no more specific collection applies to something, the mods from the Default Collection will be used.\n\n" - + "This is also the collection you need to use for all UI mods." ) - .Register( "Special Collections", - "Special Collections are those that are used only for special characters in the game, either by specific conditions, or by name.\n\n" - + "We will skip this for now, but hovering over the creation buttons should explain how they work." ) + .Register( $"Initial Setup, Step 7: {DefaultCollection}", + $"The {DefaultCollection} - which should currently be set to a collection named {ModCollection.DefaultCollection} - is the main one.\n\n" + + $"As long as no more specific conditions apply to an object in the game, the mods from the {DefaultCollection} will be used.\n\n" + + "This is also the collection you need to use for all UI mods, music mods or any mods not associated with a character in the game at all." ) + .Register( GroupAssignment + 's', + "Collections assigned here are used for groups of characters for which specific conditions are met.\n\n" + + "The more specific the condition, the higher its priority (i.e. Your Character > Player Characters > Race).\n\n" + + $"{IndividualAssignments} always take precedence before groups.") + .Register( IndividualAssignments, + "Collections assigned here are used only for individual characters or NPCs that have the specified name.\n\n" + + "They may also apply to objects 'owned' by those characters, e.g. minions or mounts - see the general settings for options on this.\n\n" ) .Register( "Initial Setup, Step 8: Mods", "Our last stop is the Mods tab, where you can import and setup your mods.\n\n" - + "Please go there after verifying that your Current Collection and Default Collection are setup to your liking." ) + + $"Please go there after verifying that your {SelectedCollection} and {DefaultCollection} are setup to your liking." ) .Register( "Initial Setup, Step 9: Mod Import", "Click this button to open a file selector with which to select TTMP mod files. You can select multiple at once.\n\n" + "It is not recommended to import huge mod packs of all your TexTools mods, but rather import the mods themselves, otherwise you lose out on a lot of Penumbra features!\n\n" @@ -100,8 +116,8 @@ public partial class ConfigWindow .Register( "Advanced Help", "Click this button to get detailed information on what you can do in the mod selector.\n\n" + "Import and select a mod now to continue." ) .Register( "Mod Filters", "You can filter the available mods by name, author, changed items or various attributes here." ) - .Register( "Collection Selectors", "This row provides shortcuts to set your Current Collection.\n\n" - + "The first button sets it to your Default Collection (if any).\n\n" + .Register( "Collection Selectors", $"This row provides shortcuts to set your {SelectedCollection}.\n\n" + + $"The first button sets it to your {DefaultCollection} (if any).\n\n" + "The second button sets it to the collection the settings of the currently selected mod are inherited from (if any).\n\n" + "The third is a regular collection selector to let you choose among all your collections." ) .Register( "Initial Setup, Step 11: Enabling Mods",