|
@@ -321,6 +321,60 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|
|
subtracks.clear();
|
|
|
subtrack_icons.clear();
|
|
|
|
|
|
+ // Marker sections.
|
|
|
+ {
|
|
|
+ float scale = timeline->get_zoom_scale();
|
|
|
+ int limit_end = get_size().width - timeline->get_buttons_width();
|
|
|
+
|
|
|
+ PackedStringArray section = editor->get_selected_section();
|
|
|
+ if (section.size() == 2) {
|
|
|
+ StringName start_marker = section[0];
|
|
|
+ StringName end_marker = section[1];
|
|
|
+ double start_time = animation->get_marker_time(start_marker);
|
|
|
+ double end_time = animation->get_marker_time(end_marker);
|
|
|
+
|
|
|
+ // When AnimationPlayer is playing, don't move the preview rect, so it still indicates the playback section.
|
|
|
+ AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
|
|
|
+ if (editor->is_marker_moving_selection() && !(player && player->is_playing())) {
|
|
|
+ start_time += editor->get_marker_moving_selection_offset();
|
|
|
+ end_time += editor->get_marker_moving_selection_offset();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (start_time < animation->get_length() && end_time >= 0) {
|
|
|
+ float start_ofs = MAX(0, start_time) - timeline->get_value();
|
|
|
+ float end_ofs = MIN(animation->get_length(), end_time) - timeline->get_value();
|
|
|
+ start_ofs = start_ofs * scale + limit;
|
|
|
+ end_ofs = end_ofs * scale + limit;
|
|
|
+ start_ofs = MAX(start_ofs, limit);
|
|
|
+ end_ofs = MIN(end_ofs, limit_end);
|
|
|
+ Rect2 rect;
|
|
|
+ rect.set_position(Vector2(start_ofs, 0));
|
|
|
+ rect.set_size(Vector2(end_ofs - start_ofs, get_size().height));
|
|
|
+
|
|
|
+ draw_rect(rect, Color(1, 0.1, 0.1, 0.2));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Marker overlays.
|
|
|
+ {
|
|
|
+ float scale = timeline->get_zoom_scale();
|
|
|
+ PackedStringArray markers = animation->get_marker_names();
|
|
|
+ for (const StringName marker : markers) {
|
|
|
+ double time = animation->get_marker_time(marker);
|
|
|
+ if (editor->is_marker_selected(marker) && editor->is_marker_moving_selection()) {
|
|
|
+ time += editor->get_marker_moving_selection_offset();
|
|
|
+ }
|
|
|
+ if (time >= 0) {
|
|
|
+ float offset = time - timeline->get_value();
|
|
|
+ offset = offset * scale + limit;
|
|
|
+ Color marker_color = animation->get_marker_color(marker);
|
|
|
+ marker_color.a = 0.2;
|
|
|
+ draw_line(Point2(offset, 0), Point2(offset, get_size().height), marker_color, Math::round(EDSCALE));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
RBMap<String, Vector<int>> track_indices;
|
|
|
int track_count = animation->get_track_count();
|
|
|
for (int i = 0; i < track_count; ++i) {
|