-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul sequence filename definitions #20580
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are changing everything up we may want a more user friendly exception for missing values. It doesn't mention where something is missing nor what
I deleted the filename field from MiG and got this
Exception of type `System.IO.FileNotFoundException`: File not found:
at OpenRA.Mods.Common.Graphics.FileNotFoundSequence.OpenRA.Graphics.ISpriteSequence.get_Tick() in /Users/gustas/Documents/GitHub/OpenRA/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs:line 112
at OpenRA.Graphics.Animation.PlaySequence(String sequenceName) in /Users/gustas/Documents/GitHub/OpenRA/OpenRA.Game/Graphics/Animation.cs:line 126
Completely unhelpful to modders
The CheckSequences lint test (or a new one) could also be used to pick up on missing values |
e711e91
to
3fb0fa8
Compare
Fixed. |
This is much better 👍. However it would be more ideal if lint test didn't display the tracelogs |
The next PR completely overhauls the way that the sprite loading and lint tests work, so can we leave that for now? |
sure |
I tried updating Treasure_Hunt.oramap.zip and the update rule crashed Crashlog
|
The update rule requires the legacy tileset metadata (which is removed in the last commit) to be defined in mod.yaml. The map updates fine if you add that back. |
Seems less than ideal. Update rules are also meant for maps, I'd even say that they're used for maps more than for mods. We should handle the crashes |
I can’t think of an acceptable way to do that - keeping unused junk data in mod.yaml isn’t acceptable, and hardcoding the upgrade rule with data for only the upstream mods isn’t really either. |
OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs
Show resolved
Hide resolved
The update rule shouldn't crash but write a proper error message - explaining what is written in the comments above: That it needs the definitions in mod.yaml and that those can be removed (again) afterwards. |
3fb0fa8
to
9b8d893
Compare
Updated.
|
0223a1c
to
bf3ca1a
Compare
In the future we should make it clearer when update rules fail / require manual changes. Currently that information is fairly hard to find within walls of text. I did run this rule on some other fairly artwork heavy maps and it seems to function well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Could there be anything done to the resource centre update function to account for the missing definitions? |
Yes, the definitions can be added back to mod.yaml on the RC engines. |
Needs a rebase / copyright header update |
Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming may or may not just be me, but there is at least one crash to fix.
OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs
Outdated
Show resolved
Hide resolved
OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs
Outdated
Show resolved
Hide resolved
OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs
Show resolved
Hide resolved
https://github.com/OpenRA/OpenRA/wiki/Sequences |
4838396
to
b2664a0
Compare
Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--check-sprite-sequences
clean. No problems in-game.
The previous MiniYaml.Merge implementation interacted poorly with yaml inheritance, making it complicated (or impossible) to override certain keys from Defaults. The new implementation is simpler: If a key is defined it will be used. If it isn't, the default (if defined) will be used. Defaults can be masked by making sure the same key is defined (even with an empty value) in the sequence. This also fixes naming within the sequence code to distinguish between images (a group of sequences), sequences (defining a specific sprite/animation), and filenames for a specific sprite/animation.
All magic behaviour for constructing sprite filenames has been removed in favour of an explicit Filename (and TilesetFilenames for tileset-specific sequences) property.
b2664a0
to
6c09805
Compare
Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is the first in a series of PRs aiming to remove technical debt from the sequence code and add features needed to finish and upstream remastered asset support.
All the magic around sprite filenames is removed in favour of explicitly specifying the full sprite name (per tileset if needed). This allows mods that don't follow the existing C&C conventions (e.g. by putting each tilesets assets in its own directory) to use tileset-specific artwork. It also prepares for a future PR that will add new ways of specifying filenames (e.g.
FilenamePattern: mytank-{:D4}.png
).The
Defaults
node was previously combined into each sequence usingMiniYaml.Merge
at sequence-parsing time. This prevented us from implementing recursive merging at theMiniYaml
level (see e.g. this complaint) because the raw sequence yaml may be malformed (e.g. trying to remove keys that don't exist) before the defaults have been copied over. This has been replaced with a much simpler fallback convention: the parser first looks for the requested key in the current sequence, and if not found it will look again inDefaults
. Sequences can override (or more correctly, mask) theDefaults
value by defining a key with no value.I suggest reviewing by commit, and reading the commit descriptions for more information.
The yaml changes in the third commit are fully automated, so it shouldn't be necessary to inspect every single line in detail. A small number of manual cleanups are specified in the fourth commit.