Skip to content

Commit fe9cca8

Browse files
committed
Add select node shortcut to list view in Animation Player Editor
1 parent cc7a951 commit fe9cca8

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
@@ -2135,7 +2135,8 @@ void AnimationTrackEdit::_notification(int p_what) {
21352135
Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(node, "Node");
21362136
const Vector2 icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
21372137

2138-
draw_texture_rect(icon, Rect2(Point2(ofs, (get_size().height - icon_size.y) / 2).round(), icon_size));
2138+
icon_rect = Rect2(Point2(ofs, (get_size().height - check->get_height()) / 2).round(), icon->get_size());
2139+
draw_texture_rect(icon, icon_rect);
21392140
icon_cache = icon;
21402141

21412142
text = String() + node->get_name() + ":" + anim_path.get_concatenated_subnames();
@@ -2749,6 +2750,10 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
27492750
return TTR("Toggle this track on/off.");
27502751
}
27512752

2753+
if (icon_rect.has_point(p_pos)) {
2754+
return TTR("Select node in scene.");
2755+
}
2756+
27522757
// Don't overlap track keys if they start at 0.
27532758
if (path_rect.has_point(p_pos + Size2(type_icon->get_width(), 0))) {
27542759
return animation->track_get_path(track);
@@ -2960,6 +2965,15 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
29602965
accept_event();
29612966
}
29622967

2968+
if (icon_rect.has_point(pos)) {
2969+
EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
2970+
editor_selection->clear();
2971+
Node *n = root->get_node_or_null(node_path);
2972+
if (n) {
2973+
editor_selection->add_node(n);
2974+
}
2975+
}
2976+
29632977
// Don't overlap track keys if they start at 0.
29642978
if (path_rect.has_point(pos + Size2(type_icon->get_width(), 0))) {
29652979
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)