godot icon indicating copy to clipboard operation
godot copied to clipboard

[Shaders] Allow constants and expressions in `hint_range`

Open Chaosus opened this issue 10 months ago • 1 comments

Allows expressions in hint_range declaration:

shader_type spatial;

const float begin = 0.5;
const float end = 4.0;
const float st = 0.1;

uniform float test : hint_range(begin, end);
uniform float test2 : hint_range(0.25 + 0.25, TAU + 1.0, st);
  • Fix https://github.com/godotengine/godot/issues/101926

Chaosus avatar Feb 01 '25 15:02 Chaosus

big fan of this

maxpiepenbrink avatar Feb 05 '25 07:02 maxpiepenbrink

Thanks!

Repiteo avatar Apr 18 '25 17:04 Repiteo

The hints instance_index and hint_enum also accept parameters. Should we assume they may eventually allow expressions or at least named constants as well? I guess not with hint_enum, since only strings are allowed, and we can't set those in constants (except for macros). But what about instance_index?

geekley avatar Apr 19 '25 17:04 geekley