summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthe-sink <lucianedean@gmail.com>2023-08-30 22:10:12 -0700
committerthe-sink <lucianedean@gmail.com>2023-09-28 18:00:34 -0700
commitcbdb23e7eeaa77d14d82fabbac4772cbd951e102 (patch)
tree7fa1470506a5789c54d2586dbe5d424b49cb310f
parentbc88dca176cef6b8943ded58c68a60f7c127baea (diff)
downloadredot-engine-cbdb23e7eeaa77d14d82fabbac4772cbd951e102.tar.gz
Select node when clicked in AnimationPlayer timeline
-rw-r--r--editor/animation_track_editor.cpp16
-rw-r--r--editor/animation_track_editor.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 3aa3aa567b..ce9114a5c1 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -3244,6 +3244,22 @@ void AnimationTrackEditGroup::_notification(int p_what) {
}
}
+void AnimationTrackEditGroup::gui_input(const Ref<InputEvent> &p_event) {
+ ERR_FAIL_COND(p_event.is_null());
+
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
+ Point2 pos = mb->get_position();
+ Rect2 node_name_rect = Rect2(0, 0, timeline->get_name_limit(), get_size().height);
+
+ if (node_name_rect.has_point(pos)) {
+ EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
+ editor_selection->clear();
+ editor_selection->add_node(root->get_node(node));
+ }
+ }
+}
+
void AnimationTrackEditGroup::set_type_and_name(const Ref<Texture2D> &p_type, const String &p_name, const NodePath &p_node) {
icon = p_type;
node_name = p_name;
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index cef726f6c0..f7ee229c75 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -349,6 +349,8 @@ class AnimationTrackEditGroup : public Control {
protected:
void _notification(int p_what);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
+
public:
void set_type_and_name(const Ref<Texture2D> &p_type, const String &p_name, const NodePath &p_node);
virtual Size2 get_minimum_size() const override;