Skip to content

Convert remaining item color lists into palette textures - #3463

Open
yel0h wants to merge 2 commits into
PixelGuys:masterfrom
yel0h:all-item-color-lists
Open

Convert remaining item color lists into palette textures#3463
yel0h wants to merge 2 commits into
PixelGuys:masterfrom
yel0h:all-item-color-lists

Conversation

@yel0h

@yel0h yel0h commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Finishes the migration started in #3403 and #3460.

Removed the legacy .colors parsing fallback in Material.init and helpers. loadColorsFromTexture now always resolves a color source instead of returning a .notLoaded status for the caller to fall back on. Missing .colorTexture field, failed load, or invalid image (too small or with non-opaque outline pixels) all log an error and fall back to graphics.Image.defaultImage.

Closes #3451

@careeoki careeoki moved this to Low Priority in PRs to review Aug 3, 2026

@IntegratedQuantum IntegratedQuantum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/items.zig Outdated
break :validate graphics.Image.defaultImage;
}
break :validate img;
} else graphics.Image.defaultImage;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of all this complex logic for handling the default image and error printing, I'd suggest to use errors to simplify the process:

  1. Change the return value to !void
  2. 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};
};
  1. all error cases in here can be replaced with a simple return error.@"MissingAttribute: colorTexture" or return error.@"Color texture must be at least 2×2 pixels" or return error.@"Colors must be fully opaque"

@IntegratedQuantum IntegratedQuantum moved this from Low Priority to In review in PRs to review Aug 4, 2026
@yel0h

yel0h commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Convert all item color lists into textures

3 participants