- [Preview Pabel] Fix error with "Save all current previews as..."

This commit is contained in:
Tanasart 2024-06-03 18:30:49 +07:00
parent 633cd9d7aa
commit fd70ca9292
2 changed files with 37 additions and 27 deletions

View file

@ -2012,7 +2012,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var ovy = ui(8); var ovy = ui(8);
if(show_view_control == 2) if(show_view_control == 2)
ovy += ui(36); ovy += ui(36);
draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub); draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub);
draw_text(w - ui(8), ovy, $"x{graph_s_to}"); draw_text(w - ui(8), ovy, $"x{graph_s_to}");
drawNodes(); drawNodes();

View file

@ -1278,13 +1278,14 @@ function Panel_Preview() : PanelContent() constructor {
var _node = getNodePreview(); var _node = getNodePreview();
#region status texts (top right) #region status texts (top right)
var _lh = line_get_height(f_p0); draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text);
var _lh = line_get_height();
if(right_menu_x == 0) right_menu_x = w - ui(8); if(right_menu_x == 0) right_menu_x = w - ui(8);
if(show_info) { if(show_info) {
if(PANEL_PREVIEW == self) { if(PANEL_PREVIEW == self) {
draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_accent); draw_set_color(COLORS._main_text_accent);
draw_text(right_menu_x, right_menu_y, __txt("Active")); draw_text(right_menu_x, right_menu_y, __txt("Active"));
right_menu_y += _lh; right_menu_y += _lh;
} }
@ -1293,13 +1294,14 @@ function Panel_Preview() : PanelContent() constructor {
if(PREFERENCES.panel_preview_show_real_fps) if(PREFERENCES.panel_preview_show_real_fps)
txt += $" / {FPS_REAL}"; txt += $" / {FPS_REAL}";
draw_set_text(f_p0, fa_right, fa_top, fps >= PROJECT.animator.framerate? COLORS._main_text_sub : COLORS._main_value_negative); draw_set_color(fps >= PROJECT.animator.framerate? COLORS._main_text_sub : COLORS._main_value_negative);
draw_text(right_menu_x, right_menu_y, txt); draw_text(right_menu_x, right_menu_y, txt);
right_menu_y += _lh; right_menu_y += _lh;
draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub); draw_set_color(COLORS._main_text_sub);
draw_text(right_menu_x, right_menu_y, $"{__txt("Frame")} {CURRENT_FRAME + 1}/{TOTAL_FRAMES}"); draw_text(right_menu_x, right_menu_y, $"{__txt("Frame")} {CURRENT_FRAME + 1}/{TOTAL_FRAMES}");
if(!d3_active) {
right_menu_y += _lh; right_menu_y += _lh;
draw_text(right_menu_x, right_menu_y, $"x{canvas_s}"); draw_text(right_menu_x, right_menu_y, $"x{canvas_s}");
@ -1315,7 +1317,7 @@ function Panel_Preview() : PanelContent() constructor {
} }
} }
if(_node != noone && !d3_active) { if(_node != noone) {
right_menu_y += _lh; right_menu_y += _lh;
var txt = $"{canvas_w} x {canvas_h}px"; var txt = $"{canvas_w} x {canvas_h}px";
if(canvas_a) txt = $"{canvas_a} x {txt}"; if(canvas_a) txt = $"{canvas_a} x {txt}";
@ -1325,6 +1327,7 @@ function Panel_Preview() : PanelContent() constructor {
right_menu_x = w - ui(8); right_menu_x = w - ui(8);
right_menu_y += _lh; right_menu_y += _lh;
} }
}
mouse_pos_string = ""; mouse_pos_string = "";
} }
@ -1979,7 +1982,6 @@ function Panel_Preview() : PanelContent() constructor {
function saveCurrentFrameToFocus() { #region function saveCurrentFrameToFocus() { #region
var prevS = getNodePreviewSurface(); var prevS = getNodePreviewSurface();
var _node = getNodePreview();
if(!is_surface(prevS)) return; if(!is_surface(prevS)) return;
if(!is_struct(PANEL_FILE)) return; if(!is_struct(PANEL_FILE)) return;
@ -1999,10 +2001,13 @@ function Panel_Preview() : PanelContent() constructor {
function saveCurrentFrame() { #region function saveCurrentFrame() { #region
var prevS = getNodePreviewSurface(); var prevS = getNodePreviewSurface();
var _node = getNodePreview(); var _node = getNodePreview();
if(_node == noone) return;
if(!is_surface(prevS)) return; if(!is_surface(prevS)) return;
var path = get_save_filename_pxc("image|*.png;*.jpg", _node.display_name == ""? "export" : _node.display_name, "Save surface as"); var path = get_save_filename_pxc("image|*.png;*.jpg", _node.display_name == ""? "export" : _node.display_name, "Save surface as");
key_release(); key_release();
if(path == "") return; if(path == "") return;
if(filename_ext(path) != ".png") path += ".png"; if(filename_ext(path) != ".png") path += ".png";
@ -2010,8 +2015,13 @@ function Panel_Preview() : PanelContent() constructor {
} #endregion } #endregion
function saveAllCurrentFrames() { #region function saveAllCurrentFrames() { #region
var _node = getNodePreview();
if(_node == noone) return;
var path = get_save_filename_pxc("image|*.png;*.jpg", _node.display_name == ""? "export" : _node.display_name, "Save surfaces as"); var path = get_save_filename_pxc("image|*.png;*.jpg", _node.display_name == ""? "export" : _node.display_name, "Save surfaces as");
key_release(); key_release();
if(path == "") return; if(path == "") return;
var ext = ".png"; var ext = ".png";