-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the ability to conditionally assign attributes #16
Comments
Yes please, or just a way to set attributes programmatically. This is not allowed: struct palette_entry_t {
u24 color;
} [[inline, color(color)]]; And while there is e.g.: builtin::std::core::get_attribute_value(this, "color"); There's no |
This has been partially implemented now. It's not possible yet to assign attributes conditionally but they aren't limited to taking string literals as inputs anymore and can access the current pattern's fields |
so can i now set a palette entry to its color? |
You can indeed. Something like this should work now provided you're using the latest nightly version of ImHex #include <std/io.pat>
struct PaletteEntry {
u8 r, g, b;
} [[color(std::format("{:02X}{:02X}{:02X}", r, g, b))]]; |
nice :D i will give it a try in the png pattern |
It would be great if there's a way to conditionally assign attributes to a variable. This would be pretty nice for verifying checksums included in some file formats, where the pattern language can verify the checksum for the data chunks if the algorithm is known, and dynamically rename the variable to something like CRC(verified) and CRC(unverified) depending on the result. Currently there does not seem to be a way to implement this if the variable is a part of a struct.
The text was updated successfully, but these errors were encountered: