Skip to content

Convert remaining item color lists into palette textures - #3463

Merged
IntegratedQuantum merged 2 commits into
PixelGuys:masterfrom
yel0h:all-item-color-lists
Aug 5, 2026
Merged

Convert remaining item color lists into palette textures#3463
IntegratedQuantum merged 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

@IntegratedQuantum

IntegratedQuantum commented Aug 5, 2026

Copy link
Copy Markdown
Member

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 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.

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.

@IntegratedQuantum
IntegratedQuantum merged commit 8a03e7f into PixelGuys:master Aug 5, 2026
1 check passed
@IntegratedQuantum

Copy link
Copy Markdown
Member

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.

@yel0h
yel0h deleted the all-item-color-lists branch August 5, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Convert all item color lists into textures

3 participants