[Presets] Fix crash when deleting presets.

This commit is contained in:
Tanasart 2025-01-08 09:24:05 +07:00
parent e22b4f4597
commit 63038087c1
21 changed files with 129 additions and 1917 deletions

View file

@ -321,7 +321,6 @@
{"name":"o_dialog_output_visibility","order":2,"path":"objects/o_dialog_output_visibility/o_dialog_output_visibility.yy",},
{"name":"o_dialog_palette","order":2,"path":"objects/o_dialog_palette/o_dialog_palette.yy",},
{"name":"o_dialog_panel","order":13,"path":"objects/o_dialog_panel/o_dialog_panel.yy",},
{"name":"o_dialog_preference","order":3,"path":"objects/o_dialog_preference/o_dialog_preference.yy",},
{"name":"o_dialog_preset","order":1,"path":"objects/o_dialog_preset/o_dialog_preset.yy",},
{"name":"o_dialog_release_note","order":4,"path":"objects/o_dialog_release_note/o_dialog_release_note.yy",},
{"name":"o_dialog_run_shell","order":9,"path":"objects/o_dialog_run_shell/o_dialog_run_shell.yy",},

View file

@ -754,7 +754,6 @@
{"id":{"name":"o_dialog_palette","path":"objects/o_dialog_palette/o_dialog_palette.yy",},},
{"id":{"name":"o_dialog_panel","path":"objects/o_dialog_panel/o_dialog_panel.yy",},},
{"id":{"name":"o_dialog_patreon","path":"objects/o_dialog_patreon/o_dialog_patreon.yy",},},
{"id":{"name":"o_dialog_preference","path":"objects/o_dialog_preference/o_dialog_preference.yy",},},
{"id":{"name":"o_dialog_preset","path":"objects/o_dialog_preset/o_dialog_preset.yy",},},
{"id":{"name":"o_dialog_release_note","path":"objects/o_dialog_release_note/o_dialog_release_note.yy",},},
{"id":{"name":"o_dialog_run_shell","path":"objects/o_dialog_run_shell/o_dialog_run_shell.yy",},},

Binary file not shown.

View file

@ -29,7 +29,6 @@ event_inherited();
}
}
cb_recursive = new checkBox(function(val) { dir_recursive = !dir_recursive; });
tb_filter = new textBox(TEXTBOX_INPUT.text, function(str) { dir_filter = str; })
cb_recursive = new checkBox(function() /*=>*/ { dir_recursive = !dir_recursive; });
tb_filter = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { dir_filter = str; })
#endregion

File diff suppressed because it is too large Load diff

View file

@ -1,3 +0,0 @@
/// @description
event_inherited();
ds_list_destroy(pref_global);

View file

@ -1,251 +0,0 @@
/// @description init
if !ready exit;
#region base UI
DIALOG_DRAW_BG
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
draw_text(dialog_x + ui(56), dialog_y + ui(20), __txt("Preferences"));
var bx = dialog_x + ui(24);
var by = dialog_y + ui(18);
if(buttonInstant(THEME.button_hide_fill, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, destroy_on_click_out? __txt("Pin") : __txt("Unpin"),
THEME.pin, !destroy_on_click_out, destroy_on_click_out? COLORS._main_icon : COLORS._main_icon_light) == 2)
destroy_on_click_out = !destroy_on_click_out;
if(should_restart) {
var _txt = "Restart recommended";
var _rx = dialog_x + ui(168);
var _ry = dialog_y + ui(20);
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_accent);
var _rw = string_width(_txt);
var _rh = string_height(_txt);
draw_sprite_stretched_ext(THEME.box_r5_clr, 0, _rx - ui(8), _ry - ui(4), _rw + ui(16), _rh + ui(8), COLORS._main_accent, 1);
draw_text(_rx, _ry, _txt);
}
#endregion
#region page
sp_page.setFocusHover(sFOCUS, sHOVER);
sp_page.draw(dialog_x + ui(padding), dialog_y + ui(title_height));
#endregion
#region draw
section_current = "";
var px = dialog_x + ui(padding) + page_width;
var py = dialog_y + ui(title_height);
var pw = dialog_w - ui(padding + padding) - page_width;
var ph = dialog_h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
tb_search.auto_update = true;
tb_search.no_empty = false;
tb_search.font = f_p1;
tb_search.active = sFOCUS;
tb_search.hover = sHOVER;
tb_search.draw(dialog_x + dialog_w - ui(padding - 8), dialog_y + ui(title_height) / 2, ui(200), ui(28), search_text, mouse_ui, fa_right, fa_center);
draw_sprite_ui_uniform(THEME.search, 0, dialog_x + dialog_w - ui(padding + 208), dialog_y + ui(title_height) / 2, 1, COLORS._main_text_sub);
if(page_current == 0) {
current_list = pref_global;
sp_pref.setFocusHover(sFOCUS, sHOVER);
sp_pref.draw(px, py);
} else if(page_current == 1) {
current_list = pref_appr;
sp_pref.setFocusHover(sFOCUS, sHOVER);
sp_pref.draw(px, py);
} else if(page_current == 2) {
current_list = pref_node;
sp_pref.setFocusHover(sFOCUS, sHOVER);
sp_pref.draw(px, py);
} else if(page_current == 3) {
var _sp_x = ui(296);
var _sp_y = ui(28);
var x1 = px + _sp_x - ui(8);
sp_theme.verify(_sp_x - ui(8), panel_height);
sp_theme.setFocusHover(sFOCUS, sHOVER);
sp_theme.draw(px, py);
var _res_w = panel_width - _sp_x;
tab_resources.setFocusHover(sFOCUS, sHOVER);
tab_resources.draw(px + _sp_x + ui(32), py, _res_w - ui(64), ui(24), theme_page);
var sp = sp_theme_colors;
switch(theme_page) {
case 0 : sp = sp_theme_colors; break;
case 1 : sp = sp_theme_sprites; break;
case 2 : sp = sp_theme_fonts; break;
}
sp.verify(_res_w, panel_height - _sp_y);
sp.setFocusHover(sFOCUS, sHOVER);
sp.draw(px + _sp_x, py + _sp_y);
} else if(page_current == 4) {
if(mouse_press(mb_left, sFOCUS))
hk_editing = noone;
var hk_w = panel_width;
var hk_h = hotkey_cont_h - ui(16);
var kdsp = keyboards_display;
var keys = keyboards_display.keys;
var ks = min(hk_w / kdsp.width, hk_h / kdsp.height);
var _kww = ks * kdsp.width;
var _khh = ks * kdsp.height;
var _ksx = px + hk_w / 2 - _kww / 2;
var _ksy = py + hk_h / 2 - _khh / 2;
var _kp = ui(2);
var _keyUsing = {};
var _ctxObj = hotkeyContext[hk_page];
var _cntx = _ctxObj.context;
var _list = _ctxObj.list;
for (var j = 0, m = array_length(_list); j < m; j++) {
var _ky = _list[j];
var _kkey = _ky.key;
var _kmod = _ky.modi;
if(_kkey == noone && _kmod == MOD_KEY.none) continue;
if(!struct_has(_keyUsing, _kkey))
_keyUsing[$ _kkey] = {};
var _kuse = _keyUsing[$ _kkey];
if(!struct_has(_kuse, _kmod))
_kuse[$ _kmod] = [];
array_append(_kuse[$ _kmod], _ky);
}
var c_control = CDEF.orange, kc_control = colorMultiply(CDEF.main_dkgrey, c_control);
var c_shift = CDEF.blue, kc_shift = colorMultiply(CDEF.main_dkgrey, c_shift);
var c_alt = CDEF.lime, kc_alt = colorMultiply(CDEF.main_dkgrey, c_alt);
var _sel = true;
var _mod_arr = [
MOD_KEY.ctrl, MOD_KEY.shift, MOD_KEY.alt,
MOD_KEY.ctrl | MOD_KEY.shift,
MOD_KEY.ctrl | MOD_KEY.alt,
MOD_KEY.shift | MOD_KEY.alt,
MOD_KEY.ctrl | MOD_KEY.shift | MOD_KEY.alt,
];
var _cur_mod = MOD_KEY.ctrl * key_mod_press(CTRL)
+ MOD_KEY.shift * key_mod_press(SHIFT)
+ MOD_KEY.alt * key_mod_press(ALT)
var _cmod = _cur_mod == MOD_KEY.none? hk_modifiers : _cur_mod;
draw_set_text(f_p4, fa_center, fa_center);
for (var i = 0, n = array_length(keys); i < n; i++) {
var _key = keys[i];
var _kx = _ksx + _key.x * ks;
var _ky = _ksy + _key.y * ks;
var _kw = _key.w * ks;
var _kh = _key.h * ks;
var _vk = _key.vk;
_kx += _kw / 2 - (_kw - _kp) / 2;
_ky += _kh / 2 - (_kh - _kp) / 2;
_kw -= _kp;
_kh -= _kp;
if(_vk == -1) {
draw_sprite_stretched_ext(THEME.ui_panel, 0, _kx, _ky, _kw, _kh, CDEF.main_black, 0.3);
continue;
}
var _tc = CDEF.main_grey;
var _hov = sHOVER && point_in_rectangle(mouse_mx, mouse_my, _kx - _kp, _ky - _kp, _kx + _kw + _kp - 1, _ky + _kh + _kp - 1);
if(_vk == vk_control) {
_sel = bool(MOD_KEY.ctrl & _cmod);
draw_sprite_stretched_ext(THEME.ui_panel, 0, _kx, _ky, _kw, _kh, _sel? c_control : kc_control);
_tc = _sel? kc_control : c_control;
if(mouse_press(mb_left, sFOCUS && _hov)) hk_modifiers ^= MOD_KEY.ctrl;
} else if(_vk == vk_shift) {
_sel = bool(MOD_KEY.shift & _cmod);
draw_sprite_stretched_ext(THEME.ui_panel, 0, _kx, _ky, _kw, _kh, _sel? c_shift : kc_shift);
_tc = _sel? kc_shift : c_shift;
if(mouse_press(mb_left, sFOCUS && _hov)) hk_modifiers ^= MOD_KEY.shift;
} else if(_vk == vk_alt) {
_sel = bool(MOD_KEY.alt & _cmod);
draw_sprite_stretched_ext(THEME.ui_panel, 0, _kx, _ky, _kw, _kh, _sel? c_alt : kc_alt);
_tc = _sel? kc_alt : c_alt;
if(mouse_press(mb_left, sFOCUS && _hov)) hk_modifiers ^= MOD_KEY.alt;
} else if(struct_has(_keyUsing, _vk) && struct_has(_keyUsing[$ _vk], _cmod)) {
draw_sprite_stretched_ext(THEME.ui_panel, 0, _kx, _ky, _kw, _kh, CDEF.main_ltgrey);
draw_sprite_stretched_add(THEME.ui_panel, 1, _kx, _ky, _kw, _kh, c_white, 0.1);
_tc = CDEF.main_mdblack;
var _act = _keyUsing[$ _vk][$ _cmod];
if(_hov) {
TOOLTIP = new tooltipHotkey_assign(_act, key_get_name(_vk, _cmod));
if(mouse_press(mb_left, sFOCUS)) {
if(hotkey_focus_index >= array_length(_act))
hotkey_focus_index = 0;
hotkey_focus = _act[hotkey_focus_index];
hotkey_focus_highlight = _act[hotkey_focus_index];
hotkey_focus_high_bg = 1;
hotkey_focus_index++;
}
}
} else {
draw_sprite_stretched_ext(THEME.ui_panel, 0, _kx, _ky, _kw, _kh, CDEF.main_black);
_tc = CDEF.main_grey;
if(_hov) {
TOOLTIP = new tooltipHotkey_assign(noone, key_get_name(_vk, _cmod));
}
}
draw_sprite_stretched_add(THEME.ui_panel, 1, _kx, _ky, _kw, _kh, c_white, 0.1 + _hov * 0.2);
if(is_string(_key.key)) {
draw_set_color(_tc);
draw_set_alpha(1);
draw_text(_kx + _kw / 2, _ky + _kh / 2, _key.key);
}
}
var _ppy = py + hotkey_cont_h;
hk_scroll.font = f_p2;
hk_scroll.setFocusHover(sFOCUS, sHOVER);
hk_scroll.draw(px, _ppy, ui(200), ui(24), hk_page);
sp_hotkey.setFocusHover(sFOCUS, sHOVER);
sp_hotkey.draw(px, _ppy + ui(32));
}
#endregion

View file

@ -1,37 +0,0 @@
{
"spriteId": null,
"solid": false,
"visible": true,
"spriteMaskId": null,
"persistent": false,
"parentObjectId": {
"name": "_p_dialog",
"path": "objects/_p_dialog/_p_dialog.yy",
},
"physicsObject": false,
"physicsSensor": false,
"physicsShape": 1,
"physicsGroup": 1,
"physicsDensity": 0.5,
"physicsRestitution": 0.1,
"physicsLinearDamping": 0.1,
"physicsAngularDamping": 0.1,
"physicsFriction": 0.2,
"physicsStartAwake": true,
"physicsKinematic": false,
"physicsShapePoints": [],
"eventList": [
{"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
],
"properties": [],
"overriddenProperties": [],
"parent": {
"name": "dialog",
"path": "folders/dialog.yy",
},
"resourceVersion": "1.0",
"name": "o_dialog_animation",
"tags": [],
"resourceType": "GMObject",
}

View file

@ -1,40 +0,0 @@
{
"$GMObject":"",
"%Name":"o_dialog_preference",
"eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_dialog_preference",
"overriddenProperties":[],
"parent":{
"name":"menu",
"path":"folders/dialog/menu.yy",
},
"parentObjectId":{
"name":"_p_dialog",
"path":"objects/_p_dialog/_p_dialog.yy",
},
"persistent":false,
"physicsAngularDamping":0.1,
"physicsDensity":0.5,
"physicsFriction":0.2,
"physicsGroup":1,
"physicsKinematic":false,
"physicsLinearDamping":0.1,
"physicsObject":false,
"physicsRestitution":0.1,
"physicsSensor":false,
"physicsShape":1,
"physicsShapePoints":[],
"physicsStartAwake":true,
"properties":[],
"resourceType":"GMObject",
"resourceVersion":"2.0",
"solid":false,
"spriteId":null,
"spriteMaskId":null,
"visible":true,
}

View file

@ -24,7 +24,7 @@ if(!LOADING && PROJECT.active && !PROJECT.safeMode) { //node step
}
#region hotkey
if(!instance_exists(o_dialog_preference) && !HOTKEY_BLOCK) {
if(!HOTKEY_BLOCK) {
if(ds_map_exists(HOTKEYS, "")) {
var l = HOTKEYS[? ""];
for(var i = 0, n = ds_list_size(l); i < n; i++) {

View file

@ -28,6 +28,8 @@ function Atlas(_surface, _x = 0, _y = 0, _rot = 0, _sx = 1, _sy = 1, _blend = c_
return self;
}
static draw = function() {}
}
function SurfaceAtlasFast(_surface, _x = 0, _y = 0, _rot = 0, _sx = 1, _sy = 1, _blend = c_white, _alpha = 1) : Atlas(_surface, _x, _y, _rot, _sx, _sy, _blend, _alpha) constructor {}
@ -67,21 +69,20 @@ function SurfaceAtlas( _surface, _x = 0, _y = 0, _rot = 0, _sx = 1, _sy = 1,
static setSurface = function(_surface) {
INLINE
self.surface.set(_surface);
surface.set(_surface);
w = surface_get_width_safe(_surface);
h = surface_get_height_safe(_surface);
}
static draw = function() {
draw_surface_ext_safe(surface.get(), x, y, sx, sy, rotation, blend, alpha);
static draw = function(submitInt = false) {
var _surf = getSurface();
draw_surface_ext_safe(_surf, x, y, sx, sy, rotation, blend, alpha);
return self;
}
static clone = function(_cloneSurf = false) {
var _surf = getSurface();
if(_cloneSurf) _surf = surface_clone(_surf);
return new SurfaceAtlas(_surf, x, y, rotation, sx, sy, blend, alpha);
}
}

View file

@ -170,8 +170,8 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
if(_a == 1) {
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh, current_color, 1);
} else {
// draw_sprite_stretched_ext(THEME.button_def, 0, _bx, _by, _bww, _bh, boxColor, 1);
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh - ui(8), current_color, 1);
draw_sprite_stretched_ext(THEME.button_backdroup, 4, _bx, _by, _bww, _bh, boxColor, 1);
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh - ui(8), current_color, 1);
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by + _bh - ui(6), _bww, ui(6), c_black, 1);
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by + _bh - ui(6), _bww * _a, ui(6), c_white, 1);

View file

@ -43,7 +43,7 @@
LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_06_2;
SAVE_VERSION = 1_18_05_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.7.004";
VERSION_STRING = MAC? "1.18.003m" : "1.18.7.005";
BUILD_NUMBER = 1_18_06_4;
PREF_VERSION = 1_17_1;

View file

@ -8,25 +8,34 @@ function Node_Atlas_Draw(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
.setArrayDepth(1)
.setVisible(true, true);
newInput(2, nodeValue_Bool("Combine", self, true))
.rejectArray()
newOutput(0, nodeValue_Output("Surface", self, VALUE_TYPE.surface, noone));
attribute_interpolation(true);
input_display_list = [
0, 1, 2,
];
static preGetInputs = function() {
var _comb = getSingleValue(2);
inputs[1].setArrayDepth(_comb);
}
static processData = function(_outSurf, _data, _output_index, _array_index = 0) {
var dim = _data[0];
var atl = _data[1];
//_outSurf = surface_verify(_outSurf, dim[0], dim[1]);
if(!is_array(atl)) atl = [ atl ];
surface_set_shader(_outSurf);
for( var i = 0, n = array_length(atl); i < n; i++ ) {
var _a = atl[i];
if(!is_instanceof(_a, Atlas)) continue;
shader_set_interpolation(_a.getSurface())
_a.draw();
}
if(!is_array(atl)) {
if(is(atl, Atlas)) { shader_set_interpolation(atl.getSurface()); atl.draw(); }
} else {
for( var i = 0, n = array_length(atl); i < n; i++ )
if(is(atl[i], Atlas)) { shader_set_interpolation(atl[i].getSurface()); atl[i].draw(); }
}
surface_reset_shader();
return _outSurf;

View file

@ -76,7 +76,7 @@
function attribute_surface_depth(label = true) {
attr_depth_array = variable_clone(global.SURFACE_FORMAT_NAME);
attr_depth_array[0].setActive(!array_empty(inputs) && inputs[0].type == VALUE_TYPE.surface);
attributes.color_depth = 3;
attributes.color_depth = PREFERENCES.node_default_depth;
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Color depth", function() /*=>*/ {return attributes.color_depth},
@ -85,8 +85,8 @@
function attribute_interpolation(label = false) {
attr_interpolate_array = variable_clone(global.SURFACE_INTERPOLATION);
attributes.interpolate = 1;
attributes.oversample = 1;
attributes.interpolate = PREFERENCES.node_default_interpolation;
attributes.oversample = PREFERENCES.node_default_oversample;
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Texture interpolation", function() /*=>*/ {return attributes.interpolate},
@ -95,8 +95,8 @@
function attribute_oversample(label = false) {
attr_oversample_array = variable_clone(global.SURFACE_OVERSAMPLE);
attributes.interpolate = 1;
attributes.oversample = 1;
attributes.interpolate = PREFERENCES.node_default_interpolation;
attributes.oversample = PREFERENCES.node_default_oversample;
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Oversample", function() /*=>*/ {return attributes.oversample},
@ -110,4 +110,5 @@
array_push(attributeEditors, ["Auto execute", function() /*=>*/ {return attributes.auto_exe},
new checkBox(function() /*=>*/ { attribute_set("auto_exe", !attributes.auto_exe); })]);
}
#endregion

View file

@ -17,6 +17,8 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newOutput(1, nodeValue_Output("Crop distance", self, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]))
.setDisplay(VALUE_DISPLAY.padding);
newOutput(2, nodeValue_Output("Atlas", self, VALUE_TYPE.atlas, []));
input_display_list = [ 1,
["Surfaces", false], 0, 2, 4,
["Padding", false], 3,
@ -48,7 +50,7 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
}
var _arr = is_array(_inSurf);
_array &= _arr;
_array &= _arr;
if(!is_array(_inSurf) && !is_surface(_inSurf)) return;
if( is_array(_inSurf) && array_empty(_inSurf)) return;
@ -56,10 +58,10 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(!_arr) _inSurf = [ _inSurf ];
var _amo = array_length(_inSurf);
var minx = _array? array_create(_amo) : 999999;
var miny = _array? array_create(_amo) : 999999;
var maxx = _array? array_create(_amo) : 0;
var maxy = _array? array_create(_amo) : 0;
var minx = array_create(_amo);
var miny = array_create(_amo);
var maxx = array_create(_amo);
var maxy = array_create(_amo);
var cDep = attrDepth();
for( var j = 0; j < _amo; j++ ) {
@ -103,52 +105,44 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
maxx[j] = _maxx;
maxy[j] = _maxy;
} else {
minx = min(minx, _minx);
miny = min(miny, _miny);
minx[0] = min(minx[0], _minx);
miny[0] = min(miny[0], _miny);
maxx = max(maxx, _maxx);
maxy = max(maxy, _maxy);
maxx[0] = max(maxx[0], _maxx);
maxy[0] = max(maxy[0], _maxy);
}
}
var res = [];
var crop = [];
var res = [];
var crop = [];
var atlas = [];
for( var i = 0, n = _amo; i < n; i++ ) {
var _surf = _inSurf[i];
var _ind = _array == 0? 0 : i;
if(_array == 0) {
var resDim = [maxx - minx + 1, maxy - miny + 1];
resDim[DIMENSION.width] += _padd[PADDING.left] + _padd[PADDING.right];
resDim[DIMENSION.height] += _padd[PADDING.top] + _padd[PADDING.bottom];
res[i] = surface_create_valid(resDim[DIMENSION.width], resDim[DIMENSION.height], cDep);
crop[i] = [ surface_get_width_safe(_surf) - maxx - 1, miny, minx, surface_get_height_safe(_surf) - maxy - 1 ];
surface_set_shader(res[i], noone);
draw_surface_safe(_surf, -minx + _padd[PADDING.left], -miny + _padd[PADDING.top]);
surface_reset_shader();
} else if(_array == 1) {
var resDim = [maxx[i] - minx[i] + 1, maxy[i] - miny[i] + 1];
resDim[DIMENSION.width] += _padd[PADDING.left] + _padd[PADDING.right];
resDim[DIMENSION.height] += _padd[PADDING.top] + _padd[PADDING.bottom];
res[i] = surface_create_valid(resDim[DIMENSION.width], resDim[DIMENSION.height], cDep);
crop[i] = [ surface_get_width_safe(_surf) - maxx - 1, miny, minx, surface_get_height_safe(_surf) - maxy - 1 ];
surface_set_shader(res[i], noone);
draw_surface_safe(_surf, -minx[i] + _padd[PADDING.left], -miny[i] + _padd[PADDING.top]);
surface_reset_shader();
}
var resDim = [maxx[_ind] - minx[_ind] + 1, maxy[_ind] - miny[_ind] + 1];
resDim[DIMENSION.width] += _padd[PADDING.left] + _padd[PADDING.right];
resDim[DIMENSION.height] += _padd[PADDING.top] + _padd[PADDING.bottom];
res[i] = surface_create_valid(resDim[DIMENSION.width], resDim[DIMENSION.height], cDep);
crop[i] = [ surface_get_width_safe(_surf) - maxx[_ind] - 1, miny[_ind], minx[_ind], surface_get_height_safe(_surf) - maxy[_ind] - 1 ];
surface_set_shader(res[i], noone);
draw_surface_safe(_surf, -minx[_ind] + _padd[PADDING.left], -miny[_ind] + _padd[PADDING.top]);
surface_reset_shader();
atlas[i] = new SurfaceAtlas(res[i], minx[_ind], miny[_ind]);
}
if(!_arr) {
res = res[0];
crop = crop[0];
res = res[0];
crop = crop[0];
atlas = atlas[0];
}
outputs[0].setValue(res);
outputs[1].setValue(crop);
outputs[2].setValue(atlas);
}
}

View file

@ -1,9 +1,11 @@
function Node_Displace(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Displace";
newInput(0, nodeValue_Surface("Surface in", self));
newInput(0, nodeValue_Surface("Surface in", self))
.setVisible(true, true);
newInput(1, nodeValue_Surface("Displace map", self));
newInput(1, nodeValue_Surface("Displace map", self))
.setVisible(true, true);
newInput(2, nodeValue_Vec2("Position", self, [ 1, 0 ] ))
.setTooltip("Vector to displace pixel by.")
@ -103,6 +105,8 @@ If set, then strength value control how many times the effect applies on itself.
var _sep = _data[16];
var _map2 = _data[17];
print(attributes.oversample);
var _mode = _data[5];
if(!is_surface(_map) || (_sep && !is_surface(_map2))) {
surface_set_shader(_outSurf);

View file

@ -3537,6 +3537,7 @@ function load_file_path(path, _x = undefined, _y = undefined) {
if(is_multi) {
dialogCall(o_dialog_add_multiple_images).setPath(path);
} else {
if(!IS_CMD) PANEL_GRAPH.onStepBegin();

View file

@ -518,33 +518,55 @@ function Panel_Preference() : PanelContent() constructor {
#region node
pref_node = ds_list_create();
// ds_list_add(pref_node, __txt("Node"));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_param_show", "Show paramater on new node"),
"node_param_show",
new checkBox(function() /*=>*/ { PREFERENCES.node_param_show = !PREFERENCES.node_param_show; PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_param_width", "Default param width"),
"node_param_width",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.node_param_width = val; PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_3d_preview", "3D Preview resolution"),
"node_3d_preview_size",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.node_3d_preview_size = clamp(val, 16, 1024); PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_file_watcher_delay", "File watcher delay (s)"),
"file_watcher_delay",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.file_watcher_delay = val; PREF_SAVE(); })
));
ds_list_add(pref_node, __txt("Defaults"));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_default_depth", "Default surface depth"),
"node_default_depth",
new scrollBox(global.SURFACE_FORMAT_NAME, function(val) /*=>*/ { PREFERENCES.node_default_depth = val; PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_default_interpolation", "Default interpolation"),
"node_default_interpolation",
new scrollBox(global.SURFACE_INTERPOLATION, function(val) /*=>*/ { PREFERENCES.node_default_interpolation = val; PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_default_oversample", "Default oversample"),
"node_default_oversample",
new scrollBox(global.SURFACE_OVERSAMPLE, function(val) /*=>*/ { PREFERENCES.node_default_oversample = val; PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_param_width", "Default param width"),
"node_param_width",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.node_param_width = val; PREF_SAVE(); })
));
ds_list_add(pref_node, __txt("Display"));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_param_show", "Show paramater on new node"),
"node_param_show",
new checkBox(function() /*=>*/ { PREFERENCES.node_param_show = !PREFERENCES.node_param_show; PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_node_3d_preview", "3D Preview resolution"),
"node_3d_preview_size",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.node_3d_preview_size = clamp(val, 16, 1024); PREF_SAVE(); })
));
ds_list_add(pref_node, __txt("Files"));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_file_watcher_delay", "File watcher delay (s)"),
"file_watcher_delay",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.file_watcher_delay = val; PREF_SAVE(); })
));
#endregion
#region theme

View file

@ -1,7 +1,7 @@
#macro CHECK_PANEL_PRESETS if(!is_instanceof(FOCUS_CONTENT, Panel_Presets)) return;
function panel_preset_replace() { CHECK_PANEL_PRESETS CALL("panel_preset_replace"); FOCUS_CONTENT.replacePreset(FOCUS_CONTENT.selecting_preset.path); }
function panel_preset_delete() { CHECK_PANEL_PRESETS CALL("panel_preset_delete"); file_delete(FOCUS_CONTENT.selecting_preset.path); FOCUS_CONTENT.__initPresets(); }
function panel_preset_delete() { CHECK_PANEL_PRESETS CALL("panel_preset_delete"); file_delete(FOCUS_CONTENT.selecting_preset.path); __initPresets(); }
function panel_preset_reset() { CHECK_PANEL_PRESETS CALL("panel_preset_reset"); FOCUS_CONTENT.newPresetFromNode("_default"); }
function __fnInit_Presets() {

View file

@ -136,6 +136,10 @@
PREFERENCES.node_param_show = false;
PREFERENCES.node_param_width = 192;
PREFERENCES.node_3d_preview_size = 256;
PREFERENCES.node_default_depth = 3;
PREFERENCES.node_default_oversample = 1;
PREFERENCES.node_default_interpolation = 1;
#endregion