panel perf

This commit is contained in:
Tanasart 2024-11-23 13:26:39 +07:00
parent 9665e4ef6e
commit ba6e8a7eb0
35 changed files with 724 additions and 751 deletions

View file

@ -60,7 +60,7 @@ draw_clear(COLORS.bg);
winManDraw();
#endregion
if(APP_SURF_OVERRIDE) { #region
if(APP_SURF_OVERRIDE) {
surface_reset_target();
draw_surface(POST_APP_SURF, 0, 0);
@ -71,4 +71,4 @@ if(APP_SURF_OVERRIDE) { #region
surface_set_target(POST_APP_SURF);
draw_surface(APP_SURF, 0, 0);
surface_reset_target();
} #endregion
}

View file

@ -1,5 +1,8 @@
function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = 1, thick = 1, c1 = c_white, c2 = c_white, params = {}) {
var extend = params.extend;
var indexIn = struct_try_get(params, "fromIndex", 1);
var indexOut = struct_try_get(params, "toIndex", 1);
var corner = min(extend, params.corner);
var type = params.type;
@ -17,8 +20,8 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
var iy = sign(y1 - y0);
var xx0 = x0;
var xx1 = x1;
var xx0 = x0 + extend * _s;
var xx1 = x1 - extend * _s;
var yy0 = y0;
var yy1 = y1;
@ -32,6 +35,9 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
var rx = _x1 - _x0;
var ry = _y1 - _y0;
xx0 = x0 + extend * _s * indexIn;
xx1 = x1 - extend * _s * indexOut;
if(inv) {
var cm = merge_color(c1, c2, 0.5);
@ -209,6 +215,9 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
function draw_line_elbow_diag_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c_white, col2 = c_white, params = {}) {
var extend = params.extend;
var indexIn = struct_try_get(params, "fromIndex", 1);
var indexOut = struct_try_get(params, "toIndex", 1);
var corner = min(extend, params.corner);
var type = params.type;
@ -236,10 +245,12 @@ function draw_line_elbow_diag_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c
function distance_to_elbow_diag(mx, my, x0, y0, x1, y1, cx, cy, _s, params = {}) {
var extend = params.extend;
var indexIn = struct_try_get(params, "fromIndex", 1);
var indexOut = struct_try_get(params, "toIndex", 1);
var iy = sign(y1 - y0);
var xx0 = x0;
var xx1 = x1;
var xx0 = x0 + extend * _s;
var xx1 = x1 - extend * _s;
var yy0 = y0;
var yy1 = y1;
@ -252,6 +263,9 @@ function distance_to_elbow_diag(mx, my, x0, y0, x1, y1, cx, cy, _s, params = {})
var rx = _x1 - _x0;
var ry = _y1 - _y0;
xx0 = x0 + extend * _s * indexIn;
xx1 = x1 - extend * _s * indexOut;
var dist = 9999999;
if(inv) {
var ofl = cy < _y0 || cy > _y1;

View file

@ -44,7 +44,7 @@
LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_04_0;
SAVE_VERSION = 1_18_02_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.5.002";
VERSION_STRING = MAC? "1.18.003m" : "1.18.5.003";
BUILD_NUMBER = 1_18_04_1;
HOTKEYS = ds_map_create();

View file

@ -1,5 +1,6 @@
function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Array";
setDimension(96, 32);
attributes.spread_value = false;

View file

@ -119,25 +119,19 @@ function Node_Array_Rearrange(_x, _y, _group = noone) : Node(_x, _y, _group) con
inputs[1].setValue(_val);
}
static step = function() {
var _typ = VALUE_TYPE.any;
if(inputs[0].value_from != noone) _typ = inputs[0].value_from.type;
static update = function(frame = CURRENT_FRAME) {
var _typ = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type;
inputs[0].setType(_typ);
outputs[0].setType(_typ);
if(type != _typ) {
if(_typ == VALUE_TYPE.surface)
setDimension(128, 128);
else
setDimension(96, 32 + 24);
if(_typ == VALUE_TYPE.surface) setDimension(128, 128);
else setDimension(96, 32 + 24);
type = _typ;
will_setHeight = true;
}
}
static update = function(frame = CURRENT_FRAME) {
var _arr = getInputData(0);
var _ord = getInputData(1);

View file

@ -135,7 +135,7 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
draw_rectangle(_rx, _ry, _rx + _rw, _ry + _rh, true);
}
static step = function() {
static processData_prebatch = function() {
var _back = getSingleValue(0);
var _fore = getSingleValue(1);
var _fill = getSingleValue(5);

View file

@ -331,7 +331,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static step = function() {
if(combine_render_time) {
render_time = 0;
array_foreach(getNodeList(), function(node) { render_time += node.render_time; });
array_foreach(getNodeList(), function(node) /*=>*/ { render_time += node.render_time; });
}
onStep();

View file

@ -91,7 +91,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
.setDisplay(VALUE_DISPLAY.palette);
input_display_list = [11, 12, 15, 9, 24,
["Surface", false], 0, 8, 16, 17, 13,
["Input", false], 0, 8, 16, 17, 13,
["Brightness", false], 1, 18, 10, 25, 2, 19,
["HSV", false], 3, 20, 4, 21, 5, 22,
["Color blend", false], 6, 14, 7, 23,
@ -101,22 +101,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
attribute_surface_depth();
static step = function() { #region
var type = getInputData(12);
inputs[ 0].setVisible(type == 0, type == 0);
inputs[ 8].setVisible(type == 0, type == 0);
inputs[ 9].setVisible(type == 0);
inputs[13].setVisible(type == 1, type == 1);
inputs[14].setVisible(type == 0);
outputs[0].setVisible(type == 0, type == 0);
outputs[1].setVisible(type == 1, type == 1);
var _msk = is_surface(getSingleValue(8));
inputs[16].setVisible(_msk);
inputs[17].setVisible(_msk);
static step = function() {
inputs[ 1].mappableStep();
inputs[ 2].mappableStep();
inputs[ 3].mappableStep();
@ -125,9 +110,29 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
inputs[ 7].mappableStep();
inputs[ 9].mappableStep();
inputs[10].mappableStep();
} #endregion
}
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData_prebatch = function() {
var _type = getSingleValue(12);
inputs[ 0].setVisible(_type == 0, _type == 0);
inputs[ 8].setVisible(_type == 0, _type == 0);
inputs[ 9].setVisible(_type == 0);
inputs[13].setVisible(_type == 1, _type == 1);
inputs[14].setVisible(_type == 0);
outputs[0].setVisible(_type == 0, _type == 0);
outputs[1].setVisible(_type == 1, _type == 1);
inputs[16].setVisible(_type == 0);
inputs[17].setVisible(_type == 0);
preview_draw = _type == 0;
if(_type == 0) setDimension(128, 128);
else if(_type == 1) setDimension(96, process_length[13] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _bri = _data[1];
var _con = _data[2];
var _hue = _data[3];
@ -155,7 +160,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
_col = array_clone(_col);
if(_type == 1) { #region color adjust
if(_type == 1) { // single color adjust
if(is_array(_bri)) _bri = array_safe_get_fast(_bri, 0);
if(is_array(_con)) _con = array_safe_get_fast(_con, 0);
if(is_array(_hue)) _hue = array_safe_get_fast(_hue, 0);
@ -197,7 +202,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
}
return _col;
} #endregion
}
#region param
var sw = surface_get_width_safe(_baseSurf);
@ -252,15 +257,10 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
#endregion
return _outSurf;
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var type = getInputData(12);
if(preview_draw != (type == 0)) {
preview_draw = (type == 0);
will_setHeight = true;
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var type = getInputData(12);
if(type == 0) return;
var bbox = drawGetBbox(xx, yy, _s);
@ -270,7 +270,6 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
@ -278,8 +277,5 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -1,6 +1,5 @@
function Node_Color_Data(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Color Data";
batch_output = false;
setDimension(96, 48);
newInput(0, nodeValue_Color("Color", self, c_white))
@ -19,31 +18,38 @@ function Node_Color_Data(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
newOutput(6, nodeValue_Output("Brightness", self, VALUE_TYPE.float, 0).setVisible(false));
newOutput(7, nodeValue_Output("Alpha", self, VALUE_TYPE.float, 0).setVisible(false));
static processData = function(_output, _data, _output_index, _array_index = 0) {
static processData = function(_outData, _data, _output_index, _array_index = 0) {
var _c = _data[0];
var _n = _data[1];
var val = 0;
switch(_output_index) {
case 0 : val = color_get_red(_c); break;
case 1 : val = color_get_green(_c); break;
case 2 : val = color_get_blue(_c); break;
if(!is_numeric(_c)) return _outData;
case 3 : val = color_get_hue(_c); break;
case 4 : val = color_get_saturation(_c); break;
case 5 : val = color_get_value(_c); break;
if(_n) {
_outData[0] = _color_get_red(_c);
_outData[1] = _color_get_green(_c);
_outData[2] = _color_get_blue(_c);
case 6 :
var r = color_get_red(_c);
var g = color_get_green(_c);
var b = color_get_blue(_c);
val = 0.2126 * r + 0.7152 * g + 0.0722 * b;
break;
_outData[3] = _color_get_hue(_c);
_outData[4] = _color_get_saturation(_c);
_outData[5] = _color_get_value(_c);
case 7 : val = color_get_alpha(_c); break;
_outData[6] = 0.2126 * _outData[0] + 0.7152 * _outData[1] + 0.0722 * _outData[2];
_outData[7] = _color_get_alpha(_c);
} else {
_outData[0] = color_get_red(_c);
_outData[1] = color_get_green(_c);
_outData[2] = color_get_blue(_c);
_outData[3] = color_get_hue(_c);
_outData[4] = color_get_saturation(_c);
_outData[5] = color_get_value(_c);
_outData[6] = 0.2126 * _outData[0] + 0.7152 * _outData[1] + 0.0722 * _outData[2];
_outData[7] = color_get_alpha(_c);
}
return _n? val / 255 : val;
return _outData;
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {

View file

@ -43,20 +43,6 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
newOutput(0, nodeValue_Output("Result", self, VALUE_TYPE.any, []));
newOutput(1, nodeValue_Output("Bool", self, VALUE_TYPE.boolean, false));
static step = function() {
var _mode = getInputData(5);
inputs[0].setVisible(_mode == 1, _mode == 1);
inputs[1].setVisible(_mode == 1);
inputs[2].setVisible(_mode == 1, _mode == 1);
inputs[6].setVisible(_mode == 0, _mode == 0);
inputs[7].setVisible(_mode == 2, _mode == 2);
inputs[8].setVisible(_mode == 2, _mode == 2);
inputs[3].setType(inputs[3].value_from == noone? VALUE_TYPE.any : inputs[3].value_from.type);
inputs[4].setType(inputs[4].value_from == noone? VALUE_TYPE.any : inputs[4].value_from.type);
}
static update = function(frame = CURRENT_FRAME) {
var _true = getInputData(3);
var _fals = getInputData(4);
@ -70,6 +56,16 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var _txt1 = getInputData(7);
var _txt2 = getInputData(8);
inputs[0].setVisible(_mode == 1, _mode == 1);
inputs[1].setVisible(_mode == 1);
inputs[2].setVisible(_mode == 1, _mode == 1);
inputs[6].setVisible(_mode == 0, _mode == 0);
inputs[7].setVisible(_mode == 2, _mode == 2);
inputs[8].setVisible(_mode == 2, _mode == 2);
inputs[3].setType(inputs[3].value_from == noone? VALUE_TYPE.any : inputs[3].value_from.type);
inputs[4].setType(inputs[4].value_from == noone? VALUE_TYPE.any : inputs[4].value_from.type);
var res = false;
switch(_mode) {

View file

@ -103,11 +103,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
w = 128;
h = 128;
min_w = w;
min_h = name_height;
con_h = 128;
h_param = h;
will_setHeight = false;
preserve_height_for_preview = false;
selectable = true;
@ -587,12 +585,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
updatedOutTrigger.setValue(false);
}
if(will_setHeight) {
setHeight();
getJunctionList();
will_setHeight = false;
}
if(is_3D == NODE_3D.polygon) USE_DEPTH = true;
if(is_simulation) PROJECT.animator.is_simulating = true;
@ -737,9 +729,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
}
h = max(min_h, _prev_surf * 128, _hi, _ho);
h = max(previewable? con_h : name_height, _prev_surf * 128, _hi, _ho);
if(attributes.node_height) h = max(h, attributes.node_height);
}
static getJunctionList = function() { ////getJunctionList
@ -988,14 +979,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(!is_instanceof(self, Node_Collection))
render_time = get_timer() - render_timer;
//refreshNodeDisplay();
LOG_BLOCK_END();
}
static valueUpdate = function(index) {
onValueUpdate(index);
if(is_dynamic_input) will_setHeight = true;
cacheCheck();
}
@ -1006,7 +995,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(auto_input && !LOADING && !APPENDING)
refreshDynamicInput();
if(is_dynamic_input) will_setHeight = true;
cacheCheck();
}
@ -1246,6 +1234,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
/////============= DRAW =============
static setShowParameter = function(showParam) {
show_parameter = showParam;
refreshNodeDisplay();
return self;
}
static onInspect = function() {}
static pointIn = function(_x, _y, _mx, _my, _s) {
@ -1267,6 +1261,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
draw_boundary[3] = maxy;
draw_graph_culled = !rectangle_in_rectangle(minx, miny, maxx, maxy, x0, y0, x1, y1);
return !draw_graph_culled;
}
static refreshNodeDisplay = function() {
@ -1278,10 +1273,26 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
} run_in(1, function() /*=>*/ { refreshNodeDisplay(); });
static preDraw = function(_x, _y, _s) {
__preDraw_data = { _x: undefined, _y: undefined, _s: undefined };
static preDraw = function(_x, _y, _s) {
var xx = x * _s + _x;
var yy = y * _s + _y;
var _upd = __preDraw_data._x != xx ||
__preDraw_data._y != yy ||
__preDraw_data._s != _s;
__preDraw_data._x = xx;
__preDraw_data._y = yy;
__preDraw_data._s = _s;
if(!_upd) {
if(SHOW_PARAM) h = h_param;
onPreDraw(_x, _y, _s, _iy, _oy);
return;
}
var jun;
var inspCount = hasInspector1Update() + hasInspector2Update();
@ -1319,70 +1330,23 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
_junSy = yy + _junRy * _s;
}
var _ix = xx;
var _iy = _junSy;
var rx = x;
var ry = y + _junRy;
__s = _s;
_ix = xx;
_iy = _junSy;
for( var i = 0, n = array_length(inputs); i < n; i++ ) {
jun = inputs[i];
_ox = xx + w * _s;
_oy = _junSy;
jun.x = _ix; jun.rx = rx;
jun.y = _iy; jun.ry = ry;
}
array_foreach(inputs, function(jun) /*=>*/ { jun.x = _ix; jun.y = _iy; });
array_foreach(inputDisplayList, function(jun) /*=>*/ { jun.x = _ix; jun.y = _iy; _iy += junction_draw_hei_y * __s; });
for(var i = 0; i < in_cache_len; i++) {
jun = inputDisplayList[i];
array_foreach(outputs_index, function(jun) /*=>*/ { jun = outputs[jun]; jun.x = _ox; jun.y = _oy; _oy += junction_draw_hei_y * jun.isVisible() * __s; });
jun.x = _ix; jun.rx = rx;
jun.y = _iy; jun.ry = ry;
_iy += junction_draw_hei_y * _s;
ry += junction_draw_hei_y;
}
var _ox = xx + w * _s;
var _oy = _junSy;
var rx = x + w;
var ry = y + _junRy;
var idx;
var _oamo = getOutputJunctionAmount();
for(var i = 0; i < _oamo; i++) {
idx = outputs_index[i];
jun = outputs[idx];
jun.x = _ox; jun.rx = rx;
jun.y = _oy; jun.ry = ry;
_oy += junction_draw_hei_y * jun.isVisible() * _s;
ry += junction_draw_hei_y * jun.isVisible();
}
for( var i = 0; i < array_length(inputs); i++ ) {
var _inp = inputs[i];
var jun = _inp.bypass_junc;
if(jun == noone) continue;
jun.x = _ox; jun.rx = rx;
jun.y = _oy; jun.ry = ry;
_oy += junction_draw_hei_y * jun.visible * _s;
ry += junction_draw_hei_y * jun.visible;
}
for( var i = 0, n = array_length(junc_meta); i < n; i++ ) {
var jun = junc_meta[i];
jun.x = _ox; jun.rx = rx;
jun.y = _oy; jun.ry = ry;
_oy += junction_draw_hei_y * jun.isVisible() * _s;
ry += junction_draw_hei_y * jun.isVisible();
}
array_foreach(inputs, function(jun) /*=>*/ { jun = jun.bypass_junc; if(!jun.visible) return;
jun.x = _ox; jun.y = _oy; _oy += junction_draw_hei_y * jun.visible * __s; });
array_foreach(junc_meta, function(jun) /*=>*/ { jun.x = _ox; jun.y = _oy; _oy += junction_draw_hei_y * jun.isVisible() * __s; });
if(SHOW_PARAM) h = h_param;
onPreDraw(_x, _y, _s, _iy, _oy);
}
@ -1396,7 +1360,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static getColor = function() { INLINE return attributes.color == -1? color : attributes.color; }
static drawNodeBase = function(xx, yy, _s) { INLINE draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, getColor(), (.25 + .5 * renderActive) * (.25 + .75 * isHighlightingInGraph())); }
static drawNodeBase = function(xx, yy, _s) {
draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, getColor(), (.25 + .5 * renderActive) * (.25 + .75 * isHighlightingInGraph()));
}
static drawNodeOverlay = function(xx, yy, _mx, _my, _s) {}
@ -1738,7 +1704,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
__draw_inputs = []
static drawConnections = function(params = {}) {
if(!active) return;
if(!active) return noone;
var hovering = noone;
var drawLineIndex = 1;
@ -1746,43 +1712,26 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var high = params.highlight; // 0
var bg = params.bg; // 0
for(var i = 0; i < array_length(outputs); i++) {
for(var i = 0, n = array_length(outputs); i < n; i++) {
var jun = outputs[i];
var connected = false;
for( var j = 0; j < array_length(jun.value_to); j++ ) {
if(jun.value_to[j].value_from == jun)
connected = true;
}
var connected = !array_empty(jun.value_to);
if(connected) {
jun.drawLineIndex = drawLineIndex;
drawLineIndex += 0.5;
}
if(high) {
jun.draw_blend_color = bg;
jun.draw_blend = PREFERENCES.connection_line_highlight_fade;
} else {
jun.draw_blend_color = bg;
jun.draw_blend = -1;
}
jun.draw_blend = high? PREFERENCES.connection_line_highlight_fade : -1;
}
__draw_inputs = array_verify(__draw_inputs, array_length(inputs));
var _len = 0;
var _jun, _hov;
if(hasInspector1Update()) {
_hov = inspectInput1.drawConnections(params);
if(_hov) hovering = _hov;
}
if(hasInspector1Update()) { _hov = inspectInput1.drawConnections(params); if(_hov) hovering = _hov; }
if(hasInspector2Update()) {
_hov = inspectInput2.drawConnections(params);
if(_hov) hovering = _hov;
}
if(hasInspector2Update()) { _hov = inspectInput2.drawConnections(params); if(_hov) hovering = _hov; }
var drawLineIndex = 1;
for(var i = 0, n = array_length(inputs); i < n; i++) {
@ -1790,25 +1739,17 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
_jun.draw_blend_color = bg;
_jun.draw_blend = high? PREFERENCES.connection_line_highlight_fade : -1;
if( _jun.value_from == noone) continue;
if(!_jun.value_from.node.active) continue;
if(!_jun.isVisible()) continue;
if(_jun.bypass_junc.visible) _jun.bypass_junc.drawBypass(params);
if( _jun.value_from == noone || !_jun.value_from.node.active || !_jun.isVisible()) continue;
if(i >= 0) __draw_inputs[_len++] = _jun;
}
for( var i = 0; i < array_length(inputs); i++ ) {
var jun = inputs[i].bypass_junc;
if(jun == noone || !jun.visible) continue;
jun.drawBypass(params);
__draw_inputs[_len++] = _jun;
}
for( var i = 0; i < _len; i++ ) {
_jun = __draw_inputs[i];
_jun.drawLineIndex = 1 + (i > _len / 2? (_len - 1 - i) : i) * 0.5;
_hov = _jun.drawConnectionsRaw(params);
if(_hov) hovering = _hov;
_hov = _jun.drawConnectionsRaw(params); if(_hov) hovering = _hov;
}
if(attributes.show_update_trigger) {
@ -2032,7 +1973,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
static drawNodeBehind = function(_x, _y, _mx, _my, _s) {
if(draw_graph_culled) return;
if(!active) return;
var xx = x * _s + _x;
@ -2608,10 +2548,14 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static setDimension = function(_w = 128, _h = 128, _apply = true) {
INLINE
var _oh = con_h;
min_w = _w;
con_h = _h;
if(_apply) { w = _w; h = _h; }
if(!_apply) return;
w = max(w, min_w);
if(_oh != _h) refreshNodeDisplay();
}
static move = function(_x, _y, _s) {

View file

@ -56,7 +56,9 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
static onValueUpdate = function(index = 3) { global.__FRAME_LABEL_SCALE = getInputData(3); }
static step = function() {
static setHeight = function() {}
static update = function() {
previewable = true;
var sz = getInputData(0);
@ -70,6 +72,9 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
lcolor = getInputData(4);
}
static drawNode = function() { return noone; }
static drawBadge = function() { return noone; }
static drawNodeBase = function(xx, yy, _s, _panel) {
var px0 = 3;
var py0 = 3;

View file

@ -14,6 +14,10 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
newOutput(2, nodeValue_Output("Type", self, VALUE_TYPE.integer, 0 ));
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var gra = _data[0];
@ -42,8 +46,6 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
var grad = getInputData(0);
if(!is_array(grad)) grad = [ grad ];
var _h = array_length(grad) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
@ -51,8 +53,5 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
}
}

View file

@ -15,6 +15,10 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
_pal = -1;
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var pal = _data[0];
var pos = _data[1];
@ -32,7 +36,6 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
var grad = outputs[0].getValue();
if(!is_array(grad)) grad = [ grad ];
var _h = array_length(grad) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
@ -41,8 +44,5 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
}
}

View file

@ -17,12 +17,16 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
_pal = -1;
static step = function() { #region
static step = function() {
var usePos = array_safe_get_fast(current_data, 1);
inputs[2].setVisible(usePos, usePos);
} #endregion
}
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var pal = _data[0];
var pos_use = _data[1];
var _pos = _data[2];
@ -50,15 +54,14 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
}
return grad;
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return;
var grad = outputs[0].getValue();
if(!is_array(grad)) grad = [ grad ];
var _h = array_length(grad) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
@ -67,8 +70,5 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -1,6 +1,6 @@
function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Gradient Replace";
setDimension(96, 48);;
setDimension(96, 48);
newInput(0, nodeValue_Gradient("Gradient", self, new gradientObject(cola(c_white))))
.setVisible(true, true);
@ -14,7 +14,11 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
newOutput(0, nodeValue_Output("Gradient", self, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) ));
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var gra = _data[0];
var pfr = _data[1];
var pto = _data[2];
@ -43,15 +47,14 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
graO.type = gra.type;
return graO;
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return;
var grad = outputs[0].getValue();
if(!is_array(grad)) grad = [ grad ];
var _h = array_length(grad) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
@ -61,7 +64,5 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -17,7 +17,11 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
_pal = -1;
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var pal = _data[0];
var sft = _data[1];
var lop = _data[2];
@ -42,15 +46,14 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
_outSurf.type = pal.type;
return _outSurf;
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return;
var grad = outputs[0].getValue();
if(!is_array(grad)) grad = [ grad ];
var _h = array_length(grad) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
@ -59,8 +62,5 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -423,6 +423,10 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
doTrigger = 0;
}
}
}
static update = function(frame = CURRENT_FRAME) {
if(is_undefined(inParent)) return;
var _dstype = getInputData(0);
var _data = getInputData(2);
@ -458,16 +462,13 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[4].setVisible(true);
break;
}
}
static update = function(frame = CURRENT_FRAME) {
if(is_undefined(inParent)) return;
visibleCheck();
outputs[0].setValue(inParent.getValue());
}
static getGraphPreviewSurface = function() { return inputs[0].getValue(); }
static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static postDeserialize = function() { createInput(false); }

View file

@ -77,7 +77,9 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(is_undefined(outParent)) return;
outParent.name = display_name;
}
static update = function() {
var _in0 = inputs[0];
var _pty = _in0.type;
var _typ = _in0.value_from == noone? VALUE_TYPE.any : _in0.value_from.type;
@ -93,13 +95,11 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
outParent.draw_fg = _in0.draw_fg;
if(group && _pty != _typ) group.setHeight();
}
static update = function() {
outParent.setValue(inputs[0].getValue());
}
static getGraphPreviewSurface = function() { return inputs[0].getValue(); }
static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static postDeserialize = function() { if(group == noone) return; createOutput(false); }
static postApplyDeserialize = function() {}

View file

@ -94,7 +94,7 @@ void main(in VertexShaderOutput _input, out PixelShaderOutput output) {
input_display_list = [ 2,
["Vertex Shader [read only]", true], new Inspector_Label(vs_string, _f_code_s),
["Fragmanet Shader", false], preLabel, 1, new Inspector_Label(fs_postString, _f_code_s),
["Fragment Shader", false], preLabel, 1, new Inspector_Label(fs_postString, _f_code_s),
["Arguments", false], argument_renderer,
["Values", true],
];

View file

@ -21,15 +21,7 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
arr[@ 1] = group.inputs[0];
}
static step = function() {
if(group == noone) return;
if(!variable_struct_exists(group, "iterated")) return;
if(outputs[0].setType(group.inputs[0].type))
will_setHeight = true;
}
static getPreviewValues = function() { #region
static getPreviewValues = function() {
if(group == noone) return noone;
switch(group.inputs[0].type) {
@ -41,9 +33,9 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
}
return group.getInputData(0);
} #endregion
}
static getGraphPreviewSurface = function() { #region
static getGraphPreviewSurface = function() {
if(group == noone) return noone;
switch(group.inputs[0].type) {
@ -55,9 +47,9 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
}
return group.getInputData(0);
} #endregion
}
static onLoadGroup = function() { #region
static onLoadGroup = function() {
if(group == noone) destroy();
} #endregion
}
}

View file

@ -11,24 +11,21 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
newOutput(0, nodeValue_Output("Preview", self, VALUE_TYPE.any, 0 ))
.setVisible(false, false);
static getNextNodes = function() { #region
static getNextNodes = function() {
if(!struct_has(group, "outputNextNode")) return [];
return group.outputNextNode();
} #endregion
}
static step = function() { #region
static step = function() {
if(!variable_struct_exists(group, "iterated")) return;
var type = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type;
inputs[0].setType(type);
group.outputs[0].setType(type);
}
if(outputs[0].setType(type))
will_setHeight = true;
} #endregion
static cloneValue = function(_prev_val, _val) { #region
static cloneValue = function(_prev_val, _val) {
if(inputs[0].value_from == noone) return _prev_val;
var is_surf = inputs[0].value_from.type == VALUE_TYPE.surface;
@ -41,9 +38,9 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
else _new_val = array_clone(_val);
return _new_val;
} #endregion
}
static update = function(frame = CURRENT_FRAME) { #region
static update = function(frame = CURRENT_FRAME) {
if(inputs[0].value_from == noone) {
group.iterationUpdate();
return;
@ -61,9 +58,9 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
outputs[0].setValue(_val);
group.outputs[0].setValue(_val);
group.iterationUpdate();
} #endregion
}
static onLoadGroup = function() { #region
static onLoadGroup = function() {
if(group == noone) destroy();
} #endregion
}
}

View file

@ -7,7 +7,7 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
newOutput(0, nodeValue_Output("Value in", self, VALUE_TYPE.any, 0 ));
outputs[0].getValueDefault = method(outputs[0], outputs[0].getValueRecursive); //Get value from outside loop
outputs[0].getValueRecursive = function(arr) { #region
outputs[0].getValueRecursive = function(arr) {
if(!variable_struct_exists(group, "iterated"))
return outputs[0].getValueDefault(arr);
@ -16,17 +16,14 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
arr[@ 0] = array_safe_get_fast(val, ind)
arr[@ 1] = group.inputs[0];
} #endregion
}
static step = function() { #region
static step = function() {
if(group == noone) return noone;
if(!variable_struct_exists(group, "iterated")) return;
}
if(outputs[0].setType(group.inputs[0].type))
will_setHeight = true;
} #endregion
static getPreviewValues = function() { #region
static getPreviewValues = function() {
if(group == noone) return noone;
switch(group.inputs[0].type) {
@ -38,9 +35,9 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
}
return group.getInputData(0);
} #endregion
}
static getGraphPreviewSurface = function() { #region
static getGraphPreviewSurface = function() {
if(group == noone) return noone;
switch(group.inputs[0].type) {
@ -52,6 +49,6 @@ function Node_Iterator_Filter_Input(_x, _y, _group = noone) : Node(_x, _y, _grou
}
return group.getInputData(0);
} #endregion
}
}

View file

@ -84,8 +84,6 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
auto_input = true;
return;
}
will_setHeight = true;
}
static _eval = function(mode, a, b) {
@ -102,18 +100,18 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
}
function evalLogicArray(mode, a, b = false) {
var as = is_array(a);
var bs = is_array(b);
var _as = is_array(a);
var _bs = is_array(b);
if(!as && !bs)
if(!_as && !_bs)
return _eval(mode, a, b);
var al = as? array_length(a) : 0;
var bl = bs? array_length(b) : 0;
var al = _as? array_length(a) : 0;
var bl = _bs? array_length(b) : 0;
var val = [];
if(!as) a = [ a ];
if(!bs) b = [ b ];
if(!_as) a = [ a ];
if(!_bs) b = [ b ];
for( var i = 0; i < max(al, bl, cl); i++ )
val[i] = evalLogicArray(mode,

View file

@ -116,7 +116,43 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
return 0;
}
static step = function() {
function evalArray(a, b, c = 0) {
var _as = is_array(a);
var _bs = is_array(b);
var _cs = is_array(c);
if(!_as && !_bs && !_cs)
return _eval(a, b, c);
if(!_as) a = [ a ];
if(!_bs) b = [ b ];
if(!_cs) c = [ c ];
var al = array_length(a);
var bl = array_length(b);
var cl = array_length(c);
var amo = max(al, bl, cl);
var val = array_create(amo);
for( var i = 0; i < amo; i++ )
val[i] = evalArray(
array_safe_get(a, i,, ARRAY_OVERFLOW.loop),
array_safe_get(b, i,, ARRAY_OVERFLOW.loop),
array_safe_get(c, i,, ARRAY_OVERFLOW.loop),
);
return val;
}
static update = function(frame = CURRENT_FRAME) {
use_mod = getInputData(0);
use_deg = getInputData(3);
var a = getInputData(1);
var b = getInputData(2);
var c = getInputData(5);
var mode = getInputData(0);
inputs[2].setVisible(false, false);
@ -193,44 +229,6 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
default: return;
}
}
function evalArray(a, b, c = 0) {
var _as = is_array(a);
var _bs = is_array(b);
var _cs = is_array(c);
if(!_as && !_bs && !_cs)
return _eval(a, b, c);
if(!_as) a = [ a ];
if(!_bs) b = [ b ];
if(!_cs) c = [ c ];
var al = array_length(a);
var bl = array_length(b);
var cl = array_length(c);
var amo = max(al, bl, cl);
var val = array_create(amo);
for( var i = 0; i < amo; i++ )
val[i] = evalArray(
array_safe_get(a, i,, ARRAY_OVERFLOW.loop),
array_safe_get(b, i,, ARRAY_OVERFLOW.loop),
array_safe_get(c, i,, ARRAY_OVERFLOW.loop),
);
return val;
}
static update = function(frame = CURRENT_FRAME) {
use_mod = getInputData(0);
use_deg = getInputData(3);
var a = getInputData(1);
var b = getInputData(2);
var c = getInputData(5);
var val = evalArray(a, b, c);
outputs[0].setValue(val);

View file

@ -41,24 +41,21 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
}
static step = function() {
static setType = function() {
var int = getInputData(1);
var disp = getInputData(2);
var _ch = con_h;
if(!show_parameter) setDimension(96, 56, false);
var _ww = 96, _hh = 56;
switch(disp) {
case 0 :
min_h = 0;
inputs[3].setVisible(false);
inputs[4].setVisible(false);
inputs[5].setVisible(false);
break;
case 1 :
if(inputs[0].value_from == noone && !show_parameter) setDimension(160, 96, false);
min_h = con_h;
_ww = 160; _hh = 96;
inputs[3].setVisible(true);
inputs[4].setVisible(true);
@ -66,8 +63,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
break;
case 2 :
if(inputs[0].value_from == noone && !show_parameter) setDimension(128, 128, false);
min_h = con_h;
_ww = 128; _hh = 128;
inputs[3].setVisible(false);
inputs[4].setVisible(false);
@ -75,7 +71,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
break;
}
if(_ch != con_h) will_setHeight = true;
setDimension(_ww, _hh);
for( var i = 0; i < 1; i++ )
inputs[i].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
@ -95,12 +91,12 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
static update = function() {
setType();
var _dat = getInputData(0);
outputs[0].setValue(_dat);
var _int = getInputData(1);
var _res = processNumber(_dat, _int);
outputs[0].setValue(_res);
}

View file

@ -13,6 +13,10 @@ function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
["Trim", true], 1
];
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var pal = _data[0];
var ran = _data[1];
@ -35,7 +39,6 @@ function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
@ -43,8 +46,5 @@ function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
}
}

View file

@ -1,6 +1,6 @@
function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Palette Extract";
setDimension(96, 48);;
setDimension(96, 48);
newInput(0, nodeValue_Surface("Surface in", self));
@ -35,6 +35,10 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _
attribute_surface_depth();
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
function sortPalette(pal) {
array_sort(pal, function(c0, c1) {
var r0 = _color_get_red(c0);
@ -312,7 +316,6 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _
if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
@ -320,8 +323,5 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
}
}

View file

@ -19,7 +19,11 @@ function Node_Palette_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.color, [ ] ))
.setDisplay(VALUE_DISPLAY.palette);
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var pal = _data[0];
var pfr = _data[1];
var pto = _data[2];
@ -45,9 +49,9 @@ function Node_Palette_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
}
return palo;
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return;
@ -55,7 +59,6 @@ function Node_Palette_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
@ -63,8 +66,5 @@ function Node_Palette_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -21,6 +21,10 @@ function Node_Palette_Shrink(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
0, 4, 1, 2,
];
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
function kmean(_pal) {
_size = max(1, getInputData(2));
_space = getInputData(4);
@ -187,7 +191,6 @@ function Node_Palette_Shrink(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
@ -195,8 +198,5 @@ function Node_Palette_Shrink(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
}
}

View file

@ -23,14 +23,18 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
0, 1, 3, 2,
]
static step = function() { #region
static step = function() {
var _typ = getInputData(1);
inputs[3].setVisible(_typ == 10);
} #endregion
}
static processData_prebatch = function() {
setDimension(96, process_length[0] * 32);
}
sort_string = "";
static customSort = function(c) { #region
static customSort = function(c) {
var len = string_length(sort_string);
var val = power(256, len - 1);
var res = 0;
@ -55,9 +59,9 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
}
return res;
} #endregion
}
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _arr = _data[0];
var _ord = _data[1];
var _rev = _data[2];
@ -83,9 +87,9 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(_rev) _pal = array_reverse(_pal);
return _pal;
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return;
@ -93,7 +97,6 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
@ -101,8 +104,5 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -52,21 +52,20 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static step = function() {
var _key = inputs[0].getValue();
project.tunnels_out[? node_id] = _key;
if(ds_map_exists(project.tunnels_in, _key)) {
outputs[0].setType(project.tunnels_in[? _key].type);
outputs[0].display_type = project.tunnels_in[? _key].display_type;
} else {
outputs[0].setType(VALUE_TYPE.any);
outputs[0].display_type = VALUE_DISPLAY._default;
}
}
static update = function(frame = CURRENT_FRAME) {
var _key = inputs[0].getValue();
if(ds_map_exists(project.tunnels_in, _key))
if(ds_map_exists(project.tunnels_in, _key)) {
outputs[0].setType(project.tunnels_in[? _key].type);
outputs[0].display_type = project.tunnels_in[? _key].display_type;
outputs[0].setValue(project.tunnels_in[? _key].getValue());
} else {
outputs[0].setType(VALUE_TYPE.any);
outputs[0].display_type = VALUE_DISPLAY._default;
}
}
/////////////////////////////////////////////////////////////////////////////

View file

@ -22,8 +22,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
node = _node;
x = node.x;
y = node.y;
rx = x;
ry = y;
tags = VALUE_TAG.none;
index = array_length(node.inputs);
@ -31,8 +29,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
forward = true;
_initName = _name;
node.will_setHeight = true;
static updateName = function(_name) {
name = _name;
internalName = string_to_var(name);
@ -515,10 +511,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(connect_type == CONNECT_TYPE.input) {
show_in_inspector = inspector;
visible = argument_count > 1? argument[1] : visible;
} else
visible = inspector;
node.will_setHeight |= visible != v;
return self;
}
@ -526,8 +522,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
visible = _vis;
show_in_inspector = _vis;
visible_manual = 0;
node.will_setHeight = true;
return self;
}
@ -2384,6 +2378,89 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
/////========== FUNCTIONS ==========
function checkJuncConnection(from, to, params) {
#region parameters
var _s = params.s;
var mx = params.mx;
var my = params.my;
var _active = params.active;
var hovering = noone;
var jx = to.x, jy = to.y;
var frx = from.x, fry = from.y;
var fromIndex = from.drawLineIndex;
var toIndex = to.drawLineIndex;
var _loop = struct_try_get(params, "loop");
if(params.minx != 0 && params.maxx != 0) {
var minx = params.minx, miny = params.miny;
var maxx = params.maxx, maxy = params.maxy;
if((jx < minx && frx < minx) || (jx > maxx && frx > maxx) || (jy < miny && fry < miny) || (jy > maxy && fry > maxy)) return noone;
}
var shx = to.draw_line_shift_x * _s;
var shy = to.draw_line_shift_y * _s;
var cx = round((frx + jx) / 2 + shx);
var cy = round((fry + jy) / 2 + shy);
var th = max(1, PREFERENCES.connection_line_width * _s);
to.draw_line_shift_hover = false;
var downDirection = to.type == VALUE_TYPE.action || from.type == VALUE_TYPE.action;
#endregion
var _drawParam = {
extend : PREFERENCES.connection_line_extend,
fromIndex : fromIndex,
toIndex : toIndex,
}
var hovDist = max(th * 2, 6);
var hover = false;
if(PANEL_GRAPH.pHOVER) {
if(_loop || from.node == to.node) {
hover = distance_line_feedback(mx, my, jx, jy, frx, fry, _s) < hovDist;
} else {
var _hdist = 999999;
switch(PREFERENCES.curve_connection_line) {
case 0 :
if(downDirection) _hdist = distance_to_line(mx, my, jx, jy, frx, fry);
else _hdist = distance_to_linear_connection(mx, my, frx, fry, jx, jy, _s, _drawParam);
break;
case 1 :
if(downDirection) _hdist = distance_to_curve_corner(mx, my, jx, jy, frx, fry, _s);
else _hdist = distance_to_curve(mx, my, jx, jy, frx, fry, cx, cy, _s);
break;
case 2 :
if(downDirection) _hdist = distance_to_elbow_corner(mx, my, frx, fry, jx, jy);
else _hdist = distance_to_elbow(mx, my, frx, fry, jx, jy, cx, cy, _s, _drawParam);
break;
case 3 :
if(downDirection) _hdist = distance_to_elbow_diag_corner(mx, my, frx, fry, jx, jy);
else _hdist = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, _drawParam);
break;
}
hover = _hdist < hovDist;
if(PANEL_GRAPH.value_focus == noone) to.draw_line_shift_hover = hover;
}
}
if(_active && hover) hovering = self;
return hovering;
}
function drawJuncConnection(from, to, params) {
#region parameters
var log = params.log;
@ -2391,8 +2468,6 @@ function drawJuncConnection(from, to, params) {
var bg = params.bg;
var aa = params.aa;
var _x = params.x;
var _y = params.y;
var _s = params.s;
var mx = params.mx;
var my = params.my;
@ -2402,11 +2477,11 @@ function drawJuncConnection(from, to, params) {
var hovering = noone;
var jx = to.x;
var jy = to.y;
var jx = to.x, jy = to.y;
var frx = from.x, fry = from.y;
var frx = from.x;
var fry = from.y;
var fromIndex = from.drawLineIndex;
var toIndex = to.drawLineIndex;
var _loop = struct_try_get(params, "loop");
@ -2439,6 +2514,8 @@ function drawJuncConnection(from, to, params) {
#region +++++ CHECK HOVER +++++
var _drawParam = {
extend : PREFERENCES.connection_line_extend,
fromIndex : fromIndex,
toIndex : toIndex,
}
var hovDist = max(th * 2, 6);

View file

@ -623,8 +623,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
__temp_show = false;
array_foreach(nodes_selecting, function(node, index) {
if(index == 0) __temp_show = !node.show_parameter;
node.show_parameter = __temp_show;
node.refreshNodeDisplay();
node.setShowParameter(__temp_show);
});
}
@ -1199,17 +1198,23 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
function drawNodes() { //
if(selection_block-- > 0) return;
display_parameter.highlight = !array_empty(nodes_selecting) && ((PREFERENCES.connection_line_highlight == 1 && key_mod_press(ALT)) || PREFERENCES.connection_line_highlight == 2);
var _focus = pFOCUS && !view_hovering;
display_parameter.highlight =
!array_empty(nodes_selecting) && (
(PREFERENCES.connection_line_highlight == 1 && key_mod_press(ALT)) ||
PREFERENCES.connection_line_highlight == 2
);
var gr_x = graph_x * graph_s;
var gr_y = graph_y * graph_s;
__gr_x = gr_x;
__gr_y = gr_y;
__gr_s = graph_s;
__gr_w = w;
__gr_h = h;
__mx = mx;
__my = my;
__self = self;
var log = false;
var t = get_timer();
printIf(log, "============ Draw start ============");
@ -1217,47 +1222,30 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
_frame_hovering = frame_hovering;
frame_hovering = noone;
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
if(!display_parameter.show_control && _node.is_controller) continue;
var _node_draw = display_parameter.show_control? nodes_list : array_filter(nodes_list, function(_n) /*=>*/ {return !_n.is_controller});
_node_draw = array_filter( _node_draw, function(_n) /*=>*/ {
_n.preDraw(__gr_x, __gr_y, __gr_s, __gr_x, __gr_y);
return _n.cullCheck(__gr_x, __gr_y, __gr_s, -32, -32, __gr_w + 32, __gr_h + 64);
});
_node.cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64);
_node.preDraw(gr_x, gr_y, graph_s, gr_x, gr_y);
}
printIf(log, $"Predraw time: {get_timer() - t}"); t = get_timer();
// draw frame
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
if(!display_parameter.show_control && _node.is_controller) continue;
if(_node.drawNodeBG(gr_x, gr_y, mx, my, graph_s, display_parameter, self))
frame_hovering = _node;
}
array_foreach(_node_draw, function(_n) /*=>*/ { if(_n.drawNodeBG(__gr_x, __gr_y, __mx, __my, __gr_s, display_parameter, __self)) frame_hovering = _n; });
printIf(log, $"Frame draw time: {get_timer() - t}"); t = get_timer();
// hover
node_hovering = noone;
if(pHOVER)
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
if(!display_parameter.show_control && _node.is_controller) continue;
if(pHOVER) array_foreach(_node_draw, function(_n) /*=>*/ {
_n.branch_drawing = false;
if(_n.pointIn(__gr_x, __gr_y, __mx, __my, __gr_s))
node_hovering = _n;
});
_node.branch_drawing = false;
if(_node.pointIn(gr_x, gr_y, mx, my, graph_s))
node_hovering = _node;
}
if(node_hovering != noone)
if(node_hovering != noone) {
_HOVERING_ELEMENT = node_hovering;
if(DOUBLE_CLICK) {
// print($"Double click {node_hovering} || {_focus} || {instanceof(node_hovering)}");
if(node_hovering != noone && _focus && node_hovering.onDoubleClick != -1)
if(node_hovering.onDoubleClick(self)) {
if(_focus && DOUBLE_CLICK && node_hovering.onDoubleClick != -1 && node_hovering.onDoubleClick(self)) {
DOUBLE_CLICK = false;
node_hovering = noone;
}
@ -1486,12 +1474,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
printIf(log, $"Node selection time: {get_timer() - t}"); t = get_timer();
// draw active
for(var i = 0; i < array_length(nodes_selecting); i++) {
var _node = nodes_selecting[i];
if(!_node) continue;
_node.drawActive(gr_x, gr_y, graph_s);
}
array_foreach(nodes_selecting, function(_n) /*=>*/ { _n.drawActive(__gr_x, __gr_y, __gr_s); });
if(nodes_select_anchor) nodes_select_anchor.active_draw_anchor = true;
printIf(log, $"Draw active: {get_timer() - t}"); t = get_timer();
@ -1552,12 +1535,15 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
add_node_draw_junc.drawConnectionMouse(param, _amx, _amy);
}
}
surface_reset_target();
gpu_set_texfilter(true);
surface_set_shader(connection_surface_aa, sh_downsample);
shader_set_f("down", aa);
shader_set_f("dimension", w, h);
shader_set_f("cornerDis", 0.5);
shader_set_f("mixAmo", 1);
shader_set_dim("dimension", connection_surface);
draw_surface_safe(connection_surface);
surface_reset_shader();
@ -1576,46 +1562,22 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
value_focus = noone;
var t = get_timer();
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
if(!display_parameter.show_control && _node.is_controller) continue;
nodes_list[i].drawNodeBehind(gr_x, gr_y, mx, my, graph_s);
}
array_foreach(_node_draw, function(_n) /*=>*/ { _n.drawNodeBehind(__gr_x, __gr_y, __mx, __my, __gr_s); });
array_foreach(value_draggings, function(_v) /*=>*/ { _v.graph_selecting = true; });
for( var i = 0, n = array_length(value_draggings); i < n; i++ )
value_draggings[i].graph_selecting = true;
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
if(!display_parameter.show_control && _node.is_controller) continue;
if(is_instanceof(_node, Node_Frame)) continue;
array_foreach(_node_draw, function(_n) /*=>*/ {
try {
var val = _node.drawNode(gr_x, gr_y, mx, my, graph_s, display_parameter, self);
var val = _n.drawNode(__gr_x, __gr_y, __mx, __my, __gr_s, display_parameter, __self);
if(val) {
value_focus = val;
if(key_mod_press(SHIFT)) TOOLTIP = [ val.getValue(), val.type ];
}
} catch(e) {
log_warning("NODE DRAW", exception_print(e));
}
}
} catch(e) { log_warning("NODE DRAW", exception_print(e)); }
});
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
if(!display_parameter.show_control && _node.is_controller) continue;
if(!is_instanceof(nodes_list[i], Node_Frame))
nodes_list[i].drawBadge(gr_x, gr_y, graph_s);
}
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
if(!display_parameter.show_control && _node.is_controller) continue;
nodes_list[i].drawNodeFG(gr_x, gr_y, mx, my, graph_s, display_parameter, self);
}
array_foreach(_node_draw, function(_n) /*=>*/ { _n.drawBadge(__gr_x, __gr_y, __gr_s); });
array_foreach(_node_draw, function(_n) /*=>*/ { _n.drawNodeFG(__gr_x, __gr_y, __mx, __my, __gr_s, display_parameter, __self); });
if(PANEL_INSPECTOR && PANEL_INSPECTOR.prop_hover != noone)
value_focus = PANEL_INSPECTOR.prop_hover;
@ -3338,7 +3300,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
_jun.visible_manual = -1;
}
_node.will_setHeight = true;
_node.setHeight();
}
}

View file

@ -108,7 +108,7 @@ function Panel_Patreon() : PanelContent() constructor {
switch(page) {
case 0 :
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text_inner);
draw_text(w / 2, _yy, "Enter your Pateron email:");
draw_text(w / 2, _yy, "Enter your Patreon email:");
tb_email.setInteract(!mail_checking);
tb_email.setFocusHover(pFOCUS, pHOVER);