Skip to content
Merged
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
11 changes: 5 additions & 6 deletions editor/animation/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1897,12 +1897,12 @@ void AnimationTimelineEdit::_play_position_draw() {
}

float scale = get_zoom_scale();
int h = editor->box_selection_container->get_global_position().y - get_global_position().y;

int px = (-get_value() + play_position_pos) * scale + get_name_limit();

if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) {
int h = editor->box_selection_container->get_global_position().y - get_global_position().y;
Color color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));

play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
play_position->draw_texture(
get_editor_theme_icon(SNAME("TimelineIndicator")),
Expand Down Expand Up @@ -8109,9 +8109,10 @@ AnimationTrackEditor::AnimationTrackEditor() {

marker_edit = memnew(AnimationMarkerEdit);
timeline->get_child(0)->add_child(marker_edit);
// Prevents the play position from being drawn at the wrong place in specific cases.
timeline->get_child(0)->connect(SceneStringName(resized), callable_mp(marker_edit, &AnimationMarkerEdit::update_play_position));
marker_edit->set_editor(this);
marker_edit->set_timeline(timeline);
marker_edit->set_h_size_flags(SIZE_EXPAND_FILL);
marker_edit->set_anchors_and_offsets_preset(Control::LayoutPreset::PRESET_FULL_RECT);
marker_edit->set_z_index(1); // Ensure marker appears over the animation track editor.
marker_edit->connect(SceneStringName(draw), callable_mp(this, &AnimationTrackEditor::_redraw_groups));
Expand Down Expand Up @@ -8759,13 +8760,11 @@ void AnimationMarkerEdit::_play_position_draw() {
}

float scale = timeline->get_zoom_scale();
int h = get_size().height;

int px = (play_position_pos - timeline->get_value()) * scale + timeline->get_name_limit();

if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
Color color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
play_position->draw_line(Point2(px, 0), Point2(px, get_size().height), color, Math::round(2 * EDSCALE));
}
}

Expand Down