Convert remaining item color lists into palette textures - #3463
Open
yel0h wants to merge 2 commits into
Open
Conversation
IntegratedQuantum
requested changes
Aug 4, 2026
IntegratedQuantum
left a comment
Member
There was a problem hiding this comment.
Also for completeness, would you mind sharing the script you used for conversion? It would be handy if someone searches for something similar in the future.
| break :validate graphics.Image.defaultImage; | ||
| } | ||
| break :validate img; | ||
| } else graphics.Image.defaultImage; |
Member
There was a problem hiding this comment.
Instead of all this complex logic for handling the default image and error printing, I'd suggest to use errors to simplify the process:
- Change the return value to
!void - at the callsite handle the error by setting some default colors:
catch |err| {
std.log.err("Could not load material colors for item {s} from paths {s} and {s}: {s}", .{self.id, path1hhawehu, path2dwdhihawdhuw, @errorName(err)});
self.outlineColorLight = 0xff00ff;
self.outlineColorDark = 0x000000;
self.colorPalette = &.{0xff00ff, 0x000000, 0xff00ff, 0x000000};
};
- all error cases in here can be replaced with a simple
return error.@"MissingAttribute: colorTexture"orreturn error.@"Color texture must be at least 2×2 pixels"orreturn error.@"Colors must be fully opaque"
Contributor
Author
|
Sure, here's the script: https://gist.github.com/yel0h/d9ccbdf51c59e3915feceff490024872 |
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.
Finishes the migration started in #3403 and #3460.
Removed the legacy
.colorsparsing fallback inMaterial.initand helpers.loadColorsFromTexturenow always resolves a color source instead of returning a.notLoadedstatus for the caller to fall back on. Missing.colorTexturefield, failed load, or invalid image (too small or with non-opaque outline pixels) all log an error and fall back tographics.Image.defaultImage.Closes #3451