Skip to content

Commit 101b827

Browse files
committed
Merge pull request #110623 from YeldhamDev/time_manipulation
Allow resizing the length of animations by dragging the timeline
2 parents 4ce5f9c + 2a10291 commit 101b827

File tree

6 files changed

+202
-108
lines changed

6 files changed

+202
-108
lines changed

editor/animation/animation_bezier_editor.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,23 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
307307
const String &lang = _get_locale();
308308

309309
if (has_focus(true)) {
310-
draw_rect(Rect2(Point2(), get_size()), focus_color, false, Math::round(EDSCALE));
310+
draw_rect(Rect2(Point2(1, 1), get_size() - Point2(1, 1)), focus_color, false, Math::round(EDSCALE));
311311
}
312312

313-
draw_line(Point2(limit, 0), Point2(limit, get_size().height), v_line_color, Math::round(EDSCALE));
314-
315313
int right_limit = get_size().width;
316314

315+
// Unavailable timeline.
316+
{
317+
int px = (editor->get_current_animation()->get_length() - timeline->get_value()) * timeline->get_zoom_scale() + timeline->get_name_limit();
318+
px = MAX(px, timeline->get_name_limit());
319+
Rect2 rect = Rect2(px, 0, right_limit - px, get_size().height);
320+
if (rect.size.width > 0) {
321+
draw_rect(rect, Color(0, 0, 0, 0.2));
322+
}
323+
}
324+
325+
draw_line(Point2(limit, 0), Point2(limit, get_size().height), v_line_color, Math::round(EDSCALE));
326+
317327
track_v_scroll_max = v_separation;
318328

319329
int vofs = v_separation + track_v_scroll;

0 commit comments

Comments
 (0)