Convert remaining item color lists into palette textures - #3463
Conversation
IntegratedQuantum
left a comment
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; |
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"
|
Sure, here's the script: https://gist.github.com/yel0h/d9ccbdf51c59e3915feceff490024872 |
|
Oh thanks, looking at the script, it seems that you totally missed items that do not have a block (e.g. metal ingots which carrie already converted, so nevermind) |
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Looks good now, except from a small conversion issue for amber (which mistakenly used 9 hex digits in one of the colors, tricking your regex), but not a big deal I'm sure @careeoki will fix it once she goes through them to add better shadow colors.
|
By the way if you want to keep working on improving procedural item textures, there is also the idea to add custom small (4×4) textures for gems and stuff. |
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