[Statistic] Fix min/max add argument swapped.

This commit is contained in:
Tanasart 2024-12-01 10:14:35 +07:00
parent 19545b24a0
commit 04457621aa
13 changed files with 127 additions and 50 deletions

View file

@ -217,8 +217,8 @@
{"name":"node","order":5,"path":"folders/shader/UI/node.yy",},
{"name":"palette mixer","order":2,"path":"folders/shader/UI/palette mixer.yy",},
{"name":"sprites","order":152,"path":"folders/sprites.yy",},
{"name":"profiler","order":1,"path":"folders/sprites/profiler.yy",},
{"name":"junctions","order":30,"path":"folders/sprites/nodes/junctions.yy",},
{"name":"profiler","order":1,"path":"folders/sprites/profiler.yy",},
{"name":"Steamworks","order":153,"path":"folders/Steamworks.yy",},
{"name":"theme","order":156,"path":"folders/theme.yy",},
{"name":"icon","order":1,"path":"folders/theme/icon.yy",},

View file

@ -320,10 +320,10 @@
{"$GMFolder":"","%Name":"sprites","folderPath":"folders/sprites.yy","name":"sprites","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"bs","folderPath":"folders/sprites/bs.yy","name":"bs","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"gameframe","folderPath":"folders/sprites/gameframe.yy","name":"gameframe","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"profiler","folderPath":"folders/sprites/profiler.yy","name":"profiler","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"misc","folderPath":"folders/sprites/misc.yy","name":"misc","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"nodes","folderPath":"folders/sprites/nodes.yy","name":"nodes","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"junctions","folderPath":"folders/sprites/nodes/junctions.yy","name":"junctions","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"profiler","folderPath":"folders/sprites/profiler.yy","name":"profiler","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"texture","folderPath":"folders/sprites/texture.yy","name":"texture","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Steamworks","folderPath":"folders/Steamworks.yy","name":"Steamworks","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"UGC","folderPath":"folders/Steamworks/UGC.yy","name":"UGC","resourceType":"GMFolder","resourceVersion":"2.0",},

View file

@ -17,13 +17,13 @@ switch(load_process) {
create_list = array_create(array_length(_node_list));
}
for(; load_step < load_total; load_step++) {
while(load_step < load_total) {
var _node = nodeLoad(_node_list[load_step]);
load_step++;
if(_node) create_list[node_length++] = _node;
var _ts = get_timer() - _t;
if(load_step < load_total - 1 && _ts > load_delay) {
if(_ts > load_delay) {
_skp = true;
break;
}

View file

@ -1,6 +1,7 @@
function draw_line_elbow_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = 1, thick = 1, col1 = c_white, col2 = c_white, params = {}) {
var extend = params.extend;
var corner = min(extend, params.corner);
// var corner = min(extend, params.corner);
var corner = params.corner;
var type = params.type;
if(cx == noone) cx = (x0 + x1) / 2;

View file

@ -3,7 +3,8 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
var indexIn = struct_try_get(params, "fromIndex", 1);
var indexOut = struct_try_get(params, "toIndex", 1);
var corner = min(extend, params.corner);
// var corner = min(extend, params.corner);
var corner = params.corner;
var type = params.type;
var __dash = 6 * _s;

View file

@ -46,7 +46,7 @@
LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_04_0;
SAVE_VERSION = 1_18_04_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.5.008";
VERSION_STRING = MAC? "1.18.003m" : "1.18.5.009";
BUILD_NUMBER = 1_18_04_1;
HOTKEYS = ds_map_create();

View file

@ -78,7 +78,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
cHov = true;
if(visi_hold != noone && jun.visible_manual != visi_hold) {
jun.visible_manual = visi_hold;
jun.setVisibleManual(visi_hold);
jun.node.refreshNodeDisplay();
}
@ -86,10 +86,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
TOOLTIP = __txt("Visibility");
if(mouse_press(mb_left, _focus)) {
jun.visible_manual = _visi? -1 : 1;
jun.setVisibleManual(_visi? -1 : 1);
visi_hold = jun.visible_manual;
jun.node.refreshNodeDisplay();
}
}

View file

@ -188,6 +188,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
input_buttons = [];
input_button_length = 0;
toRefreshNodeDisplay = false;
run_in(1, function() {
input_buttons = [];
@ -594,6 +596,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
junc_meta[0].setValue(getDisplayName());
junc_meta[1].setValue([ x, y ]);
}
if(toRefreshNodeDisplay) {
refreshNodeDisplay();
toRefreshNodeDisplay = false;
}
}
static doStepBegin = function() {}
@ -817,6 +824,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
if(auto_input && dummy_input) array_push(inputDisplayList, dummy_input);
// print(inputDisplayList);
}
static onValidate = function() {
@ -1798,15 +1807,24 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
__draw_inputs_len = 0;
static setJunctionIndex = function() {
var drawLineIndex = 1;
var drawLineIndex = 1;
__draw_outputs_len = 0;
for(var i = 0, n = array_length(outputs); i < n; i++) {
var jun = outputs[i];
var connected = !array_empty(jun.value_to);
var _jun = outputs[i];
var connected = !array_empty(_jun.value_to);
if(connected) __draw_outputs_len++;
}
var _ind = 0;
for(var i = 0, n = array_length(outputs); i < n; i++) {
var _jun = outputs[i];
var connected = !array_empty(_jun.value_to);
if(connected) {
jun.drawLineIndex = drawLineIndex;
drawLineIndex += 0.5;
_jun.drawLineIndex = 1 + (_ind > __draw_outputs_len / 2? (__draw_outputs_len - 1 - _ind) : _ind) * 0.5;
_ind++;
}
}

View file

@ -125,11 +125,13 @@
dragging_sy = _pos[1];
dragging_mx = _mx;
dragging_my = _my;
} else if(hovering == 1) { //rot
dragging_sx = _rot;
rot_anc_x = _x + _pos[0] * _s;
rot_anc_y = _y + _pos[1] * _s;
dragging_mx = point_direction(rot_anc_x, rot_anc_y, _mx, _my);
} else if(hovering == 2) { //sca
dragging_sx = _sca[0];
dragging_sy = _sca[1];

View file

@ -7,7 +7,7 @@ enum STAT_OPERATOR {
}
#region create
global.node_statistic_keys = [ "sum", "mean", "median", "min", "max" ];
global.node_statistic_keys = [ "sum", "mean", "median", "max", "min" ];
array_append(global.node_statistic_keys, [ "average" ]);
function Node_create_Statistic(_x, _y, _group = noone, _param = {}) {

View file

@ -137,8 +137,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
#endregion
#region ---- draw ----
draw_line_shift_x = 0;
draw_line_shift_y = 0;
draw_line_shift_x = 0;
draw_line_shift_y = 0;
draw_line_shift_e = -1;
draw_line_thick = 1;
draw_line_shift_hover = false;
draw_line_blend = 1;
@ -500,6 +502,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
/////============ DISPLAY ===========
static setVisibleManual = function(v) {
visible_manual = v;
node.refreshNodeDisplay();
return self;
}
static setVisible = function(inspector) {
var v = visible;
@ -510,6 +518,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} else
visible = inspector;
if(NOT_LOAD) node.toRefreshNodeDisplay = true;
return self;
}
@ -2134,9 +2144,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(loop_range != -1) _map.loop_range = loop_range;
if(sep_axis) _map.sep_axis = sep_axis;
if(draw_line_shift_x != 0) _map.shift_x = draw_line_shift_x;
if(draw_line_shift_y != 0) _map.shift_y = draw_line_shift_y;
if(is_modified == true) _map.is_modified = is_modified;
if(draw_line_shift_x != 0) _map.shift_x = draw_line_shift_x;
if(draw_line_shift_y != 0) _map.shift_y = draw_line_shift_y;
if(draw_line_shift_e != -1) _map.shift_e = draw_line_shift_e;
if(is_modified == true) _map.is_modified = is_modified;
if(!preset && value_from) {
_map.from_node = value_from.node.node_id;
@ -2179,7 +2190,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(_map == noone) return;
if(!is_struct(_map)) return;
visible = struct_try_get(_map, LOADING_VERSION >= 1_18_04_0? "v" : "visible", 0);
visible = struct_try_get(_map, LOADING_VERSION >= 1_18_04_0 || CLONING? "v" : "visible", 0);
visible_manual = struct_try_get(_map, "visible_manual", 0);
color = struct_try_get(_map, "color", -1);
@ -2198,6 +2209,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
draw_line_shift_x = struct_try_get(_map, "shift_x", 0);
draw_line_shift_y = struct_try_get(_map, "shift_y", 0);
draw_line_shift_e = struct_try_get(_map, "shift_e", -1);
is_modified = struct_try_get(_map, "is_modified", false);
if(struct_has(_map, "attri")) {
@ -2415,8 +2427,14 @@ function checkJuncConnection(from, to, params) {
var th = max(1, PREFERENCES.connection_line_width * _s);
var hover, hovDist = max(th * 2, 6);
var _x0 = min(jx, cx, frx) - hovDist, _x1 = max(jx, cx, frx) + hovDist;
var _y0 = min(jy, cy, fry) - hovDist, _y1 = max(jy, cy, fry) + hovDist;
var _fin = from.draw_line_shift_e > -1? from.draw_line_shift_e : from.drawLineIndex;
var _tin = to.draw_line_shift_e > -1? to.draw_line_shift_e : to.drawLineIndex;
var _x0 = min(jx, cx, frx) - hovDist - max(_fin, _tin) * PREFERENCES.connection_line_extend;
var _y0 = min(jy, cy, fry) - hovDist;
var _x1 = max(jx, cx, frx) + hovDist + max(_fin, _tin) * PREFERENCES.connection_line_extend;
var _y1 = max(jy, cy, fry) + hovDist;
if(!point_in_rectangle(mx, my, _x0, _y0, _x1, _y1)) return noone;
var downDirection = to.type == VALUE_TYPE.action || from.type == VALUE_TYPE.action;
@ -2446,7 +2464,7 @@ function checkJuncConnection(from, to, params) {
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, PREFERENCES.connection_line_extend, from.drawLineIndex, to.drawLineIndex);
else _hdist = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, PREFERENCES.connection_line_extend, _fin, _tin);
break;
default : return noone;
@ -2534,8 +2552,8 @@ function drawJuncConnection(from, to, params, _thick = false) {
var down = to.type == VALUE_TYPE.action || from.type == VALUE_TYPE.action;
drawParam.extend = PREFERENCES.connection_line_extend;
drawParam.fromIndex = from.drawLineIndex;
drawParam.toIndex = to.drawLineIndex;
drawParam.fromIndex = from.draw_line_shift_e > -1? from.draw_line_shift_e : from.drawLineIndex;
drawParam.toIndex = to.draw_line_shift_e > -1? to.draw_line_shift_e : to.drawLineIndex;
drawParam.corner = corner;
drawParam.type = ty;

View file

@ -1671,8 +1671,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var sn = !key_mod_press(CTRL) && project.graphGrid.snap;
if(sn) {
nx = round(nx / _grd) * _grd;
ny = round(ny / _grd) * _grd;
nx = value_snap(nx, _grd);
ny = value_snap(ny, _grd);
}
if(node_drag_ox == -1 || node_drag_oy == -1) {
@ -1688,9 +1688,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var _nx = _node.x + dx;
var _ny = _node.y + dy;
if(sn) {
_nx = value_snap(_nx, _grd);
_ny = value_snap(_ny, _grd);
}
_node.move(_nx, _ny, graph_s);
}
node_drag_ox = nx;
node_drag_oy = ny;
}
@ -2811,6 +2816,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
ds_map_clear(APPEND_MAP);
APPEND_LIST = [];
LOADING_VERSION = SAVE_VERSION;
CLONING = true;
var _pmap_keys = variable_struct_get_names(_pmap);
@ -2886,7 +2892,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
function doCopy() { //
if(array_empty(nodes_selecting)) return;
clipboard_set_text("");
LOADING_VERSION = SAVE_VERSION;
var _map = {
version: SAVE_VERSION,
nodes: [],
@ -3376,7 +3383,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(!_jun.isVisible()) continue;
if(_jun.value_from == noone)
_jun.visible_manual = -1;
_jun.setVisibleManual(-1);
}
for(var j = 0; j < array_length(_node.outputs); j++) {
@ -3384,7 +3391,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(!_jun.isVisible()) continue;
if(array_empty(_jun.getJunctionTo()))
_jun.visible_manual = -1;
_jun.setVisibleManual(-1);
}
_node.refreshNodeDisplay();

View file

@ -24,11 +24,15 @@ function Panel_Profile_Render() : PanelContent() constructor {
report_selecting = noone;
report_clicked = noone;
filter_node = noone;
set_selecting_node = false;
filter_node = noone;
set_selecting_node = false;
graph_set_latest = noone;
show_io = true;
show_log_level = 1;
show_io = true;
show_log_level = 1;
count_render_event = 0;
count_message_event = 0;
filter_list_string = "";
tb_list = new textBox( TEXTBOX_INPUT.text, function(str) /*=>*/ { filter_list_string = str; searchData(); })
@ -53,7 +57,7 @@ function Panel_Profile_Render() : PanelContent() constructor {
var sw = surface_get_width(surf);
var sh = surface_get_height(surf);
var sd = surface_get_format(surf);
var ss = min(w / sw, h / sh);
var ss = min((w - ui(144)) / sw, h / sh);
var sx = xx;
var sy = yy + h / 2 - sh * ss / 2
@ -88,7 +92,6 @@ function Panel_Profile_Render() : PanelContent() constructor {
}
}
function onResize() {
padding = in_dialog? ui(4) : ui(8);
@ -100,6 +103,14 @@ function Panel_Profile_Render() : PanelContent() constructor {
sc_profile_detail.resize(detail_w - ui(8), content_h - ui(8));
}
function setReport(_report) {
report_selecting = _report;
if(_report == noone) return;
if(_report.type == "render" && set_selecting_node)
PANEL_GRAPH.nodes_selecting = [ _report.node ];
}
sc_profile_list = new scrollPane(list_w - ui(8), content_h - ui(8), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
var _h = ui(8);
@ -154,11 +165,11 @@ function Panel_Profile_Render() : PanelContent() constructor {
if(_hov) {
if(mouse_press(mb_left, pFOCUS)) {
report_selecting = _sel? noone : _report;
setReport(_sel? noone : _report);
report_clicked = _report;
} else if(mouse_click(mb_left, pFOCUS) && report_clicked != noone && report_clicked != _report) {
report_selecting = _report;
setReport(_report);
report_clicked = _report;
}
}
@ -190,7 +201,7 @@ function Panel_Profile_Render() : PanelContent() constructor {
var _ty = ui(8);
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(_tx, _ty, $"{array_length(PROFILER_DATA)} render events");
draw_text_add(_tx, _ty, $"{count_render_event} render events");
_ty += ui(20); _h += ui(20);
draw_text_add(_tx, _ty, $"Render time : {render_time / 1000}ms ({render_time})");
@ -212,8 +223,6 @@ function Panel_Profile_Render() : PanelContent() constructor {
var _tx = ui(8);
var _ty = _y + ui(8);
if(set_selecting_node) PANEL_GRAPH.nodes_selecting = [_node];
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
draw_text_add(_tx, _ty, $"Render {_node.getFullName()}");
@ -458,10 +467,10 @@ function Panel_Profile_Render() : PanelContent() constructor {
var _bx = _pd;
var _by = _pd;
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "Render", s_run, 1, COLORS._main_value_positive, 1, 1) == 2) {
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "Render all", s_run, 1, COLORS._main_value_positive, 1, 1) == 2) {
PROFILER_STAT = 1;
PROFILER_DATA = [];
report_selecting = noone;
setReport(noone);
var _t = get_timer();
Render();
@ -475,7 +484,7 @@ function Panel_Profile_Render() : PanelContent() constructor {
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "Render partial", s_run_partial, 1, COLORS._main_value_positive, 1, 1) == 2) {
PROFILER_STAT = 1;
PROFILER_DATA = [];
report_selecting = noone;
setReport(noone);
var _t = get_timer();
Render(true);
@ -543,6 +552,9 @@ function Panel_Profile_Render() : PanelContent() constructor {
var _selected_time = 0;
var _running_time = 0;
count_render_event = 0;
count_message_event = 0;
for( var i = 0, n = array_length(PROFILER_DATA); i < n; i++ ) {
var _report = PROFILER_DATA[i];
var _rtype = _report.type;
@ -550,11 +562,15 @@ function Panel_Profile_Render() : PanelContent() constructor {
if(_report == report_selecting) _selected_time = _running_time;
if(_rtype == "render") {
count_render_event++;
var _node = _report.node;
var _time = _report.time;
_total_time += _time;
_running_time += _time;
} else if(_rtype == "message") {
count_message_event++;
}
}
@ -583,7 +599,7 @@ function Panel_Profile_Render() : PanelContent() constructor {
if(mouse_click(mb_left, pFOCUS) || render_drag) {
render_drag = true;
report_selecting = _report;
setReport(_report);
}
}
@ -635,5 +651,21 @@ function Panel_Profile_Render() : PanelContent() constructor {
sc_profile_detail.setFocusHover(pFOCUS, pHOVER);
sc_profile_detail.draw(ndx + ui(4), ndy + ui(4), mx - ndx - ui(4), my - ndy - ui(4));
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(set_selecting_node) {
var _graph = array_empty(PANEL_GRAPH.nodes_selecting)? noone : PANEL_GRAPH.nodes_selecting[0];
if(_graph != noone && graph_set_latest != _graph) {
for( var i = 0, n = array_length(PROFILER_DATA); i < n; i++ ) {
var _report = PROFILER_DATA[i];
if(_report.type == "render" && _report.node == _graph) {
report_selecting = _report;
break;
}
}
}
graph_set_latest = _graph;
}
}
}