Export annotation for range limits #10545
AndreaTerenz
started this conversation in
Scripting
Replies: 1 comment
-
PS: to be clear, my point is about easily editing the limits of a range. Whether those are used to randomly set a thid variable, like in a Particle Material, is beside the point |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In a
ParticleProcessMaterial
you can find many parameters that are randomly set, for each particle, to a value within a user defined range (e.g., radial acceleration or initial velocity). This is done with a UI that "visualizes" the range's limits and very easily lets you change them:Unlike any other UI element in the editor (as far as I can tell), this is not possible anywhere else, since these sliders are of a purpose-built ParticleProcessMaterialMinMaxPropertyEditor class, not used anywhere else. This also means that there is no way to
@export
a pair of variables with such a UI from a script. I propose to change that.The idea is to add a
@export_minmax
annotation, which would show that UI in the editor and be used, in code, like this:This annotation would require to be followed by two int or float variables of the same type. The "step" parameter would be optional and change the granularity of the sliders (just like with
@export_range
).Alternatively, to maintain that export annotations should be about just one variable, this could be done through
Vector2i
(forint
limits) orVector2
(forfloat
limits)Though maybe it would be awkward to think of range limits as xy components of a vector
Beta Was this translation helpful? Give feedback.
All reactions