Draw aggregate animation keys on top of folded node groups
Co-authored-by: Kasper Arnklit Frandsen <kasper.arnklit@gmail.com>
This commit is contained in:
@@ -3926,6 +3926,25 @@ void AnimationTrackEditGroup::_notification(int p_what) {
|
||||
const Color accent = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(2 * EDSCALE));
|
||||
}
|
||||
|
||||
if (is_group_folded) {
|
||||
for (const AnimationTrackEdit *track_edit : track_edits) {
|
||||
const Ref<Texture2D> &key_type_icon = track_edit->get_key_type_icon();
|
||||
int track = track_edit->get_track();
|
||||
for (int i = 0; i < editor->get_current_animation()->track_get_key_count(track); ++i) {
|
||||
float key_time_offset = editor->get_current_animation()->track_get_key_time(track, i) - timeline->get_value();
|
||||
int key_screen_pos = int(key_time_offset * timeline->get_zoom_scale() + limit);
|
||||
int key_limit_left = timeline->get_name_limit();
|
||||
int key_limit_right = get_size().width - timeline->get_buttons_width();
|
||||
if (key_screen_pos >= key_limit_left && key_screen_pos <= key_limit_right) {
|
||||
draw_texture(
|
||||
key_type_icon,
|
||||
Vector2(key_screen_pos - key_type_icon->get_width() / 2, (get_size().height - key_type_icon->get_height()) / 2),
|
||||
Color(1, 1, 1, 0.3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_MOUSE_EXIT: {
|
||||
|
||||
@@ -520,6 +520,7 @@ public:
|
||||
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;
|
||||
virtual String get_tooltip(const Point2 &p_pos) const override;
|
||||
|
||||
const Ref<Texture2D> &get_key_type_icon() const { return type_icon; }
|
||||
virtual int get_key_height() const;
|
||||
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
|
||||
virtual bool is_key_selectable_by_distance() const;
|
||||
|
||||
Reference in New Issue
Block a user