[OutputBox] Now preview surface data.

This commit is contained in:
Tanasart 2024-10-05 15:39:18 +07:00
parent 31a4e7e658
commit 103bb06491
2 changed files with 16 additions and 4 deletions

View file

@ -24,6 +24,7 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(9, nodeValue_Bool("Normalize", self, false)); newInput(9, nodeValue_Bool("Normalize", self, false));
newInput(10, nodeValue_Int("Size", self, 3)) newInput(10, nodeValue_Int("Size", self, 3))
.setValidator(VV_clamp(3, 16))
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));

View file

@ -15,12 +15,23 @@ function outputBox() : widget() constructor {
draw_set_text(font, fa_left, fa_top, COLORS._main_text_sub); draw_set_text(font, fa_left, fa_top, COLORS._main_text_sub);
// if(typeof(_value) == "ref") { if(typeof(_value) == "ref" && string_starts_with(string(_value), "ref surface")) {
// var _hh = ui(96); var _hh = ui(64);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _hh, COLORS._main_icon_light);
var _sw = _w - ui(8);
var _sh = _hh - ui(8);
// return _hh; var sfw = surface_get_width(_value);
// } var sfh = surface_get_height(_value);
var ss = min(_sw / sfw, _sh / sfh);
var _sx = _x + _w / 2 - ss * sfw / 2;
var _sy = _y + _hh / 2 - ss * sfh / 2;
draw_surface_ext_safe(_value, _sx, _sy, ss, ss, 0, c_white, 1);
return _hh;
}
var _txt = string(_value); var _txt = string(_value);
var _bh = string_height("l"); var _bh = string_height("l");