Fix hide_slider vs no_slider inconsistency in editor property code

This commit is contained in:
Aaron Franke 2022-10-03 11:59:33 -05:00
parent 1371a97acf
commit 094e8db97c
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
8 changed files with 55 additions and 57 deletions

View File

@ -50,7 +50,7 @@ class TypedArray;
enum PropertyHint { enum PropertyHint {
PROPERTY_HINT_NONE, ///< no hint provided. PROPERTY_HINT_NONE, ///< no hint provided.
PROPERTY_HINT_RANGE, ///< hint_text = "min,max[,step][,or_greater][,or_less][,no_slider][,radians][,degrees][,exp][,suffix:<keyword>] range. PROPERTY_HINT_RANGE, ///< hint_text = "min,max[,step][,or_greater][,or_less][,hide_slider][,radians][,degrees][,exp][,suffix:<keyword>] range.
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
PROPERTY_HINT_ENUM_SUGGESTION, ///< hint_text= "val1,val2,val3,etc" PROPERTY_HINT_ENUM_SUGGESTION, ///< hint_text= "val1,val2,val3,etc"
PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) use "attenuation" hint string to revert (flip h), "positive_only" to exclude in-out and out-in. (ie: "attenuation,positive_only") PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) use "attenuation" hint string to revert (flip h), "positive_only" to exclude in-out and out-in. (ie: "attenuation,positive_only")

View File

@ -2621,7 +2621,7 @@
</constant> </constant>
<constant name="PROPERTY_HINT_RANGE" value="1" enum="PropertyHint"> <constant name="PROPERTY_HINT_RANGE" value="1" enum="PropertyHint">
Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_less"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,or_greater,or_less"[/code]. Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_less"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,or_greater,or_less"[/code].
Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians"[/code] for editing radian angles in degrees, [code]"degrees"[/code] to hint at an angle and [code]"no_slider"[/code] to hide the slider. Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians"[/code] for editing radian angles in degrees, [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider.
</constant> </constant>
<constant name="PROPERTY_HINT_ENUM" value="2" enum="PropertyHint"> <constant name="PROPERTY_HINT_ENUM" value="2" enum="PropertyHint">
Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string. Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string.

View File

@ -1489,12 +1489,12 @@ void EditorPropertyFloat::update_property() {
void EditorPropertyFloat::_bind_methods() { void EditorPropertyFloat::_bind_methods() {
} }
void EditorPropertyFloat::setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_exp_range, bool p_greater, bool p_lesser, const String &p_suffix, bool p_angle_in_radians) { void EditorPropertyFloat::setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_exp_range, bool p_greater, bool p_lesser, const String &p_suffix, bool p_angle_in_radians) {
angle_in_radians = p_angle_in_radians; angle_in_radians = p_angle_in_radians;
spin->set_min(p_min); spin->set_min(p_min);
spin->set_max(p_max); spin->set_max(p_max);
spin->set_step(p_step); spin->set_step(p_step);
spin->set_hide_slider(p_no_slider); spin->set_hide_slider(p_hide_slider);
spin->set_exp_ratio(p_exp_range); spin->set_exp_ratio(p_exp_range);
spin->set_allow_greater(p_greater); spin->set_allow_greater(p_greater);
spin->set_allow_lesser(p_lesser); spin->set_allow_lesser(p_lesser);
@ -1797,12 +1797,12 @@ void EditorPropertyVector2::_notification(int p_what) {
} }
} }
void EditorPropertyVector2::setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_link, const String &p_suffix) { void EditorPropertyVector2::setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_link, const String &p_suffix) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -1907,12 +1907,12 @@ void EditorPropertyRect2::_notification(int p_what) {
void EditorPropertyRect2::_bind_methods() { void EditorPropertyRect2::_bind_methods() {
} }
void EditorPropertyRect2::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyRect2::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -2078,13 +2078,13 @@ void EditorPropertyVector3::_notification(int p_what) {
void EditorPropertyVector3::_bind_methods() { void EditorPropertyVector3::_bind_methods() {
} }
void EditorPropertyVector3::setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_link, const String &p_suffix, bool p_angle_in_radians) { void EditorPropertyVector3::setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_link, const String &p_suffix, bool p_angle_in_radians) {
angle_in_radians = p_angle_in_radians; angle_in_radians = p_angle_in_radians;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -2210,12 +2210,12 @@ void EditorPropertyVector2i::_notification(int p_what) {
} }
} }
void EditorPropertyVector2i::setup(int p_min, int p_max, bool p_no_slider, bool p_link, const String &p_suffix) { void EditorPropertyVector2i::setup(int p_min, int p_max, bool p_hide_slider, bool p_link, const String &p_suffix) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(1); spin[i]->set_step(1);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -2320,12 +2320,12 @@ void EditorPropertyRect2i::_notification(int p_what) {
void EditorPropertyRect2i::_bind_methods() { void EditorPropertyRect2i::_bind_methods() {
} }
void EditorPropertyRect2i::setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix) { void EditorPropertyRect2i::setup(int p_min, int p_max, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(1); spin[i]->set_step(1);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -2464,12 +2464,12 @@ void EditorPropertyVector3i::_notification(int p_what) {
void EditorPropertyVector3i::_bind_methods() { void EditorPropertyVector3i::_bind_methods() {
} }
void EditorPropertyVector3i::setup(int p_min, int p_max, bool p_no_slider, bool p_link, const String &p_suffix) { void EditorPropertyVector3i::setup(int p_min, int p_max, bool p_hide_slider, bool p_link, const String &p_suffix) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(1); spin[i]->set_step(1);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -2573,12 +2573,12 @@ void EditorPropertyPlane::_notification(int p_what) {
void EditorPropertyPlane::_bind_methods() { void EditorPropertyPlane::_bind_methods() {
} }
void EditorPropertyPlane::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyPlane::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
} }
@ -2734,12 +2734,12 @@ void EditorPropertyQuaternion::_notification(int p_what) {
void EditorPropertyQuaternion::_bind_methods() { void EditorPropertyQuaternion::_bind_methods() {
} }
void EditorPropertyQuaternion::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix, bool p_hide_editor) { void EditorPropertyQuaternion::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix, bool p_hide_editor) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
// Quaternion is inherently unitless, however someone may want to use it as // Quaternion is inherently unitless, however someone may want to use it as
@ -2882,16 +2882,14 @@ void EditorPropertyVector4::_notification(int p_what) {
void EditorPropertyVector4::_bind_methods() { void EditorPropertyVector4::_bind_methods() {
} }
void EditorPropertyVector4::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyVector4::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
// Vector4 is inherently unitless, however someone may want to use it as
// a generic way to store 4 values, so we'll still respect the suffix.
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
} }
} }
@ -2974,11 +2972,11 @@ void EditorPropertyVector4i::_notification(int p_what) {
void EditorPropertyVector4i::_bind_methods() { void EditorPropertyVector4i::_bind_methods() {
} }
void EditorPropertyVector4i::setup(double p_min, double p_max, bool p_no_slider, const String &p_suffix) { void EditorPropertyVector4i::setup(double p_min, double p_max, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -3069,12 +3067,12 @@ void EditorPropertyAABB::_notification(int p_what) {
void EditorPropertyAABB::_bind_methods() { void EditorPropertyAABB::_bind_methods() {
} }
void EditorPropertyAABB::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyAABB::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
spin[i]->set_suffix(p_suffix); spin[i]->set_suffix(p_suffix);
@ -3157,12 +3155,12 @@ void EditorPropertyTransform2D::_notification(int p_what) {
void EditorPropertyTransform2D::_bind_methods() { void EditorPropertyTransform2D::_bind_methods() {
} }
void EditorPropertyTransform2D::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyTransform2D::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
if (i % 3 == 2) { if (i % 3 == 2) {
@ -3249,12 +3247,12 @@ void EditorPropertyBasis::_notification(int p_what) {
void EditorPropertyBasis::_bind_methods() { void EditorPropertyBasis::_bind_methods() {
} }
void EditorPropertyBasis::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyBasis::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
// Basis is inherently unitless, however someone may want to use it as // Basis is inherently unitless, however someone may want to use it as
@ -3347,12 +3345,12 @@ void EditorPropertyTransform3D::_notification(int p_what) {
void EditorPropertyTransform3D::_bind_methods() { void EditorPropertyTransform3D::_bind_methods() {
} }
void EditorPropertyTransform3D::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyTransform3D::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
if (i % 4 == 3) { if (i % 4 == 3) {
@ -3453,12 +3451,12 @@ void EditorPropertyProjection::_notification(int p_what) {
void EditorPropertyProjection::_bind_methods() { void EditorPropertyProjection::_bind_methods() {
} }
void EditorPropertyProjection::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) { void EditorPropertyProjection::setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix) {
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
spin[i]->set_min(p_min); spin[i]->set_min(p_min);
spin[i]->set_max(p_max); spin[i]->set_max(p_max);
spin[i]->set_step(p_step); spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider); spin[i]->set_hide_slider(p_hide_slider);
spin[i]->set_allow_greater(true); spin[i]->set_allow_greater(true);
spin[i]->set_allow_lesser(true); spin[i]->set_allow_lesser(true);
if (i % 4 == 3) { if (i % 4 == 3) {
@ -4218,7 +4216,7 @@ static EditorPropertyRangeHint _parse_range_hint(PropertyHint p_hint, const Stri
hint.or_greater = true; hint.or_greater = true;
} else if (slice == "or_less") { } else if (slice == "or_less") {
hint.or_less = true; hint.or_less = true;
} else if (slice == "no_slider") { } else if (slice == "hide_slider") {
hint.hide_slider = true; hint.hide_slider = true;
} else if (slice == "exp") { } else if (slice == "exp") {
hint.exp_range = true; hint.exp_range = true;

View File

@ -433,7 +433,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_exp_range, bool p_greater, bool p_lesser, const String &p_suffix = String(), bool p_angle_in_radians = false); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_exp_range, bool p_greater, bool p_lesser, const String &p_suffix = String(), bool p_angle_in_radians = false);
EditorPropertyFloat(); EditorPropertyFloat();
}; };
@ -496,7 +496,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_link = false, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_link = false, const String &p_suffix = String());
EditorPropertyVector2(bool p_force_wide = false); EditorPropertyVector2(bool p_force_wide = false);
}; };
@ -513,7 +513,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyRect2(bool p_force_wide = false); EditorPropertyRect2(bool p_force_wide = false);
}; };
@ -541,7 +541,7 @@ public:
virtual void update_property() override; virtual void update_property() override;
virtual void update_using_vector(Vector3 p_vector); virtual void update_using_vector(Vector3 p_vector);
virtual Vector3 get_vector(); virtual Vector3 get_vector();
void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_link = false, const String &p_suffix = String(), bool p_angle_in_radians = false); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_link = false, const String &p_suffix = String(), bool p_angle_in_radians = false);
EditorPropertyVector3(bool p_force_wide = false); EditorPropertyVector3(bool p_force_wide = false);
}; };
@ -561,7 +561,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(int p_min, int p_max, bool p_no_slider, bool p_link = false, const String &p_suffix = String()); void setup(int p_min, int p_max, bool p_hide_slider, bool p_link = false, const String &p_suffix = String());
EditorPropertyVector2i(bool p_force_wide = false); EditorPropertyVector2i(bool p_force_wide = false);
}; };
@ -578,7 +578,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String()); void setup(int p_min, int p_max, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyRect2i(bool p_force_wide = false); EditorPropertyRect2i(bool p_force_wide = false);
}; };
@ -603,7 +603,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(int p_min, int p_max, bool p_no_slider, bool p_link = false, const String &p_suffix = String()); void setup(int p_min, int p_max, bool p_hide_slider, bool p_link = false, const String &p_suffix = String());
EditorPropertyVector3i(bool p_force_wide = false); EditorPropertyVector3i(bool p_force_wide = false);
}; };
@ -620,7 +620,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyPlane(bool p_force_wide = false); EditorPropertyPlane(bool p_force_wide = false);
}; };
@ -654,7 +654,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String(), bool p_hide_editor = false); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String(), bool p_hide_editor = false);
EditorPropertyQuaternion(); EditorPropertyQuaternion();
}; };
@ -671,7 +671,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyVector4(); EditorPropertyVector4();
}; };
@ -688,7 +688,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyVector4i(); EditorPropertyVector4i();
}; };
@ -705,7 +705,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyAABB(); EditorPropertyAABB();
}; };
@ -722,7 +722,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyTransform2D(bool p_include_origin = true); EditorPropertyTransform2D(bool p_include_origin = true);
}; };
@ -739,7 +739,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyBasis(); EditorPropertyBasis();
}; };
@ -757,7 +757,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
virtual void update_using_transform(Transform3D p_transform); virtual void update_using_transform(Transform3D p_transform);
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyTransform3D(); EditorPropertyTransform3D();
}; };
@ -775,7 +775,7 @@ protected:
public: public:
virtual void update_property() override; virtual void update_property() override;
virtual void update_using_transform(Projection p_transform); virtual void update_using_transform(Projection p_transform);
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
EditorPropertyProjection(); EditorPropertyProjection();
}; };

View File

@ -507,7 +507,7 @@
<param index="3" name="extra_hints" type="String" default="&quot;&quot;" /> <param index="3" name="extra_hints" type="String" default="&quot;&quot;" />
<description> <description>
Export a numeric property as a range value. The range must be defined by [param min] and [param max], as well as an optional [param step] and a variety of extra hints. The [param step] defaults to [code]1[/code] for integer properties. For floating-point numbers this value depends on your [code]EditorSettings.interface/inspector/default_float_step[/code] setting. Export a numeric property as a range value. The range must be defined by [param min] and [param max], as well as an optional [param step] and a variety of extra hints. The [param step] defaults to [code]1[/code] for integer properties. For floating-point numbers this value depends on your [code]EditorSettings.interface/inspector/default_float_step[/code] setting.
If hints [code]"or_greater"[/code] and [code]"or_less"[/code] are provided, the editor widget will not cap the value at range boundaries. The [code]"exp"[/code] hint will make the edited values on range to change exponentially. The [code]"no_slider"[/code] hint will hide the slider element of the editor widget. If hints [code]"or_greater"[/code] and [code]"or_less"[/code] are provided, the editor widget will not cap the value at range boundaries. The [code]"exp"[/code] hint will make the edited values on range to change exponentially. The [code]"hide_slider"[/code] hint will hide the slider element of the editor widget.
Hints also allow to indicate the units for the edited value. Using [code]"radians"[/code] you can specify that the actual value is in radians, but should be displayed in degrees in the Inspector dock. [code]"degrees"[/code] allows to add a degree sign as a unit suffix. Finally, a custom suffix can be provided using [code]"suffix:unit"[/code], where "unit" can be any string. Hints also allow to indicate the units for the edited value. Using [code]"radians"[/code] you can specify that the actual value is in radians, but should be displayed in degrees in the Inspector dock. [code]"degrees"[/code] allows to add a degree sign as a unit suffix. Finally, a custom suffix can be provided using [code]"suffix:unit"[/code], where "unit" can be any string.
See also [constant PROPERTY_HINT_RANGE]. See also [constant PROPERTY_HINT_RANGE].
[codeblock] [codeblock]

View File

@ -766,7 +766,7 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a
ScriptLanguage::CodeCompletionOption slider2("or_less", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT); ScriptLanguage::CodeCompletionOption slider2("or_less", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
slider2.insert_text = slider2.display.quote(p_quote_style); slider2.insert_text = slider2.display.quote(p_quote_style);
r_result.insert(slider2.display, slider2); r_result.insert(slider2.display, slider2);
ScriptLanguage::CodeCompletionOption slider3("no_slider", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT); ScriptLanguage::CodeCompletionOption slider3("hide_slider", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
slider3.insert_text = slider3.display.quote(p_quote_style); slider3.insert_text = slider3.display.quote(p_quote_style);
r_result.insert(slider3.display, slider3); r_result.insert(slider3.display, slider3);
} }

View File

@ -437,7 +437,7 @@ void Node2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent); ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent);
ADD_GROUP("Transform", ""); ADD_GROUP("Transform", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "position", PROPERTY_HINT_RANGE, "-99999,99999,0.001,or_less,or_greater,no_slider,suffix:px"), "set_position", "get_position"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "position", PROPERTY_HINT_RANGE, "-99999,99999,0.001,or_less,or_greater,hide_slider,suffix:px"), "set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_less,or_greater,radians"), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_less,or_greater,radians"), "set_rotation", "get_rotation");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scale", PROPERTY_HINT_LINK), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scale", PROPERTY_HINT_LINK), "set_scale", "get_scale");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "skew", PROPERTY_HINT_RANGE, "-89.9,89.9,0.1,radians"), "set_skew", "get_skew"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "skew", PROPERTY_HINT_RANGE, "-89.9,89.9,0.1,radians"), "set_skew", "get_skew");

View File

@ -1054,7 +1054,7 @@ void Node3D::_bind_methods() {
ADD_GROUP("Transform", ""); ADD_GROUP("Transform", "");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform", PROPERTY_HINT_NONE, "suffix:m", PROPERTY_USAGE_NO_EDITOR), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform", PROPERTY_HINT_NONE, "suffix:m", PROPERTY_USAGE_NO_EDITOR), "set_transform", "get_transform");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "global_transform", PROPERTY_HINT_NONE, "suffix:m", PROPERTY_USAGE_NONE), "set_global_transform", "get_global_transform"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "global_transform", PROPERTY_HINT_NONE, "suffix:m", PROPERTY_USAGE_NONE), "set_global_transform", "get_global_transform");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "position", PROPERTY_HINT_RANGE, "-99999,99999,0.001,or_greater,or_less,no_slider,suffix:m", PROPERTY_USAGE_EDITOR), "set_position", "get_position"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "position", PROPERTY_HINT_RANGE, "-99999,99999,0.001,or_greater,or_less,hide_slider,suffix:m", PROPERTY_USAGE_EDITOR), "set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_less,or_greater,radians", PROPERTY_USAGE_EDITOR), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_less,or_greater,radians", PROPERTY_USAGE_EDITOR), "set_rotation", "get_rotation");
ADD_PROPERTY(PropertyInfo(Variant::QUATERNION, "quaternion", PROPERTY_HINT_HIDE_QUATERNION_EDIT, "", PROPERTY_USAGE_EDITOR), "set_quaternion", "get_quaternion"); ADD_PROPERTY(PropertyInfo(Variant::QUATERNION, "quaternion", PROPERTY_HINT_HIDE_QUATERNION_EDIT, "", PROPERTY_USAGE_EDITOR), "set_quaternion", "get_quaternion");
ADD_PROPERTY(PropertyInfo(Variant::BASIS, "basis", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_basis", "get_basis"); ADD_PROPERTY(PropertyInfo(Variant::BASIS, "basis", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_basis", "get_basis");