[Sprite Stack] Add dimension type.

This commit is contained in:
Tanasart 2024-10-14 09:39:02 +07:00
parent 6402a68364
commit 13f35d6068
7 changed files with 104 additions and 37 deletions

View File

@ -173,8 +173,8 @@
{"name":"corner","order":43,"path":"folders/shader/filter/corner.yy",},
{"name":"dither","order":53,"path":"folders/shader/filter/dither.yy",},
{"name":"edge_shade","order":44,"path":"folders/shader/filter/edge_shade.yy",},
{"name":"liquefy","order":60,"path":"folders/shader/filter/liquefy.yy",},
{"name":"jpeg","order":55,"path":"folders/shader/filter/jpeg.yy",},
{"name":"liquefy","order":60,"path":"folders/shader/filter/liquefy.yy",},
{"name":"morph","order":45,"path":"folders/shader/filter/morph.yy",},
{"name":"shadow_caster","order":46,"path":"folders/shader/filter/shadow_caster.yy",},
{"name":"shape_seperator","order":47,"path":"folders/shader/filter/shape_seperator.yy",},

View File

@ -284,8 +284,8 @@
{"$GMFolder":"","%Name":"corner","folderPath":"folders/shader/filter/corner.yy","name":"corner","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"dither","folderPath":"folders/shader/filter/dither.yy","name":"dither","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"edge_shade","folderPath":"folders/shader/filter/edge_shade.yy","name":"edge_shade","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"liquefy","folderPath":"folders/shader/filter/liquefy.yy","name":"liquefy","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"jpeg","folderPath":"folders/shader/filter/jpeg.yy","name":"jpeg","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"liquefy","folderPath":"folders/shader/filter/liquefy.yy","name":"liquefy","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"morph","folderPath":"folders/shader/filter/morph.yy","name":"morph","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"shadow_caster","folderPath":"folders/shader/filter/shadow_caster.yy","name":"shadow_caster","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"shape_seperator","folderPath":"folders/shader/filter/shape_seperator.yy","name":"shape_seperator","resourceType":"GMFolder","resourceVersion":"2.0",},

View File

@ -42,7 +42,7 @@
LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_01_0;
SAVE_VERSION = 1_18_01_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.2.004";
VERSION_STRING = MAC? "1.18.003m" : "1.18.2.005";
BUILD_NUMBER = 1_18_01_0;
HOTKEYS = ds_map_create();

View File

@ -29,13 +29,21 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
newInput(11, nodeValue_Float("Highlight alpha", self, 1))
.setDisplay(VALUE_DISPLAY.slider);
newInput(12, nodeValue_Float("Array process", self, 1))
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Individual", "Combined" ]);
newInput(12, nodeValue_Enum_Scroll("Array process", self, 1, [ "Individual", "Combined" ]));
newInput(13, nodeValue_Enum_Scroll("Output dimension type", self, OUTPUT_SCALING.constant, [
new scrollItem("Same as input"),
new scrollItem("Constant"),
new scrollItem("Relative to input").setTooltip("Set dimension as a multiple of input surface."),
new scrollItem("Fit content").setTooltip("Automatically set dimension to fit content."),
]));
newInput(14, nodeValue_Vec2("Relative dimension", self, [ 1, 1 ]));
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
input_display_list = [
["Surface", false], 0, 1, 12,
["Surface", false], 0, 13, 1, 14, 12,
["Stack", false], 2, 3, 8, 4, 5,
["Render", false], 6, 7, 9, 10,
];
@ -202,10 +210,10 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _in = _data[0];
var _dim = _data[1];
var _amo = _data[2];
var _shf = _data[3];
var _surf = _data[0];
var _dimc = _data[1];
var _amo = _data[2];
var _shf = _data[3];
var _pos = _data[4];
var _rot = _data[5];
@ -218,10 +226,45 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
var _hiA = _data[11];
var _arr = _data[12];
var _dimt = _data[13];
var _dims = _data[14];
/////////////////////////////////////// ===== DIMENSION
var _sdim = surface_get_dimension(is_array(_surf)? _surf[0] : _surf);
var _dim = _sdim;
inputs[ 1].setVisible(false);
inputs[14].setVisible(false);
switch(_dimt) {
case OUTPUT_SCALING.same_as_input :
_dim = _sdim;
break;
case OUTPUT_SCALING.constant :
inputs[ 1].setVisible(true);
_dim = _dimc;
break;
case OUTPUT_SCALING.relative :
inputs[14].setVisible(true);
_dim = [ _sdim[0] * _dims[0], _sdim[1] * _dims[1] ];
break;
}
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
var _x, _y;
///////////////////////////////////////
_pos = [ _pos[0], _pos[1] ];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
if(is_array(_in) && _arr) _amo = array_length(_in);
if(is_array(_surf) && _arr) _amo = array_length(_surf);
if(_mov) {
_pos[0] -= _shf[0] * _amo;
@ -230,9 +273,9 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
surface_set_target(_outSurf);
DRAW_CLEAR
if(is_surface(_in)) {
var _ww = surface_get_width_safe(_in);
var _hh = surface_get_height_safe(_in);
if(is_surface(_surf)) {
var _ww = surface_get_width_safe(_surf);
var _hh = surface_get_height_safe(_surf);
var _po = point_rotate(0, 0, _ww / 2, _hh / 2, _rot);
var aa = _alp;
var aa_delta = (1 - aa) / _amo;
@ -247,21 +290,22 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
shader_set_f("dimension", _ww, _hh);
shader_set_f("shift", _shf[0] / _ww, _shf[1] / _hh);
shader_set_f("angle", degtorad(_rot));
draw_surface_ext_safe(_in, _po[0] + _pos[0], _po[1] + _pos[1], 1, 1, _rot, _hiC, _color_get_alpha(_hiC));
draw_surface_ext_safe(_surf, _po[0] + _pos[0], _po[1] + _pos[1], 1, 1, _rot, _hiC, _color_get_alpha(_hiC));
shader_reset();
} else
draw_surface_ext_safe(_in, _po[0] + _pos[0], _po[1] + _pos[1], 1, 1, _rot, _col, _color_get_alpha(_col) * aa);
draw_surface_ext_safe(_surf, _po[0] + _pos[0], _po[1] + _pos[1], 1, 1, _rot, _col, _color_get_alpha(_col) * aa);
_pos[0] -= _shf[0];
_pos[1] -= _shf[1];
aa += aa_delta;
}
draw_surface_ext_safe(_in, _po[0] + _pos[0], _po[1] + _pos[1], 1, 1, _rot, c_white, aa);
} else if(is_array(_in)) {
draw_surface_ext_safe(_surf, _po[0] + _pos[0], _po[1] + _pos[1], 1, 1, _rot, c_white, aa);
} else if(is_array(_surf)) {
for(var i = 0; i < _amo; i++) {
var index = clamp(i, 0, array_length(_in) - 1);
var _surf = _in[index];
var index = clamp(i, 0, array_length(_surf) - 1);
var _surf = _surf[index];
if(!is_surface(_surf)) continue;
var _ww = surface_get_width_safe(_surf);

View File

@ -2548,13 +2548,16 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
#region draw metadata
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub);
var _zms = $"x{graph_s_to}";
var _zmw = string_width(_zms) + ui(16);
var _zmh = string_height(_zms);
var _zmx = w;
var _zmc = tb_zoom_level.selecting || tb_zoom_level.hovering || tb_zoom_level.sliding? COLORS._main_text : COLORS._main_text_sub;
var _zmsl = tb_zoom_level.selecting || tb_zoom_level.hovering || tb_zoom_level.sliding;
var _zms = $"x{graph_s_to}";
var _zmw = string_width(_zms) + ui(16);
var _zmh = string_height(_zms);
var _zmx = w;
var _zmc = _zmsl? COLORS._main_text : COLORS._main_text_sub;
if(tb_zoom_level.hovering) mouse_on_graph = false;
if(_zmsl) draw_sprite_stretched(THEME.textbox, 3, _zmx - _zmw + ui(4), ovy + ui(2), _zmw - ui(10), _zmh - ui(2));
tb_zoom_level.rx = x;
tb_zoom_level.ry = y;
tb_zoom_level.setFocusHover(pFOCUS, pHOVER);

View File

@ -4,7 +4,6 @@ function Panel_History() : PanelContent() constructor {
w = ui(400);
h = ui(480);
anchor = ANCHOR.left | ANCHOR.top;
hold = false;
w_min = 320;
@ -15,6 +14,9 @@ function Panel_History() : PanelContent() constructor {
undo_list = ds_list_create();
click_hold = noone;
sep_y = 0;
sep_y_to = 0;
function refreshList() {
ds_list_clear(redo_list);
ds_list_clear(undo_list);
@ -59,8 +61,8 @@ function Panel_History() : PanelContent() constructor {
for( var i = 0; i < amo; i++ ) {
if(i == red) {
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, 0, yy, sc_history.surface_w, ui(4), COLORS._main_accent, 1);
connect_line_st = yy + ui(2);
sep_y_to = yy;
connect_line_st = sep_y + ui(2);
_h += ui(4 + 8);
yy += ui(4 + 8);
@ -114,10 +116,10 @@ function Panel_History() : PanelContent() constructor {
for( var j = 0; j < amoDisp; j++ ) {
var _ty = yy + lh * (j + 0.5);
if(j == 3) {
draw_set_color(COLORS._main_text_sub);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text_sub);
draw_text_add(ui(32 + 12), _ty, string(array_length(item) - 3) + __txtx("more_actions", " more actions..."));
} else {
draw_set_color(COLORS._main_text);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(32 + 12), _ty, item[j].toString());
}
}
@ -127,10 +129,24 @@ function Panel_History() : PanelContent() constructor {
}
if(hovering > -1) {
draw_set_color(COLORS._main_accent);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_accent);
draw_line_width(ui(16), connect_line_st, ui(16), connect_line_ed, ui(3));
}
sep_y = lerp_float(sep_y, sep_y_to, 5);
if(red < amo - 1) {
draw_set_text(f_p2b, fa_right, fa_top, COLORS._main_text_sub);
draw_text_transformed(ui(0), sep_y + ui(2 + 8), __txt("Past"), 1, 1, 90);
}
if(red > 0) {
draw_set_text(f_p2b, fa_left, fa_top, COLORS._main_text_sub);
draw_text_transformed(ui(0), sep_y + ui(2 - 8), __txt("Future"), 1, 1, 90);
}
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, 0, sep_y, sc_history.surface_w, ui(4), COLORS._main_accent, 1);
if(mouse_release(mb_left))
click_hold = noone;
hovering = _hover;

View File

@ -1412,18 +1412,22 @@ function Panel_Preview() : PanelContent() constructor {
draw_text(right_menu_x, right_menu_y, txt);
right_menu_y += _lh;
draw_set_color(COLORS._main_text_sub);
draw_text(right_menu_x, right_menu_y, $"{__txt("Frame")} {CURRENT_FRAME + 1}/{TOTAL_FRAMES}");
var _cur_frame = CURRENT_FRAME + 1;
draw_set_color(frac(_cur_frame) == 0? COLORS._main_text_sub : COLORS._main_value_negative);
draw_text(right_menu_x, right_menu_y, $"{__txt("Frame")} {_cur_frame}/{TOTAL_FRAMES}");
if(d3_active == NODE_3D.none) {
right_menu_y += _lh;
var _zms = $"x{canvas_s}";
var _zmw = string_width(_zms) + ui(16);
var _zmx = right_menu_x + ui(8);
var _zmc = tb_zoom_level.selecting || tb_zoom_level.hovering || tb_zoom_level.sliding? COLORS._main_text : COLORS._main_text_sub;
var _zmsl = tb_zoom_level.selecting || tb_zoom_level.hovering || tb_zoom_level.sliding;
var _zms = $"x{canvas_s}";
var _zmw = string_width(_zms) + ui(16);
var _zmx = right_menu_x + ui(8);
var _zmc = _zmsl? COLORS._main_text : COLORS._main_text_sub;
if(tb_zoom_level.hovering) mouse_on_preview = false;
if(_zmsl) draw_sprite_stretched(THEME.textbox, 3, _zmx - _zmw + ui(4), right_menu_y + ui(2), _zmw - ui(10), _lh - ui(2));
tb_zoom_level.rx = x;
tb_zoom_level.ry = y;
tb_zoom_level.setFocusHover(pFOCUS, pHOVER);