1.13 prerelease

This commit is contained in:
Tanasart 2023-02-14 19:44:46 +07:00
parent 6ac06794fb
commit b63ebf6c12
25 changed files with 264 additions and 146 deletions

View file

@ -1089,6 +1089,8 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"group","folderPath":"folders/nodes/data/group.yy","order":6,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"IO","folderPath":"folders/nodes/data/IO.yy","order":0,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"iterate","folderPath":"folders/nodes/data/iterate.yy","order":10,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"for each","folderPath":"folders/nodes/data/iterate/for each.yy","order":1,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"for","folderPath":"folders/nodes/data/iterate/for.yy","order":0,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"lua","folderPath":"folders/nodes/data/lua.yy","order":17,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"node","folderPath":"folders/nodes/data/node.yy","order":11,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"render","folderPath":"folders/nodes/data/render.yy","order":2,},
@ -1144,8 +1146,6 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Steamworks","folderPath":"folders/Steamworks.yy","order":0,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"UGC","folderPath":"folders/Steamworks/UGC.yy","order":0,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy","order":6,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"for","folderPath":"folders/nodes/data/iterate/for.yy","order":0,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"for each","folderPath":"folders/nodes/data/iterate/for each.yy","order":1,},
],
"AudioGroups": [
{"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,},

View file

@ -6,10 +6,23 @@ event_inherited();
dialog_h = ui(396);
destroy_on_click_out = true;
name = "Color selector";
name = get_text("color_selector_title", "Color selector");
previous_color = c_black;
selector = new colorSelector();
function setDefault(color) {
selector.setColor(color);
previous_color = color;
}
b_cancel = button(function() {
onApply(previous_color);
DIALOG_CLICK = false;
instance_destroy();
}).setIcon(THEME.revert, 0, COLORS._main_icon)
.setTooltip("Revert and exit");
b_apply = button(function() {
onApply(selector.current_color);
DIALOG_CLICK = false;

View file

@ -23,7 +23,7 @@ if !ready exit;
draw_sprite_stretched_ext(THEME.dialog_active, 0, content_x, dialog_y, content_w, dialog_h, COLORS._main_accent, 1);
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_title);
draw_text(presets_x + ui(24), dialog_y + ui(16), "Palettes");
draw_text(presets_x + ui(24), dialog_y + ui(16), get_text("palette", "Palettes"));
draw_text(content_x + ui(24), dialog_y + ui(16), name);
#endregion
@ -36,11 +36,11 @@ if !ready exit;
var bx = presets_x + presets_w - ui(44);
var by = dialog_y + ui(12);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Refresh", THEME.refresh) == 2)
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("refresh", "Refresh"), THEME.refresh) == 2)
presetCollect();
bx -= ui(32);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Open palette folder", THEME.folder) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("color_selector_open_palette", "Open palette folder"), THEME.folder) == 2) {
var _realpath = environment_get_variable("LOCALAPPDATA") + "\\Pixels_Composer\\Palettes";
var _windir = environment_get_variable("WINDIR") + "\\explorer.exe";
execute_shell(_windir, _realpath);
@ -63,4 +63,10 @@ if !ready exit;
b_apply.hover = sHOVER;
b_apply.active = sFOCUS;
b_apply.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_lime);
bx -= ui(48);
b_cancel.register();
b_cancel.hover = sHOVER;
b_cancel.active = sFOCUS;
b_cancel.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_hide);
#endregion

View file

@ -5,7 +5,7 @@ event_inherited();
dialog_w = ui(1068);
dialog_h = ui(476);
name = "Gradient editor";
name = get_text("gradient_editor_title", "Gradient editor");
gradient = noone;
grad_data = noone;
@ -26,36 +26,61 @@ event_inherited();
if(key_selecting == noone) return;
key_selecting.value = color;
}
function setGradient(grad, data) {
gradient = grad;
grad_data = data;
if(!ds_list_empty(grad))
key_selecting = grad[| 0];
if(array_length(grad))
key_selecting = grad[0];
}
selector = new colorSelector(setColor);
selector.dropper_close = false;
previous_gradient = [];
previous_data = 0;
function setDefault(grad, data) {
var _grad = [];
for( var i = 0; i < array_length(grad); i++ )
_grad[i] = grad[i].clone();
setGradient(_grad, data);
previous_data = data[| 0];
previous_gradient = [];
for( var i = 0; i < array_length(grad); i++ )
array_push(previous_gradient, grad[i].clone());
}
b_cancel = button(function() {
grad_data[| 0] = previous_data;
onApply(previous_gradient);
DIALOG_CLICK = false;
instance_destroy();
}).setIcon(THEME.revert, 0, COLORS._main_icon)
.setTooltip("Revert and exit");
b_apply = button(function() {
onApply();
onApply(gradient);
instance_destroy();
}).setIcon(THEME.accept, 0, COLORS._main_icon_dark);
function setKeyPosition(key, position) {
key.time = position;
ds_list_remove(gradient, key);
array_remove(gradient, key);
gradient_add(gradient, key, false);
}
function removeKeyOverlap(key) {
for(var i = 0; i < ds_list_size(gradient); i++) {
var _key = gradient[| i];
for(var i = 0; i < array_length(gradient); i++) {
var _key = gradient[i];
if(_key == key || _key.time != key.time)
continue;
_key.value = key.value;
ds_list_remove(gradient, key);
array_remove(gradient, key);
}
}
#endregion
@ -65,7 +90,7 @@ event_inherited();
if(path == "") return noone;
if(!file_exists(path)) return noone;
var grad = ds_list_create();
var grad = [];
var _t = file_text_open_read(path);
while(!file_text_eof(_t)) {
var key = file_text_readln(_t);
@ -83,7 +108,7 @@ event_inherited();
_pos = toNumber(file_text_readln(_t));
}
ds_list_add(grad, new valueKey(_pos, _col));
array_push(grad, new gradientKey(_pos, _col));
}
file_text_close(_t);
return grad;
@ -129,10 +154,9 @@ event_inherited();
if(_hover && isHover && mouse_press(mb_left, sFOCUS)) {
var target = presets[| i];
ds_list_clear(gradient);
for( var i = 0; i < ds_list_size(target); i++ ) {
ds_list_add(gradient, new valueKey(target[| i].time, target[| i].value));
}
gradient = [];
for( var i = 0; i < array_length(target); i++ )
array_push(gradient, new gradientKey(target[i].time, target[i].value));
}
yy += hg + ui(4);

View file

@ -27,9 +27,9 @@ if !ready exit;
if(sFOCUS) draw_sprite_stretched_ext(THEME.dialog_active, 0, palette_x, dialog_y, presets_w, dialog_h, COLORS._main_accent, 1);
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_title);
draw_text(presets_x + ui(24), dialog_y + ui(16), "Presets");
draw_text(presets_x + ui(24), dialog_y + ui(16), get_text("presets", "Presets"));
draw_text(content_x + ui(24), dialog_y + ui(16), name);
draw_text(palette_x + ui(24), dialog_y + ui(16), "Palettes");
draw_text(palette_x + ui(24), dialog_y + ui(16), get_text("palette", "Palettes"));
#endregion
#region presets
@ -41,15 +41,14 @@ if !ready exit;
var bx = presets_x + presets_w - ui(44);
var by = dialog_y + ui(12);
var _b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER);
if(_b) TOOLTIP = "Add to preset";
var _b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("add_preset", "Add to preset"));
if(_b == 2) {
var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8));
dia.onModify = function (txt) {
var gradStr = "";
for(var i = 0; i < ds_list_size(gradient); i++) {
var gr = gradient[| i];
for(var i = 0; i < array_length(gradient); i++) {
var gr = gradient[i];
var cc = gr.value;
var tt = gr.time;
@ -66,7 +65,7 @@ if !ready exit;
draw_sprite_ui_uniform(THEME.add, 0, bx + ui(14), by + ui(14), 1, COLORS._main_icon);
bx -= ui(32);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Refresh", THEME.refresh) == 2)
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("refresh", "Refresh"), THEME.refresh) == 2)
presetCollect();
bx -= ui(32);
@ -95,12 +94,12 @@ if !ready exit;
var bx = content_x + content_w - ui(50);
var by = dialog_y + ui(16);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Key blending", THEME.grad_blend) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("gradient_editor_key_blend", "Key blending"), THEME.grad_blend) == 2) {
var dia = dialogCall(o_dialog_menubox, bx + ui(32), by);
dia.setMenu([
[ "RGB blend", function() { grad_data[| 0] = 0; } ],
[ "HSV blend", function() { grad_data[| 0] = 2; } ],
[ "Hard blend", function() { grad_data[| 0] = 1; } ],
[ get_text("gradient_editor_blend_RGB", "RGB blend"), function() { grad_data[| 0] = 0; } ],
[ get_text("gradient_editor_blend_HSV", "HSV blend"), function() { grad_data[| 0] = 2; } ],
[ get_text("gradient_editor_blend_hard", "Hard blend"), function() { grad_data[| 0] = 1; } ],
]);
}
bx -= ui(32);
@ -111,8 +110,8 @@ if !ready exit;
draw_gradient(gr_x, gr_y, gr_w, gr_h, gradient, grad_data[| 0]);
var hover = noone;
for(var i = 0; i < ds_list_size(gradient); i++) {
var _k = gradient[| i];
for(var i = 0; i < array_length(gradient); i++) {
var _k = gradient[i];
var _c = _k.value;
var _kx = gr_x + _k.time * gr_w;
var _in = _k == key_selecting? 1 : 0;
@ -162,7 +161,7 @@ if !ready exit;
var tt = clamp((mouse_mx - gr_x) / gr_w, 0, 1);
var cc = gradient_eval(gradient, tt);
var _newkey = new valueKey(tt, cc);
var _newkey = new gradientKey(tt, cc);
gradient_add(gradient, _newkey, true);
key_selecting = _newkey;
@ -175,19 +174,17 @@ if !ready exit;
}
}
if(mouse_press(mb_right, sFOCUS) && hover && ds_list_size(gradient) > 1) {
var _index = ds_list_find_index(gradient, hover);
ds_list_delete(gradient, _index);
}
if(mouse_press(mb_right, sFOCUS) && hover && array_length(gradient) > 1)
array_remove(gradient, hover);
}
var op_x = content_x + ui(20);
var op_y = gr_y + gr_h + ui(12);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub);
draw_text(op_x, op_y + TEXTBOX_HEIGHT / 2, "Position")
draw_text(op_x, op_y + TEXTBOX_HEIGHT / 2, get_text("position", "Position"))
var txt = key_selecting? key_selecting.time * 100 : "-";
var txt = key_selecting? key_selecting.time * 100 : 0;
sl_position.active = sFOCUS;
sl_position.hover = sHOVER;
sl_position.register();
@ -209,4 +206,10 @@ if !ready exit;
b_apply.hover = sHOVER;
b_apply.active = sFOCUS;
b_apply.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_lime);
bx -= ui(48);
b_cancel.register();
b_cancel.hover = sHOVER;
b_cancel.active = sFOCUS;
b_cancel.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_hide);
#endregion

View file

@ -8,7 +8,7 @@ if !target exit;
draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_title);
draw_text(dialog_x + ui(24), dialog_y + ui(16), "Image array edit");
draw_text(dialog_x + ui(24), dialog_y + ui(16), get_text("array_edit_title", "Image array edit"));
#endregion
#region content
@ -29,7 +29,7 @@ if !target exit;
var bx = x1 - ui(10) - ui(16);
var by = dialog_y + ui(12);
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, "Add...", THEME.add,, COLORS._main_value_positive) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, get_text("add", "Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) {
var path = get_open_filenames(".png", "");
if(path != "") {
var paths = paths_to_array(path);
@ -44,6 +44,6 @@ if !target exit;
bx -= ui(32 + 4);
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, "Sort by name", THEME.text) == 2)
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, get_text("array_edit_sort_name", "Sort by name"), THEME.text) == 2)
sortByName();
#endregion

View file

@ -6,7 +6,7 @@ event_inherited();
dialog_h = ui(440);
destroy_on_click_out = true;
name = "Palette editor";
name = get_text("palette_editor_title", "Palette editor");
palette = 0;
index_selecting = 0;
@ -25,6 +25,20 @@ event_inherited();
selector = new colorSelector(setColor);
selector.dropper_close = false;
previous_palette = c_black;
function setDefault(pal) {
setPalette(pal);
previous_palette = array_clone(pal);
}
b_cancel = button(function() {
onApply(previous_palette);
DIALOG_CLICK = false;
instance_destroy();
}).setIcon(THEME.revert, 0, COLORS._main_icon)
.setTooltip("Revert and exit");
b_apply = button(function() {
onApply(palette);
instance_destroy();

View file

@ -23,7 +23,7 @@ if palette == 0 exit;
if(sFOCUS) draw_sprite_stretched_ext(THEME.dialog_active, 0, content_x, dialog_y, content_w, dialog_h, COLORS._main_accent, 1);
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_title);
draw_text(presets_x + ui(24), dialog_y + ui(16), "Presets");
draw_text(presets_x + ui(24), dialog_y + ui(16), get_text("presets", "Presets"));
draw_text(content_x + ui(24), dialog_y + ui(16), name);
#endregion
@ -36,7 +36,7 @@ if palette == 0 exit;
var bx = presets_x + presets_w - ui(44);
var by = dialog_y + ui(10);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Save current palette to preset", THEME.add) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("add_preset", "Add to preset"), THEME.add) == 2) {
var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8));
dia.onModify = function (txt) {
var file = file_text_open_write(txt + ".hex");
@ -56,13 +56,13 @@ if palette == 0 exit;
}
bx -= ui(32);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Refresh", THEME.refresh_s) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("refresh", "Refresh"), THEME.refresh) == 2) {
presetCollect();
}
draw_sprite_ui_uniform(THEME.refresh_s, 0, bx + ui(14), by + ui(14), 1, COLORS._main_icon);
draw_sprite_ui_uniform(THEME.refresh, 0, bx + ui(14), by + ui(14), 1, COLORS._main_icon);
bx -= ui(32);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Open palette folder", THEME.folder) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("color_selector_open_palette", "Open palette folder"), THEME.folder) == 2) {
var _realpath = environment_get_variable("LOCALAPPDATA") + "\\Pixels_Composer\\Palettes";
var _windir = environment_get_variable("WINDIR") + "\\explorer.exe";
execute_shell(_windir, _realpath);
@ -80,7 +80,7 @@ if palette == 0 exit;
var max_col = 8;
var col = min(array_length(palette), max_col);
var row = ceil(array_length(palette) / col);
var ww = pl_w / col;
var ww = round(pl_w / col);
var hh = (pl_h + ui(6)) * row;
dialog_h = ui(408) + hh;
@ -91,12 +91,12 @@ if palette == 0 exit;
var bx = content_x + content_w - ui(50);
var by = dialog_y + ui(16);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Sort color", THEME.sort) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("palette_editor_sort", "Sort color"), THEME.sort) == 2) {
var dia = dialogCall(o_dialog_menubox, bx + ui(32), by);
dia.setMenu([
[ "Brighter", function() { sortPalette(__sortBright); } ],
[ "Darker", function() { sortPalette(__sortDark); } ],
[ "Hue", function() { sortPalette(__sortHue); } ],
[ get_text("palette_editor_sort_brighter", "Brighter"), function() { sortPalette(__sortBright); } ],
[ get_text("palette_editor_sort_darker", "Darker"), function() { sortPalette(__sortDark); } ],
[ get_text("palette_editor_sort_hue", "Hue"), function() { sortPalette(__sortHue); } ],
]);
}
@ -154,6 +154,7 @@ if palette == 0 exit;
if(array_length(palette) > 1) {
if(buttonInstant(THEME.button, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "", THEME.minus) == 2) {
array_delete(palette, index_selecting, 1);
index_selecting = clamp(index_selecting - 1, 0, array_length(palette) - 1);
onApply(palette);
}
} else {
@ -162,12 +163,13 @@ if palette == 0 exit;
bx -= ui(32);
if(buttonInstant(THEME.button, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "", THEME.add) == 2) {
index_selecting = array_length(palette);
palette[array_length(palette)] = c_black;
onApply(palette);
}
bx = content_x + ui(18);
if(buttonInstant(THEME.button, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Load palette file (.hex)", THEME.file) == 2) {
if(buttonInstant(THEME.button, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("palette_editor_load", "Load palette file") + " (.hex)", THEME.file) == 2) {
var path = get_open_filename(".hex", "");
if(path != "") {
palette = loadPalette(path);
@ -192,4 +194,10 @@ if palette == 0 exit;
b_apply.hover = sHOVER;
b_apply.active = sFOCUS;
b_apply.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_lime);
bx -= ui(48);
b_cancel.register();
b_cancel.hover = sHOVER;
b_cancel.active = sFOCUS;
b_cancel.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_hide);
#endregion

View file

@ -87,10 +87,12 @@ function array_merge() {
}
function array_clone(arr) {
var _res = array_create(array_length(arr));
for( var i = 0; i < array_length(arr); i++ ) {
_res[i] = arr[i];
}
if(!is_array(arr))
return arr;
var _res = [];
for( var i = 0; i < array_length(arr); i++ )
_res[i] = array_clone(arr[i]);
return _res;
}
@ -129,4 +131,16 @@ function array_shape(arr, first = true, isSurface = false) {
dim += array_shape(arr[0], false, isSurface);
return (first? "" : " x ") + dim;
}
function array_spread(arr, _arr = []) {
if(!is_array(arr)) {
array_push(_arr, arr);
return _arr;
}
for( var i = 0; i < array_length(arr); i++ )
array_spread(arr[i], _arr);
return _arr;
}

View file

@ -263,8 +263,8 @@ function colorSelector(onApply = noone) constructor {
var cx = col_x + ui(16);
var cy = col_y + ui(296);
draw_sprite_stretched(THEME.color_picker_sample, 0, cx - ui(20), cy - ui(20), ui(40), ui(40));
draw_sprite_stretched_ext(THEME.color_picker_sample, 0, cx - ui(18), cy - ui(18), ui(36), ui(36), current_color, 1);
draw_sprite_stretched_ext(THEME.color_picker_box, 0, cx - ui(20), cy - ui(20), ui(40), ui(40), COLORS._main_icon_dark, 1);
draw_sprite_stretched_ext(THEME.color_picker_box, 1, cx - ui(18), cy - ui(18), ui(36), ui(36), current_color, 1);
cx += ui(48);
if(buttonInstant(THEME.button_hide, cx - ui(18), cy - ui(18), ui(36), ui(36), mouse_ui, focus, hover, "", THEME.color_picker_dropper, 0, c_white) == 2)

View file

@ -44,7 +44,47 @@ function draw_tooltip_palette(clr) {
drawPalette(clr, mx + ui(8), my + ui(8), ui(ww), ui(hh));
}
function draw_tooltip_surface_array(surf) {
var amo = array_length(surf);
var col = ceil(sqrt(amo));
var row = ceil(amo / col);
var nn = min(ui(64), ui(320) / col);
var sw = nn;
var sh = nn;
var ww = sw * col;
var hh = sh * row;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16)));
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16)));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16));
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16));
for( var ind = 0; ind < amo; ind++ ) {
if(!is_surface(surf[ind])) continue;
var i = floor(ind / col);
var j = ind % col;
var sw = surface_get_width(surf[ind]);
var sh = surface_get_height(surf[ind]);
var ss = nn / max(sw, sh);
var cx = mx + ui(8) + j * nn + nn / 2;
var cy = my + ui(8) + i * nn + nn / 2;
draw_surface_ext(surf[ind], cx - sw * ss / 2, cy - sh * ss / 2, ss, ss, 0, c_white, 1);
draw_set_color(COLORS._main_icon);
draw_rectangle(cx - sw * ss / 2, cy - sh * ss / 2, cx + sw * ss / 2 - 1, cy + sh * ss / 2 - 1, true);
}
}
function draw_tooltip_surface(surf) {
if(is_array(surf)) {
draw_tooltip_surface_array(array_spread(surf))
return;
}
if(!is_surface(surf)) return;
var sw = surface_get_width(surf);

View file

@ -31,6 +31,7 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) {
nodeCleanUp();
clearPanel();
setPanel();
instance_destroy(_p_dialog);
room_restart();
var temp_path = DIRECTORY + "\_temp";

View file

@ -4,7 +4,7 @@ function loadPalette(path) {
if(path != "" && file_exists(path)) {
var _t = file_text_open_read(path);
var _index = 0;
var ext = filename_ext(path);
var ext = string_lower(filename_ext(path));
while(!file_text_eof(_t)) {
var _w = file_text_readln(_t);
if(_w != "") {
@ -20,9 +20,8 @@ function loadPalette(path) {
case ".pal" :
if(string_char_at(_w, 1) == "#") break;
var _c = string_splice(_w, " ");
if(array_length(_c) >= 3) {
pal[_index++] = make_color_rgb(string_decimal(_c[0]), string_decimal(_c[1]), string_decimal(_c[2]));
}
if(array_length(_c) >= 3)
pal[_index++] = make_color_rgb(toString(_c[0]), toString(_c[1]), toString(_c[2]));
break;
}
}

View file

@ -28,8 +28,8 @@ function Node_Blend(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr
inputs[| 4] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 5] = nodeValue("Tiling", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Stretch", "Tile" ]);
inputs[| 5] = nodeValue("Fill mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "None", "Stretch", "Tile" ]);
inputs[| 6] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Background", "Forground", "Mask", "Maximum", "Constant" ])
@ -93,7 +93,7 @@ function Node_Blend(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr
surface_set_target(_outSurf);
draw_clear_alpha(0, 0);
draw_surface_blend(_back, _fore, _type, _opacity, _pre_alp, _mask, _tile);
draw_surface_blend(_back, _fore, _type, _opacity, _pre_alp, _mask, _tile - 1);
surface_reset_target();
return _outSurf;

View file

@ -1,3 +1,5 @@
global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) constructor {
active = true;
node_id = generateUUID();
@ -164,6 +166,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) constructor {
return false;
}
static isInLoop = function() {
return array_exists(global.loop_nodes, instanceof(group));
}
static move = function(_x, _y) {
x = _x;
y = _y;

View file

@ -87,8 +87,6 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
["Settings", false], 8, 5, 6, 7, 10,
];
in_loop = false;
directory = DIRECTORY + "temp\\" + string(irandom_range(100000, 999999));
converter = working_directory + "ImageMagick\\convert.exe";
magick = working_directory + "ImageMagick\\magick.exe";
@ -344,9 +342,8 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
insp2UpdateIcon = [ THEME.play_all, 0, COLORS._main_value_positive ];
static onInspectorUpdate = function() {
initExport();
if(in_loop) Render();
if(isInLoop()) Render();
else doInspectorAction();
}
static onInspector2Update = function() {
@ -358,13 +355,13 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
if(!node.active) continue;
if(instanceof(node) != "Node_Export") continue;
node.initExport();
node.doInspectorAction();
}
if(in_loop) Render();
if(isInLoop()) Render();
}
static initExport = function() {
static doInspectorAction = function() {
if(LOADING || APPENDING) return;
if(playing) return;
@ -389,10 +386,7 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
directory_create(directory);
}
loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
static step = function() {
in_loop = array_exists(loop_nodes, instanceof(group));
var surf = inputs[| 0].getValue();
if(is_array(surf)) {
inputs[| 3].display_data = format_array;
@ -420,14 +414,14 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
inputs[| 10].setVisible(extn != 0);
}
outputs[| 0].visible = in_loop;
outputs[| 0].visible = isInLoop();
}
static update = function(frame = ANIMATOR.current_frame) {
var anim = inputs[| 3].getValue();
if(anim == NODE_EXPORT_FORMAT.single) {
if(in_loop && RENDERING)
initExport();
if(isInLoop() && RENDERING)
doInspectorAction();
return;
}

View file

@ -257,6 +257,11 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo
}
static onInspectorUpdate = function() {
if(isInLoop()) Render();
else doInspectorAction();
}
static doInspectorAction = function() {
var _inSurf = inputs[| 0].getValue();
if(!is_surface(_inSurf)) return;
@ -337,6 +342,9 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo
}
static update = function(frame = ANIMATOR.current_frame) {
if(isInLoop() && RENDERING)
doInspectorAction();
var _out = inputs[| 7].getValue();
if(_out == 1) {
outputs[| 0].setValue(surf_array);

View file

@ -46,36 +46,14 @@ function Node_Iterator_Each_Output(_x, _y, _group = -1) : Node(_x, _y, _group) c
static cloneValue = function(_prev_val, _val) {
if(inputs[| 0].value_from == noone) return _prev_val;
var _arr = inputs[| 0].value_from.isArray();
var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface;
var _new_val;
if(is_array(_prev_val)) {
for( var i = 0; i < array_length(_prev_val); i++ ) {
if(is_surf && is_surface(_prev_val[i]))
surface_free(_prev_val[i]);
}
} else if(is_surf && is_surface(_prev_val))
surface_free(_prev_val);
var _new_val = 0;
if(_arr) {
var amo = array_length(_val);
_new_val = array_create(amo);
if(is_surf) {
for( var i = 0; i < amo; i++ ) {
if(is_surface(_val[i]))
_new_val[i] = surface_clone(_val[i]);
}
} else
_new_val = _val;
} else {
if(is_surf) {
if(is_surface(_val))
_new_val = surface_clone(_val);
} else
_new_val = _val;
}
surface_array_free(_prev_val);
if(is_surf)
_new_val = surface_array_clone(_val);
else
_new_val = array_clone(_val);
return _new_val;
}

View file

@ -66,36 +66,14 @@ function Node_Iterator_Output(_x, _y, _group = -1) : Node_Group_Output(_x, _y, _
static cloneValue = function(_prev_val, _val) {
if(inputs[| 0].value_from == noone) return _prev_val;
var _arr = inputs[| 0].value_from.isArray();
var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface;
var _new_val;
if(is_array(_prev_val)) {
for( var i = 0; i < array_length(_prev_val); i++ ) {
if(is_surf && is_surface(_prev_val[i]))
surface_free(_prev_val[i]);
}
} else if(is_surf && is_surface(_prev_val))
surface_free(_prev_val);
var _new_val = 0;
if(_arr) {
var amo = array_length(_val);
_new_val = array_create(amo);
if(is_surf) {
for( var i = 0; i < amo; i++ ) {
if(is_surface(_val[i]))
_new_val[i] = surface_clone(_val[i]);
}
} else
_new_val = _val;
} else {
if(is_surf) {
if(is_surface(_val))
_new_val = surface_clone(_val);
} else
_new_val = _val;
}
surface_array_free(_prev_val);
if(is_surf)
_new_val = surface_array_clone(_val);
else
_new_val = array_clone(_val);
return _new_val;
}

View file

@ -21,7 +21,7 @@ function Node_Processor(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
var _in = _n.getValue();
if(_n.isArray())
return _in[_arr % array_length(_in)];
return array_safe_get(_in, _arr,, ARRAY_OVERFLOW.loop);
return _in;
}

View file

@ -19,6 +19,6 @@ function Node_Sequence_Anim(_x, _y, _group = -1) : Node(_x, _y, _group) construc
}
var _frame = safe_mod(floor(ANIMATOR.current_frame / spd), array_length(seq));
outputs[| 0].setValue(seq[_frame]);
outputs[| 0].setValue(array_safe_get(seq, _frame));
}
}

View file

@ -571,7 +571,7 @@ function Panel_Graph() : PanelContent() constructor {
#endregion
#region dragging
if(mouse_release(mb_left))
if(mouse_press(mb_left))
node_dragging = noone;
if(node_dragging) {
@ -774,9 +774,14 @@ function Panel_Graph() : PanelContent() constructor {
}
APPENDING = true;
var cx = 0;
var cy = 0;
for(var i = 0; i < ds_list_size(dups); i++) {
var _node = dups[| i];
_node.connect();
cx += _node.x;
cy += _node.y;
}
APPENDING = false;
@ -784,8 +789,8 @@ function Panel_Graph() : PanelContent() constructor {
nodes_select_list = dups;
node_dragging = nodes_select_list[| 0];
node_drag_mx = 0;
node_drag_my = 0;
node_drag_mx = cx / ds_list_size(dups);
node_drag_my = cy / ds_list_size(dups);
node_drag_sx = 0;
node_drag_sy = 0;
@ -949,7 +954,7 @@ function Panel_Graph() : PanelContent() constructor {
}
function doDelete(_merge = false) {
if(node_focus != noone && mode_focus.manual_deletable)
if(node_focus != noone && node_focus.manual_deletable)
nodeDelete(node_focus, _merge);
for(var i = 0; i < ds_list_size(nodes_select_list); i++) {

View file

@ -4,7 +4,7 @@ enum RENDER_TYPE {
full = 2
}
global.RENDER_LOG = true;
global.RENDER_LOG = false;
function __nodeLeafList(_list, _queue) {
for( var i = 0; i < ds_list_size(_list); i++ ) {

View file

@ -1,6 +1,7 @@
function NEW() {
nodeCleanUp();
setPanel();
instance_destroy(_p_dialog);
room_restart();
gc_collect();

View file

@ -124,4 +124,30 @@ function surface_verify(surf, w, h) {
return surface_create_valid(w, h);
surface_size_to(surf, w, h);
return surf;
}
function surface_array_free(arr) {
if(!is_array(arr)) {
if(is_surface(arr)) surface_free(arr);
return;
}
for( var i = 0; i < array_length(arr); i++ )
surface_array_free(arr[i]);
}
function surface_array_clone(arr) {
if(!is_array(arr)) {
if(is_surface(arr))
return surface_clone(arr);
else
return arr;
}
var _arr = [];
for( var i = 0; i < array_length(arr); i++ )
_arr[i] = surface_array_clone(arr[i]);
return _arr;
}