[Animation Panel] Add frame number when hovering on frame bars.

This commit is contained in:
Tanasart 2025-01-21 08:43:21 +07:00
parent 8877c8db59
commit c089207e4c
3 changed files with 51 additions and 28 deletions

Binary file not shown.

View file

@ -671,6 +671,9 @@ function Panel_Animation() : PanelContent() constructor {
surface_set_target(timeline_surface);
draw_clear_alpha(COLORS.panel_bg_clear, 0);
var msx = mx - bar_x;
var msy = my - bar_y;
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, bar_w, bar_h);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 2, 0, 0, bar_w, bar_h, COLORS.panel_animation_timeline_blend, 1);
@ -723,11 +726,22 @@ function Panel_Animation() : PanelContent() constructor {
if(FRAME_RANGE != noone) {
var _fr_x0 = FRAME_RANGE[0] * timeline_scale + timeline_shift - 6;
var _fr_x1 = FRAME_RANGE[1] * timeline_scale + timeline_shift + 2;
var _rng_spr = PROJECT.animator.is_simulating? THEME.ui_selection_range_sim_hori : THEME.ui_selection_range_hori;
var _rng_clr = PROJECT.animator.is_simulating? COLORS.panel_animation_range_sim : COLORS.panel_animation_range;
if(PROJECT.animator.is_simulating)
draw_sprite_stretched_ext(THEME.ui_selection_range_sim_hori, 0, _fr_x0, 0, _fr_x1 - _fr_x0, bar_h, COLORS.panel_animation_range_sim, 1);
else
draw_sprite_stretched_ext(THEME.ui_selection_range_hori, 0, _fr_x0, 0, _fr_x1 - _fr_x0, bar_h, COLORS.panel_animation_range, 1);
draw_sprite_stretched_ext(_rng_spr, 0, _fr_x0, 0, _fr_x1 - _fr_x0, bar_h, _rng_clr, 1);
}
if(pHOVER && point_in_rectangle(msx, msy, 0, 0, bar_w, bar_h)) {
var _frame_hover = round((msx - timeline_shift) / timeline_scale);
var _frame_hover_x = _frame_hover * timeline_scale + timeline_shift;
draw_set_alpha(0.5);
draw_set_color(COLORS._main_text_sub);
draw_line(_frame_hover_x, ui(15), _frame_hover_x, bar_h - PANEL_PAD);
draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text_sub);
draw_text_add(_frame_hover_x, ui(16), _frame_hover);
draw_set_alpha(1);
}
var bar_line_x = (CURRENT_FRAME + 1) * timeline_scale + timeline_shift;
@ -775,10 +789,8 @@ function Panel_Animation() : PanelContent() constructor {
PROJECT.animator.setFrame(rfrm, !key_mod_press(ALT));
timeline_show_time = CURRENT_FRAME;
if(timeline_show_time != _scrub_frame) {
if(timeline_show_time != _scrub_frame)
_scrub_frame = timeline_show_time;
}
if(mouse_release(mb_left))
timeline_scubbing = false;
@ -849,6 +861,7 @@ function Panel_Animation() : PanelContent() constructor {
timeline_scub_st = CURRENT_FRAME;
_scrub_frame = timeline_scub_st;
}
if(mouse_press(mb_right, pFOCUS)) {
__selecting_frame = clamp(round((mx - bar_x - timeline_shift) / timeline_scale), 0, TOTAL_FRAMES - 1);
@ -2291,6 +2304,16 @@ function Panel_Animation() : PanelContent() constructor {
draw_set_alpha(1);
if(pHOVER && point_in_rectangle(msx, msy, 0, 0, bar_w, hh)) {
var _frame_hover = round((msx - timeline_shift) / timeline_scale);
var _frame_hover_x = _frame_hover * timeline_scale + timeline_shift;
draw_set_alpha(0.5);
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text_sub);
draw_text_add(_frame_hover_x, PANEL_PAD, _frame_hover);
draw_set_alpha(1);
}
draw_set_color(COLORS.panel_animation_end_line);
var end_x = TOTAL_FRAMES * timeline_scale + timeline_shift;
draw_line_width(end_x, 0, end_x, ui(20), 2);

View file

@ -195,8 +195,8 @@ function Render(partial = false, runAction = false) {
LOG_IF(global.FLAG.render == 1, $"----- Finding leaf from {array_length(PROJECT.nodeTopo)} nodes -----");
RENDER_QUEUE.clear();
array_foreach(PROJECT.nodeTopo, function(n) /*=>*/ {
n.passiveDynamic = false;
// n.__nextNodes = noone;
n.passiveDynamic = false;
n.render_time = 0;
});