mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 19:38:05 +01:00
- [Group] Fix crash when opening output editor.
This commit is contained in:
parent
ce4c89495b
commit
1279f7ae3c
11 changed files with 326 additions and 14 deletions
|
@ -0,0 +1,155 @@
|
|||
// 2024-04-23 08:59:29
|
||||
#event properties (no comments/etc. here are saved)
|
||||
parent_index = _p_dialog;
|
||||
uses_physics = false;
|
||||
|
||||
#event create init
|
||||
event_inherited();
|
||||
|
||||
#region data
|
||||
dialog_w = ui(320);
|
||||
dialog_h = ui(400);
|
||||
|
||||
destroy_on_click_out = true;
|
||||
dragging = noone;
|
||||
drag_disp = noone;
|
||||
drag_insert = 0;
|
||||
drag_shift = 0;
|
||||
|
||||
sep_editing = -1;
|
||||
tb_edit = new textBox(TEXTBOX_INPUT.text, function(str) {
|
||||
if(sep_editing == -1) return;
|
||||
|
||||
display_list[sep_editing][0] = str;
|
||||
sep_editing = -1;
|
||||
node.sortIO();
|
||||
} );
|
||||
tb_edit.align = fa_left;
|
||||
tb_edit.font = f_p2;
|
||||
|
||||
node = noone;
|
||||
display_list = [];
|
||||
type = 1;
|
||||
junction_list = noone;
|
||||
|
||||
function setNode(node, type) {
|
||||
self.node = node;
|
||||
self.type = type;
|
||||
self.display_list = type == JUNCTION_CONNECT.input? node.attributes.input_display_list : node.attributes.output_display_list;
|
||||
self.junction_list = type == JUNCTION_CONNECT.input? node.inputs : node.outputs;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region content
|
||||
sc_group = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
if(node == noone) return 0;
|
||||
|
||||
var _h = 0;
|
||||
var hg = ui(28);
|
||||
var con_w = sc_group.surface_w;
|
||||
var hovr = 0;
|
||||
var padd = ui(4);
|
||||
|
||||
for( var i = 0, n = array_length(display_list); i < n; i++ ) {
|
||||
var disp = display_list[i];
|
||||
|
||||
var _y0 = _y;
|
||||
var _y1 = _y + hg + padd;
|
||||
|
||||
if(dragging == noone) {
|
||||
var aa = 0.5;
|
||||
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0 + padd, _y + padd, hg - padd, _y + hg - padd)) {
|
||||
aa = 1;
|
||||
if(mouse_press(mb_left, sFOCUS)) dragging = display_list[i];
|
||||
}
|
||||
|
||||
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_icon_light, aa);
|
||||
}
|
||||
|
||||
if((i == n - 1 && _m[1] > _y0) || (_m[1] > _y0 && _m[1] <= _y1) || (i == 0 && _m[1] < _y1))
|
||||
hovr = i;
|
||||
|
||||
if(is_array(disp)) {
|
||||
var ed_x = hg + ui(4);
|
||||
if(sHOVER && point_in_rectangle(_m[0], _m[1], ed_x, _y, con_w, _y + hg)) {
|
||||
draw_sprite_stretched_ext(THEME.button_def, 1, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon_light, 1);
|
||||
|
||||
if(sep_editing == -1 && mouse_press(mb_left, sFOCUS)) {
|
||||
sep_editing = i;
|
||||
tb_edit._current_text = disp[0];
|
||||
tb_edit.activate();
|
||||
}
|
||||
} else
|
||||
draw_sprite_stretched_ext(THEME.button_def, 0, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon_light, 1);
|
||||
|
||||
if(sep_editing == i) {
|
||||
WIDGET_CURRENT = tb_edit;
|
||||
tb_edit.setFocusHover(sFOCUS, sHOVER);
|
||||
tb_edit.draw(ed_x, _y, con_w - ed_x, hg, disp[0], _m);
|
||||
} else {
|
||||
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text_add(ed_x + ui(8), _y + hg / 2 - 1, disp[0]);
|
||||
}
|
||||
} else {
|
||||
var ind = junction_list[| disp];
|
||||
draw_set_text(f_p2, fa_left, fa_center, ind.color_display);
|
||||
draw_text_add(hg + ui(8), _y + hg / 2 - 1, ind.name);
|
||||
}
|
||||
|
||||
if(dragging == disp) {
|
||||
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_accent, 1);
|
||||
draw_sprite_stretched_ext(THEME.button_hide, 3, 0, _y0, con_w, hg, COLORS._main_icon, 1);
|
||||
}
|
||||
|
||||
_y += hg + padd;
|
||||
_h += hg + padd;
|
||||
}
|
||||
|
||||
if(dragging != noone) {
|
||||
array_remove(display_list, dragging);
|
||||
array_insert(display_list, hovr, dragging);
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
node.sortIO();
|
||||
dragging = noone;
|
||||
}
|
||||
}
|
||||
|
||||
return _h;
|
||||
})
|
||||
#endregion
|
||||
|
||||
#event draw_gui init
|
||||
if !ready exit;
|
||||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_order_title", "IO order"));
|
||||
#endregion
|
||||
|
||||
#region preset
|
||||
var px = dialog_x + ui(padding);
|
||||
var py = dialog_y + ui(title_height);
|
||||
var pw = dialog_w - ui(padding + padding);
|
||||
var ph = dialog_h - ui(title_height + padding)
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
|
||||
sc_group.setFocusHover(sFOCUS, sHOVER);
|
||||
sc_group.draw(px, py);
|
||||
|
||||
var bx = dialog_x + dialog_w - ui(32 + 16);
|
||||
var by = dialog_y + ui(16);
|
||||
|
||||
if(type == JUNCTION_CONNECT.input) {
|
||||
var _txt = __txtx("dialog_group_order_add", "Add separator");
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.add_16, 1, COLORS._main_value_positive) == 2) {
|
||||
array_push(node.attributes.input_display_list, [ "Separator", false ]);
|
||||
node.sortIO();
|
||||
}
|
||||
}
|
||||
#endregion
|
|
@ -0,0 +1,155 @@
|
|||
// 2024-04-23 08:58:27
|
||||
#event properties (no comments/etc. here are saved)
|
||||
parent_index = _p_dialog;
|
||||
uses_physics = false;
|
||||
|
||||
#event create init
|
||||
event_inherited();
|
||||
|
||||
#region data
|
||||
dialog_w = ui(320);
|
||||
dialog_h = ui(400);
|
||||
|
||||
destroy_on_click_out = true;
|
||||
dragging = noone;
|
||||
drag_disp = noone;
|
||||
drag_insert = 0;
|
||||
drag_shift = 0;
|
||||
|
||||
sep_editing = -1;
|
||||
tb_edit = new textBox(TEXTBOX_INPUT.text, function(str) {
|
||||
if(sep_editing == -1) return;
|
||||
|
||||
display_list[sep_editing][0] = str;
|
||||
sep_editing = -1;
|
||||
node.sortIO();
|
||||
} );
|
||||
tb_edit.align = fa_left;
|
||||
tb_edit.font = f_p2;
|
||||
|
||||
node = noone;
|
||||
display_list = [];
|
||||
type = 1;
|
||||
junction_list = noone;
|
||||
|
||||
function setNode(node, type) {
|
||||
self.node = node;
|
||||
self.type = type;
|
||||
self.display_list = type == JUNCTION_CONNECT.input? node.attributes.input_display_list : node.attributes.output_display_list;
|
||||
self.junction_list = type == JUNCTION_CONNECT.input? node.inputs : node.outputs;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region content
|
||||
sc_group = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
if(node == noone) return 0;
|
||||
|
||||
var _h = 0;
|
||||
var hg = ui(28);
|
||||
var con_w = sc_group.surface_w;
|
||||
var hovr = 0;
|
||||
var padd = ui(4);
|
||||
|
||||
for( var i = 0, n = array_length(display_list); i < n; i++ ) {
|
||||
var disp = display_list[i];
|
||||
|
||||
var _y0 = _y;
|
||||
var _y1 = _y + hg + padd;
|
||||
|
||||
if(dragging == noone) {
|
||||
var aa = 0.5;
|
||||
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0 + padd, _y + padd, hg - padd, _y + hg - padd)) {
|
||||
aa = 1;
|
||||
if(mouse_press(mb_left, sFOCUS)) dragging = display_list[i];
|
||||
}
|
||||
|
||||
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_icon_light, aa);
|
||||
}
|
||||
|
||||
if((i == n - 1 && _m[1] > _y0) || (_m[1] > _y0 && _m[1] <= _y1) || (i == 0 && _m[1] < _y1))
|
||||
hovr = i;
|
||||
|
||||
if(is_array(disp)) {
|
||||
var ed_x = hg + ui(4);
|
||||
if(sHOVER && point_in_rectangle(_m[0], _m[1], ed_x, _y, con_w, _y + hg)) {
|
||||
draw_sprite_stretched_ext(THEME.button_def, 1, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon_light, 1);
|
||||
|
||||
if(sep_editing == -1 && mouse_press(mb_left, sFOCUS)) {
|
||||
sep_editing = i;
|
||||
tb_edit._current_text = disp[0];
|
||||
tb_edit.activate();
|
||||
}
|
||||
} else
|
||||
draw_sprite_stretched_ext(THEME.button_def, 0, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon_light, 1);
|
||||
|
||||
if(sep_editing == i) {
|
||||
WIDGET_CURRENT = tb_edit;
|
||||
tb_edit.setFocusHover(sFOCUS, sHOVER);
|
||||
tb_edit.draw(ed_x, _y, con_w - ed_x, hg, disp[0], _m);
|
||||
} else {
|
||||
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text_add(ed_x + ui(8), _y + hg / 2 - 1, disp[0]);
|
||||
}
|
||||
} else {
|
||||
var ind = junction_list[| disp];
|
||||
draw_set_text(f_p2, fa_left, fa_center, ind.color_display);
|
||||
draw_text_add(hg + ui(8), _y + hg / 2 - 1, ind.name);
|
||||
}
|
||||
|
||||
if(dragging == disp) {
|
||||
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_accent, 1);
|
||||
draw_sprite_stretched_ext(THEME.button_hide, 3, 0, _y0, con_w, hg, COLORS._main_icon, 1);
|
||||
}
|
||||
|
||||
_y += hg + padd;
|
||||
_h += hg + padd;
|
||||
}
|
||||
|
||||
if(dragging != noone) {
|
||||
array_remove(display_list, dragging);
|
||||
array_insert(display_list, hovr, dragging);
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
node.sortIO();
|
||||
dragging = noone;
|
||||
}
|
||||
}
|
||||
|
||||
return _h;
|
||||
})
|
||||
#endregion
|
||||
|
||||
#event draw_gui init
|
||||
if !ready exit;
|
||||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_order_title", "IO order"));
|
||||
#endregion
|
||||
|
||||
#region preset
|
||||
var px = dialog_x + ui(padding);
|
||||
var py = dialog_y + ui(title_height);
|
||||
var pw = dialog_w - ui(padding + padding);
|
||||
var ph = dialog_h - ui(title_height + padding)
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
|
||||
sc_group.setFocusHover(sFOCUS, sHOVER);
|
||||
sc_group.draw(px, py);
|
||||
|
||||
var bx = dialog_x + dialog_w - ui(32 + 16);
|
||||
var by = dialog_y + ui(16);
|
||||
|
||||
if(type == JUNCTION_CONNECT.input) {
|
||||
var _txt = __txtx("dialog_group_order_add", "Add separator");
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.add_16, 1, COLORS._main_value_positive) == 2) {
|
||||
array_push(node.attributes.input_display_list, [ "Separator", false ]);
|
||||
node.sortIO();
|
||||
}
|
||||
}
|
||||
#endregion
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-22 19:24:36
|
||||
// 2024-04-22 19:31:48
|
||||
function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Tunnel In";
|
||||
color = COLORS.node_blend_tunnel;
|
||||
|
@ -211,7 +211,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
|
||||
#region draw arc
|
||||
var prev_s = preview_connecting? 1 + sin(current_time / 100) * 0.1 : 1;
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_connecting = false;
|
||||
|
||||
shader_set(sh_node_arc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-22 19:24:33
|
||||
// 2024-04-22 19:31:03
|
||||
function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Tunnel In";
|
||||
color = COLORS.node_blend_tunnel;
|
||||
|
@ -175,7 +175,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
var node = PROJECT.nodeMap[? _k];
|
||||
if(node.group != group) continue;
|
||||
|
||||
preview_connecting = true;
|
||||
preview_connecting = true;
|
||||
node.preview_connecting = true;
|
||||
|
||||
var tox = _x + node.x * _s;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-22 19:25:58
|
||||
// 2024-04-22 19:32:35
|
||||
function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Tunnel Out";
|
||||
color = COLORS.node_blend_tunnel;
|
||||
|
@ -145,7 +145,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
|
||||
#region draw arc
|
||||
var prev_s = preview_connecting? 1 + sin(current_time / 100) * 0.1 : 1;
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_connecting = false;
|
||||
|
||||
shader_set(sh_node_arc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-22 19:24:39
|
||||
// 2024-04-22 19:32:21
|
||||
function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Tunnel Out";
|
||||
color = COLORS.node_blend_tunnel;
|
||||
|
@ -145,7 +145,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
|
||||
#region draw arc
|
||||
var prev_s = preview_connecting? 1 + sin(current_time / 100) * 0.1 : 1;
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_connecting = false;
|
||||
|
||||
shader_set(sh_node_arc);
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
{"name":"for","order":6,"path":"folders/nodes/data/iterate/for.yy",},
|
||||
{"name":"lua","order":21,"path":"folders/nodes/data/lua.yy",},
|
||||
{"name":"misc","order":22,"path":"folders/nodes/data/misc.yy",},
|
||||
{"name":"tunnel","order":27,"path":"folders/nodes/data/misc/tunnel.yy",},
|
||||
{"name":"lovify","order":26,"path":"folders/nodes/data/misc/lovify.yy",},
|
||||
{"name":"tunnel","order":27,"path":"folders/nodes/data/misc/tunnel.yy",},
|
||||
{"name":"MK_effects","order":23,"path":"folders/nodes/data/MK_effects.yy",},
|
||||
{"name":"src","order":14,"path":"folders/nodes/data/MK_effects/src.yy",},
|
||||
{"name":"PCX","order":24,"path":"folders/nodes/data/PCX.yy",},
|
||||
|
|
|
@ -173,9 +173,9 @@
|
|||
{"$GMFolder":"","%Name":"for","folderPath":"folders/nodes/data/iterate/for.yy","name":"for","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"lua","folderPath":"folders/nodes/data/lua.yy","name":"lua","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"misc","folderPath":"folders/nodes/data/misc.yy","name":"misc","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"tunnel","folderPath":"folders/nodes/data/misc/tunnel.yy","name":"tunnel","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"lovify","folderPath":"folders/nodes/data/misc/lovify.yy","name":"lovify","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"spr","folderPath":"folders/nodes/data/misc/lovify/spr.yy","name":"spr","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"tunnel","folderPath":"folders/nodes/data/misc/tunnel.yy","name":"tunnel","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"MK_effects","folderPath":"folders/nodes/data/MK_effects.yy","name":"MK_effects","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"src","folderPath":"folders/nodes/data/MK_effects/src.yy","name":"src","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"PCX","folderPath":"folders/nodes/data/PCX.yy","name":"PCX","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
|
|
|
@ -25,11 +25,13 @@ event_inherited();
|
|||
node = noone;
|
||||
display_list = [];
|
||||
type = 1;
|
||||
junction_list = noone;
|
||||
|
||||
function setNode(node, type) {
|
||||
self.node = node;
|
||||
self.type = type;
|
||||
self.display_list = type == JUNCTION_CONNECT.input? node.attributes.input_display_list : node.attributes.output_display_list;
|
||||
self.display_list = type == JUNCTION_CONNECT.input? node.attributes.input_display_list : node.attributes.output_display_list;
|
||||
self.junction_list = type == JUNCTION_CONNECT.input? node.inputs : node.outputs;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -85,7 +87,7 @@ event_inherited();
|
|||
draw_text_add(ed_x + ui(8), _y + hg / 2 - 1, disp[0]);
|
||||
}
|
||||
} else {
|
||||
var ind = node.inputs[| disp];
|
||||
var ind = junction_list[| disp];
|
||||
draw_set_text(f_p2, fa_left, fa_center, ind.color_display);
|
||||
draw_text_add(hg + ui(8), _y + hg / 2 - 1, ind.name);
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
|
||||
#region draw arc
|
||||
var prev_s = preview_connecting? 1 + sin(current_time / 100) * 0.1 : 1;
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_connecting = false;
|
||||
|
||||
shader_set(sh_node_arc);
|
||||
|
|
|
@ -144,7 +144,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
|
||||
#region draw arc
|
||||
var prev_s = preview_connecting? 1 + sin(current_time / 100) * 0.1 : 1;
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_scale = lerp_float(preview_scale, prev_s, 5);
|
||||
preview_connecting = false;
|
||||
|
||||
shader_set(sh_node_arc);
|
||||
|
|
Loading…
Reference in a new issue