ImportGraphics, ImportGraphicsAdvanced: trim texture pages items, credit ImportGraphicsWithParameters' creator#2083
Merged
colinator27 merged 2 commits intoUnderminersTeam:masterfrom Apr 5, 2025
Conversation
This makes imported sprite fonts not break, as well as saving on texture page space.
|
Download the artifacts for this pull request here: GUI:
CLI: |
colinator27
approved these changes
Apr 5, 2025
Member
colinator27
left a comment
There was a problem hiding this comment.
Seems to work great! As an additional note, I'll probably be adding some texture packing (and related) utilities to the library proper as part of the project system. Hopefully should consolidate a lot of the duplicated code across these two scripts, and others.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ImportGraphics.csx and ImportGraphicsAdvanced.csx now trims the textures of imported sprites (and adjusts the appropriate page item properties), which saves on texture page space, matches GameMaker's behavior better and fixes importing proprtional sprite fonts. The margin left/right/top/bottom properties are also now somewhat properly calculated (they are properly calculated for new sprites, but for existing ones they are only ever grown and never shrinked).
I also changed the header comments in ImportGraphicsAdvanced to credit the actual creator of the original ImportGraphicsWithParameters, @DonavinDraws. Maybe mention him too (alongside me) when the ImportGraphicsAdvanced script is mentioned on the next release's changelog.

I found him by looking for the earliest time ImportGraphicsWithParameters.csx was sent in the PTD with B&H Discord server (a Pizza Tower server), and I also DMed him to confirm it:
(this DM was posted with permission from him, by the way)
Output example with a few random sprites
Old:


New:
Caveats
Something happened to the indentation in ImportGraphicsAdvanced, not sure how that happened (probably through Visual Studio doing some autoformatting). The diff is more readable if you turn on the ignore whitespace option.
I also didn't test much.
Notes
Coincidentally, Donavin himself was also developing ImportGraphicsWithParameters further (which I was completely unaware of; it's also in the PTD with B&H server), re-incorparating my ImportGraphicsWithParametersPlus changes back into his and adding an independent implementation of texture trimming before me. However it was before the texture refactor so it isn't really useful here. I just thought it was interesting.