Merge pull request #103295 from Arnklit/animation-editor-select-node-list-view

Add select node shortcut to list view in Animation Player Editor
This commit is contained in:
Thaddeus Crews 2025-05-16 07:43:14 -05:00
commit 0d8f33a74a
No known key found for this signature in database
GPG Key ID: 8C6E5FEB5FC03CCC
2 changed files with 16 additions and 1 deletions

View File

@ -2177,7 +2177,8 @@ void AnimationTrackEdit::_notification(int p_what) {
Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(node, "Node");
const Vector2 icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
draw_texture_rect(icon, Rect2(Point2(ofs, (get_size().height - icon_size.y) / 2).round(), icon_size));
icon_rect = Rect2(Point2(ofs, (get_size().height - check->get_height()) / 2).round(), icon->get_size());
draw_texture_rect(icon, icon_rect);
icon_cache = icon;
text = String() + node->get_name() + ":" + anim_path.get_concatenated_subnames();
@ -2805,6 +2806,10 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
return TTR("Toggle this track on/off.");
}
if (icon_rect.has_point(p_pos)) {
return TTR("Select node in scene.");
}
// Don't overlap track keys if they start at 0.
if (path_rect.has_point(p_pos + Size2(type_icon->get_width(), 0))) {
return animation->track_get_path(track);
@ -3016,6 +3021,15 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
accept_event();
}
if (icon_rect.has_point(pos)) {
EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
editor_selection->clear();
Node *n = root->get_node_or_null(node_path);
if (n) {
editor_selection->add_node(n);
}
}
// Don't overlap track keys if they start at 0.
if (path_rect.has_point(pos + Size2(type_icon->get_width(), 0))) {
clicking_on_name = true;

View File

@ -446,6 +446,7 @@ class AnimationTrackEdit : public Control {
int track = 0;
Rect2 check_rect;
Rect2 icon_rect;
Rect2 path_rect;
Rect2 update_mode_rect;