[Wavetable] New wavetable builder.

This commit is contained in:
Tanasart 2024-11-13 14:35:04 +07:00
parent c86d841c2e
commit 92c1ac3979
25 changed files with 452 additions and 87 deletions

View file

@ -62,6 +62,8 @@
{"name":"effects","order":4,"path":"folders/nodes/data/filter/effects.yy",}, {"name":"effects","order":4,"path":"folders/nodes/data/filter/effects.yy",},
{"name":"fixes","order":5,"path":"folders/nodes/data/filter/fixes.yy",}, {"name":"fixes","order":5,"path":"folders/nodes/data/filter/fixes.yy",},
{"name":"warps","order":6,"path":"folders/nodes/data/filter/warps.yy",}, {"name":"warps","order":6,"path":"folders/nodes/data/filter/warps.yy",},
{"name":"game engines","order":32,"path":"folders/nodes/data/game engines.yy",},
{"name":"gamemaker","order":1,"path":"folders/nodes/data/game engines/gamemaker.yy",},
{"name":"generator","order":17,"path":"folders/nodes/data/generator.yy",}, {"name":"generator","order":17,"path":"folders/nodes/data/generator.yy",},
{"name":"drawer","order":11,"path":"folders/nodes/data/generator/drawer.yy",}, {"name":"drawer","order":11,"path":"folders/nodes/data/generator/drawer.yy",},
{"name":"noise","order":14,"path":"folders/nodes/data/generator/noise.yy",}, {"name":"noise","order":14,"path":"folders/nodes/data/generator/noise.yy",},
@ -2063,6 +2065,7 @@
{"name":"s_inspector_surface_valign","order":13,"path":"sprites/s_inspector_surface_valign/s_inspector_surface_valign.yy",}, {"name":"s_inspector_surface_valign","order":13,"path":"sprites/s_inspector_surface_valign/s_inspector_surface_valign.yy",},
{"name":"s_inspector_text_halign","order":14,"path":"sprites/s_inspector_text_halign/s_inspector_text_halign.yy",}, {"name":"s_inspector_text_halign","order":14,"path":"sprites/s_inspector_text_halign/s_inspector_text_halign.yy",},
{"name":"s_inspector_text_valign","order":15,"path":"sprites/s_inspector_text_valign/s_inspector_text_valign.yy",}, {"name":"s_inspector_text_valign","order":15,"path":"sprites/s_inspector_text_valign/s_inspector_text_valign.yy",},
{"name":"s_inspector_wavetable","order":32,"path":"sprites/s_inspector_wavetable/s_inspector_wavetable.yy",},
{"name":"s_itch","order":119,"path":"sprites/s_itch/s_itch.yy",}, {"name":"s_itch","order":119,"path":"sprites/s_itch/s_itch.yy",},
{"name":"s_junc_visible","order":120,"path":"sprites/s_junc_visible/s_junc_visible.yy",}, {"name":"s_junc_visible","order":120,"path":"sprites/s_junc_visible/s_junc_visible.yy",},
{"name":"s_junction_bypass","order":232,"path":"sprites/s_junction_bypass/s_junction_bypass.yy",}, {"name":"s_junction_bypass","order":232,"path":"sprites/s_junction_bypass/s_junction_bypass.yy",},

View file

@ -152,6 +152,8 @@
{"$GMFolder":"","%Name":"effects","folderPath":"folders/nodes/data/filter/effects.yy","name":"effects","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"effects","folderPath":"folders/nodes/data/filter/effects.yy","name":"effects","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"fixes","folderPath":"folders/nodes/data/filter/fixes.yy","name":"fixes","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"fixes","folderPath":"folders/nodes/data/filter/fixes.yy","name":"fixes","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"warps","folderPath":"folders/nodes/data/filter/warps.yy","name":"warps","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"warps","folderPath":"folders/nodes/data/filter/warps.yy","name":"warps","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"game engines","folderPath":"folders/nodes/data/game engines.yy","name":"game engines","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"gamemaker","folderPath":"folders/nodes/data/game engines/gamemaker.yy","name":"gamemaker","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"generator","folderPath":"folders/nodes/data/generator.yy","name":"generator","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"generator","folderPath":"folders/nodes/data/generator.yy","name":"generator","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"drawer","folderPath":"folders/nodes/data/generator/drawer.yy","name":"drawer","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"drawer","folderPath":"folders/nodes/data/generator/drawer.yy","name":"drawer","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"noise","folderPath":"folders/nodes/data/generator/noise.yy","name":"noise","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"noise","folderPath":"folders/nodes/data/generator/noise.yy","name":"noise","resourceType":"GMFolder","resourceVersion":"2.0",},
@ -1464,6 +1466,7 @@
{"id":{"name":"node_gamma_map","path":"scripts/node_gamma_map/node_gamma_map.yy",},}, {"id":{"name":"node_gamma_map","path":"scripts/node_gamma_map/node_gamma_map.yy",},},
{"id":{"name":"node_global","path":"scripts/node_global/node_global.yy",},}, {"id":{"name":"node_global","path":"scripts/node_global/node_global.yy",},},
{"id":{"name":"node_glow","path":"scripts/node_glow/node_glow.yy",},}, {"id":{"name":"node_glow","path":"scripts/node_glow/node_glow.yy",},},
{"id":{"name":"node_gm_room","path":"scripts/node_gm_room/node_gm_room.yy",},},
{"id":{"name":"node_gradient_extract","path":"scripts/node_gradient_extract/node_gradient_extract.yy",},}, {"id":{"name":"node_gradient_extract","path":"scripts/node_gradient_extract/node_gradient_extract.yy",},},
{"id":{"name":"node_gradient_out","path":"scripts/node_gradient_out/node_gradient_out.yy",},}, {"id":{"name":"node_gradient_out","path":"scripts/node_gradient_out/node_gradient_out.yy",},},
{"id":{"name":"node_gradient_palette","path":"scripts/node_gradient_palette/node_gradient_palette.yy",},}, {"id":{"name":"node_gradient_palette","path":"scripts/node_gradient_palette/node_gradient_palette.yy",},},
@ -2788,6 +2791,7 @@
{"id":{"name":"s_inspector_surface_valign","path":"sprites/s_inspector_surface_valign/s_inspector_surface_valign.yy",},}, {"id":{"name":"s_inspector_surface_valign","path":"sprites/s_inspector_surface_valign/s_inspector_surface_valign.yy",},},
{"id":{"name":"s_inspector_text_halign","path":"sprites/s_inspector_text_halign/s_inspector_text_halign.yy",},}, {"id":{"name":"s_inspector_text_halign","path":"sprites/s_inspector_text_halign/s_inspector_text_halign.yy",},},
{"id":{"name":"s_inspector_text_valign","path":"sprites/s_inspector_text_valign/s_inspector_text_valign.yy",},}, {"id":{"name":"s_inspector_text_valign","path":"sprites/s_inspector_text_valign/s_inspector_text_valign.yy",},},
{"id":{"name":"s_inspector_wavetable","path":"sprites/s_inspector_wavetable/s_inspector_wavetable.yy",},},
{"id":{"name":"s_itch","path":"sprites/s_itch/s_itch.yy",},}, {"id":{"name":"s_itch","path":"sprites/s_itch/s_itch.yy",},},
{"id":{"name":"s_junc_aseprite","path":"sprites/s_junc_aseprite/s_junc_aseprite.yy",},}, {"id":{"name":"s_junc_aseprite","path":"sprites/s_junc_aseprite/s_junc_aseprite.yy",},},
{"id":{"name":"s_junc_visible","path":"sprites/s_junc_visible/s_junc_visible.yy",},}, {"id":{"name":"s_junc_visible","path":"sprites/s_junc_visible/s_junc_visible.yy",},},

View file

@ -49,14 +49,14 @@ function GMRoom(_gm, _path, _info) constructor {
} }
function __Binder_Gamemaker(path) constructor { function __Binder_Gamemaker(path) constructor {
self.path = path; self.path = path;
name = filename_name_only(path); name = filename_name_only(path);
dir = filename_dir(path); dir = filename_dir(path);
projectName = ""; projectName = "";
resourcesRaw = []; resourcesRaw = [];
resourcesMap = {}; resourcesMap = {};
resources = [ resources = [
{ name: "sprites", data : [], closed : false, }, { name: "sprites", data : [], closed : false, },
{ name: "tileset", data : [], closed : false, }, { name: "tileset", data : [], closed : false, },
{ name: "rooms", data : [], closed : false, }, { name: "rooms", data : [], closed : false, },

View file

@ -5,12 +5,17 @@
function color_real(color) { INLINE return make_color_rgb(color_get_red(color), color_get_green(color), color_get_blue(color)); } function color_real(color) { INLINE return make_color_rgb(color_get_red(color), color_get_green(color), color_get_blue(color)); }
function color_get_alpha(color) { INLINE return (color & (0xFF << 24)) >> 24; } function color_get_alpha(color) { INLINE return (color & (0xFF << 24)) >> 24; }
function _color_get_alpha(color) { INLINE return color_get_alpha(color) / 255; }
#macro _color_get_r _color_get_red
#macro _color_get_g _color_get_green
#macro _color_get_b _color_get_blue
#macro _color_get_a _color_get_alpha
function _color_get_red(color) { INLINE return color_get_red(color) / 255; } function _color_get_red(color) { INLINE return color_get_red(color) / 255; }
function _color_get_green(color) { INLINE return color_get_green(color) / 255; } function _color_get_green(color) { INLINE return color_get_green(color) / 255; }
function _color_get_blue(color) { INLINE return color_get_blue(color) / 255; } function _color_get_blue(color) { INLINE return color_get_blue(color) / 255; }
function _color_get_alpha(color) { INLINE return color_get_alpha(color) / 255; }
function _color_get_hue(color) { INLINE return color_get_hue(color) / 255; } function _color_get_hue(color) { INLINE return color_get_hue(color) / 255; }
function _color_get_saturation(color) { INLINE return color_get_saturation(color) / 255; } function _color_get_saturation(color) { INLINE return color_get_saturation(color) / 255; }
function _color_get_value(color) { INLINE return color_get_value(color) / 255; } function _color_get_value(color) { INLINE return color_get_value(color) / 255; }

View file

@ -60,9 +60,12 @@ function draw_sprite_bbox_uniform(spr, ind, _bbox, _col = c_white, _alp = 1) {
if(_bbox == noone) return; if(_bbox == noone) return;
var _sw = sprite_get_width(spr); var _sw = sprite_get_width(spr);
var _sh = sprite_get_height(spr); var _sh = sprite_get_height(spr);
var _ox = sprite_get_xoffset(spr);
var _oy = sprite_get_yoffset(spr);
var _minS = min(_bbox.w / _sw, _bbox.h / _sh); var _minS = min(_bbox.w / _sw, _bbox.h / _sh);
__draw_sprite_ext(spr, ind, _bbox.xc - _sw * _minS / 2, _bbox.yc - _sh * _minS / 2, _minS, _minS, 0, _col, _alp); __draw_sprite_ext(spr, ind, _bbox.xc - _sw * _minS / 2 + _ox * _minS, _bbox.yc - _sh * _minS / 2 + _oy * _minS, _minS, _minS, 0, _col, _alp);
} }
function draw_sprite_uniform(spr, ind, _x, _y, scale, color = c_white, alpha = 1) { function draw_sprite_uniform(spr, ind, _x, _y, scale, color = c_white, alpha = 1) {

View file

@ -42,7 +42,7 @@
LATEST_VERSION = 1_18_00_0; LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_04_0; VERSION = 1_18_04_0;
SAVE_VERSION = 1_18_02_0; SAVE_VERSION = 1_18_02_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.4.004"; VERSION_STRING = MAC? "1.18.003m" : "1.18.4.005";
BUILD_NUMBER = 1_18_03_1; BUILD_NUMBER = 1_18_03_1;
HOTKEYS = ds_map_create(); HOTKEYS = ds_map_create();

View file

@ -20,7 +20,7 @@ function Node_Find_Pixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
input_display_list = [ 0, input_display_list = [ 0,
["Search", false ], 1, 2, 3, ["Search", false], 1, 2, 3,
["Alpha", true, 4], 5, ["Alpha", true, 4], 5,
] ]
@ -45,13 +45,15 @@ function Node_Find_Pixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
buffer_seek(_buff, buffer_seek_start, 0); buffer_seek(_buff, buffer_seek_start, 0);
var res = []; var res = [];
var r = _color_get_red(_col); var r = _color_get_r( _col );
var g = _color_get_green(_col); var g = _color_get_g( _col );
var b = _color_get_blue(_col); var b = _color_get_b( _col );
var a = _color_get_alpha(_col); var a = _color_get_a( _col );
for( var i = 0; i < _sh; i++ ) var _am = _sw * _sh, _i = -1;
for( var j = 0; j < _sw; j++ ) {
repeat(_am) {
_i++;
var _c = buffer_read(_buff, buffer_u32); var _c = buffer_read(_buff, buffer_u32);
var _r = ((_c & 0x000000FF) >> 0) / 255; var _r = ((_c & 0x000000FF) >> 0) / 255;
@ -65,9 +67,12 @@ function Node_Find_Pixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
if(!colMatch) continue; if(!colMatch) continue;
if(!_alp || abs(a - _a) <= _alpT) { if(!_alp || abs(a - _a) <= _alpT) {
if(_all) array_push(res, [ j, i ]); var _pnt = [ _i % _sw, floor(_i / _sw) ];
else return [ j, i ];
if(_all) array_push(res, _pnt);
else return _pnt;
} }
} }
buffer_delete(_buff); buffer_delete(_buff);

View file

@ -1,57 +1,283 @@
enum WAVETABLE_FN {
sine,
square,
tri,
saw,
}
function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) constructor { function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) constructor {
name = "WaveTable"; name = "WaveTable";
newInput(inl + 0, nodeValue_Float("Pattern", self, 0 )) newInput(inl + 0, nodeValue_Float("Pattern", self, 0 ));
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 3, 0.01] });
newInput(inl + 1, nodeValue_Vec2("Range", self, [ 0, 1 ])); newInput(inl + 1, nodeValue_Vec2("Range", self, [ 0, 1 ]));
newInput(inl + 2, nodeValue_Float("Frequency", self, 2 )) newInput(inl + 2, nodeValue_Float("Frequency", self, 2 ))
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 8, 0.01] }); .setDisplay(VALUE_DISPLAY.slider, { range: [1, 8, 0.01] });
newInput(inl + 3, nodeValue_Float("Phase", self, 0 ));
wavetable_apply = function(typ) {
if(wavetable_selecting == noone) return;
attributes.wavetable[wavetable_selecting] = typ;
resetDisplayTable();
triggerRender();
}
wavetable_selecting = noone;
wavetable_menu = [
new MenuItem("Sine", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.sine); }, [ s_inspector_wavetable, 0 ]),
new MenuItem("Square", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.square); }, [ s_inspector_wavetable, 1 ]),
new MenuItem("Triangle", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.tri); }, [ s_inspector_wavetable, 2 ]),
new MenuItem("Sawtooth", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.saw); }, [ s_inspector_wavetable, 3 ]),
];
wavetable_editor = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) {
var _h = ui(160);
var pd = ui(8);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1);
if(array_empty(wavetable_display_data)) return _h;
var xr = graph_res;
var yr = attributes.wavetable_y_res;
var _len = array_length(attributes.wavetable);
var x0 = _x + pd;
var x1 = _x + _w - pd;
var ww = _w - pd * 2;
var y0 = _y + pd;
var y1 = _y + _h - pd;
var hh = _h - pd * 2;
var _gra_w = ww * .6;
var _gra_h = ui(32);
var _gra_p = _gra_w / (xr - 1);
var _gra_l = (hh - _gra_h) / yr;
var ys = y1 - _gra_h / 2;
var ox, oy, nx, ny;
draw_set_color(COLORS._main_icon_light);
draw_set_alpha(.2);
for( var i = 0; i < yr; i++ ) {
var _crv = wavetable_display_data[i];
var _gra_y = ys - _gra_l * i;
var _gra_x = lerp(x0, x1 - _gra_w, i / yr);
for( var j = 0; j < xr; j++ ) {
var _val = _crv[j];
nx = _gra_x + j * _gra_p;
ny = _gra_y - _val * _gra_h / 2;
if(j) draw_line(ox, oy, nx, ny);
ox = nx;
oy = ny;
}
}
draw_set_color(COLORS._main_icon_light);
draw_set_alpha(.5);
for( var i = 0; i < array_length(wavetable_display_data_step); i++ ) {
var _ind = safe_mod(i, _len) / _len * yr;
var _crv = wavetable_display_data_step[i];
var _gra_y = ys - _gra_l * _ind;
var _gra_x = lerp(x0, x1 - _gra_w, _ind / yr);
for( var j = 0; j < xr; j++ ) {
var _val = _crv[j];
nx = _gra_x + j * _gra_p;
ny = _gra_y - _val * _gra_h / 2;
if(j) draw_line(ox, oy, nx, ny);
ox = nx;
oy = ny;
}
}
draw_set_color(COLORS._main_accent);
draw_set_alpha(1);
var _ind = safe_mod(pattern, _len) / _len * yr;
var _crv = wavetable_display_curent;
var _gra_y = ys - _gra_l * _ind;
var _gra_x = lerp(x0, x1 - _gra_w, _ind / yr);
for( var j = 0; j < xr; j++ ) {
var _val = _crv[j];
nx = _gra_x + j * _gra_p;
ny = _gra_y - _val * _gra_h / 2;
if(j) draw_line_width(ox, oy, nx, ny, 2);
ox = nx;
oy = ny;
}
var _yy = _y + _h + ui(4);
var _tw = ui(28);
var _th = ui(24);
_h += ui(4) + _th + ui(8);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _yy, _w, _th + ui(8), COLORS.node_composite_bg_blend, 1);
var _del = noone;
for( var i = 0; i <= _len; i++ ) {
var _tx = _x + ui(4) + i * (_tw + ui(4));
var _ty = _yy + ui(4);
if(_hover && point_in_rectangle(_m[0], _m[1], _tx, _ty, _tx + _tw, _ty + _th)) {
if(i == _len) {
if(mouse_press(mb_left, _focus)) {
array_push(attributes.wavetable, 0);
wavetable_selecting = i;
menuCall("", wavetable_menu);
}
} else {
draw_sprite_stretched_ext(THEME.button_def, 1, _tx, _ty, _tw, _th, COLORS._main_icon_light, 1);
if(mouse_press(mb_left, _focus)) {
wavetable_selecting = i;
menuCall("", wavetable_menu);
}
if(_len > 1 && mouse_press(mb_right, _focus))
_del = i;
}
}
if(i < _len) {
var _type = attributes.wavetable[i];
draw_sprite_stretched_ext(THEME.button_def, 0, _tx, _ty, _tw, _th, COLORS._main_icon_light, .5);
draw_sprite_ui(s_inspector_wavetable, _type, _tx + _tw / 2, _ty + _th / 2, 1, 1, 0, COLORS._main_icon_light, 1);
} else
draw_sprite_ui(THEME.add_16, _type, _tx + _tw / 2, _ty + _th / 2, 1, 1, 0, COLORS._main_value_positive, 1);
}
if(_del != noone) {
array_delete(attributes.wavetable, _del, 1);
resetDisplayTable();
triggerRender();
}
return _h;
});
array_append(input_display_list, [ array_append(input_display_list, [
["Wave", false], inl + 0, inl + 1, inl + 2, ["Wave", false], wavetable_editor, inl + 0, inl + 1, inl + 2, inl + 3,
]); ]);
attributes.wavetable = [
WAVETABLE_FN.sine,
WAVETABLE_FN.square,
WAVETABLE_FN.tri,
];
attributes.wavetable_y_res = 24;
wavetable_display_data = [];
wavetable_display_data_step = [];
wavetable_display_curent = [];
pattern = 0; pattern = 0;
frequency = 0; frequency = 0;
phase = 0;
range_min = 0; range_min = 0;
range_max = 0; range_max = 0;
function getPattern(_patt, _x) { function getPattern(_patt, _x) {
switch(_patt % 3) { var _len = array_length(attributes.wavetable);
case 0 : return sin(_x * pi * 2); var _ind = safe_mod(_patt, _len);
case 1 : return frac(_x) < 0.5? 1 : -1;
case 2 : return frac(_x + 0.5) * 2 - 1; switch(attributes.wavetable[_ind]) {
case WAVETABLE_FN.sine : return sin(_x * pi * 2);
case WAVETABLE_FN.square : return (1 - floor(frac(_x) * 2)) * 2 - 1;
case WAVETABLE_FN.tri : return frac(_x + 0.5) * 2 - 1;
case WAVETABLE_FN.saw : return abs(frac(_x + .5) - .5) * 2 * 2 - 1;
} }
return 0; return 0;
} }
static __fnEval = function(_x = 0) { function resetDisplayTable() {
var _p0 = floor(pattern); var xr = graph_res;
var _p1 = floor(pattern) + 1; var yr = attributes.wavetable_y_res;
var _fr = frac(pattern); var _len = array_length(attributes.wavetable);
var xri = 1 / xr;
var yri = 1 / (yr - 1);
var _v0 = getPattern(_p0, _x * frequency) * .5 + .5; wavetable_display_data = array_verify(wavetable_display_data, yr);
var _v1 = getPattern(_p1, _x * frequency) * .5 + .5; for( var i = 0; i < yr; i++ ) {
var _lrp = lerp(_v0, _v1, _fr); var _patt = i * yri * _len;
wavetable_display_data[i] = array_verify(wavetable_display_data[i], xr);
for( var j = 0; j < xr; j++ )
wavetable_display_data[i][j] = __evalRaw(_patt, (j * xri) * 2);
}
return lerp(range_min, range_max, _lrp); wavetable_display_data_step = array_verify(wavetable_display_data_step, _len);
for( var i = 0; i < _len; i++ ) {
wavetable_display_data_step[i] = array_verify(wavetable_display_data_step[i], xr);
for( var j = 0; j < xr; j++ )
wavetable_display_data_step[i][j] = __evalRaw(i, (j * xri) * 2);
}
} resetDisplayTable();
static __evalRaw = function(_patt, _x = 0) {
var _p0 = floor(_patt);
var _p1 = floor(_patt) + 1;
var _fr = frac(_patt);
var _v0 = getPattern(_p0, _x);
var _v1 = getPattern(_p1, _x);
var _lr = lerp(_v0, _v1, _fr);
return _lr;
} }
static processData = function(_output, _data, _output_index, _array_index = 0) { #region static __fnEval = function(_x = 0) {
_x = _x * frequency - phase;
var _lr = __evalRaw(pattern, _x) * .5 + .5;
return lerp(range_min, range_max, _lr);
}
static processData = function(_output, _data, _output_index, _array_index = 0) {
pattern = _data[inl + 0]; pattern = _data[inl + 0];
var ran = _data[inl + 1]; var ran = _data[inl + 1];
range_min = array_safe_get_fast(ran, 0); range_min = array_safe_get_fast(ran, 0);
range_max = array_safe_get_fast(ran, 1); range_max = array_safe_get_fast(ran, 1);
frequency = _data[inl + 2]; frequency = _data[inl + 2];
phase = _data[inl + 3];
var val = __fnEval(CURRENT_FRAME / TOTAL_FRAMES); var val = __fnEval(CURRENT_FRAME / TOTAL_FRAMES);
text_display = val; text_display = val;
wavetable_display_curent = array_verify(wavetable_display_curent, graph_res);
for( var j = 0; j < graph_res; j++ )
wavetable_display_curent[j] = __evalRaw(pattern, (j / graph_res) * 2);
return val; return val;
} #endregion }
static postApplyDeserialize = function() {
resetDisplayTable();
}
} }

View file

@ -0,0 +1,3 @@
function Script1257(){
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"v1",
"%Name":"node_gm_room",
"isCompatibility":false,
"isDnD":false,
"name":"node_gm_room",
"parent":{
"name":"gamemaker",
"path":"folders/nodes/data/game engines/gamemaker.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -1537,6 +1537,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr
tileAmount = [ floor(_tdim[0] / tileSize[0]), floor(_tdim[1] / tileSize[1]) ]; tileAmount = [ floor(_tdim[0] / tileSize[0]), floor(_tdim[1] / tileSize[1]) ];
if(gmTile != noone) { if(gmTile != noone) {
inputs[0].setVisible(false, false);
var _spm = struct_try_get(gmTile.gmBinder.resourcesMap, gmTile.sprite, noone); var _spm = struct_try_get(gmTile.gmBinder.resourcesMap, gmTile.sprite, noone);
var _spr = _spm == noone? noone : _spm.thumbnail; var _spr = _spm == noone? noone : _spm.thumbnail;

View file

@ -2308,14 +2308,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static extractNode = function(_type = extract_node) { static extractNode = function(_type = extract_node) {
if(_type == "") return noone; if(_type == "") return noone;
var ext = nodeBuild(_type, node.x, node.y); var ext = nodeBuild(_type, node.x, node.y).skipDefault();
ext.x -= ext.w + 32; ext.x -= ext.w + 32;
for( var i = 0; i < array_length(ext.outputs); i++ ) { for( var i = 0; i < array_length(ext.outputs); i++ )
if(setFrom(ext.outputs[i])) break; if(setFrom(ext.outputs[i])) break;
}
var animFrom = animator.values;
var len = 2; var len = 2;
switch(_type) { switch(_type) {
@ -2323,39 +2321,29 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case "Node_Vector3": len++; case "Node_Vector3": len++;
case "Node_Vector2": case "Node_Vector2":
for( var j = 0; j < len; j++ ) { for( var j = 0; j < len; j++ ) {
var animTo = ext.inputs[j].animator; var _in = ext.inputs[j];
var animLs = animTo.values;
ext.inputs[j].setAnim(is_anim); _in.setAnim(is_anim);
ds_list_clear(animLs); _in.animator.values = [];
} }
for( var i = 0; i < ds_list_size(animFrom); i++ ) { for( var i = 0; i < array_length(animator.values); i++ ) {
var _arrVal = animator.values[i];
for( var j = 0; j < len; j++ ) { for( var j = 0; j < len; j++ ) {
var animTo = ext.inputs[j].animator; var _in = ext.inputs[j];
var animLs = animTo.values; var _kf = _arrVal.clone(_in.animator);
var a = animFrom[| i].clone(animTo); _kf.value = _kf.value[j];
a.value = a.value[j]; array_push(_in.animator.values, _kf);
ds_list_add(animLs, a);
} }
} }
break;
case "Node_Path":
break;
default:
var animTo = ext.inputs[0].animator;
var animLs = animTo.values;
ext.inputs[0].setAnim(is_anim);
ds_list_clear(animLs);
for( var i = 0; i < ds_list_size(animFrom); i++ )
ds_list_add(animLs, animFrom[| i].clone(animTo));
break; break;
} }
ext.doUpdate(); ext.triggerRender();
} }
static dragValue = function() { static dragValue = function() {

View file

@ -1,4 +1,4 @@
function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { #region function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Vector2"; name = "Vector2";
color = COLORS.node_blend_number; color = COLORS.node_blend_number;
@ -54,7 +54,7 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}), }),
]; ];
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
PROCESSOR_OVERLAY_CHECK PROCESSOR_OVERLAY_CHECK
var __ax = current_data[0]; var __ax = current_data[0];
@ -103,9 +103,9 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
drag_sy = _ay; drag_sy = _ay;
} }
} }
} #endregion }
static step = function() { #region static step = function() {
var int = getInputData(2); var int = getInputData(2);
var disp = getInputData(3); var disp = getInputData(3);
@ -118,17 +118,17 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
if(disp == 1 && inputs[0].value_from == noone && inputs[1].value_from == noone) if(disp == 1 && inputs[0].value_from == noone && inputs[1].value_from == noone)
setDimension(160, 160, false); setDimension(160, 160, false);
} #endregion }
static processData = function(_output, _data, _output_index, _array_index = 0) { #region static processData = function(_output, _data, _output_index, _array_index = 0) {
var vec = [ _data[0], _data[1] ]; var vec = [ _data[0], _data[1] ];
for( var i = 0, n = array_length(vec); i < n; i++ ) for( var i = 0, n = array_length(vec); i < n; i++ )
vec[i] = _data[2]? round(vec[i]) : vec[i]; vec[i] = _data[2]? round(vec[i]) : vec[i];
return vec; return vec;
} #endregion }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var disp = getInputData(3); var disp = getInputData(3);
var vec = getSingleValue(0,, true); var vec = getSingleValue(0,, true);
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
@ -176,13 +176,13 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var pin_x = (v0 - wd_minx) / (wd_maxx - wd_minx); var pin_x = (v0 - wd_minx) / (wd_maxx - wd_minx);
var pin_y = (v1 - wd_miny) / (wd_maxy - wd_miny); var pin_y = (v1 - wd_miny) / (wd_maxy - wd_miny);
if(point_in_rectangle(v0, v1, wd_minx, wd_miny, wd_maxx, wd_maxy)) { #region draw pin if(point_in_rectangle(v0, v1, wd_minx, wd_miny, wd_maxx, wd_maxy)) { // draw pin
var pin_dx = bbox.x0 + bbox.w * pin_x; var pin_dx = bbox.x0 + bbox.w * pin_x;
var pin_dy = bbox.y1 - bbox.h * pin_y; var pin_dy = bbox.y1 - bbox.h * pin_y;
draw_sprite_ext(THEME.node_coor_pin, 0, pin_dx, pin_dy, 1, 1, 0, c_white, 1); draw_sprite_ext(THEME.node_coor_pin, 0, pin_dx, pin_dy, 1, 1, 0, c_white, 1);
} #endregion }
if(wd_dragging) { #region if(wd_dragging) {
var mx = wd_minx + (_mx - bbox.x0) / bbox.w * (wd_maxx - wd_minx); var mx = wd_minx + (_mx - bbox.x0) / bbox.w * (wd_maxx - wd_minx);
var my = wd_maxy - (_my - bbox.y0) / bbox.h * (wd_maxy - wd_miny); var my = wd_maxy - (_my - bbox.y0) / bbox.h * (wd_maxy - wd_miny);
@ -199,8 +199,8 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
wd_dragging = false; wd_dragging = false;
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
#endregion
} else if(wd_panning) { #region } else if(wd_panning) {
draw_set_color(color); draw_set_color(color);
draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 1); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 1);
@ -216,10 +216,10 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
if(mouse_release(mb_middle)) if(mouse_release(mb_middle))
wd_panning = false; wd_panning = false;
#endregion
} }
if(_hover && point_in_rectangle(_mx, _my, bbox.x0, bbox.y0, bbox.x1, bbox.y1)) { #region if(_hover && point_in_rectangle(_mx, _my, bbox.x0, bbox.y0, bbox.x1, bbox.y1)) {
draw_set_color(color); draw_set_color(color);
draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 1); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 1);
@ -264,11 +264,11 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
if(mouse_press(mb_right, _focus)) if(mouse_press(mb_right, _focus))
menuCall("node_vec2_coordinate", coordinate_menu); menuCall("node_vec2_coordinate", coordinate_menu);
} #endregion }
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text); draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
var str = $"[{v0}, {v1}]"; var str = $"[{v0}, {v1}]";
var ss = min(1, string_scale(str, bbox.w - 16 * _s, bbox.h)); var ss = min(1, string_scale(str, bbox.w - 16 * _s, bbox.h));
draw_text_transformed(bbox.xc, bbox.y1 - 4, str, ss, ss, 0); draw_text_transformed(bbox.xc, bbox.y1 - 4, str, ss, ss, 0);
} #endregion }
} #endregion }

View file

@ -1,6 +1,6 @@
function Panel_GM_Explore(gmBinder) : PanelContent() constructor { function Panel_GM_Explore(gmBinder) : PanelContent() constructor {
self.gmBinder = gmBinder; self.gmBinder = gmBinder;
title = gmBinder.projectName; title = $"{gmBinder.projectName}.yyc";
auto_pin = true; auto_pin = true;
padding = 8; padding = 8;
@ -16,11 +16,7 @@ function Panel_GM_Explore(gmBinder) : PanelContent() constructor {
keyboard_lastkey = -1; keyboard_lastkey = -1;
search_res = []; search_res = [];
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) { tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchResource(); });
search_string = string(str);
searchResource();
});
tb_search.align = fa_left; tb_search.align = fa_left;
tb_search.auto_update = true; tb_search.auto_update = true;
tb_search.boxColor = COLORS._main_icon_light; tb_search.boxColor = COLORS._main_icon_light;
@ -100,6 +96,7 @@ function Panel_GM_Explore(gmBinder) : PanelContent() constructor {
if(_hover && point_in_rectangle(_m[0], _m[1], _asx, _asy, _asx + _ths, _asy + _ths)) { if(_hover && point_in_rectangle(_m[0], _m[1], _asx, _asy, _asx + _ths, _asy + _ths)) {
draw_sprite_stretched_ext(THEME.ui_panel, 1, _asx, _asy, _ths, _ths, COLORS._main_icon); draw_sprite_stretched_ext(THEME.ui_panel, 1, _asx, _asy, _ths, _ths, COLORS._main_icon);
if(_thm) TOOLTIP = [ _thm, "sprite" ];
if(mouse_press(mb_left, _focus)) { if(mouse_press(mb_left, _focus)) {
DRAGGING = { type : _ass.type, data : _ass }; DRAGGING = { type : _ass.type, data : _ass };
@ -131,9 +128,20 @@ function Panel_GM_Explore(gmBinder) : PanelContent() constructor {
var ph = h - ui(padding + padding); var ph = h - ui(padding + padding);
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
tb_search.draw(px, py, pw, ui(32), search_string, [mx, my]);
var _tw = pw - ui(24 + 4);
var _th = ui(24);
tb_search.setFocusHover(pFOCUS, pHOVER);
tb_search.draw(px, py, _tw, _th, search_string, [mx, my]);
if(search_string == "") tb_search.sprite_index = 1; if(search_string == "") tb_search.sprite_index = 1;
var _bs = _th;
var _bx = px + pw - _bs;
var _by = py;
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.refresh_16) == 2)
gmBinder.refreshResources();
sc_content.setFocusHover(pFOCUS, pHOVER); sc_content.setFocusHover(pFOCUS, pHOVER);
sc_content.draw(px, py + ui(40), mx - px, my - (py + ui(40))); sc_content.draw(px, py + ui(40), mx - px, my - (py + ui(40)));

View file

@ -1030,7 +1030,9 @@ function Panel_Inspector() : PanelContent() constructor {
var arr = []; var arr = [];
for(var i = 0; i < array_length(__dialog_junction.extract_node); i++) { for(var i = 0; i < array_length(__dialog_junction.extract_node); i++) {
var _rec = __dialog_junction.extract_node[i]; var _rec = __dialog_junction.extract_node[i];
array_push(arr, menuItem(_rec, function(_dat) { __dialog_junction.extractNode(_dat.name); }, noone, noone, noone, { name : _rec })); var _nod = ALL_NODES[? _rec];
array_push(arr, menuItem(_nod.name, function(_dat) /*=>*/ { __dialog_junction.extractNode(_dat.name); }, noone, noone, noone, { name : _rec }));
} }
return submenuCall(_dat, arr); return submenuCall(_dat, arr);

View file

@ -107,6 +107,7 @@
RENDER_ALL RENDER_ALL
return true; return true;
}), }),
function(junc) { function(junc) {
if(!is_struct(junc)) return; if(!is_struct(junc)) return;
if(!is_instanceof(junc, NodeValue)) return; if(!is_instanceof(junc, NodeValue)) return;

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

View file

@ -0,0 +1,102 @@
{
"$GMSprite":"",
"%Name":"s_inspector_wavetable",
"bboxMode":0,
"bbox_bottom":20,
"bbox_left":1,
"bbox_right":22,
"bbox_top":1,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"a04956a7-d482-440c-bdb6-eb84935289df","name":"a04956a7-d482-440c-bdb6-eb84935289df","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"bb762384-b3c7-459a-9952-4fc54cb4b6cb","name":"bb762384-b3c7-459a-9952-4fc54cb4b6cb","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"bfb9e57d-423a-42be-94a1-f94e86201807","name":"bfb9e57d-423a-42be-94a1-f94e86201807","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"0c49479a-915c-498f-bead-9ebd42395732","name":"0c49479a-915c-498f-bead-9ebd42395732","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":24,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"a06e3ac6-bc4a-4ebf-98db-525189236cd9","blendMode":0,"displayName":"default","isLocked":false,"name":"a06e3ac6-bc4a-4ebf-98db-525189236cd9","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_inspector_wavetable",
"nineSlice":null,
"origin":4,
"parent":{
"name":"nodes",
"path":"folders/sprites/nodes.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_inspector_wavetable",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":4.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_inspector_wavetable",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"a04956a7-d482-440c-bdb6-eb84935289df","path":"sprites/s_inspector_wavetable/s_inspector_wavetable.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"3af0ee71-6d40-4155-bd31-18ef9145f947","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"bb762384-b3c7-459a-9952-4fc54cb4b6cb","path":"sprites/s_inspector_wavetable/s_inspector_wavetable.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"fdcd088a-dfd1-491b-8501-4c57c8d9efe8","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"bfb9e57d-423a-42be-94a1-f94e86201807","path":"sprites/s_inspector_wavetable/s_inspector_wavetable.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"679ce54a-e060-426f-bc02-5924da0ba921","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"0c49479a-915c-498f-bead-9ebd42395732","path":"sprites/s_inspector_wavetable/s_inspector_wavetable.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"6bf52375-96e2-4fa0-8283-a035abecd365","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":12,
"yorigin":12,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":24,
}