From d53dbaf81a66fb78696dd08adb71375e50d505b5 Mon Sep 17 00:00:00 2001 From: Giganzo <158825920+Giganzo@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:07:05 +0100 Subject: [PATCH] Hide EditorSpinSlider slider for VectorNI --- editor/editor_properties.cpp | 6 +++--- editor/editor_properties_vector.cpp | 3 ++- editor/editor_properties_vector.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 73f6c70f342..81af2da105d 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3663,7 +3663,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ case Variant::VECTOR2I: { EditorPropertyVector2i *editor = memnew(EditorPropertyVector2i(p_wide)); EditorPropertyRangeHint hint = _parse_range_hint(p_hint, p_hint_text, 1, true); - editor->setup(hint.min, hint.max, 1, false, p_hint == PROPERTY_HINT_LINK, hint.suffix); + editor->setup(hint.min, hint.max, 1, false, p_hint == PROPERTY_HINT_LINK, hint.suffix, false, true); return editor; } break; @@ -3690,7 +3690,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ case Variant::VECTOR3I: { EditorPropertyVector3i *editor = memnew(EditorPropertyVector3i(p_wide)); EditorPropertyRangeHint hint = _parse_range_hint(p_hint, p_hint_text, 1, true); - editor->setup(hint.min, hint.max, 1, false, p_hint == PROPERTY_HINT_LINK, hint.suffix); + editor->setup(hint.min, hint.max, 1, false, p_hint == PROPERTY_HINT_LINK, hint.suffix, false, true); return editor; } break; @@ -3704,7 +3704,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ case Variant::VECTOR4I: { EditorPropertyVector4i *editor = memnew(EditorPropertyVector4i); EditorPropertyRangeHint hint = _parse_range_hint(p_hint, p_hint_text, 1, true); - editor->setup(hint.min, hint.max, 1, false, p_hint == PROPERTY_HINT_LINK, hint.suffix); + editor->setup(hint.min, hint.max, 1, false, p_hint == PROPERTY_HINT_LINK, hint.suffix, false, true); return editor; } break; diff --git a/editor/editor_properties_vector.cpp b/editor/editor_properties_vector.cpp index 9ff8bf674d8..0ec7cf518a4 100644 --- a/editor/editor_properties_vector.cpp +++ b/editor/editor_properties_vector.cpp @@ -153,7 +153,7 @@ void EditorPropertyVectorN::_notification(int p_what) { } } -void EditorPropertyVectorN::setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_link, const String &p_suffix, bool p_radians_as_degrees) { +void EditorPropertyVectorN::setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_link, const String &p_suffix, bool p_radians_as_degrees, bool p_is_int) { radians_as_degrees = p_radians_as_degrees; for (EditorSpinSlider *spin : spin_sliders) { @@ -164,6 +164,7 @@ void EditorPropertyVectorN::setup(double p_min, double p_max, double p_step, boo spin->set_allow_greater(true); spin->set_allow_lesser(true); spin->set_suffix(p_suffix); + spin->set_editing_integer(p_is_int); } if (!p_link) { diff --git a/editor/editor_properties_vector.h b/editor/editor_properties_vector.h index 009735ae3e7..32f1abe97f5 100644 --- a/editor/editor_properties_vector.h +++ b/editor/editor_properties_vector.h @@ -62,7 +62,7 @@ protected: public: virtual void update_property() override; - void setup(double p_min, double p_max, double p_step = 1.0, bool p_hide_slider = true, bool p_link = false, const String &p_suffix = String(), bool p_radians_as_degrees = false); + void setup(double p_min, double p_max, double p_step = 1.0, bool p_hide_slider = true, bool p_link = false, const String &p_suffix = String(), bool p_radians_as_degrees = false, bool p_is_int = false); EditorPropertyVectorN(Variant::Type p_type, bool p_force_wide, bool p_horizontal); };