From 2240d6c97072005f113b4bd2609b0f25ad674a71 Mon Sep 17 00:00:00 2001 From: some1one Date: Tue, 15 Oct 2024 23:22:15 -0500 Subject: [PATCH 1/6] changed mkdoc tab color to increase visibility --- docs/stylesheets/extra.css | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index ac1444ebb..ba59ef064 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -16,6 +16,25 @@ } .md-grid { - width: 100%; - max-width: 1900px; -} \ No newline at end of file + width: 100%; + max-width: 1900px; +} + +.tabbed-labels > label { + background-color: (219.29deg 73.01% 27.85% / 64%) +} + +/* the source theme uses this for selected tabs and goes out to 9 as well */ +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(1), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(2), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(3), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(4), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(5), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(6), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(7), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(8), +.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(9) +{ + background-color: #a95914c7; +} + From 6248d1db0b9a28a3656e85b37c0be8419f62e345 Mon Sep 17 00:00:00 2001 From: some1one Date: Wed, 16 Oct 2024 10:49:46 -0500 Subject: [PATCH 2/6] fixed copy paste typo --- docs/stylesheets/extra.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index ba59ef064..325c481d8 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -26,14 +26,14 @@ /* the source theme uses this for selected tabs and goes out to 9 as well */ .tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(1), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(2), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(3), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(4), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(5), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(6), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(7), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(8), -.tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(9) +.tabbed-alternate input:nth-child(2):checked ~ .tabbed-labels > :nth-child(2), +.tabbed-alternate input:nth-child(3):checked ~ .tabbed-labels > :nth-child(3), +.tabbed-alternate input:nth-child(4):checked ~ .tabbed-labels > :nth-child(4), +.tabbed-alternate input:nth-child(5):checked ~ .tabbed-labels > :nth-child(5), +.tabbed-alternate input:nth-child(6):checked ~ .tabbed-labels > :nth-child(6), +.tabbed-alternate input:nth-child(7):checked ~ .tabbed-labels > :nth-child(7), +.tabbed-alternate input:nth-child(8):checked ~ .tabbed-labels > :nth-child(8), +.tabbed-alternate input:nth-child(9):checked ~ .tabbed-labels > :nth-child(9) { background-color: #a95914c7; } From 1ec4fac96feea504e15647e13cbdc4719f411c30 Mon Sep 17 00:00:00 2001 From: some1one Date: Thu, 17 Oct 2024 10:56:46 -0500 Subject: [PATCH 3/6] changed tab colors and added drop shadow --- docs/stylesheets/extra.css | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index 325c481d8..f0eb3bc20 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -21,10 +21,10 @@ } .tabbed-labels > label { - background-color: (219.29deg 73.01% 27.85% / 64%) + background-color: var(--md-typeset-mark-color); } -/* the source theme uses this for selected tabs and goes out to 9 as well */ +/* the source theme uses this for selected tabs and goes out to 19 as well */ .tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(1), .tabbed-alternate input:nth-child(2):checked ~ .tabbed-labels > :nth-child(2), .tabbed-alternate input:nth-child(3):checked ~ .tabbed-labels > :nth-child(3), @@ -35,6 +35,20 @@ .tabbed-alternate input:nth-child(8):checked ~ .tabbed-labels > :nth-child(8), .tabbed-alternate input:nth-child(9):checked ~ .tabbed-labels > :nth-child(9) { - background-color: #a95914c7; + background-color: var(--md-primary-fg-color); + box-shadow: var(--md-shadow-z3); +} + +.md-typeset .tabbed-alternate input:nth-child(1):checked ~ .tabbed-labels > :nth-child(1), +.md-typeset .tabbed-alternate input:nth-child(2):checked ~ .tabbed-labels > :nth-child(2), +.md-typeset .tabbed-alternate input:nth-child(3):checked ~ .tabbed-labels > :nth-child(3), +.md-typeset .tabbed-alternate input:nth-child(4):checked ~ .tabbed-labels > :nth-child(4), +.md-typeset .tabbed-alternate input:nth-child(5):checked ~ .tabbed-labels > :nth-child(5), +.md-typeset .tabbed-alternate input:nth-child(6):checked ~ .tabbed-labels > :nth-child(6), +.md-typeset .tabbed-alternate input:nth-child(7):checked ~ .tabbed-labels > :nth-child(7), +.md-typeset .tabbed-alternate input:nth-child(8):checked ~ .tabbed-labels > :nth-child(8), +.md-typeset .tabbed-alternate input:nth-child(9):checked ~ .tabbed-labels > :nth-child(9) +{ + color: var(--md-accent-fg-color); } From a6ed9abda4d71903b6022fb00791fef4dda4e7f9 Mon Sep 17 00:00:00 2001 From: some1one Date: Thu, 17 Oct 2024 11:13:07 -0500 Subject: [PATCH 4/6] updated the MkDocs installation instructions --- docs/Contributing.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/Contributing.md b/docs/Contributing.md index fa8df928f..5fcf5ce60 100644 --- a/docs/Contributing.md +++ b/docs/Contributing.md @@ -45,11 +45,12 @@ This step downloads (clones) the fork you just made to your local computer. ![Cloning](images/cloning.png){ width="350" } #### Installing MkDocs -This is the documentation system Mutagen uses, so you have to install it so it can display the docs as you edit them. +This is the documentation system Mutagen uses, so you have to install it, along with the GLightbox plugin, so it can display the docs as you edit them. [Installing Material for MkDocs](https://squidfunk.github.io/mkdocs-material/getting-started/) +[Installing MkDocs GLightbox](https://blueswen.github.io/mkdocs-glightbox/) -TLDR: `pip install mkdocs-material` in a command line +TLDR: `pip install mkdocs-material mkdocs-glightbox` in a command line #### Running MkDocs Running `mkdocs serve` on your cloned Mutagen repository From c9b1b875262e727537cfcbb4f36bcc9811123dbc Mon Sep 17 00:00:00 2001 From: some1one Date: Thu, 17 Oct 2024 10:51:37 -0500 Subject: [PATCH 5/6] +added GetTopLevelMajorRecordTypesFor to MajorRecordTypeEnumerator +added a WhereNotNull IEnumerable extension *also changed the list collection type to an immutable array --- .../Extensions/EnumerableExt.cs | 5 ++++ .../Mapping/MajorRecordTypeEnumerator.cs | 29 ++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Mutagen.Bethesda.Core/Extensions/EnumerableExt.cs b/Mutagen.Bethesda.Core/Extensions/EnumerableExt.cs index f65afdcfb..300735315 100644 --- a/Mutagen.Bethesda.Core/Extensions/EnumerableExt.cs +++ b/Mutagen.Bethesda.Core/Extensions/EnumerableExt.cs @@ -4,6 +4,11 @@ namespace Mutagen.Bethesda; internal static class EnumerableExt { + public static IEnumerable WhereNotNull(this IEnumerable enumer) + { + return enumer.Where(x => x != null).Cast(); + } + public static ExtendedList CastExtendedList(this ExtendedList enumer) { return enumer; diff --git a/Mutagen.Bethesda.Core/Plugins/Records/Mapping/MajorRecordTypeEnumerator.cs b/Mutagen.Bethesda.Core/Plugins/Records/Mapping/MajorRecordTypeEnumerator.cs index b2c651546..c8579bdae 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/Mapping/MajorRecordTypeEnumerator.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/Mapping/MajorRecordTypeEnumerator.cs @@ -1,4 +1,6 @@ using System.Collections.Concurrent; +using System.Collections.Immutable; +using System.Reflection; using Loqui; using Noggog; @@ -8,14 +10,15 @@ public record RecordTypes(Type ClassType, Type GetterType, Type SetterType); public static class MajorRecordTypeEnumerator { - private static readonly ConcurrentDictionary> Registrations = new(); + private static readonly ConcurrentDictionary> MajorRecordRegistrations = new(); + private static readonly ConcurrentDictionary> TopLevelMajorRecordRegistrations = new(); static MajorRecordTypeEnumerator() { Warmup.Init(); } - private static List GetRegistrations(GameCategory cat) + private static ImmutableArray GetMajorRecordRegistrations(GameCategory cat) { var categoryString = Enums.ToStringFast((int) cat); @@ -25,11 +28,29 @@ private static List GetRegistrations(GameCategory cat) && x.ClassType.Namespace.Contains(categoryString, StringComparison.Ordinal) && x.GetterType.IsAssignableTo(typeof(IMajorRecordGetter))) .Select(x => new RecordTypes(x.ClassType, x.GetterType, x.SetterType)) - .ToList(); + .ToImmutableArray(); } public static IEnumerable GetMajorRecordTypesFor(GameCategory cat) { - return Registrations.GetOrAdd(cat, () => GetRegistrations(cat)); + return MajorRecordRegistrations.GetOrAdd(cat, () => GetMajorRecordRegistrations(cat)); + } + + private static ImmutableArray GetTopLevelMajorRecordRegistrations(GameCategory cat) + { + return cat.ToModRegistration().GetterType + .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) + .Where(p => p.PropertyType.IsGenericType && p.PropertyType.IsAssignableTo(typeof(IGroupGetter))) + .Select(p => + LoquiRegistration.StaticRegister.Registrations + .FirstOrDefault(r => r.GetterType == p.PropertyType.GetGenericArguments()[0])) + .WhereNotNull() + .Select(r => new RecordTypes(r.ClassType, r.GetterType, r.SetterType)) + .ToImmutableArray(); + } + + public static IEnumerable GetTopLevelMajorRecordTypesFor(GameCategory cat) + { + return TopLevelMajorRecordRegistrations.GetOrAdd(cat, () => GetTopLevelMajorRecordRegistrations(cat)); } } From b042889cb1077ee1e8a49f88108265d0d8a30573 Mon Sep 17 00:00:00 2001 From: some1one Date: Thu, 17 Oct 2024 11:22:08 -0500 Subject: [PATCH 6/6] added to cheatsheat --- docs/Big-Cheat-Sheet.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/Big-Cheat-Sheet.md b/docs/Big-Cheat-Sheet.md index f77d3409e..17844686d 100644 --- a/docs/Big-Cheat-Sheet.md +++ b/docs/Big-Cheat-Sheet.md @@ -312,4 +312,14 @@ foreach (var recTypes in MajorRecordTypeEnumerator.GetMajorRecordTypesFor(GameCa Console.WriteLine($"Setter: {recTypes.SetterType}"); Console.WriteLine($"Class: {recTypes.ClassType}"); } +``` + +## Find all Major Record Types for Top Level Groups +```cs +foreach (var recTypes in MajorRecordTypeEnumerator.GetTopLevelMajorRecordTypesFor(GameCategory.Skyrim)) +{ + Console.WriteLine($"Getter: {recTypes.GetterType}"); + Console.WriteLine($"Setter: {recTypes.SetterType}"); + Console.WriteLine($"Class: {recTypes.ClassType}"); +} ``` \ No newline at end of file