Function export_range
pub fn export_range(
min: f64,
max: f64,
step: Option<f64>,
or_greater: bool,
or_less: bool,
exp: bool,
radians_as_degrees: bool,
degrees: bool,
hide_slider: bool,
suffix: Option<String>,
) -> PropertyHintInfo
Expand description
Mark an exported numerical value to use the editor’s range UI.
You’ll never call this function itself, but will instead use the macro #[export(range=(...))]
, as below. The syntax is
very similar to Godot’s @export_range
.
min
, max
, and step
are f32
positional arguments, with step
being optional and defaulting to 1.0
. The rest of
the arguments can be written in any order. The symbols of type bool
just need to have those symbols written, and those of type Option<T>
will be written as {KEY}={VALUE}
, e.g. suffix="px"
.
#[derive(GodotClass)]
#[class(init, base=Node)]
struct MyClassWithRangedValues {
#[export(range=(0.0, 400.0, 1.0, or_greater, suffix="px"))]
icon_width: i32,
#[export(range=(-180.0, 180.0, degrees))]
angle: f32,
}