This commit is contained in:
Tanasart 2023-11-30 09:18:25 +07:00
parent 7fb8cacd22
commit cf48f9ab9d
8 changed files with 226 additions and 168 deletions

View File

@ -17,6 +17,8 @@ event_inherited();
show_autosaves = false; show_autosaves = false;
recent_width = PREFERENCES.splash_expand_recent? ui(576) : ui(288); recent_width = PREFERENCES.splash_expand_recent? ui(576) : ui(288);
clip_surf = surface_create(1, 1);
#endregion #endregion
#region content #region content
@ -121,27 +123,32 @@ event_inherited();
} }
var hh = 0; var hh = 0;
var grid_heigh = ui(96);
var grid_width = ui(128); var grid_width = ui(128);
var grid_heigh = txt == "Workshop"? ui(128) : ui(96);
var grid_space = ui(20); var grid_space = ui(20);
var grid_line = ui(4);
var node_count = ds_list_size(list); var node_count = ds_list_size(list);
var col = floor(sp_sample.surface_w / (grid_width + grid_space)); var col = floor(sp_sample.surface_w / (grid_width + grid_space));
var row = ceil(node_count / col); var row = ceil(node_count / col);
var hh = grid_space; var hh = ui(20);
var yy = _y + grid_space; var yy = _y + ui(20);
var name_height = 0; var name_height = 0;
for(var i = 0; i < row; i++) { for(var i = 0; i < row; i++) {
name_height = 0; name_height = 0;
for(var j = 0; j < col; j++) { for(var j = 0; j < col; j++) {
var index = i * col + j; var index = i * col + j;
if(index < node_count) { if(index >= node_count) break;
var _project = list[| index];
var _nx = grid_space + (grid_width + grid_space) * j;
var _boxx = _nx;
var _project = list[| index];
var _nx = grid_space + (grid_width + grid_space) * j;
var _boxx = _nx;
if(yy > -grid_heigh && yy < sp_sample.surface_h) {
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_width, grid_heigh); draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_width, grid_heigh);
if(sHOVER && sp_sample.hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_heigh)) { if(sHOVER && sp_sample.hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_heigh)) { #region
var _meta = _project.getMetadata(); var _meta = _project.getMetadata();
if(txt == "Workshop") if(txt == "Workshop")
TOOLTIP = _meta; TOOLTIP = _meta;
@ -157,17 +164,17 @@ event_inherited();
} }
instance_destroy(); instance_destroy();
} }
} } #endregion
var spr = _project.getSpr(); var spr = _project.getSpr();
if(spr) { if(spr) { #region
var gw = grid_width - ui(8); var gw = grid_width - ui(8);
var gh = grid_heigh - ui(8); var gh = grid_heigh - ui(8);
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 s = min(1, gw / sw, gh / sh); var s = max(gw / sw, gh / sh);
var ox = (sprite_get_xoffset(spr) - sw / 2) * s; var ox = (sprite_get_xoffset(spr) - sw / 2) * s;
var oy = (sprite_get_yoffset(spr) - sh / 2) * s; var oy = (sprite_get_yoffset(spr) - sh / 2) * s;
@ -175,35 +182,57 @@ event_inherited();
var _sx = _boxx + grid_width / 2 + ox; var _sx = _boxx + grid_width / 2 + ox;
var _sy = yy + grid_heigh / 2 + ox; var _sy = yy + grid_heigh / 2 + ox;
draw_sprite_ui_uniform(spr, 0, _sx, _sy, s); var _spw = sw * s;
} var _sph = sh * s;
var tx = _boxx + grid_width / 2; if(txt == "Workshop") {
var ty = yy + grid_heigh + ui(4); clip_surf = surface_verify(clip_surf, _spw, _sph);
draw_set_text(f_p2, fa_center, fa_top);
if(txt == "Sample projects") {
var _tw = string_width(_project.tag);
var _th = string_height(_project.tag);
draw_set_color(COLORS.dialog_splash_badge); surface_set_target(clip_surf);
draw_roundrect_ext(tx - _tw / 2 - ui(6), ty - ui(2), tx + _tw / 2 + ui(6), ty + _th, THEME_VALUE.selection_corner_radius, THEME_VALUE.selection_corner_radius, 0); DRAW_CLEAR
draw_set_color(_project.tag == "Getting started"? COLORS._main_text_accent : COLORS._main_text_sub);
draw_text(tx, ty - ui(2), _project.tag);
ty += line_get_height(, ui(4)); draw_sprite_ui_uniform(spr, 0, 0, 0, s);
} gpu_set_blendmode_ext(bm_dest_colour, bm_zero);
draw_sprite_stretched(THEME.ui_panel_bg, 4, 0, 0, _spw, _sph);
BLEND_NORMAL
surface_reset_target();
draw_set_text(f_p1, fa_center, fa_top, COLORS._main_text); draw_surface(clip_surf, _sx, _sy);
name_height = max(name_height, string_height_ext(_project.name, -1, grid_width) + ui(8)); } else
draw_text_ext_add(tx, ty - ui(2), _project.name, -1, grid_width); draw_sprite_ui_uniform(spr, 0, _sx, _sy, s);
} #endregion
} }
var tx = _boxx + grid_width / 2;
var ty = yy + grid_heigh + ui(4);
draw_set_text(f_p2, fa_center, fa_top);
if(txt == "Sample projects") { #region
var _tw = string_width(_project.tag);
var _th = string_height(_project.tag);
draw_set_color(COLORS.dialog_splash_badge);
var _rr = THEME_VALUE.selection_corner_radius;
draw_roundrect_ext(tx - _tw / 2 - ui(6), ty - ui(2), tx + _tw / 2 + ui(6), ty + _th, _rr, _rr, 0);
draw_set_color(_project.tag == "Getting started"? COLORS._main_text_accent : COLORS._main_text_sub);
draw_text(tx, ty - ui(2), _project.tag);
ty += line_get_height(, ui(4));
} #endregion
draw_set_text(f_p1, fa_center, fa_top, COLORS._main_text);
name_height = max(name_height, string_height_ext(_project.name, -1, grid_width) + ui(8));
draw_text_ext_add(tx, ty - ui(2), _project.name, -1, grid_width);
} }
var hght = grid_heigh + grid_space + name_height + ui(20);
var hght = grid_heigh + name_height + grid_line;
if(txt == "Sample projects") hght += line_get_height(f_p2, ui(4));
hh += hght; hh += hght;
yy += hght; yy += hght;
} }
return hh; return hh + ui(20);
}); #endregion }); #endregion
#endregion #endregion

View File

@ -4,3 +4,5 @@ event_inherited();
ds_map_destroy(discord_map); ds_map_destroy(discord_map);
ds_map_destroy(nicknames); ds_map_destroy(nicknames);
ds_map_destroy(attachment); ds_map_destroy(attachment);
surface_free(clip_surf);

View File

@ -146,6 +146,13 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
inputs_data = []; inputs_data = [];
input_hash = ""; input_hash = "";
input_hash_raw = ""; input_hash_raw = "";
inputs_amount = 0;
in_cache_len = 0;
inputs_index = [];
outputs_amount = 0;
outputs_index = [];
out_cache_len = 0;
#endregion #endregion
#region --- attributes ---- #region --- attributes ----
@ -294,6 +301,23 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
return output_display_list[index]; return output_display_list[index];
} #endregion } #endregion
static updateIO = function() { #region
inputs_amount = (input_display_list == -1 || !use_display_list)? ds_list_size(inputs) : array_length(input_display_list);
inputs_index = array_create(inputs_amount);
var _i = 0;
for( var i = 0; i < inputs_amount; i++ ) {
var _input = getInputJunctionIndex(i);
if(_input == noone) continue;
inputs_index[_i++] = _input;
}
inputs_amount = _i;
array_resize(inputs_index, inputs_amount);
outputs_amount = output_display_list == -1? ds_list_size(outputs) : array_length(output_display_list);
outputs_index = array_create_ext(outputs_amount, function(index) { return getOutputJunctionIndex(index); });
} #endregion
static setHeight = function() { #region static setHeight = function() { #region
if(!auto_height) return; if(!auto_height) return;
@ -796,26 +820,28 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
updatedOutTrigger.x = xx + w * _s; updatedOutTrigger.x = xx + w * _s;
updatedOutTrigger.y = yy + 10; updatedOutTrigger.y = yy + 10;
var inamo = (input_display_list == -1 || !use_display_list)? ds_list_size(inputs) : array_length(input_display_list); if(in_cache_len != ds_list_size(inputs) || out_cache_len != ds_list_size(outputs)) {
updateIO();
in_cache_len = ds_list_size(inputs);
out_cache_len = ds_list_size(outputs);
}
var _iny = yy + ui(junction_draw_pad_y) * _s; var _iny = yy + ui(junction_draw_pad_y) * _s;
for(var i = 0; i < inamo; i++) { for(var i = 0; i < inputs_amount; i++) {
var idx = getInputJunctionIndex(i); var idx = inputs_index[i];
if(idx == noone) continue; jun = inputs[| idx];
jun = ds_list_get(inputs, idx, noone);
if(jun == noone || is_undefined(jun)) continue;
jun.x = xx; jun.x = xx;
jun.y = _iny; jun.y = _iny;
_iny += 24 * _s * jun.isVisible(); _iny += 24 * _s * jun.isVisible();
} }
var outamo = output_display_list == -1? ds_list_size(outputs) : array_length(output_display_list); xx = xx + w * _s;
xx = xx + w * _s;
var _outy = yy + ui(junction_draw_pad_y) * _s; var _outy = yy + ui(junction_draw_pad_y) * _s;
for(var i = 0; i < outamo; i++) { for(var i = 0; i < outputs_amount; i++) {
var idx = getOutputJunctionIndex(i); var idx = outputs_index[i];
jun = outputs[| idx]; jun = outputs[| idx];
jun.x = xx; jun.x = xx;
@ -1040,7 +1066,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(hasInspector1Update()) st = -1; if(hasInspector1Update()) st = -1;
if(hasInspector2Update()) st = -2; if(hasInspector2Update()) st = -2;
var _inputs = []; var _inputs = array_create(ds_list_size(inputs));
var _len = 0;
var drawLineIndex = 1; var drawLineIndex = 1;
for(var i = st; i < ds_list_size(inputs); i++) { for(var i = st; i < ds_list_size(inputs); i++) {
var jun; var jun;
@ -1062,17 +1090,13 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(!jun.value_from.node.active) continue; if(!jun.value_from.node.active) continue;
if(!jun.isVisible()) continue; if(!jun.isVisible()) continue;
if(i >= 0) array_push(_inputs, jun); if(i >= 0) _inputs[_len++] = jun;
} }
var len = array_length(_inputs); for( var i = 0; i < _len; i++ ) {
for( var i = 0; i < len; i++ )
_inputs[i].drawLineIndex = 1 + (i > len / 2? (len - 1 - i) : i) * 0.5;
for( var i = 0, n = array_length(_inputs); i < n; i++ ) {
var jun = _inputs[i]; var jun = _inputs[i];
jun.drawLineIndex = 1 + (i > _len / 2? (_len - 1 - i) : i) * 0.5;
var hov = jun.drawConnections(params); var hov = jun.drawConnections(params);
if(hov) hovering = hov; if(hov) hovering = hov;
} }

View File

@ -96,16 +96,17 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
insp1UpdateTooltip = "Generate"; insp1UpdateTooltip = "Generate";
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ]; insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() { static onInspector1Update = function() { #region
setTriangle(); setTriangle();
} } #endregion
static onValueFromUpdate = function(index) { static onValueFromUpdate = function(index) { #region
if(LOADING || APPENDING) return;
if(index == 0 && array_empty(data.tris)) if(index == 0 && array_empty(data.tris))
setTriangle(); setTriangle();
} } #endregion
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
var mx = (_mx - _x) / _s; var mx = (_mx - _x) / _s;
var my = (_my - _y) / _s; var my = (_my - _y) / _s;
@ -257,9 +258,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
} }
} }
} }
} } #endregion
function _Point(node, index, _x, _y) constructor { function _Point(node, index, _x, _y) constructor { #region
self.index = index; self.index = index;
self.node = node; self.node = node;
x = _x; x = _x;
@ -334,9 +335,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static equal = function(point) { static equal = function(point) {
return x == point.x && y == point.y; return x == point.x && y == point.y;
} }
} } #endregion
function link(_p0, _p1) constructor { function link(_p0, _p1) constructor { #region
p0 = _p0; p0 = _p0;
p1 = _p1; p1 = _p1;
k = 1; k = 1;
@ -360,9 +361,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
draw_set_color(c_red); draw_set_color(c_red);
draw_line(_x + p0.x * _s, _y + p0.y * _s, _x + p1.x * _s, _y + p1.y * _s); draw_line(_x + p0.x * _s, _y + p0.y * _s, _x + p1.x * _s, _y + p1.y * _s);
} }
} } #endregion
function _Triangle(_p0, _p1, _p2) constructor { function _Triangle(_p0, _p1, _p2) constructor { #region
p0 = _p0; p0 = _p0;
p1 = _p1; p1 = _p1;
p2 = _p2; p2 = _p2;
@ -402,9 +403,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static contain = function(p) { static contain = function(p) {
return p == p0 || p == p1 || p == p2; return p == p0 || p == p1 || p == p2;
} }
} } #endregion
static regularTri = function(surf) { static regularTri = function(surf) { #region
var sample = getInputData(1); var sample = getInputData(1);
var spring = getInputData(2); var spring = getInputData(2);
var diagon = getInputData(4); var diagon = getInputData(4);
@ -504,9 +505,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
} }
if(is_surface(cont)) surface_free(cont); if(is_surface(cont)) surface_free(cont);
} } #endregion
static triangulate = function(surf) { static triangulate = function(surf) { #region
var sample = getInputData(1); var sample = getInputData(1);
var seed = getInputData(9); var seed = getInputData(9);
@ -577,14 +578,14 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
array_push(data.links, new link(t[1], t[2])); array_push(data.links, new link(t[1], t[2]));
array_push(data.links, new link(t[2], t[0])); array_push(data.links, new link(t[2], t[0]));
} }
} } #endregion
static reset = function() { static reset = function() { #region
for(var i = 0; i < array_length(data.tris); i++) for(var i = 0; i < array_length(data.tris); i++)
data.tris[i].reset(); data.tris[i].reset();
} } #endregion
static setTriangle = function() { static setTriangle = function() { #region
var _inSurf = getInputData(0); var _inSurf = getInputData(0);
var _type = getInputData(8); var _type = getInputData(8);
@ -595,9 +596,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
for(var i = 0; i < array_length(data.tris); i++) for(var i = 0; i < array_length(data.tris); i++)
data.tris[i].initSurface(is_array(_inSurf)? _inSurf[0] : _inSurf); data.tris[i].initSurface(is_array(_inSurf)? _inSurf[0] : _inSurf);
} } #endregion
static affectPoint = function(c, p) { static affectPoint = function(c, p) { #region
var mode = c[PUPPET_CONTROL.mode]; var mode = c[PUPPET_CONTROL.mode];
var cx = c[PUPPET_CONTROL.cx]; var cx = c[PUPPET_CONTROL.cx];
var cy = c[PUPPET_CONTROL.cy]; var cy = c[PUPPET_CONTROL.cy];
@ -627,9 +628,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
p.planMove(lengthdir_x(fx * inf, fy), lengthdir_y(fx * inf, fy)); p.planMove(lengthdir_x(fx * inf, fy), lengthdir_y(fx * inf, fy));
break; break;
} }
} } #endregion
static control = function() { static control = function() { #region
var lStr = getInputData(6); var lStr = getInputData(6);
for(var i = control_index; i < ds_list_size(inputs); i++) { for(var i = control_index; i < ds_list_size(inputs); i++) {
@ -661,9 +662,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
if(data.points[j] == 0) continue; if(data.points[j] == 0) continue;
data.points[j].clearMove(); data.points[j].clearMove();
} }
} } #endregion
static step = function() { static step = function() { #region
var _type = getInputData(8); var _type = getInputData(8);
inputs[| 2].setVisible(_type == 0); inputs[| 2].setVisible(_type == 0);
@ -672,9 +673,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
if(_type == 0) tools = tools_edit; if(_type == 0) tools = tools_edit;
else if (_type == 1) tools = tools_mesh; else if (_type == 1) tools = tools_mesh;
} } #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _inSurf = _data[0]; var _inSurf = _data[0];
if(!is_surface(_inSurf)) return _outSurf; if(!is_surface(_inSurf)) return _outSurf;
@ -696,18 +697,18 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
surface_reset_shader(); surface_reset_shader();
return _outSurf; return _outSurf;
} } #endregion
static postDeserialize = function() { static postDeserialize = function() { #region
var _inputs = load_map.inputs; var _inputs = load_map.inputs;
for(var i = control_index; i < array_length(_inputs); i++) { for(var i = control_index; i < array_length(_inputs); i++) {
var inp = createControl(); var inp = createControl();
inp.applyDeserialize(_inputs[i]); inp.applyDeserialize(_inputs[i]);
} }
} } #endregion
static attributeSerialize = function() { static attributeSerialize = function() { #region
var att = {}; var att = {};
var pinList = []; var pinList = [];
@ -721,15 +722,15 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
att.mesh_bound = attributes.mesh_bound; att.mesh_bound = attributes.mesh_bound;
return att; return att;
} } #endregion
loadPin = noone; loadPin = noone;
static attributeDeserialize = function(attr) { static attributeDeserialize = function(attr) { #region
if(struct_has(attr, "pin")) loadPin = attr.pin; if(struct_has(attr, "pin")) loadPin = attr.pin;
if(struct_has(attr, "mesh_bound")) attributes.mesh_bound = attr.mesh_bound;; if(struct_has(attr, "mesh_bound")) attributes.mesh_bound = attr.mesh_bound;;
} } #endregion
static postLoad = function() { static postLoad = function() { #region
setTriangle(); setTriangle();
if(loadPin == noone) return; if(loadPin == noone) return;
@ -740,5 +741,5 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
points[ind].pin = true; points[ind].pin = true;
} }
loadPin = noone; loadPin = noone;
} } #endregion
} }

View File

@ -23,6 +23,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
highlight : false, highlight : false,
} }
connection_param = {};
bg_color = c_black; bg_color = c_black;
#endregion #endregion
@ -717,7 +719,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
function drawNodes() { #region function drawNodes() { #region
if(selection_block-- > 0) return; if(selection_block-- > 0) return;
//print("==== DRAW NODES ====");
display_parameter.highlight = display_parameter.highlight =
!array_empty(nodes_selecting) && ( !array_empty(nodes_selecting) && (
(PREFERENCES.connection_line_highlight == 1 && key_mod_press(ALT)) || (PREFERENCES.connection_line_highlight == 1 && key_mod_press(ALT)) ||
@ -728,7 +730,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var gr_y = graph_y * graph_s; var gr_y = graph_y * graph_s;
var log = false; var log = false;
var t = current_time; var t = get_timer();
printIf(log, "============ Draw start ============");
var frame_hovering = noone; var frame_hovering = noone;
@ -736,7 +739,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
nodes_list[| i].cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64); nodes_list[| i].cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64);
nodes_list[| i].preDraw(gr_x, gr_y, graph_s, gr_x, gr_y); nodes_list[| i].preDraw(gr_x, gr_y, graph_s, gr_x, gr_y);
} }
printIf(log, "Predraw time: " + string(current_time - t)); t = current_time; printIf(log, $"Predraw time: {get_timer() - t}"); t = get_timer();
#region draw frame #region draw frame
for(var i = 0; i < ds_list_size(nodes_list); i++) { for(var i = 0; i < ds_list_size(nodes_list); i++) {
@ -744,7 +747,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
frame_hovering = nodes_list[| i]; frame_hovering = nodes_list[| i];
} }
#endregion #endregion
printIf(log, "Frame draw time: " + string(current_time - t)); t = current_time; printIf(log, $"Frame draw time: {get_timer() - t}"); t = get_timer();
#region hover #region hover
node_hovering = noone; node_hovering = noone;
@ -767,7 +770,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(node_hovering) node_hovering.onDrawHover(gr_x, gr_y, mx, my, graph_s); if(node_hovering) node_hovering.onDrawHover(gr_x, gr_y, mx, my, graph_s);
#endregion #endregion
printIf(log, "Hover time: " + string(current_time - t)); t = current_time; printIf(log, $"Hover time: {get_timer() - t}"); t = get_timer();
#region selection #region selection
if(mouse_on_graph && pHOVER) { if(mouse_on_graph && pHOVER) {
@ -878,7 +881,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
} #endregion } #endregion
} }
#endregion #endregion
printIf(log, "Node selection time: " + string(current_time - t)); t = current_time; printIf(log, $"Node selection time: {get_timer() - t}"); t = get_timer();
#region draw active #region draw active
for(var i = 0; i < array_length(nodes_selecting); i++) { for(var i = 0; i < array_length(nodes_selecting); i++) {
@ -887,79 +890,78 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
_node.drawActive(gr_x, gr_y, graph_s); _node.drawActive(gr_x, gr_y, graph_s);
} }
#endregion #endregion
printIf(log, "Draw active: " + string(current_time - t)); t = current_time; printIf(log, $"Draw active: {get_timer() - t}"); t = get_timer();
var aa = min(8192 / w, 8192 / h, PREFERENCES.connection_line_aa); #region draw connections
connection_surface = surface_verify(connection_surface, w * aa, h * aa); var aa = min(8192 / w, 8192 / h, PREFERENCES.connection_line_aa);
connection_surface_aa = surface_verify(connection_surface_aa, w, h); connection_surface = surface_verify(connection_surface, w * aa, h * aa);
surface_set_target(connection_surface); connection_surface_aa = surface_verify(connection_surface_aa, w, h);
DRAW_CLEAR surface_set_target(connection_surface);
DRAW_CLEAR
var hov = noone; var hov = noone;
var hoverable = !bool(node_dragging) && pHOVER; var hoverable = !bool(node_dragging) && pHOVER;
var _params = { connection_param.x = gr_x;
x : gr_x, connection_param.y = gr_y;
y : gr_y, connection_param.s = graph_s;
s : graph_s, connection_param.mx = mx;
mx : mx, connection_param.my = my;
my : my, connection_param.aa = aa;
aa : aa, connection_param.bg = bg_color;
bg : bg_color, connection_param.minx = -64;
minx : -64, connection_param.miny = -64;
miny : -64, connection_param.maxx = w + 64;
maxx : w + 64, connection_param.maxy = h + 64;
maxy : h + 64, connection_param.active = hoverable;
active : hoverable, connection_param.max_layer = ds_list_size(nodes_list);
max_layer : ds_list_size(nodes_list), connection_param.highlight = display_parameter.highlight;
highlight : display_parameter.highlight,
};
for(var i = 0; i < ds_list_size(nodes_list); i++) { for(var i = 0; i < ds_list_size(nodes_list); i++) {
_params.cur_layer = i + 1; connection_param.cur_layer = i + 1;
var _hov = nodes_list[| i].drawConnections(_params); var _hov = nodes_list[| i].drawConnections(connection_param);
if(_hov != noone && is_struct(_hov)) hov = _hov; if(_hov != noone && is_struct(_hov)) hov = _hov;
} }
if(value_dragging && connection_draw_mouse != noone) { if(value_dragging && connection_draw_mouse != noone) {
var _cmx = connection_draw_mouse[0]; var _cmx = connection_draw_mouse[0];
var _cmy = connection_draw_mouse[1]; var _cmy = connection_draw_mouse[1];
var _cmt = connection_draw_target; var _cmt = connection_draw_target;
if(array_empty(value_draggings)) if(array_empty(value_draggings))
value_dragging.drawConnectionMouse(_params, _cmx, _cmy, _cmt); value_dragging.drawConnectionMouse(connection_param, _cmx, _cmy, _cmt);
else { else {
var _stIndex = array_find(value_draggings, value_dragging); var _stIndex = array_find(value_draggings, value_dragging);
for( var i = 0, n = array_length(value_draggings); i < n; i++ ) { for( var i = 0, n = array_length(value_draggings); i < n; i++ ) {
var _dmx = _cmx; var _dmx = _cmx;
var _dmy = value_draggings[i].connect_type == JUNCTION_CONNECT.output? _cmy + (i - _stIndex) * 24 * graph_s : _cmy; var _dmy = value_draggings[i].connect_type == JUNCTION_CONNECT.output? _cmy + (i - _stIndex) * 24 * graph_s : _cmy;
value_draggings[i].drawConnectionMouse(_params, _dmx, _dmy, _cmt); value_draggings[i].drawConnectionMouse(connection_param, _dmx, _dmy, _cmt);
}
} }
} }
}
printIf(log, "Draw connection: " + string(current_time - t)); t = current_time; surface_reset_target();
surface_reset_target(); surface_set_shader(connection_surface_aa, sh_downsample);
shader_set_f("down", aa);
shader_set_dim("dimension", connection_surface);
draw_surface(connection_surface, 0, 0);
surface_reset_shader();
surface_set_shader(connection_surface_aa, sh_downsample); BLEND_ALPHA_MULP
shader_set_f("down", aa); draw_surface(connection_surface_aa, 0, 0);
shader_set_dim("dimension", connection_surface); BLEND_NORMAL
draw_surface(connection_surface, 0, 0);
surface_reset_shader();
BLEND_ALPHA_MULP junction_hovering = (node_hovering == noone && !is_struct(node_hovering))? hov : noone;
draw_surface(connection_surface_aa, 0, 0); value_focus = noone;
BLEND_NORMAL #endregion
printIf(log, $"Draw connection: {get_timer() - t}"); t = get_timer();
junction_hovering = (node_hovering == noone && !is_struct(node_hovering))? hov : noone;
value_focus = noone;
#region draw node #region draw node
var t = current_time; var t = get_timer();
for(var i = 0; i < ds_list_size(nodes_list); i++) for(var i = 0; i < ds_list_size(nodes_list); i++)
nodes_list[| i].onDrawNodeBehind(gr_x, gr_y, mx, my, graph_s); nodes_list[| i].onDrawNodeBehind(gr_x, gr_y, mx, my, graph_s);
@ -977,9 +979,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
for(var i = 0; i < ds_list_size(nodes_list); i++) for(var i = 0; i < ds_list_size(nodes_list); i++)
nodes_list[| i].drawBadge(gr_x, gr_y, graph_s); nodes_list[| i].drawBadge(gr_x, gr_y, graph_s);
printIf(log, "Draw node: " + string(current_time - t)); t = current_time;
#endregion #endregion
printIf(log, $"Draw node: {get_timer() - t}"); t = get_timer();
#region dragging #region dragging
if(mouse_press(mb_left)) if(mouse_press(mb_left))
@ -1034,11 +1035,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
} }
} }
} }
printIf(log, "Drag node time : " + string(current_time - t)); t = current_time;
if(mouse_release(mb_left)) if(mouse_release(mb_left))
node_dragging = noone; node_dragging = noone;
#endregion #endregion
printIf(log, $"Drag node time : {get_timer() - t}"); t = get_timer();
if(mouse_on_graph && pFOCUS) { #region if(mouse_on_graph && pFOCUS) { #region
var _node = getFocusingNode(); var _node = getFocusingNode();
@ -1125,8 +1126,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
drag_locking = false; drag_locking = false;
} }
#endregion #endregion
printIf(log, $"Draw selection frame : {get_timer() - t}"); t = get_timer();
printIf(log, "Draw selection frame : " + string(current_time - t)); t = current_time;
} #endregion } #endregion
function drawJunctionConnect() { #region function drawJunctionConnect() { #region

View File

@ -427,7 +427,7 @@ function Panel_Menu() : PanelContent() constructor {
} }
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
draw_text_add(xc, yc, menus[i][0]); draw_text_add(round(xc), round(yc), menus[i][0]);
if(hori) { if(hori) {
xx += ww + 8; xx += ww + 8;
@ -499,11 +499,11 @@ function Panel_Menu() : PanelContent() constructor {
draw_set_color(COLORS._main_text_inner); draw_set_color(COLORS._main_text_inner);
var wr_x = hori? nx0 + ui(8) : w / 2 - (wr_w + er_w + ui(16)) / 2; var wr_x = hori? nx0 + ui(8) : w / 2 - (wr_w + er_w + ui(16)) / 2;
draw_sprite_ui_uniform(THEME.noti_icon_warning, warning_amo? 1 : 0, wr_x + ui(10), ny0); draw_sprite_ui_uniform(THEME.noti_icon_warning, warning_amo? 1 : 0, wr_x + ui(10), ny0);
draw_text(wr_x + ui(28), ny0, warning_amo); draw_text(round(wr_x + ui(28)), round(ny0), warning_amo);
wr_x += wr_w + ui(16); wr_x += wr_w + ui(16);
draw_sprite_ui_uniform(THEME.noti_icon_error, error_amo? 1 : 0, wr_x + ui(10), ny0); draw_sprite_ui_uniform(THEME.noti_icon_error, error_amo? 1 : 0, wr_x + ui(10), ny0);
draw_text(wr_x + ui(28), ny0, error_amo); draw_text(round(wr_x + ui(28)), round(ny0), error_amo);
if(hori) nx0 += nw + ui(8); if(hori) nx0 += nw + ui(8);
else ny0 += nh + ui(8); else ny0 += nh + ui(8);
@ -527,7 +527,7 @@ function Panel_Menu() : PanelContent() constructor {
dialogPanelCall(new Panel_Addon()); dialogPanelCall(new Panel_Addon());
} else } else
draw_sprite_stretched(THEME.ui_panel_bg, 1, nx0, ny0 - wh / 2, ww, wh); draw_sprite_stretched(THEME.ui_panel_bg, 1, nx0, ny0 - wh / 2, ww, wh);
draw_text(nx0 + ui(8), ny0, name); draw_text(round(nx0 + ui(8)), round(ny0), name);
draw_sprite_ui(THEME.addon_icon, 0, nx0 + ui(20) + string_width(name), ny0 + ui(1),,,, COLORS._main_icon); draw_sprite_ui(THEME.addon_icon, 0, nx0 + ui(20) + string_width(name), ny0 + ui(1),,,, COLORS._main_icon);
if(hori) nx0 += ww + ui(4); if(hori) nx0 += ww + ui(4);
@ -644,7 +644,7 @@ function Panel_Menu() : PanelContent() constructor {
} }
} }
draw_text((_x0 + _x1) / 2, (_y0 + _y1) / 2, txt); draw_text(round((_x0 + _x1) / 2), round((_y0 + _y1) / 2), txt);
} else { } else {
var _xx1 = ui(40); var _xx1 = ui(40);
var y1 = h - ui(20); var y1 = h - ui(20);
@ -663,7 +663,7 @@ function Panel_Menu() : PanelContent() constructor {
} }
} }
draw_text(_xx1 + ui(6), y1, txt); draw_text(round(_xx1 + ui(6)), round(y1), txt);
} }
#endregion #endregion
@ -737,10 +737,10 @@ function Panel_Menu() : PanelContent() constructor {
if(hori) { if(hori) {
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text_sub); draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text_sub);
draw_text(tcx, (ty0 + ty1) / 2, tc); draw_text(round(tcx), round((ty0 + ty1) / 2), tc);
} else { } else {
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub); draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub);
draw_text(tx0 + ui(8), tby0 + th / 2, tc); draw_text(round(tx0 + ui(8)), round(tby0 + th / 2), tc);
} }
if(IS_PATREON && PREFERENCES.show_supporter_icon) { if(IS_PATREON && PREFERENCES.show_supporter_icon) {

View File

@ -168,12 +168,14 @@ function winManStep() { #region
} }
winMan_setRect(sx, sy, sw, sh); winMan_setRect(sx, sy, sw, sh);
if(mouse_release(mb_left))
DISPLAY_REFRESH
} }
if(mouse_release(mb_left)) { if(mouse_release(mb_left)) {
window_minimize_size = [ sw, sh ]; window_minimize_size = [ sw, sh ];
window_drag_status = 0; window_drag_status = 0;
DISPLAY_REFRESH
} }
} #endregion } #endregion