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
Add FilenamePattern support to sequences. #21136
Conversation
b51c7d3
to
221dd86
Compare
Thank you for your contribution! |
Note that this feature is dealing with filenames before loading the sprite. It doesn't know or care anything about the format of the sprites to be loaded. The testcase could equally well have been loading a set of shp files (if a sprite contains multiple frames it will use the first).
No, this would need to be implemented as its own sprite format rather than as a sequence key, unless the |
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.
One fixup, otherwise LGTM.
OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs
Outdated
Show resolved
Hide resolved
221dd86
to
4706226
Compare
Fixed, rebased, and dropped testcase (after verifying the fixes do work). |
var filename = LoadField(Filename, data, defaults, out var location); | ||
|
||
var loadFrames = CalculateFrameIndices(start, length, stride ?? length ?? 0, facings, frames, transpose, reverseFacings, shadowStart); | ||
yield return new ReservationInfo(filename, loadFrames, frames, location); | ||
return new[] { new ReservationInfo(filename, loadFrames, frames, location) }; |
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.
Why did this change? I don't think I like it 🧐
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 old code made the function a generator, which wasn't compatible with the new code added above (which would otherwise have to explicitly loop over the results and yield
them). The subclasses already returned explicit enumerables so this allows the same code patterns to be used in all three places.
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.
Ah, right, the code above. Derp. Still not ideal but ok.
4706226
to
8e04118
Compare
Rebased. |
Backported from TDHD, this gives modders/mappers a simpler solution for multi-frame pngs.