Preview window, print node

This commit is contained in:
Tanasart 2023-06-01 19:50:53 +02:00
parent bb2874e67e
commit a8ad686f6c
9 changed files with 56 additions and 8 deletions

View file

@ -296,6 +296,7 @@
{"name":"sh_polar","order":1,"path":"shaders/sh_polar/sh_polar.yy",},
{"name":"s_node_warp_mesh","order":10,"path":"sprites/s_node_warp_mesh/s_node_warp_mesh.yy",},
{"name":"sh_pixel_cloud","order":13,"path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",},
{"name":"printer","order":2,"path":"scripts/printer/printer.yy",},
{"name":"sh_de_stray","order":16,"path":"shaders/sh_de_stray/sh_de_stray.yy",},
{"name":"sh_chromatic_aberration","order":31,"path":"shaders/sh_chromatic_aberration/sh_chromatic_aberration.yy",},
{"name":"fd_rectangle_create_view","order":3,"path":"scripts/fd_rectangle_create_view/fd_rectangle_create_view.yy",},

View file

@ -1034,6 +1034,7 @@
{"id":{"name":"sh_polar","path":"shaders/sh_polar/sh_polar.yy",},},
{"id":{"name":"s_node_warp_mesh","path":"sprites/s_node_warp_mesh/s_node_warp_mesh.yy",},},
{"id":{"name":"sh_pixel_cloud","path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",},},
{"id":{"name":"printer","path":"scripts/printer/printer.yy",},},
{"id":{"name":"node_iterate","path":"scripts/node_iterate/node_iterate.yy",},},
{"id":{"name":"sh_de_stray","path":"shaders/sh_de_stray/sh_de_stray.yy",},},
{"id":{"name":"sh_chromatic_aberration","path":"shaders/sh_chromatic_aberration/sh_chromatic_aberration.yy",},},

Binary file not shown.

View file

@ -20,7 +20,7 @@ if(OS == os_windows && gameframe_is_minimized()) exit;
draw_tooltip_text(string_real(content));
break;
case VALUE_TYPE.boolean :
draw_tooltip_text(content? get_text("true", "True") : get_text("false", "False"));
draw_tooltip_text(printBool(content));
break;
case VALUE_TYPE.curve :
draw_tooltip_text("[" + get_text("tooltip_curve_object", "Curve Object") + "]");

View file

@ -52,7 +52,10 @@ function checkBox(_onClick) : widget() constructor {
} else
if(mouse_press(mb_left)) deactivate();
if(_value) draw_sprite_stretched_ext(spr, 2, _dx, _dy, ss, ss, COLORS._main_accent, aa);
if(is_array(_value))
draw_sprite_stretched_ext(spr, 3, _dx, _dy + ss / 2 - 8, ss, 16, COLORS._main_accent, aa);
else if(_value)
draw_sprite_stretched_ext(spr, 2, _dx, _dy, ss, ss, COLORS._main_accent, aa);
if(WIDGET_CURRENT == self)
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _dx - ui(3), _dy - ui(3), ss + ui(6), ss + ui(6), COLORS._main_accent, 1);

View file

@ -143,5 +143,6 @@
win.node_target = node;
win.preview_channel = node.preview_channel;
var dia = dialogPanelCall(win, mouse_mx, mouse_my);
dia.destroy_on_click_out = false;
}
#endregion

View file

@ -13,6 +13,7 @@ function Panel_Preview_Window() : PanelContent() constructor {
title_show = 0;
scale = 0;
scale_levels = [ 1/32, 1/24, 1/16, 1/12, 1/8, 1/4, 1/3, 1/2, 2/3, 1, 1.5, 2, 3, 4, 6, 8, 12, 16, 24, 32];
panx = 0;
pany = 0;
@ -116,12 +117,31 @@ function Panel_Preview_Window() : PanelContent() constructor {
if(pHOVER) {
var inc = 0.5;
if(scale > 16) inc = 2;
if(scale > 64) inc = 4;
else if(scale > 16) inc = 2;
else if(scale > 8) inc = 1;
else if(scale > 2) inc = 0.5;
else if(scale > 0.25) inc = 0.25;
else inc = 0.05;
var s = scale;
if(mouse_wheel_down()) scale = max(round(scale / inc) * inc - inc, 0.25);
if(mouse_wheel_up()) scale = min(round(scale / inc) * inc + inc, 32);
if(mouse_wheel_down()) {
for( var i = 0; i < array_length(scale_levels) - 1; i++ ) {
if(s > scale_levels[i] && s <= scale_levels[i + 1]) {
scale = scale_levels[i];
break;
}
}
}
if(mouse_wheel_up()) {
for( var i = 0; i < array_length(scale_levels) - 1; i++ ) {
if(s >= scale_levels[i] && s < scale_levels[i + 1]) {
scale = scale_levels[i + 1];
break;
}
}
}
var ds = scale - s;
panx = panx / s * scale;

View file

@ -0,0 +1,11 @@
function printBool(val) {
if(!is_array(val)) return val? get_text("true", "True") : get_text("false", "False");
var ss = "[";
for( var i = 0; i < array_length(val); i++ ) {
ss += (i? ", " : "") + printBool(val[i]);
}
ss += "]";
return ss;
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "printer",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "debug",
"path": "folders/functions/debug.yy",
},
}