Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion editor/gui/editor_spin_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
pre_grab_value = get_max();
}

double new_value = pre_grab_value + get_step() * grabbing_spinner_dist_cache;
// Prevent dragging properties with very precise steps from being agonizingly slow.
const double default_float_step = EDITOR_GET("interface/inspector/default_float_step");
const double drag_step = MAX(get_step(), default_float_step);
const double new_value = pre_grab_value + drag_step * grabbing_spinner_dist_cache;
set_value((mm->is_command_or_control_pressed() && !editing_integer) ? Math::round(new_value) : new_value);
}
} else if (updown_offset != -1) {
Expand Down
9 changes: 8 additions & 1 deletion editor/inspector/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4029,7 +4029,14 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_
} break;
case Variant::QUATERNION: {
EditorPropertyQuaternion *editor = memnew(EditorPropertyQuaternion);
editor->setup(_parse_range_hint(p_hint, p_hint_text, default_float_step), p_hint == PROPERTY_HINT_HIDE_QUATERNION_EDIT);
// Quaternions are almost never used for human-readable values that need stepifying,
// so we should be more precise with their step, as much as the float precision allows.
#ifdef REAL_T_IS_DOUBLE
constexpr double QUATERNION_STEP = 1e-14;
#else
constexpr double QUATERNION_STEP = 1e-6;
#endif
editor->setup(_parse_range_hint(p_hint, p_hint_text, QUATERNION_STEP), p_hint == PROPERTY_HINT_HIDE_QUATERNION_EDIT);
return editor;
} break;
case Variant::AABB: {
Expand Down
13 changes: 12 additions & 1 deletion editor/scene/3d/skeleton_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,18 @@ void BonePropertiesEditor::create_editors() {

// Rotation property.
rotation_property = memnew(EditorPropertyQuaternion());
rotation_property->setup(large_range_hint);
// Quaternions are almost never used for human-readable values that need stepifying,
// so we should be more precise with their step, as much as the float precision allows.
#ifdef REAL_T_IS_DOUBLE
constexpr double QUATERNION_STEP = 1e-14;
#else
constexpr double QUATERNION_STEP = 1e-6;
#endif
EditorPropertyRangeHint quaternion_range_hint;
quaternion_range_hint.min = -1.0;
quaternion_range_hint.max = 1.0;
quaternion_range_hint.step = QUATERNION_STEP;
rotation_property->setup(quaternion_range_hint);
rotation_property->set_label("Rotation");
rotation_property->set_selectable(false);
rotation_property->connect("property_changed", callable_mp(this, &BonePropertiesEditor::_value_changed));
Expand Down