- [Graph Panel] Fix crash when grouping nodes.

This commit is contained in:
Tanasart 2023-12-26 19:28:35 +07:00
parent 599e8b1855
commit 296c7847f3
10 changed files with 22 additions and 18 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -9,11 +9,11 @@ function groupNodes(nodeArray, _group = noone, record = true, check_connect = tr
for(var i = 0; i < array_length(nodeArray); i++) {
var node = nodeArray[i];
if(inline_context != noone) {
array_push_unique(_ctx_nodes, inline_context);
if(node.inline_context != noone) {
array_push_unique(_ctx_nodes, node.inline_context);
for( var k = 0, n = array_length(inline_context.members); k < n; k++ ) {
if(!array_exists(nodeArray, inline_context.members[k])) {
for( var k = 0, n = array_length(node.inline_context.members); k < n; k++ ) {
if(!array_exists(nodeArray, node.inline_context.members[k])) {
noti_warning("Grouping incomplete inline group is not allowed.");
return;
}

View file

@ -1257,7 +1257,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
var tx = xx + w * _s / 2;
var ty = yy + (h + 4) * _s - 2;
if(display_parameter.show_dimension) {
if(struct_get(display_parameter, "show_dimension")) {
var txt = string(getNodeDimension(_s > 0.65));
draw_text(round(tx), round(ty), txt);
ty += string_height(txt) - 2;
@ -1265,7 +1265,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
draw_set_font(f_p3);
if(display_parameter.show_compute) {
if(struct_get(display_parameter, "show_compute")) {
var rt = 0, unit = "";
if(render_time == 0) {

View file

@ -84,21 +84,20 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
case 3 : shader = sh_cell_noise_crystal; break;
}
surface_set_target(_outSurf);
shader_set(shader);
surface_set_shader(_outSurf, shader);
shader_set_f("dimension", _dim);
shader_set_f("time", _tim);
shader_set_f("position", _pos);
shader_set_f_map("scale", _data[2], _data[11], inputs[| 2]);
shader_set_f_map("scale", _data[2], _data[11], inputs[| 2]);
shader_set_f("contrast", _con);
shader_set_f("middle", _mid);
shader_set_f("radiusScale", _rad);
shader_set_f("radiusShatter", _sht);
shader_set_i("pattern", _pat);
shader_set_i("colored", _col);
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
shader_reset();
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -859,7 +859,7 @@ function __initNodes() {
ds_list_add(node, "Shader");
addNodeObject(node, "HLSL", s_node_hlsl, "Node_HLSL", [1, Node_HLSL],, "Execute HLSL shader on a surface.").setVersion(11520);
}
ds_list_add(node, "Organize");
addNodeObject(node, "Pin", s_node_pin, "Node_Pin", [1, Node_Pin],, "Create pin to organize your connection. Can be create by double clicking on a connection line.");
addNodeObject(node, "Frame", s_node_frame, "Node_Frame", [1, Node_Frame],, "Create frame surrounding nodes.");

View file

@ -198,7 +198,7 @@ function Panel_Collection() : PanelContent() constructor {
BLEND_OVERRIDE;
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size);
BLEND_NORMAL;
var meta = noone;
if(variable_struct_exists(_node, "getMetadata"))
meta = _node.getMetadata();
@ -213,7 +213,7 @@ function Panel_Collection() : PanelContent() constructor {
initMenu();
menuCall("collection_menu",,, contentMenu,, _menu_node);
}
if(!instance_exists(o_dialog_menubox) && meta != noone && meta != undefined)
TOOLTIP = meta;
}
@ -222,7 +222,7 @@ function Panel_Collection() : PanelContent() constructor {
draw_sprite_stretched_ext(THEME.node_glow, 0, _boxx - 9, yy - 9, grid_size + 18, grid_size + 18, COLORS._main_value_positive, updated_prog);
if(variable_struct_exists(_node, "getSpr")) _node.getSpr();
if(sprite_exists(_node.spr)) {
var sw = sprite_get_width(_node.spr);
var sh = sprite_get_height(_node.spr);

View file

@ -90,6 +90,11 @@ function graph_export_image(allList, nodeList, settings = {}) {
surface_set_target(cs);
DRAW_CLEAR
var _params = {
show_dimension : true,
show_compute : true,
avoid_label : true,
preview_scale : 100,
x : gr_x,
y : gr_y,
s : scale,
@ -100,9 +105,9 @@ function graph_export_image(allList, nodeList, settings = {}) {
max_layer : 1,
cur_layer : 1,
highlight : false,
log: true
log: true,
};
for(var i = 0; i < ds_list_size(nodeList); i++)
nodeList[| i].drawConnections(_params, true);
surface_reset_target();
@ -122,7 +127,7 @@ function graph_export_image(allList, nodeList, settings = {}) {
for(var i = 0; i < ds_list_size(nodeList); i++) {
var _node = nodeList[| i];
if(instanceof(_node) == "Node_Frame") continue;
var val = _node.drawNode(gr_x, gr_y, mx, my, scale);
var val = _node.drawNode(gr_x, gr_y, mx, my, scale, _params);
}
#endregion