summaryrefslogtreecommitdiff
path: root/editor/editor_properties.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-07-23 17:27:55 +0200
committerRémi Verschelde <rverschelde@gmail.com>2019-07-23 17:31:38 +0200
commitd844e306147689c3f02473b3dd5d592bdf141023 (patch)
tree1124a98e2d55dfe351b490b7839bc96de811457e /editor/editor_properties.cpp
parent4c943cca2c6d6cd7a197cb1601a6356e65254837 (diff)
Inspector: Make default float step configurable
Also allow lifting the decimal step formatting with a hint range step of 0. A new `range_step_decimals()` is added for this to avoid breaking compatibility on the general purpose `step_decimals()` (which still returns 0 for an input step of 0). Supersedes #25470. Partial fix for #18251.
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r--editor/editor_properties.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index d54f72382c..3300228921 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2904,6 +2904,8 @@ void EditorInspectorDefaultPlugin::parse_begin(Object *p_object) {
bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) {
+ float default_float_step = EDITOR_GET("interface/inspector/default_float_step");
+
switch (p_type) {
// atomic types
@@ -3010,7 +3012,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} else {
EditorPropertyFloat *editor = memnew(EditorPropertyFloat);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
bool exp_range = false;
bool greater = true, lesser = true;
@@ -3107,7 +3109,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
case Variant::VECTOR2: {
EditorPropertyVector2 *editor = memnew(EditorPropertyVector2);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3125,7 +3127,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break; // 5
case Variant::RECT2: {
EditorPropertyRect2 *editor = memnew(EditorPropertyRect2);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3142,7 +3144,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break;
case Variant::VECTOR3: {
EditorPropertyVector3 *editor = memnew(EditorPropertyVector3);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3160,7 +3162,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break;
case Variant::TRANSFORM2D: {
EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3178,7 +3180,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break;
case Variant::PLANE: {
EditorPropertyPlane *editor = memnew(EditorPropertyPlane);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3195,7 +3197,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break;
case Variant::QUAT: {
EditorPropertyQuat *editor = memnew(EditorPropertyQuat);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3212,7 +3214,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break; // 10
case Variant::AABB: {
EditorPropertyAABB *editor = memnew(EditorPropertyAABB);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3229,7 +3231,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break;
case Variant::BASIS: {
EditorPropertyBasis *editor = memnew(EditorPropertyBasis);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -3246,7 +3248,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break;
case Variant::TRANSFORM: {
EditorPropertyTransform *editor = memnew(EditorPropertyTransform);
- double min = -65535, max = 65535, step = 0.001;
+ double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {