Skip to content

Commit 0d8f33a

Browse files
committed
Merge pull request #103295 from Arnklit/animation-editor-select-node-list-view
Add select node shortcut to list view in Animation Player Editor
2 parents 596a8eb + fe9cca8 commit 0d8f33a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

editor/animation_track_editor.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2177,7 +2177,8 @@ void AnimationTrackEdit::_notification(int p_what) {
21772177
Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(node, "Node");
21782178
const Vector2 icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
21792179

2180-
draw_texture_rect(icon, Rect2(Point2(ofs, (get_size().height - icon_size.y) / 2).round(), icon_size));
2180+
icon_rect = Rect2(Point2(ofs, (get_size().height - check->get_height()) / 2).round(), icon->get_size());
2181+
draw_texture_rect(icon, icon_rect);
21812182
icon_cache = icon;
21822183

21832184
text = String() + node->get_name() + ":" + anim_path.get_concatenated_subnames();
@@ -2805,6 +2806,10 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
28052806
return TTR("Toggle this track on/off.");
28062807
}
28072808

2809+
if (icon_rect.has_point(p_pos)) {
2810+
return TTR("Select node in scene.");
2811+
}
2812+
28082813
// Don't overlap track keys if they start at 0.
28092814
if (path_rect.has_point(p_pos + Size2(type_icon->get_width(), 0))) {
28102815
return animation->track_get_path(track);
@@ -3016,6 +3021,15 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
30163021
accept_event();
30173022
}
30183023

3024+
if (icon_rect.has_point(pos)) {
3025+
EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
3026+
editor_selection->clear();
3027+
Node *n = root->get_node_or_null(node_path);
3028+
if (n) {
3029+
editor_selection->add_node(n);
3030+
}
3031+
}
3032+
30193033
// Don't overlap track keys if they start at 0.
30203034
if (path_rect.has_point(pos + Size2(type_icon->get_width(), 0))) {
30213035
clicking_on_name = true;

editor/animation_track_editor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ class AnimationTrackEdit : public Control {
446446
int track = 0;
447447

448448
Rect2 check_rect;
449+
Rect2 icon_rect;
449450
Rect2 path_rect;
450451

451452
Rect2 update_mode_rect;

0 commit comments

Comments
 (0)