Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select node when clicked in AnimationPlayer timeline #81188

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions editor/animation_track_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down