diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-11-21 05:02:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-21 05:02:23 +0000 |
commit | c5b1645e60a59c0292c04bece3fdb0715a61afea (patch) | |
tree | b03c5b5de96e29ffb7e1b008912d21aba5629bc5 /scene | |
parent | fd9045fe09e9bea691f0169c16d45cbebddb6bba (diff) | |
parent | 9857e4762b8d076259c4be863ba9f53df306d940 (diff) | |
download | redot-engine-c5b1645e60a59c0292c04bece3fdb0715a61afea.tar.gz |
Merge pull request #875 from Spartan322/merge/9e60984
Merge commit godotengine/godot@9e60984
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/mesh_instance_3d.cpp | 15 | ||||
-rw-r--r-- | scene/gui/spin_box.cpp | 6 | ||||
-rw-r--r-- | scene/gui/spin_box.h | 1 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 26 |
4 files changed, 24 insertions, 24 deletions
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index eaa4cd7343..67654bf40c 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -89,17 +89,9 @@ bool MeshInstance3D::_get(const StringName &p_name, Variant &r_ret) const { } void MeshInstance3D::_get_property_list(List<PropertyInfo> *p_list) const { - List<String> ls; - for (const KeyValue<StringName, int> &E : blend_shape_properties) { - ls.push_back(E.key); - } - - ls.sort(); - - for (const String &E : ls) { - p_list->push_back(PropertyInfo(Variant::FLOAT, E, PROPERTY_HINT_RANGE, "-1,1,0.00001")); + for (uint32_t i = 0; i < blend_shape_tracks.size(); i++) { + p_list->push_back(PropertyInfo(Variant::FLOAT, vformat("blend_shapes/%s", String(mesh->get_blend_shape_name(i))), PROPERTY_HINT_RANGE, "-1,1,0.00001")); } - if (mesh.is_valid()) { for (int i = 0; i < mesh->get_surface_count(); i++) { p_list->push_back(PropertyInfo(Variant::OBJECT, vformat("%s/%d", PNAME("surface_material_override"), i), PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial", PROPERTY_USAGE_DEFAULT)); @@ -144,6 +136,7 @@ int MeshInstance3D::get_blend_shape_count() const { } return mesh->get_blend_shape_count(); } + int MeshInstance3D::find_blend_shape_by_name(const StringName &p_name) { if (mesh.is_null()) { return -1; @@ -155,11 +148,13 @@ int MeshInstance3D::find_blend_shape_by_name(const StringName &p_name) { } return -1; } + float MeshInstance3D::get_blend_shape_value(int p_blend_shape) const { ERR_FAIL_COND_V(mesh.is_null(), 0.0); ERR_FAIL_INDEX_V(p_blend_shape, (int)blend_shape_tracks.size(), 0); return blend_shape_tracks[p_blend_shape]; } + void MeshInstance3D::set_blend_shape_value(int p_blend_shape, float p_value) { ERR_FAIL_COND(mesh.is_null()); ERR_FAIL_INDEX(p_blend_shape, (int)blend_shape_tracks.size()); diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 895f9907ad..4e75cc2c45 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -547,6 +547,12 @@ void SpinBox::_set_step_no_signal(double p_step) { set_block_signals(false); } +void SpinBox::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "exp_edit") { + p_property.usage = PROPERTY_USAGE_NONE; + } +} + void SpinBox::_bind_methods() { ClassDB::bind_method(D_METHOD("set_horizontal_alignment", "alignment"), &SpinBox::set_horizontal_alignment); ClassDB::bind_method(D_METHOD("get_horizontal_alignment"), &SpinBox::get_horizontal_alignment); diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h index 17efa331cf..60f93a0f19 100644 --- a/scene/gui/spin_box.h +++ b/scene/gui/spin_box.h @@ -141,6 +141,7 @@ class SpinBox : public Range { protected: virtual void gui_input(const Ref<InputEvent> &p_event) override; void _value_changed(double p_value) override; + void _validate_property(PropertyInfo &p_property) const; void _notification(int p_what); static void _bind_methods(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 8a48b99040..dabd1dbe07 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1938,21 +1938,19 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } } - // If the tooltip timer isn't running, start it. - // Otherwise, only reset the timer if the mouse has moved more than 5 pixels. - if (!is_tooltip_shown && over->can_process() && - (gui.tooltip_timer.is_null() || - Math::is_zero_approx(gui.tooltip_timer->get_time_left()) || - mm->get_relative().length() > 5.0)) { - if (gui.tooltip_timer.is_valid()) { - gui.tooltip_timer->release_connections(); - gui.tooltip_timer = Ref<SceneTreeTimer>(); + // Reset the timer if the mouse has moved more than 5 pixels or has entered a new control. + if (!is_tooltip_shown && over->can_process()) { + Vector2 new_tooltip_pos = over->get_screen_transform().xform(pos); + if (over != gui.tooltip_control || gui.tooltip_pos.distance_squared_to(new_tooltip_pos) > 25) { + if (gui.tooltip_timer.is_valid()) { + gui.tooltip_timer->release_connections(); + } + gui.tooltip_control = over; + gui.tooltip_pos = new_tooltip_pos; + gui.tooltip_timer = get_tree()->create_timer(gui.tooltip_delay); + gui.tooltip_timer->set_ignore_time_scale(true); + gui.tooltip_timer->connect("timeout", callable_mp(this, &Viewport::_gui_show_tooltip)); } - gui.tooltip_control = over; - gui.tooltip_pos = over->get_screen_transform().xform(pos); - gui.tooltip_timer = get_tree()->create_timer(gui.tooltip_delay); - gui.tooltip_timer->set_ignore_time_scale(true); - gui.tooltip_timer->connect("timeout", callable_mp(this, &Viewport::_gui_show_tooltip)); } } |