@@ -321,6 +321,60 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
321321 subtracks.clear ();
322322 subtrack_icons.clear ();
323323
324+ // Marker sections.
325+ {
326+ float scale = timeline->get_zoom_scale ();
327+ int limit_end = get_size ().width - timeline->get_buttons_width ();
328+
329+ PackedStringArray section = editor->get_selected_section ();
330+ if (section.size () == 2 ) {
331+ StringName start_marker = section[0 ];
332+ StringName end_marker = section[1 ];
333+ double start_time = animation->get_marker_time (start_marker);
334+ double end_time = animation->get_marker_time (end_marker);
335+
336+ // When AnimationPlayer is playing, don't move the preview rect, so it still indicates the playback section.
337+ AnimationPlayer *player = AnimationPlayerEditor::get_singleton ()->get_player ();
338+ if (editor->is_marker_moving_selection () && !(player && player->is_playing ())) {
339+ start_time += editor->get_marker_moving_selection_offset ();
340+ end_time += editor->get_marker_moving_selection_offset ();
341+ }
342+
343+ if (start_time < animation->get_length () && end_time >= 0 ) {
344+ float start_ofs = MAX (0 , start_time) - timeline->get_value ();
345+ float end_ofs = MIN (animation->get_length (), end_time) - timeline->get_value ();
346+ start_ofs = start_ofs * scale + limit;
347+ end_ofs = end_ofs * scale + limit;
348+ start_ofs = MAX (start_ofs, limit);
349+ end_ofs = MIN (end_ofs, limit_end);
350+ Rect2 rect;
351+ rect.set_position (Vector2 (start_ofs, 0 ));
352+ rect.set_size (Vector2 (end_ofs - start_ofs, get_size ().height ));
353+
354+ draw_rect (rect, Color (1 , 0.1 , 0.1 , 0.2 ));
355+ }
356+ }
357+ }
358+
359+ // Marker overlays.
360+ {
361+ float scale = timeline->get_zoom_scale ();
362+ PackedStringArray markers = animation->get_marker_names ();
363+ for (const StringName marker : markers) {
364+ double time = animation->get_marker_time (marker);
365+ if (editor->is_marker_selected (marker) && editor->is_marker_moving_selection ()) {
366+ time += editor->get_marker_moving_selection_offset ();
367+ }
368+ if (time >= 0 ) {
369+ float offset = time - timeline->get_value ();
370+ offset = offset * scale + limit;
371+ Color marker_color = animation->get_marker_color (marker);
372+ marker_color.a = 0.2 ;
373+ draw_line (Point2 (offset, 0 ), Point2 (offset, get_size ().height ), marker_color, Math::round (EDSCALE));
374+ }
375+ }
376+ }
377+
324378 RBMap<String, Vector<int >> track_indices;
325379 int track_count = animation->get_track_count ();
326380 for (int i = 0 ; i < track_count; ++i) {
0 commit comments