From 75f7e1fbf8c7effabbc088a1bacc89ca4826da88 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 4 Mar 2022 19:59:12 +0100 Subject: [PATCH] Fix some properties having an invalid float step of `0` This also clamps the float step in the editor to the lowest value that is guaranteed to work in all situations (including for 32-bit floats). --- editor/editor_node.cpp | 4 +++- servers/audio/audio_stream.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 64665833dfb..b3b61f73c0c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6113,7 +6113,9 @@ EditorNode::EditorNode() { EDITOR_DEF_RST("interface/inspector/default_property_name_style", EditorPropertyNameProcessor::STYLE_CAPITALIZED); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_property_name_style", PROPERTY_HINT_ENUM, "Raw,Capitalized,Localized")); EDITOR_DEF_RST("interface/inspector/default_float_step", 0.001); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "interface/inspector/default_float_step", PROPERTY_HINT_RANGE, "0,1,0")); + // The lowest value is equal to the minimum float step for 32-bit floats. + // The step must be set manually, as changing this setting should not change the step here. + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "interface/inspector/default_float_step", PROPERTY_HINT_RANGE, "0.0000001,1,0.0000001")); EDITOR_DEF_RST("interface/inspector/disable_folding", false); EDITOR_DEF_RST("interface/inspector/auto_unfold_foreign_scenes", true); EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false); diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 5d9a9e61dce..0408db2539a 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -696,7 +696,7 @@ void AudioStreamRandomizer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "streams_count", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_streams_count", "get_streams_count"); ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_mode", PROPERTY_HINT_ENUM, "Random (Avoid Repeats),Random,Sequential"), "set_playback_mode", "get_playback_mode"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "random_pitch", PROPERTY_HINT_RANGE, "1,16,0.01"), "set_random_pitch", "get_random_pitch"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "random_volume_offset_db", PROPERTY_HINT_RANGE, "0,40,0,suffix:dB"), "set_random_volume_offset_db", "get_random_volume_offset_db"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "random_volume_offset_db", PROPERTY_HINT_RANGE, "0,40,0.01,suffix:dB"), "set_random_volume_offset_db", "get_random_volume_offset_db"); BIND_ENUM_CONSTANT(PLAYBACK_RANDOM_NO_REPEATS); BIND_ENUM_CONSTANT(PLAYBACK_RANDOM);