Open Noggog opened 4 months ago
@Noggog Has there been any progress on this specific issue? As I've mentioned before, it makes code review an absolute nightmare.
Not yet, but I'll see if i can whip up something soon
Alright, did some work on a property sorter in 2c2548ffc4863eca6be78c1ece593a5c9ee52a6d
Still need to finish the "pipeline" itself
Alright, did some work on a property sorter in 2c2548f
Still need to finish the "pipeline" itself
Is there an example on how to use it? Currently it's only in the CLI, the 2nd half of the ticket mentions a nicety to have this in the GUI, and it seems much more complicated than just simply adding -sort-script-properties to the CLI, it looks like it requires the location of where the precompiled scripts are. Why not just emplace them into a sorted set or something? That way when they're deserialized, they will be alphabetized. So long as they stay the same order from serialization to serialization, that should be good enough to not cause a Git delta in the commit.
Is there an example on how to use it?
I'll have to push a new version of spriggit for it to hit, but it would be something like:
.\Spriggit-CLI.exe sort-script-properties -i "Path/To/Mod.esp" -o "Temp/Path/To/Mod.esp" -g SkyrimSE
Where it would output the sorted mod to the temp path, which you could then pass to the serialize command as a followup
the 2nd half of the ticket mentions a nicety to have this in the GUI, and it seems much more complicated
Yeah, the pipeline would be a convenience feature for the UI to abstract away running all the commands one by one like you would in a bash script or whatever
Why not just emplace them into a sorted set or something? That way when they're deserialized, they will be alphabetized
Spriggit serializes into/from the Mutagen record definitions, which try to allow a 1:1 representation of what's in the binary file. If the mutagen definitions were to be a Set
, then it would be impossible for it to represent some binary files that had duplicate names, and be impossible to represent a file that was in an odd order. These definitions are used for a lot more than just Spriggit, so they need the ability/power to have that granularity.
So the idea of there being a sorted set is something we need to add on top of the more "raw" definitions. Lots of approaches, but the cleanest imo is to just process the raw files to be how spriggit would prefer them. Making a whole 2nd wrapper of new definitions, /w just one field being a set instead of a list seems unnecessary. There's gonna be a lot of small tweaks spriggit users will want, so just toss it on the pile of something to process before doing a seriaization
@Noggog I tried to build it myself, but I am getting Nuget errors.
Severity Code Description Project File Line Suppression State Details
Error (active) NU1102 Unable to find package Mutagen.Bethesda.Serialization with version (= 1.23.1)
- Found 49 version(s) in nuget.org [ Nearest version: 1.23.0 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages Spriggit C:\Users\Admin\Desktop\Spriggit\Spriggit\Spriggit.csproj 1
@gir489returns sorry about that! Pull dev
and try again
@gir489returns sorry about that! Pull
dev
and try again
It does not seem to be working.
PS C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\bin\Release\net8.0> .\Spriggit.CLI.exe sort-script-properties -i "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\CheatTerminal.esp" -o "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Spriggit" --GameRelease Starfield
Spriggit version 0.26.0.1-zdev+9cf526387
sort-script-properties -i D:\Backup\Stuff\Starfield\mods\Cheat Terminal\CheatTerminal.esp -o D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Spriggit --GameRelease Starfield
Error:
System.ArgumentException: Could not construct ModKey: Spriggit (Parameter 'str')
at Mutagen.Bethesda.Plugins.ModKey.FromNameAndExtension(ReadOnlySpan`1 str)
at Mutagen.Bethesda.Plugins.ModKey.FromFileName(FileName fileName)
at Mutagen.Bethesda.Plugins.ModPath..ctor(FilePath path)
at Mutagen.Bethesda.Plugins.ModPath.FromPath(FilePath path)
at Mutagen.Bethesda.Plugins.ModPath.op_Implicit(String str)
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesCommand.Run() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesCommand.cs:line 47
at Program.<>c.<<<Main>$>b__0_5>d.MoveNext() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 31
--- End of stack trace from previous location ---
at Program.<Main>$(String[] args) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 17
Could not construct ModKey: Spriggit (Parameter 'str')
at Mutagen.Bethesda.Plugins.ModKey.FromNameAndExtension(ReadOnlySpan`1 str)
at Mutagen.Bethesda.Plugins.ModKey.FromFileName(FileName fileName)
at Mutagen.Bethesda.Plugins.ModPath..ctor(FilePath path)
at Mutagen.Bethesda.Plugins.ModPath.FromPath(FilePath path)
at Mutagen.Bethesda.Plugins.ModPath.op_Implicit(String str)
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesCommand.Run() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesCommand.cs:line 47
at Program.<>c.<<<Main>$>b__0_5>d.MoveNext() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 31
--- End of stack trace from previous location ---
at Program.<Main>$(String[] args) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 17
PS C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\bin\Release\net8.0>
It wants a "normal" mod name that can be parsed into a ModKey
. Eg XYZ.esp
. Add a .esp
to your output path
It wants a "normal" mod name that can be parsed into a
ModKey
. EgXYZ.esp
. Add a.esp
to your output path
I tried making a duplicate of CheatTerminal.esp as Sorted.esp (as I think I understand what this is doing now, it's sorting it and then I desearlize the sorted ESP?)
PS C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\bin\Release\net8.0> .\Spriggit.CLI.exe sort-script-properties -i "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\CheatTerminal.esp" -o "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Sorted.esp" --GameRelease Starfield
Spriggit version 0.26.0.1-zdev+9cf526387
sort-script-properties -i D:\Backup\Stuff\Starfield\mods\Cheat Terminal\CheatTerminal.esp -o D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Sorted.esp --GameRelease Starfield
Error:
System.ArgumentException: ModKeys were misaligned: CheatTerminal.esp != Sorted.esp. Export to a file that matches the mod object's ModKey, or modify your BinaryWriteParameters.ModKey parameters to override this behavior.
at Mutagen.Bethesda.Plugins.Binary.Parameters.BinaryWriteParameters.RunMasterMatch(IModGetter mod, FilePath path)
at Mutagen.Bethesda.Starfield.StarfieldModBinaryTranslationMixIn.WriteToBinary(IStarfieldModGetter item, FilePath path, BinaryWriteParameters param, GroupMask importMask)
at Mutagen.Bethesda.Starfield.StarfieldMod.Mutagen.Bethesda.Plugins.Records.IModGetter.WriteToBinary(FilePath path, BinaryWriteParameters param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.Write(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.WriteAsync(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Plugins.Binary.Translations.FileBinaryModdedWriteBuilder`1.WriteAsync()
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesStarfield.Run(ModPath path, GameRelease release, ModPath outputPath, Nullable`1 dataFolder) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesStarfield.cs:line 139
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesCommand.Run() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesCommand.cs:line 47
at Program.<>c.<<<Main>$>b__0_5>d.MoveNext() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 31
--- End of stack trace from previous location ---
at Program.<Main>$(String[] args) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 17
ModKeys were misaligned: CheatTerminal.esp != Sorted.esp. Export to a file that matches the mod object's ModKey, or modify your BinaryWriteParameters.ModKey parameters to override this behavior.
at Mutagen.Bethesda.Plugins.Binary.Parameters.BinaryWriteParameters.RunMasterMatch(IModGetter mod, FilePath path)
at Mutagen.Bethesda.Starfield.StarfieldModBinaryTranslationMixIn.WriteToBinary(IStarfieldModGetter item, FilePath path, BinaryWriteParameters param, GroupMask importMask)
at Mutagen.Bethesda.Starfield.StarfieldMod.Mutagen.Bethesda.Plugins.Records.IModGetter.WriteToBinary(FilePath path, BinaryWriteParameters param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.Write(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.WriteAsync(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Plugins.Binary.Translations.FileBinaryModdedWriteBuilder`1.WriteAsync()
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesStarfield.Run(ModPath path, GameRelease release, ModPath outputPath, Nullable`1 dataFolder) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesStarfield.cs:line 139
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesCommand.Run() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesCommand.cs:line 47
at Program.<>c.<<<Main>$>b__0_5>d.MoveNext() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 31
--- End of stack trace from previous location ---
at Program.<Main>$(String[] args) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 17
PS C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\bin\Release\net8.0>
it's sorting it and then I desearlize the sorted ESP?
yeah, the idea is you have an unsorted esp, you run this to get a sorted one, and serialize that instead
Ah, i can probably improve the logic to be less picky for the next version, but for now, let's do this:
-o D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Sorted\CheatTerminal.esp
Where Sorted
is a folder now, and the name of the mod remains the same
Ah, i can probably improve the logic to be less picky for the next version, but for now, let's do this:
-o D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Sorted\CheatTerminal.esp
WhereSorted
is a folder now, and the name of the mod remains the same
PS C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\bin\Release\net8.0> .\Spriggit.CLI.exe sort-script-properties -i "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\CheatTerminal.esp" -o "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Sorted\CheatTerminal.esp" -g Starfield
Spriggit version 0.26.0.1-zdev+9cf526387
sort-script-properties -i D:\Backup\Stuff\Starfield\mods\Cheat Terminal\CheatTerminal.esp -o D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Sorted\CheatTerminal.esp -g Starfield
Error:
System.NotImplementedException: Writing with compression enabled is not currently supported. https://github.com/Mutagen-Modding/Mutagen/issues/235
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.<>c.<AddCompressionCheck>b__31_0(IMajorRecordGetter maj)
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.RunProcessorsOnMajorRecord(IMajorRecordGetter maj)
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.RunProcessors(IModGetter mod)
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.WriteHeader(BinaryWriteParameters param, MutagenWriter writer, IModGetter mod, IModHeaderCommon modHeader, ModKey modKey)
at Mutagen.Bethesda.Starfield.StarfieldModCommon.WriteParallel(IStarfieldModGetter item, MutagenWriter writer, BinaryWriteParameters param, ModKey modKey)
at Mutagen.Bethesda.Starfield.StarfieldModBinaryWriteTranslation.Write(MutagenWriter writer, IStarfieldModGetter item, ModKey modKey, GroupMask importMask, BinaryWriteParameters param)
at Mutagen.Bethesda.Starfield.StarfieldModBinaryTranslationMixIn.WriteToBinary(IStarfieldModGetter item, FilePath path, BinaryWriteParameters param, GroupMask importMask)
at Mutagen.Bethesda.Starfield.StarfieldMod.Mutagen.Bethesda.Plugins.Records.IModGetter.WriteToBinary(FilePath path, BinaryWriteParameters param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.Write(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.WriteAsync(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Plugins.Binary.Translations.FileBinaryModdedWriteBuilder`1.WriteAsync()
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesStarfield.Run(ModPath path, GameRelease release, ModPath outputPath, Nullable`1 dataFolder) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesStarfield.cs:line 139
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesCommand.Run() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesCommand.cs:line 47
at Program.<>c.<<<Main>$>b__0_5>d.MoveNext() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 31
--- End of stack trace from previous location ---
at Program.<Main>$(String[] args) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 17
Writing with compression enabled is not currently supported. https://github.com/Mutagen-Modding/Mutagen/issues/235
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.<>c.<AddCompressionCheck>b__31_0(IMajorRecordGetter maj)
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.RunProcessorsOnMajorRecord(IMajorRecordGetter maj)
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.RunProcessors(IModGetter mod)
at Mutagen.Bethesda.Plugins.Binary.Translations.ModHeaderWriteLogic.WriteHeader(BinaryWriteParameters param, MutagenWriter writer, IModGetter mod, IModHeaderCommon modHeader, ModKey modKey)
at Mutagen.Bethesda.Starfield.StarfieldModCommon.WriteParallel(IStarfieldModGetter item, MutagenWriter writer, BinaryWriteParameters param, ModKey modKey)
at Mutagen.Bethesda.Starfield.StarfieldModBinaryWriteTranslation.Write(MutagenWriter writer, IStarfieldModGetter item, ModKey modKey, GroupMask importMask, BinaryWriteParameters param)
at Mutagen.Bethesda.Starfield.StarfieldModBinaryTranslationMixIn.WriteToBinary(IStarfieldModGetter item, FilePath path, BinaryWriteParameters param, GroupMask importMask)
at Mutagen.Bethesda.Starfield.StarfieldMod.Mutagen.Bethesda.Plugins.Records.IModGetter.WriteToBinary(FilePath path, BinaryWriteParameters param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.Write(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Starfield.StarfieldMod.StarfieldWriteBuilderInstantiator.WriteAsync(IStarfieldModGetter mod, BinaryWriteBuilderParams`1 param)
at Mutagen.Bethesda.Plugins.Binary.Translations.FileBinaryModdedWriteBuilder`1.WriteAsync()
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesStarfield.Run(ModPath path, GameRelease release, ModPath outputPath, Nullable`1 dataFolder) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesStarfield.cs:line 139
at Spriggit.CLI.Lib.Commands.SortProperties.SortPropertiesCommand.Run() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI.Lib\Commands\SortProperties\SortPropertiesCommand.cs:line 47
at Program.<>c.<<<Main>$>b__0_5>d.MoveNext() in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 31
--- End of stack trace from previous location ---
at Program.<Main>$(String[] args) in C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\Program.cs:line 17
PS C:\Users\Admin\Desktop\Spriggit\Spriggit.CLI\bin\Release\net8.0>
Aight, pull dev
and try again:
It ran without errors, but I have to wait until I'm done with the feature I'm working on before I make a commit.
Cool! I'll be working to get this more integrated overall, but hopefully that keeps you going in the meantime
There still seems to be some randomization going on. I sorted the ESP, sent it to Git, made a commit, loaded the ESP into the CK, saved it, ran it through the sorter, serialized the sorted ESP and still some files are marked dirty.
These are still script properties that are being randomized.
Are these within the VirtualMachineAdapter of the terminal menu? Edit: Maybe reproduced, give me a few
Didn't reproduce. Red herring.
Here's a unit test flexing the sort of Terminal Menu in starfield: https://github.com/Mutagen-Modding/Spriggit/commit/efb70b19ab595fafe6de169ea973df7e8b87d913#diff-c4956256eb7a305e70915a92051ac80b6bb4e1f5aacc43e9af84263b0e58e87fR107
Is it perhaps something else at play?
The left side doesn't look sorted (Weapon
should be after Outpost
), so it makes sense that a sort pass would change it from there? Maybe the test battery got crossed somehow. I'd maybe try again and see if it keeps failing to sort?
Are these within the VirtualMachineAdapter of the terminal menu? Edit: Maybe reproduced, give me a few
They all seem to be entries within the terminal that are arrays.
This is the ESP I'm using. You can confirm what I'm seeing by simply sorting it, sending the sorted ESP to git, loading the ESP into the CK, saving, and then sorting -> git again. I've tried it at least 4 times, and the same 12 forms seem to keep being touched/randomized each time.
There seems to be a bug with the sorter. I added the dependency of sfbgs003.esm to my mod, thanks to the fact Game.GetFormFromFile doesn't work properly on Starfield. If I don't sort the ESP, YAMLs that I send to disk properly contain the sfbgs003.esm tag for their objects. If I sort the ESP, it claims those same Objects now circularly belong to my mod (CheatTerminal.ESP). If you then try to send those YAMLs back to the ESP, you will get the following error when loading:
If I sort the ESP, it claims those same Objects now circularly belong to my mod (CheatTerminal.ESP).
What command are you running for the sort CLI? Are you including the DataFolder parameter? That'll be required for Starfield (almost for every command nowadays, until #81 is done)
If omitted, the formID indices can be scrambled (One of starfield's major design flaws)
What command are you running for the sort CLI?
This.
sort-script-properties -i "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\CheatTerminal.esp" -o "D:\Backup\Stuff\Starfield\mods\Cheat Terminal\Sorted\CheatTerminal.esp" -g Starfield
alright, add -d "Path/To/Data/Folder" and see if it does better. I'll adjust the script to scream a bit more if missing for starfield
Here's what I was mentioning before about useless esoteric errors. For some reason now, Spriggit's GUI is throwing this:
What the hell does that mean? The target folder is dirtied now by only one change.
I can sync Folder -> Mod, but I can't sync Mod -> Folder.
Yeah, UI needs a repass before 1.0 #85
The CLI and/or logs will give the detail you're hoping for, at the moment. Can you upload Current.log
with the failure included?
Opening Spriggit v0.26.0+a3c9c97e9
Let's grab the 0.27 versions of the CLI/UI and give it another spin
Now it is doing the opposite! It's saying forms that belong to me now belong to sfbgs003.esm!
Can you upload your latest CheatTerminal.esp for me to look at? I've only got the one /w Starfield.esm
as a master
Can you upload your latest CheatTerminal.esp for me to look at? I've only got the one /w
Starfield.esm
as a master
Alright, pushed a fix to the sort CLI on dev
branch. Was missing a parameter pass, so the data folder wasn't getting considered in one of the steps
Alright, pushed a fix to the sort CLI on
dev
branch. Was missing a parameter pass, so the data folder wasn't getting considered in one of the steps
Yeah I saw the e-mail. I compiled it, but the issue mentioned here:
There still seems to be some randomization going on. I sorted the ESP, sent it to Git, made a commit, loaded the ESP into the CK, saved it, ran it through the sorter, serialized the sorted ESP and still some files are marked dirty.
is still existent. But the mastering issue is solved.
Cool. Yeah, i think we just need to get in the weeds on the details.. as the sorting code is hand crafted, so could be areas that I missed.
I think i got the fragments that you were showing in your previous pictures. Grab the latest cli from dev
and give it another spin. Let me know if there's any more to look at
I think i got the fragments that you were showing in your previous pictures. Grab the latest cli from
dev
and give it another spin. Let me know if there's any more to look at
Hallelujah! I can finally stop reverting YAMLs one at a time each time I make a change. Great work.
Thanks for the back and forth!
Hi @Noggog. I seem to have fleshed out another issue.
When I introduced my Items -> Misc page, I decided to not use conditionals on the terminal to reduce bloat. This seems to have thrown the sorter off for some reason? Terminals generated in this manner that are saved from the CK differ from those that are sorted.
EDIT: Nevermind, The CK was compressing my Form IDs to fit into an ESM Light.
For example, CK randomizes script properties. Some people might want that ordered, and so a preprocessor cmd could be added that did the job before flowing into the spriggit call.
Would be nice to have this in the UI somehow to where it could run these for the user as part of the single click