diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index b6900be2f..251aac02b 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -252,6 +252,7 @@ {"name":"o_dialog_crashed","order":3,"path":"objects/o_dialog_crashed/o_dialog_crashed.yy",}, {"name":"o_dialog_drag_folder","order":2,"path":"objects/o_dialog_drag_folder/o_dialog_drag_folder.yy",}, {"name":"o_dialog_exit","order":2,"path":"objects/o_dialog_exit/o_dialog_exit.yy",}, + {"name":"o_dialog_file_name_action","order":10,"path":"objects/o_dialog_file_name_action/o_dialog_file_name_action.yy",}, {"name":"o_dialog_file_name_collection","order":6,"path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",}, {"name":"o_dialog_file_name","order":1,"path":"objects/o_dialog_file_name/o_dialog_file_name.yy",}, {"name":"o_dialog_fontscrollbox","order":5,"path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",}, @@ -271,6 +272,7 @@ {"name":"o_dialog_release_note","order":8,"path":"objects/o_dialog_release_note/o_dialog_release_note.yy",}, {"name":"o_dialog_run_shell","order":13,"path":"objects/o_dialog_run_shell/o_dialog_run_shell.yy",}, {"name":"o_dialog_save","order":12,"path":"objects/o_dialog_save/o_dialog_save.yy",}, + {"name":"o_dialog_scrollbox_horizontal","order":11,"path":"objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy",}, {"name":"o_dialog_scrollbox","order":3,"path":"objects/o_dialog_scrollbox/o_dialog_scrollbox.yy",}, {"name":"o_dialog_splash","order":9,"path":"objects/o_dialog_splash/o_dialog_splash.yy",}, {"name":"o_dialog_textbox_autocomplete","order":7,"path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",}, @@ -1173,6 +1175,7 @@ {"name":"pack_skyline","order":4,"path":"scripts/pack_skyline/pack_skyline.yy",}, {"name":"paddingBox","order":7,"path":"scripts/paddingBox/paddingBox.yy",}, {"name":"palette_functions","order":3,"path":"scripts/palette_functions/palette_functions.yy",}, + {"name":"panel_action_create","order":9,"path":"scripts/panel_action_create/panel_action_create.yy",}, {"name":"panel_addon","order":3,"path":"scripts/panel_addon/panel_addon.yy",}, {"name":"panel_animation_scaler","order":1,"path":"scripts/panel_animation_scaler/panel_animation_scaler.yy",}, {"name":"panel_animation","order":3,"path":"scripts/panel_animation/panel_animation.yy",}, @@ -1626,6 +1629,7 @@ {"name":"sh_zigzag","order":2,"path":"shaders/sh_zigzag/sh_zigzag.yy",}, {"name":"credit_badge_popular","order":2,"path":"sprites/credit_badge_popular/credit_badge_popular.yy",}, {"name":"credit_badge_value","order":1,"path":"sprites/credit_badge_value/credit_badge_value.yy",}, + {"name":"s_action_add","order":1,"path":"sprites/s_action_add/s_action_add.yy",}, {"name":"s_biterator_b_grey_long","order":7,"path":"sprites/s_biterator_b_grey_long/s_biterator_b_grey_long.yy",}, {"name":"s_biterator_b_grey_short","order":8,"path":"sprites/s_biterator_b_grey_short/s_biterator_b_grey_short.yy",}, {"name":"s_biterator_b_labels","order":9,"path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 23f9875d2..795b6f1a1 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -540,6 +540,7 @@ {"id":{"name":"o_dialog_crashed","path":"objects/o_dialog_crashed/o_dialog_crashed.yy",},}, {"id":{"name":"o_dialog_drag_folder","path":"objects/o_dialog_drag_folder/o_dialog_drag_folder.yy",},}, {"id":{"name":"o_dialog_exit","path":"objects/o_dialog_exit/o_dialog_exit.yy",},}, + {"id":{"name":"o_dialog_file_name_action","path":"objects/o_dialog_file_name_action/o_dialog_file_name_action.yy",},}, {"id":{"name":"o_dialog_file_name_collection","path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",},}, {"id":{"name":"o_dialog_file_name","path":"objects/o_dialog_file_name/o_dialog_file_name.yy",},}, {"id":{"name":"o_dialog_fontscrollbox","path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",},}, @@ -559,6 +560,7 @@ {"id":{"name":"o_dialog_release_note","path":"objects/o_dialog_release_note/o_dialog_release_note.yy",},}, {"id":{"name":"o_dialog_run_shell","path":"objects/o_dialog_run_shell/o_dialog_run_shell.yy",},}, {"id":{"name":"o_dialog_save","path":"objects/o_dialog_save/o_dialog_save.yy",},}, + {"id":{"name":"o_dialog_scrollbox_horizontal","path":"objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy",},}, {"id":{"name":"o_dialog_scrollbox","path":"objects/o_dialog_scrollbox/o_dialog_scrollbox.yy",},}, {"id":{"name":"o_dialog_splash","path":"objects/o_dialog_splash/o_dialog_splash.yy",},}, {"id":{"name":"o_dialog_textbox_autocomplete","path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",},}, @@ -1600,6 +1602,7 @@ {"id":{"name":"pack_skyline","path":"scripts/pack_skyline/pack_skyline.yy",},}, {"id":{"name":"paddingBox","path":"scripts/paddingBox/paddingBox.yy",},}, {"id":{"name":"palette_functions","path":"scripts/palette_functions/palette_functions.yy",},}, + {"id":{"name":"panel_action_create","path":"scripts/panel_action_create/panel_action_create.yy",},}, {"id":{"name":"panel_addon","path":"scripts/panel_addon/panel_addon.yy",},}, {"id":{"name":"panel_animation_scaler","path":"scripts/panel_animation_scaler/panel_animation_scaler.yy",},}, {"id":{"name":"panel_animation_settings","path":"scripts/panel_animation_settings/panel_animation_settings.yy",},}, @@ -2140,6 +2143,7 @@ {"id":{"name":"credit_badge_popular","path":"sprites/credit_badge_popular/credit_badge_popular.yy",},}, {"id":{"name":"credit_badge_value","path":"sprites/credit_badge_value/credit_badge_value.yy",},}, {"id":{"name":"node_credit","path":"sprites/node_credit/node_credit.yy",},}, + {"id":{"name":"s_action_add","path":"sprites/s_action_add/s_action_add.yy",},}, {"id":{"name":"s_biterator_b_grey_long","path":"sprites/s_biterator_b_grey_long/s_biterator_b_grey_long.yy",},}, {"id":{"name":"s_biterator_b_grey_short","path":"sprites/s_biterator_b_grey_short/s_biterator_b_grey_short.yy",},}, {"id":{"name":"s_biterator_b_labels","path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",},}, diff --git a/datafiles/data/Theme.zip b/datafiles/data/Theme.zip index 0288d3dd8..b0396073c 100644 Binary files a/datafiles/data/Theme.zip and b/datafiles/data/Theme.zip differ diff --git a/objects/_p_dialog/_p_dialog.yy b/objects/_p_dialog/_p_dialog.yy index 899b16066..f3b12057a 100644 --- a/objects/_p_dialog/_p_dialog.yy +++ b/objects/_p_dialog/_p_dialog.yy @@ -2,10 +2,10 @@ "$GMObject":"", "%Name":"_p_dialog", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"_p_dialog", diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 768c5d948..c6fb18c85 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -490,14 +490,16 @@ event_inherited(); var _boxx = _nx + (grid_width - grid_size) / 2; var cc = c_white; - if(is_instanceof(_node, NodeObject)) cc = c_white; + if(is_instanceof(_node, NodeObject)) cc = c_white; else if(is_instanceof(_node, NodeAction)) cc = COLORS.add_node_blend_action; else if(is_instanceof(_node, AddNodeItem)) cc = COLORS.add_node_blend_generic; else cc = COLORS.dialog_add_node_collection; - BLEND_OVERRIDE - draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, cc, 1); - BLEND_NORMAL + if(!struct_try_get(_node, "hide_bg", false)) { + BLEND_OVERRIDE + draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, cc, 1); + BLEND_NORMAL + } if(_hoverContent && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) { draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1); @@ -527,7 +529,7 @@ event_inherited(); if(sprite_exists(_node.spr)) draw_sprite_ui_uniform(_node.spr, 0, spr_x, spr_y, 0.5); - if(is_instanceof(_node, NodeAction)) + if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false)) draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS.add_node_blend_action); } @@ -649,7 +651,7 @@ event_inherited(); draw_sprite_ext(_node.spr, 0, spr_x, spr_y, ss, ss, 0, c_white, 1); } - if(is_instanceof(_node, NodeAction)) + if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false)) draw_sprite_ui_uniform(THEME.play_action, 0, spr_x + list_height / 2 - 8, spr_y + list_height / 2 - 8, 0.5, COLORS.add_node_blend_action); draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text); @@ -829,6 +831,7 @@ event_inherited(); if(PREFERENCES.dialog_add_node_view == 0) { // grid + var cc; var col = floor(search_pane.surface_w / (grid_width + grid_space)); var yy = _y + grid_space; var index = 0; @@ -856,12 +859,17 @@ event_inherited(); var _drw = yy > -grid_size && yy < search_pane.h; if(_drw) { - BLEND_OVERRIDE; - if(is_instanceof(_node, NodeObject)) draw_sprite_stretched( THEME.node_bg, 0, _boxx, yy, grid_size, grid_size); - else if(is_instanceof(_node, NodeAction)) draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS.add_node_blend_action); - else if(is_instanceof(_node, AddNodeItem)) draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS.add_node_blend_generic); - else draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS.dialog_add_node_collection); - BLEND_NORMAL; + + if(is_instanceof(_node, NodeObject)) cc = c_white; + else if(is_instanceof(_node, NodeAction)) cc = COLORS.add_node_blend_action; + else if(is_instanceof(_node, AddNodeItem)) cc = COLORS.add_node_blend_generic; + else cc = COLORS.dialog_add_node_collection; + + if(!struct_try_get(_node, "hide_bg", false)) { + BLEND_OVERRIDE + draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, cc, 1); + BLEND_NORMAL + } if(_hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_size, yy + grid_size)) { node_selecting = i; @@ -909,7 +917,7 @@ event_inherited(); draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1); } - if(is_instanceof(_node, NodeAction)) + if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false)) draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS.add_node_blend_action); } } @@ -1033,7 +1041,7 @@ event_inherited(); draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1); - if(is_instanceof(_node, NodeAction)) + if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false)) draw_sprite_ui_uniform(THEME.play_action, 0, _sx + list_height / 2 - 8, _sy + list_height / 2 - 8, 0.5, COLORS.add_node_blend_action); } diff --git a/objects/o_dialog_file_name_action/Create_0.gml b/objects/o_dialog_file_name_action/Create_0.gml new file mode 100644 index 000000000..20a8cae43 --- /dev/null +++ b/objects/o_dialog_file_name_action/Create_0.gml @@ -0,0 +1,6 @@ +/// @description init +event_inherited(); + +#region data + +#endregion \ No newline at end of file diff --git a/objects/o_dialog_file_name_action/Draw_64.gml b/objects/o_dialog_file_name_action/Draw_64.gml new file mode 100644 index 000000000..f383946d3 --- /dev/null +++ b/objects/o_dialog_file_name_action/Draw_64.gml @@ -0,0 +1,64 @@ +/// @description init +#region base UI + DIALOG_DRAW_BG + if(sFOCUS) + DIALOG_DRAW_FOCUS +#endregion + +#region draw TB + + tb_name.setFocusHover(sFOCUS, sHOVER); tb_name.register(); + tb_tooltip.setFocusHover(sFOCUS, sHOVER); tb_tooltip.register(); + tb_alias.setFocusHover(sFOCUS, sHOVER); tb_alias.register(); + tb_location.setFocusHover(sFOCUS, sHOVER); tb_location.register(); + + var _pd = ui(16); + var _nm = ui(128); + var _wx = dialog_x + _nm; + var _wy = dialog_y + _pd; + var _ww = dialog_w - _pd - _nm; + var _wh = TEXTBOX_HEIGHT; + var _th = 0; + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_icon); + draw_text_add(dialog_x + _pd, _wy + _wh / 2, __txt("Name")); + var _hh = tb_name.draw( _wx, _wy, _ww - ui(72), _wh, name, mouse_ui); _wy += _hh + ui(8); _th += _hh + ui(8); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_icon); + draw_text_add(dialog_x + _pd, _wy + _wh / 2, __txt("Alias")); + var _hh = tb_alias.draw( _wx, _wy, _ww, _wh, tags, mouse_ui); _wy += _hh + ui(8); _th += _hh + ui(8); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_icon); + draw_text_add(dialog_x + _pd, _wy + _wh / 2, __txt("Tooltip")); + var _hh = tb_tooltip.draw( _wx, _wy, _ww, _wh * 2, tooltip, mouse_ui); _wy += _hh + ui(8); _th += _hh + ui(8); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_icon); + draw_text_add(dialog_x + _pd, _wy + _wh / 2, __txt("Categories")); + var _hh = tb_location.draw( _wx, _wy, _ww, _wh, mouse_ui); _wy += _hh + ui(8); _th += _hh + ui(8); + + dialog_h = _th + _pd * 2 - ui(8); + + var bw = ui(32); + var bh = ui(32); + var bx = dialog_x + dialog_w - _pd - bw; + var by = dialog_y + _pd; + + var txt = __txtx("new_action_create", "Create action"); + var icon = THEME.accept; + var clr = COLORS._main_value_positive; + + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, txt, icon, 0, clr) == 2) { + + } + + bx -= bw + ui(4); + + var txt = __txtx("cancel", "Cancel"); + var icon = THEME.cross; + var clr = COLORS._main_value_negative; + + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, txt, icon, 0, clr) == 2) { + instance_destroy(); + } + +#endregion \ No newline at end of file diff --git a/objects/o_dialog_file_name_action/o_dialog_file_name_action.yy b/objects/o_dialog_file_name_action/o_dialog_file_name_action.yy new file mode 100644 index 000000000..3706c1e9c --- /dev/null +++ b/objects/o_dialog_file_name_action/o_dialog_file_name_action.yy @@ -0,0 +1,39 @@ +{ + "$GMObject":"", + "%Name":"o_dialog_file_name_action", + "eventList":[ + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + ], + "managed":true, + "name":"o_dialog_file_name_action", + "overriddenProperties":[], + "parent":{ + "name":"widget", + "path":"folders/dialog/widget.yy", + }, + "parentObjectId":{ + "name":"_p_dialog", + "path":"objects/_p_dialog/_p_dialog.yy", + }, + "persistent":false, + "physicsAngularDamping":0.1, + "physicsDensity":0.5, + "physicsFriction":0.2, + "physicsGroup":1, + "physicsKinematic":false, + "physicsLinearDamping":0.1, + "physicsObject":false, + "physicsRestitution":0.1, + "physicsSensor":false, + "physicsShape":1, + "physicsShapePoints":[], + "physicsStartAwake":true, + "properties":[], + "resourceType":"GMObject", + "resourceVersion":"2.0", + "solid":false, + "spriteId":null, + "spriteMaskId":null, + "visible":true, +} \ No newline at end of file diff --git a/objects/o_dialog_scrollbox/Create_0.gml b/objects/o_dialog_scrollbox/Create_0.gml index ae95c0a90..ca660f748 100644 --- a/objects/o_dialog_scrollbox/Create_0.gml +++ b/objects/o_dialog_scrollbox/Create_0.gml @@ -2,8 +2,13 @@ event_inherited(); #region - max_h = 640; - align = fa_center; + max_h = 640; + + font = f_p0 + align = fa_center; + text_pad = ui(8); + item_pad = ui(8); + draggable = false; destroy_on_click_out = true; @@ -54,7 +59,7 @@ event_inherited(); } function setSize() { - var hght = line_get_height(f_p0, 8); + var hght = line_get_height(font) + item_pad; var hh = ui(16 + 24); for( var i = 0, n = array_length(data); i < n; i++ ) @@ -68,7 +73,7 @@ event_inherited(); sc_content = new scrollPane(0, 0, function(_y, _m) { draw_clear_alpha(COLORS.panel_bg_clear, 0); - var hght = line_get_height(f_p0, 8); + var hght = line_get_height(font) + item_pad; var _dw = sc_content.surface_w; var _h = 0; var _ly = _y; @@ -110,13 +115,13 @@ event_inherited(); } } - draw_set_text(f_p0, align, fa_center, clickable? COLORS._main_text : COLORS._main_text_sub); + draw_set_text(font, align, fa_center, clickable? COLORS._main_text : COLORS._main_text_sub); if(align == fa_center) { var _xc = _spr? hght + (_dw - hght) / 2 : _dw / 2; draw_text_cut(_xc, _ly + hght / 2, txt, _dw); } else if(align == fa_left) - draw_text_cut(ui(8) + _spr * hght, _ly + hght / 2, txt, _dw); + draw_text_cut(text_pad + _spr * hght, _ly + hght / 2, txt, _dw); if(_spr) draw_sprite_ext(_val.spr, _val.spr_ind, ui(8) + hght / 2, _ly + hght / 2, 1, 1, 0, _val.spr_blend, 1); diff --git a/objects/o_dialog_scrollbox/o_dialog_scrollbox.yy b/objects/o_dialog_scrollbox/o_dialog_scrollbox.yy index e2c4e3d7c..b54c3ae2a 100644 --- a/objects/o_dialog_scrollbox/o_dialog_scrollbox.yy +++ b/objects/o_dialog_scrollbox/o_dialog_scrollbox.yy @@ -2,9 +2,9 @@ "$GMObject":"", "%Name":"o_dialog_scrollbox", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_scrollbox", diff --git a/objects/o_dialog_scrollbox_horizontal/Create_0.gml b/objects/o_dialog_scrollbox_horizontal/Create_0.gml new file mode 100644 index 000000000..1a4373b8a --- /dev/null +++ b/objects/o_dialog_scrollbox_horizontal/Create_0.gml @@ -0,0 +1,199 @@ +/// @description init +event_inherited(); + +#region + max_h = 640; + + font = f_p0 + align = fa_center; + text_pad = ui(8); + item_pad = ui(8); + widths = []; + + draggable = false; + destroy_on_click_out = true; + + selecting = -1; + scrollbox = noone; + data = []; + initVal = 0; + update_hover = true; + + search_string = ""; + KEYBOARD_STRING = ""; + tb_search = new textBox(TEXTBOX_INPUT.text, function(str) { + search_string = string(str); + filterSearch(); + }); + tb_search.font = f_p2; + tb_search.color = COLORS._main_text_sub; + tb_search.align = fa_left; + tb_search.auto_update = true; + WIDGET_CURRENT = tb_search; + + anchor = ANCHOR.top | ANCHOR.left; + + function initScroll(scroll) { + scrollbox = scroll; + data = scroll.data; + setSize(); + } + + function filterSearch() { + if(search_string == "") { + data = scrollbox.data; + setSize(); + return; + } + + data = []; + for( var i = 0, n = array_length(scrollbox.data); i < n; i++ ) { + var val = scrollbox.data[i]; + + if(val == -1) continue; + if(string_pos(string_lower(search_string), string_lower(val)) > 0) + array_push(data, val); + } + + setSize(); + } + + function setSize() { + + var hght = line_get_height(font) + item_pad; + var sh = ui(40); + + var ww = 0; + var hh = 0; + + var lw = 0; + var lh = item_pad; + var _emp = true; + + widths = []; + + draw_set_text(font, fa_left, fa_top); + + for( var i = 0, n = array_length(data); i < n; i++ ) { + var _dat = data[i]; + var txt = is_instanceof(_dat, scrollItem)? _dat.name : _dat; + + if(_dat == -1 || i == n - 1) { + if(_emp) { + array_push(widths, 0); + } else { + array_push(widths, lw); + ww += lw; + hh = max(hh, lh); + } + + lw = 0; + lh = item_pad; + continue; + } + + _emp = false; + lw = max(lw, string_width(txt) + text_pad * 2); + lh += hght; + } + + dialog_w = max(scrollbox.w, ww); + dialog_h = min(max_h, sh + hh); + + sc_content.resize(dialog_w, dialog_h - ui(40)); + + resetPosition(); + } + + sc_content = new scrollPane(0, 0, function(_y, _m) { + draw_clear_alpha(COLORS.panel_bg_clear, 0); + var hght = line_get_height(font) + item_pad; + var _lx = 0; + var _ly = _y; + var _lw = 0; + var _lh = 0; + var _h = 0; + var hovering = ""; + var _col = 0; + + for( var i = 0, n = array_length(data); i < n; i++ ) { + var _dw = widths[_col]; + var _val = data[i]; + + if(data[i] == -1 || i == n -1) { + _lx += _dw; + _ly = _y; + _col++; + + _h = max(_h, _lh); + _lh = 0; + _lw = 0; + + continue; + } + + if(_dw == 0) continue; + + var txt = is_instanceof(_val, scrollItem)? _val.name : _val; + var _spr = is_instanceof(_val, scrollItem) && _val.spr; + var _tol = is_instanceof(_val, scrollItem) && _val.tooltip != ""; + + var clickable = !string_starts_with(txt, "-"); + var subitem = string_starts_with(txt, ">"); + txt = string_trim_start(txt, ["-", ">", " "]); + + if(clickable) { + if(sc_content.hover && point_in_rectangle(_m[0], _m[1], _lx, _ly, _lx + _dw, _ly + hght - 1)) { + selecting = i; + hovering = data[i]; + + if(_tol) TOOLTIP = _val.tooltip; + } + + if(selecting == i) { + draw_sprite_stretched_ext(THEME.textbox, 3, _lx, _ly, _dw, hght, COLORS.dialog_menubox_highlight, 1); + + if(sc_content.active && (mouse_press(mb_left) || keyboard_check_pressed(vk_enter))) { + initVal = array_find(scrollbox.data, _val); + instance_destroy(); + } + } + } + + draw_set_text(font, align, fa_center, subitem? COLORS._main_text_sub : COLORS._main_text); + if(align == fa_center) { + var _xc = _spr? hght + (_dw - hght) / 2 : _dw / 2; + draw_text_add(_lx + _xc, _ly + hght / 2, txt); + + } else if(align == fa_left) + draw_text_add(_lx + text_pad + _spr * hght, _ly + hght / 2, txt); + + if(_spr) draw_sprite_ext(_val.spr, _val.spr_ind, _lx + ui(8) + hght / 2, _ly + hght / 2, 1, 1, 0, _val.spr_blend, 1); + + _ly += hght; + _lh += hght; + } + + if(update_hover) { + UNDO_HOLDING = true; + if(hovering != "") scrollbox.onModify(array_find(scrollbox.data, hovering)); + else if(initVal > -1) scrollbox.onModify(initVal); + UNDO_HOLDING = false; + } + + if(sc_content.active) { + if(keyboard_check_pressed(vk_up)) { + selecting--; + if(selecting < 0) selecting = array_length(data) - 1; + } + + if(keyboard_check_pressed(vk_down)) + selecting = safe_mod(selecting + 1, array_length(data)); + + if(keyboard_check_pressed(vk_escape)) + instance_destroy(); + } + + return _h; + }); +#endregion diff --git a/objects/o_dialog_scrollbox_horizontal/Destroy_0.gml b/objects/o_dialog_scrollbox_horizontal/Destroy_0.gml new file mode 100644 index 000000000..f9f12dc0c --- /dev/null +++ b/objects/o_dialog_scrollbox_horizontal/Destroy_0.gml @@ -0,0 +1,6 @@ +/// @description init +event_inherited(); + +if(initVal > -1) + scrollbox.onModify(initVal); +scrollbox.open = false; \ No newline at end of file diff --git a/objects/o_dialog_scrollbox_horizontal/Draw_64.gml b/objects/o_dialog_scrollbox_horizontal/Draw_64.gml new file mode 100644 index 000000000..249527676 --- /dev/null +++ b/objects/o_dialog_scrollbox_horizontal/Draw_64.gml @@ -0,0 +1,14 @@ +/// @description init +#region draw + draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h); + + WIDGET_CURRENT = tb_search; + tb_search.setFocusHover(true, true); + tb_search.draw(dialog_x + ui(8), dialog_y + ui(8), dialog_w - ui(16), ui(24), search_string); + tb_search.sprite_index = 0; + + sc_content.setFocusHover(sFOCUS, sHOVER); + sc_content.draw(dialog_x, dialog_y + ui(40)); + + draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h); +#endregion \ No newline at end of file diff --git a/objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy b/objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy new file mode 100644 index 000000000..862f11b45 --- /dev/null +++ b/objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy @@ -0,0 +1,40 @@ +{ + "$GMObject":"", + "%Name":"o_dialog_scrollbox_horizontal", + "eventList":[ + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + ], + "managed":true, + "name":"o_dialog_scrollbox_horizontal", + "overriddenProperties":[], + "parent":{ + "name":"widget", + "path":"folders/dialog/widget.yy", + }, + "parentObjectId":{ + "name":"_p_dialog", + "path":"objects/_p_dialog/_p_dialog.yy", + }, + "persistent":false, + "physicsAngularDamping":0.1, + "physicsDensity":0.5, + "physicsFriction":0.2, + "physicsGroup":1, + "physicsKinematic":false, + "physicsLinearDamping":0.1, + "physicsObject":false, + "physicsRestitution":0.1, + "physicsSensor":false, + "physicsShape":1, + "physicsShapePoints":[], + "physicsStartAwake":true, + "properties":[], + "resourceType":"GMObject", + "resourceVersion":"2.0", + "solid":false, + "spriteId":null, + "spriteMaskId":null, + "visible":true, +} \ No newline at end of file diff --git a/scripts/_draw_defines/_draw_defines.gml b/scripts/_draw_defines/_draw_defines.gml index 8418cdba5..e343b5b3f 100644 --- a/scripts/_draw_defines/_draw_defines.gml +++ b/scripts/_draw_defines/_draw_defines.gml @@ -3,16 +3,16 @@ #endregion #region macro - #macro BLEND_NORMAL gpu_set_blendmode(bm_normal) - #macro BLEND_ADD gpu_set_blendmode(bm_add) - #macro BLEND_OVERRIDE gpu_set_blendmode_ext(bm_one, bm_zero) + #macro BLEND_NORMAL gpu_set_blendmode(bm_normal); + #macro BLEND_ADD gpu_set_blendmode(bm_add); + #macro BLEND_OVERRIDE gpu_set_blendmode_ext(bm_one, bm_zero); //#macro BLEND_ADD_ALPHA gpu_set_blendmode_ext_sepalpha(bm_one, bm_inv_src_alpha, bm_one, bm_one) - #macro BLEND_ALPHA gpu_set_blendmode_ext_sepalpha(bm_one, bm_inv_src_alpha, bm_one, bm_one) - #macro BLEND_ALPHA_MULP gpu_set_blendmode_ext_sepalpha(bm_src_alpha, bm_inv_src_alpha, bm_one, bm_one) + #macro BLEND_ALPHA gpu_set_blendmode_ext_sepalpha(bm_one, bm_inv_src_alpha, bm_one, bm_one); + #macro BLEND_ALPHA_MULP gpu_set_blendmode_ext_sepalpha(bm_src_alpha, bm_inv_src_alpha, bm_one, bm_one); - #macro BLEND_MULTIPLY gpu_set_blendmode_ext(bm_dest_colour, bm_zero) - #macro BLEND_SUBTRACT gpu_set_blendmode(bm_subtract) + #macro BLEND_MULTIPLY gpu_set_blendmode_ext(bm_dest_colour, bm_zero); + #macro BLEND_SUBTRACT gpu_set_blendmode(bm_subtract); #macro DRAW_CLEAR draw_clear_alpha(0, 0); #endregion \ No newline at end of file diff --git a/scripts/action_object/action_object.gml b/scripts/action_object/action_object.gml index 72e16bec6..311677739 100644 --- a/scripts/action_object/action_object.gml +++ b/scripts/action_object/action_object.gml @@ -2,18 +2,9 @@ function actionStep() constructor { type = ""; data = {}; - static trigger = function() { - - } + static trigger = function() {} - static serialize = function() { - var map = {}; - - map.type = type; - map.data = data; - - return map; - } + static serialize = function() { return { type, data }; } static deserialize = function(map) { type = map.type; diff --git a/scripts/button/button.gml b/scripts/button/button.gml index 7e083aa08..7a3114d57 100644 --- a/scripts/button/button.gml +++ b/scripts/button/button.gml @@ -175,7 +175,7 @@ function buttonTextIconInstant(active, spr, _x, _y, _w, _h, _m, _act, _hvr, _tip draw_set_text(f_p1, fa_left, fa_center, active? COLORS._main_icon_light : COLORS._main_icon); var bxc = _x + _w / 2 - (string_width(_icon_label) + ui(64)) / 2; var byc = _y + _h / 2; - draw_sprite_ui(_icon, 0, bxc + ui(24), byc, 1, 1, 0, _icon_blend, _icon_alpha * (0.5 + 0.5 * active)); + if(_icon) draw_sprite_ui(_icon, 0, bxc + ui(24), byc, 1, 1, 0, _icon_blend, _icon_alpha * (0.5 + 0.5 * active)); draw_text_add(bxc + ui(48), byc, _icon_label); return _b; diff --git a/scripts/draw_sprite_ext_override/draw_sprite_ext_override.gml b/scripts/draw_sprite_ext_override/draw_sprite_ext_override.gml index 12a4d0e6e..efb09b1cd 100644 --- a/scripts/draw_sprite_ext_override/draw_sprite_ext_override.gml +++ b/scripts/draw_sprite_ext_override/draw_sprite_ext_override.gml @@ -1,42 +1,35 @@ #macro draw_sprite_ext draw_sprite_ext_override #macro __draw_sprite_ext draw_sprite_ext -function draw_sprite_ext_override(spr, ind, _x, _y, xscale = 1, yscale = 1, rot = 0, color = c_white, alpha = 1) { #region - INLINE - __draw_sprite_ext(spr, ind, round(_x), round(_y), xscale, yscale, rot, color, alpha); -} #endregion +function draw_sprite_ext_override(spr, ind, _x, _y, xscale = 1, yscale = 1, rot = 0, color = c_white, alpha = 1) { + INLINE __draw_sprite_ext(spr, ind, round(_x), round(_y), xscale, yscale, rot, color, alpha); +} + + #macro draw_sprite_stretched_ext draw_sprite_stretched_ext_override #macro __draw_sprite_stretched_ext draw_sprite_stretched_ext -function draw_sprite_stretched_ext_override(spr, ind, _x, _y, w = 1, h = 1, color = c_white, alpha = 1) { #region - INLINE - __draw_sprite_stretched_ext(spr, ind, round(_x), round(_y), round(w), round(h), color, alpha); -} #endregion +function draw_sprite_stretched_ext_override(spr, ind, _x, _y, w = 1, h = 1, color = c_white, alpha = 1) { + INLINE __draw_sprite_stretched_ext(spr, ind, round(_x), round(_y), round(w), round(h), color, alpha); +} -function draw_sprite_stretched_add(spr, ind, _x, _y, w = 1, h = 1, color = c_white, alpha = 1) { #region - INLINE - BLEND_ADD - __draw_sprite_stretched_ext(spr, ind, round(_x), round(_y), round(w), round(h), color, alpha); - BLEND_NORMAL -} #endregion +function draw_sprite_stretched_add(spr, ind, _x, _y, w = 1, h = 1, color = c_white, alpha = 1) { + INLINE BLEND_ADD __draw_sprite_stretched_ext(spr, ind, round(_x), round(_y), round(w), round(h), color, alpha); BLEND_NORMAL +} #macro draw_sprite_stretched draw_sprite_stretched_override #macro __draw_sprite_stretched draw_sprite_stretched -function draw_sprite_stretched_override(spr, ind, _x, _y, w = 1, h = 1) { #region - INLINE - __draw_sprite_stretched(spr, ind, round(_x), round(_y), round(w), round(h)); -} #endregion +function draw_sprite_stretched_override(spr, ind, _x, _y, w = 1, h = 1) { + INLINE __draw_sprite_stretched(spr, ind, round(_x), round(_y), round(w), round(h)); +} -function draw_sprite_ext_add(spr, ind, _x, _y, xscale = 1, yscale = 1, rot = 0, color = c_white, alpha = 1) { #region - INLINE - BLEND_ADD - __draw_sprite_ext(spr, ind, round(_x), round(_y), xscale, yscale, rot, color, alpha); - BLEND_NORMAL -} #endregion +function draw_sprite_ext_add(spr, ind, _x, _y, xscale = 1, yscale = 1, rot = 0, color = c_white, alpha = 1) { + INLINE BLEND_ADD __draw_sprite_ext(spr, ind, round(_x), round(_y), xscale, yscale, rot, color, alpha); BLEND_NORMAL +} -function draw_sprite_stretched_points(spr, ind, _x0, _y0, _x1, _y1, color = c_white, alpha = 1) { #region +function draw_sprite_stretched_points(spr, ind, _x0, _y0, _x1, _y1, color = c_white, alpha = 1) { INLINE var _xs = min(_x0, _x1); @@ -45,9 +38,9 @@ function draw_sprite_stretched_points(spr, ind, _x0, _y0, _x1, _y1, color = c_wh var _h = max(_y0, _y1) - _ys; __draw_sprite_stretched_ext(spr, ind, _xs, _ys, _w, _h, color, alpha); -} #endregion +} -function draw_sprite_stretched_points_clamp(spr, ind, _x0, _y0, _x1, _y1, color = c_white, alpha = 1, _min = 12) { #region +function draw_sprite_stretched_points_clamp(spr, ind, _x0, _y0, _x1, _y1, color = c_white, alpha = 1, _min = 12) { INLINE var _xs = min(_x0, _x1); @@ -56,46 +49,43 @@ function draw_sprite_stretched_points_clamp(spr, ind, _x0, _y0, _x1, _y1, color var _h = max(_min, max(_y0, _y1) - _ys); __draw_sprite_stretched_ext(spr, ind, _xs, _ys, _w, _h, color, alpha); -} #endregion +} -function draw_sprite_bbox(spr, ind, _bbox) { #region +function draw_sprite_bbox(spr, ind, _bbox) { INLINE if(_bbox == noone) return; __draw_sprite_stretched(spr, ind, _bbox.x0, _bbox.y0, _bbox.w, _bbox.h); -} #endregion +} -function draw_sprite_bbox_uniform(spr, ind, _bbox) { #region +function draw_sprite_bbox_uniform(spr, ind, _bbox) { INLINE if(_bbox == noone) return; var _minS = min(_bbox.w, _bbox.h); __draw_sprite_stretched(spr, ind, _bbox.xc - _minS / 2, _bbox.yc - _minS / 2, _minS, _minS); -} #endregion +} -function draw_sprite_uniform(spr, ind, _x, _y, scale, color = c_white) { #region - INLINE - draw_sprite_ext(spr, ind, _x, _y, scale, scale, 0, color, 1); -} #endregion +function draw_sprite_uniform(spr, ind, _x, _y, scale, color = c_white) { + INLINE draw_sprite_ext(spr, ind, _x, _y, scale, scale, 0, color, 1); +} -function draw_sprite_ui(spr, ind, _x, _y, xscale = 1, yscale = 1, rot = 0, color = c_white, alpha = 1) { #region - INLINE - draw_sprite_ext(spr, ind, _x, _y, xscale * UI_SCALE, yscale * UI_SCALE, rot, color, alpha); -} #endregion +function draw_sprite_ui(spr, ind, _x, _y, xscale = 1, yscale = 1, rot = 0, color = c_white, alpha = 1) { + INLINE draw_sprite_ext(spr, ind, _x, _y, xscale * UI_SCALE, yscale * UI_SCALE, rot, color, alpha); +} -function draw_sprite_ui_uniform(spr, ind, _x, _y, scale = 1, color = c_white, alpha = 1, rot = 0) { #region - INLINE - draw_sprite_ui(spr, ind, _x, _y, scale, scale, rot, color, alpha); -} #endregion +function draw_sprite_ui_uniform(spr, ind, _x, _y, scale = 1, color = c_white, alpha = 1, rot = 0) { + INLINE draw_sprite_ui(spr, ind, _x, _y, scale, scale, rot, color, alpha); +} -function draw_sprite_colored(spr, ind, _x, _y, scale = 1, rot = 0, color = COLORS._main_accent) { #region +function draw_sprite_colored(spr, ind, _x, _y, scale = 1, rot = 0, color = COLORS._main_accent) { INLINE var num = sprite_get_number(spr); draw_sprite_ui(spr, ind, _x, _y, scale, scale, rot, c_white); if(num % 2 == 0) draw_sprite_ui(spr, num / 2 + ind, _x, _y, scale, scale, rot, color); -} #endregion +} -function draw_anchor(_index, _x, _y, _r, _type = 0) { #region +function draw_anchor(_index, _x, _y, _r, _type = 0) { shader_set(sh_node_widget_scalar); shader_set_color("color", COLORS._main_accent); shader_set_f("index", _index); @@ -103,9 +93,9 @@ function draw_anchor(_index, _x, _y, _r, _type = 0) { #region draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2); shader_reset(); -} #endregion +} -function draw_anchor_cross(_index, _x, _y, _r, _type = 0) { #region +function draw_anchor_cross(_index, _x, _y, _r, _type = 0) { shader_set(sh_node_widget_scalar_cross); shader_set_color("color", COLORS._main_accent); shader_set_f("index", _index); @@ -113,9 +103,9 @@ function draw_anchor_cross(_index, _x, _y, _r, _type = 0) { #region draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2); shader_reset(); -} #endregion +} -function draw_anchor_line(_index, _x, _y, _r, _a, _type = 0) { #region +function draw_anchor_line(_index, _x, _y, _r, _a, _type = 0) { shader_set(sh_node_widget_scalar_line); shader_set_color("color", COLORS._main_accent); shader_set_f("index", _index); @@ -124,4 +114,4 @@ function draw_anchor_line(_index, _x, _y, _r, _a, _type = 0) { #region draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2); shader_reset(); -} #endregion \ No newline at end of file +} \ No newline at end of file diff --git a/scripts/node_action_object/node_action_object.gml b/scripts/node_action_object/node_action_object.gml index 279fb324a..bbf7cb130 100644 --- a/scripts/node_action_object/node_action_object.gml +++ b/scripts/node_action_object/node_action_object.gml @@ -34,18 +34,30 @@ if(struct_has(__n, "setValues")) { var _setVals = __n.setValues; - for(var j = 0, m = array_length(_setVals); j < m; j++ ) { - var _setVal = _setVals[j]; - var _input = is_string(_setVal.index)? _node.inputMap[? _setVal.index] : _node.inputs[| _setVal.index]; - - if(_input == undefined) continue; - - if(struct_has(_setVal, "value")) - _input.setValue(_setVal.value); - if(struct_has(_setVal, "unit")) - _input.unit.setMode(_setVal.unit); - if(struct_has(_setVal, "expression")) - _input.setExpression(_setVal.expression); + + if(is_array(_setVals)) { + for(var j = 0, m = array_length(_setVals); j < m; j++ ) { + var _setVal = _setVals[j]; + var _input = is_string(_setVal.index)? _node.inputMap[? _setVal.index] : _node.inputs[| _setVal.index]; + if(_input == undefined) continue; + + if(struct_has(_setVal, "value")) _input.setValue(_setVal.value); + if(struct_has(_setVal, "unit")) _input.unit.setMode(_setVal.unit); + if(struct_has(_setVal, "expression")) _input.setExpression(_setVal.expression); + } + } else if(is_struct(_setVals)) { + var _keys = struct_get_names(_setVals); + for (var j = 0, m = array_length(_keys); j < m; j++) { + var _key = _keys[j]; + var _input = _node.inputs[| _key]; + if(_input == undefined) continue; + + var _setVal = _setVals[$ _key]; + + if(struct_has(_setVal, "value")) _input.setValue(_setVal.value); + if(struct_has(_setVal, "unit")) _input.unit.setMode(_setVal.unit); + if(struct_has(_setVal, "expression")) _input.setExpression(_setVal.expression); + } } } } @@ -97,6 +109,14 @@ return self; } #endregion } + + function NodeAction_create() : NodeAction() constructor { + name = "Create Action..."; + spr = s_action_add; + hide_bg = true; + + static build = function() { PANEL_GRAPH.createAction(); } + } function __initNodeActions(list) { var root = $"{DIRECTORY}Actions"; @@ -105,6 +125,8 @@ root += "/Nodes"; directory_verify(root); + ds_list_add(list, new NodeAction_create()); + var f = file_find_first(root + "/*", 0); while (f != "") { @@ -113,8 +135,8 @@ ds_list_add(list, _c); if(_c.location != noone) { - var _cat = _c.location[0]; - var _grp = _c.location[1]; + var _cat = array_safe_get(_c.location, 0, ""); + var _grp = array_safe_get(_c.location, 1, ""); for( var i = 0, n = ds_list_size(NODE_CATEGORY); i < n; i++ ) { if(NODE_CATEGORY[| i].name != _cat) continue; diff --git a/scripts/node_frame/node_frame.gml b/scripts/node_frame/node_frame.gml index 649d9b83b..d5109d3d5 100644 --- a/scripts/node_frame/node_frame.gml +++ b/scripts/node_frame/node_frame.gml @@ -6,7 +6,7 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { h = 160; bg_spr = THEME.node_frame_bg; nm_spr = THEME.node_frame_name; - + size_dragging = false; size_dragging_w = w; size_dragging_h = h; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 4217eb03d..4bae9c859 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -277,7 +277,8 @@ function addNodePCXCatagory(name, list, filter = []) { #region } #endregion function __initNodes() { - global.__currPage = ""; + global.__currPage = ""; + global.__startPage = 0; if(!IS_CMD) { var favPath = DIRECTORY + "Nodes/fav.json"; @@ -489,6 +490,8 @@ function __initNodes() { //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ + global.__startPage = ds_list_size(NODE_CATEGORY); + var input = ds_list_create(); #region //io addNodeCatagory("IO", input); ds_list_add(input, "Images"); diff --git a/scripts/panel_action_create/panel_action_create.gml b/scripts/panel_action_create/panel_action_create.gml new file mode 100644 index 000000000..4139f32fd --- /dev/null +++ b/scripts/panel_action_create/panel_action_create.gml @@ -0,0 +1,299 @@ +function Panel_Action_Create() : PanelContent() constructor { + #region data + title = __txt("Create Action"); + showHeader = true; + padding = ui(12); + + w = min(WIN_W, ui(720)); + h = ui(400); + min_w = ui(640); + min_h = ui(320); + + name = "New Action"; + tooltip = ""; + tags = ""; + location = []; + spr = noone; + + rawNodes = []; + nodes = []; + connections = []; + + cat_index = 0; + node_categories = [ "None" ]; + cat_value = [ noone ]; + + for(var i = global.__startPage; i < ds_list_size(NODE_CATEGORY); i++) { + var _name = NODE_CATEGORY[| i].name; + switch(_name) { + case "Action" : + case "Custom" : + case "Extra" : + continue; + } + + array_push(node_categories, _name); + array_push(cat_value, [ _name, "" ]); + + var _list = NODE_CATEGORY[| i].list; + for(var j = 0, m = ds_list_size(_list); j < m; j++ ) { + if(is_string(_list[| j])) { + array_push(node_categories, $"> {_list[| j]}"); + array_push(cat_value, [ _name, _list[| j] ]); + } + } + + array_push(node_categories, -1); + array_push(cat_value, noone); + } + + tb_name = new textBox( TEXTBOX_INPUT.text, function(str) /*=>*/ { name = str; }).setAutoUpdate(); + tb_tooltip = new textArea(TEXTBOX_INPUT.text, function(str) /*=>*/ { tooltip = str; }).setAutoUpdate(); + tb_alias = new textArea(TEXTBOX_INPUT.text, function(str) /*=>*/ { tags = str; }).setAutoUpdate(); + tb_location = new scrollBox(node_categories, function(val) /*=>*/ { cat_index = val; }); + tb_location.align = fa_left; + tb_location.horizontal = true; + tb_location.padding = ui(16); + tb_location.item_pad = ui(4); + tb_location.font = f_p2; + + b_create = button(function() /*=>*/ { + var _path = $"{DIRECTORY}Actions/Nodes/{name}.json"; + var _map = { + name, + sprPath : $"./{name}.png", + tooltip, + tags: string_split(tags, ",", true), + location : cat_value[cat_index], + nodes, + connections, + }; + + json_save_struct(_path, _map); + + if(spr) surface_save(spr, $"{DIRECTORY}Actions/Nodes/{name}.png"); + close(); + }); + + b_create.text = __txtx("new_action_create", "Create"); + + KEYBOARD_STRING = ""; + #endregion + + function onResize() { sc_node_content.resize(w - padding * 2 - ui(320) - ui(16), h - padding * 2 - ui(16)); } + + #region content + sc_node_content = new scrollPane(w - padding * 2 - ui(320) - ui(16), h - padding * 2 - ui(16), function(_y, _m) { + draw_clear_alpha(COLORS.panel_bg_clear, 0); + var _w = sc_node_content.surface_w; + var _h = ui(16); + var yy = _y; + var _lh = line_get_height(f_p2); + + for (var i = 0, n = array_length(rawNodes); i < n; i++) { + var _r = rawNodes[i]; + var _n = _r.node; + var _name = _n.getFullName(); + var _nd = nodes[i]; + + var _hv = pHOVER && point_in_rectangle(_m[0], _m[1], 0, yy, _w, yy + _lh + ui(4)); + draw_sprite_stretched_ext(THEME.group_label, _hv, 0, yy, _w, _lh + ui(4), CDEF.main_grey); + + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text); + draw_text_add(ui(8), yy + ui(2), _name); + + if(mouse_press(mb_left, _hv)) + _r.expanded = !_r.expanded; + + yy += _lh + ui(4); + _h += _lh + ui(4); + + if(_r.expanded) { + var _val = _nd.setValues; + + for(var j = 0; j < ds_list_size(_n.inputs); j++) { + var _in = _n.inputs[| j]; + var _vali = _val[$ j]; + var _ttg = false; + + var _bx = ui(8 + 12); + var _by = yy + _lh / 2; + var _tg = struct_has(_vali, "value"); _ttg |= _tg; + var _hv = pHOVER && point_in_circle(_m[0], _m[1], _bx, _by, 6); + if(_hv) TOOLTIP = "Save value"; + draw_sprite_ext(THEME.circle_toggle_8, _tg, _bx, _by, 1, 1, 0, _tg? c_white : COLORS._main_icon, .5 + .5 * (_hv || _tg)); + if(mouse_press(mb_left, _hv)) { + if(_tg) struct_remove(_vali, "value"); + else _vali[$ "value"] = _in.getValue(); + } + _bx += ui(12); + + if(_in.expUse) { + var _tg = struct_has(_vali, "expression"); _ttg |= _tg; + var _hv = pHOVER && point_in_circle(_m[0], _m[1], _bx, _by, 6); + if(_hv) TOOLTIP = "Save expression"; + draw_sprite_ext(THEME.circle_toggle_8, _tg, _bx, _by, 1, 1, 0, _tg? c_white : COLORS._main_icon, .5 + .5 * (_hv || _tg)); + if(mouse_press(mb_left, _hv)) { + if(_tg) struct_remove(_vali, "expression"); + else _vali[$ "expression"] = _in.expression; + } + } + _bx += ui(12); + + if(_in.unit.reference != noone) { + var _tg = struct_has(_vali, "unit"); _ttg |= _tg; + var _hv = pHOVER && point_in_circle(_m[0], _m[1], _bx, _by, 6); + if(_hv) TOOLTIP = "Save unit"; + draw_sprite_ext(THEME.circle_toggle_8, _tg, _bx, _by, 1, 1, 0, _tg? c_white : COLORS._main_icon, .5 + .5 * (_hv || _tg)); + if(mouse_press(mb_left, _hv)) { + if(_tg) struct_remove(_vali, "unit"); + else _vali[$ "unit"] = _in.unit.mode; + } + } + _bx += ui(12); + + draw_set_text(f_p2, fa_left, fa_top, _ttg? c_white : COLORS._main_text_sub); + draw_text_add(_bx, yy, _in.name); + + yy += _lh; + _h += _lh; + } + } + + yy += ui(4); + _h += ui(4); + } + + return _h; + }) + #endregion + + function setNodes(_nodes) { + rawNodes = []; + nodes = []; + connections = []; + + if(array_empty(_nodes)) { + close(); + return; + } + + var _nmap = {}; + var _minx = _nodes[0].x; + var _miny = _nodes[0].y; + + for (var i = 0, n = array_length(_nodes); i < n; i++) { + var _n = _nodes[i]; + rawNodes[i] = { node: _n, expanded: false }; + _nmap[$ _n.node_id] = i; + + _minx = min(_minx, _n.x); + _miny = min(_miny, _n.y); + } + + for (var i = 0, n = array_length(_nodes); i < n; i++) { + var _n = _nodes[i]; + var _idT = i; + var _vals = {}; + + for(var j = 0; j < ds_list_size(_n.inputs); j++) { + var _in = _n.inputs[| j]; + _vals[$ j] = {}; + + if(_in.value_from == noone || !struct_has(_nmap, _in.value_from.node.node_id)) { + var _vl = _in.getValue(); + if(!isEqual(_vl, _in.def_val)) + _vals[$ j].value = _vl; + continue; + } + + var _idF = _nmap[$ _in.value_from.node.node_id]; + + array_push(connections, { + from: _idF, + fromIndex: _in.value_from.index, + + to: _idT, + toIndex: j, + }); + } + + nodes[i] = { + node: instanceof(_n), + x : _n.x - _minx, + y : _n.y - _miny, + setValues : _vals, + }; + + } + } + + function drawContent(panel) { + draw_clear_alpha(COLORS.panel_bg_clear, 0); + + var _pd = padding; + + // Nodes + + var ndx = _pd; + var ndy = _pd; + var ndw = w - _pd * 2 - ui(320); + var ndh = h - _pd * 2; + + draw_sprite_stretched(THEME.ui_panel_bg, 1, ndx, ndy, ndw, ndh); + + sc_node_content.setFocusHover(pFOCUS, pHOVER); + sc_node_content.draw(ndx + ui(8), ndy + ui(8), mx - ndx - ui(8), my - ndy - ui(8)); + + // Metadata + + var _tx = w - ui(320); + var _nm = ui(128); + var _wx = _tx + _nm; + var _wy = ui(8); + var _ww = ui(320) - _pd - _nm; + var _wh = TEXTBOX_HEIGHT; + var _th = _wy; + + tb_name.setFocusHover(pFOCUS, pHOVER); tb_name.register(); + tb_tooltip.setFocusHover(pFOCUS, pHOVER); tb_tooltip.register(); + tb_alias.setFocusHover(pFOCUS, pHOVER); tb_alias.register(); + tb_location.setFocusHover(pFOCUS, pHOVER); tb_location.register(); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); + draw_text_add(_tx, _wy + _wh / 2, __txt("Name")); + var _hh = tb_name.draw(_wx, _wy, _ww, _wh, name, [ mx, my ]); _wy += _hh + ui(8); _th += _hh + ui(8); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); + draw_text_add(_tx, _wy + _wh / 2, __txt("Alias")); + var _hh = tb_alias.draw(_wx, _wy, _ww, _wh, tags, [ mx, my ]); _wy += _hh + ui(8); _th += _hh + ui(8); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); + draw_text_add(_tx, _wy + _wh / 2, __txt("Tooltip")); + var _hh = tb_tooltip.draw(_wx, _wy, _ww, _wh * 2, tooltip, [ mx, my ]); _wy += _hh + ui(8); _th += _hh + ui(8); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); + draw_text_add(_tx, _wy + _wh / 2, __txt("Categories")); + var _hh = tb_location.draw(_wx, _wy, _ww, _wh, cat_index, [ mx, my ], x, y); _wy += _hh + ui(8); _th += _hh + ui(8); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); + draw_text_add(_tx, _wy + _wh / 2, __txt("Sprite")); + + var spx = _wx; + var spy = _wy; + var spw = ui(64); + + draw_sprite_stretched(THEME.ui_panel_bg, 1, spx, spy, spw, spw); + if(spr) draw_surface_fit(spr, spx + spw / 2, spy + spw / 2, spw, spw); + + // Buttons + + var bw = ui(96); + var bh = ui(32); + var bx = w - _pd - bw; + var by = h - _pd - bh; + + b_create.setFocusHover(pFOCUS, pHOVER); + b_create.draw(bx, by, bw, bh, [ mx, my ]); + } +} \ No newline at end of file diff --git a/scripts/panel_action_create/panel_action_create.yy b/scripts/panel_action_create/panel_action_create.yy new file mode 100644 index 000000000..453d16aca --- /dev/null +++ b/scripts/panel_action_create/panel_action_create.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"", + "%Name":"panel_action_create", + "isCompatibility":false, + "isDnD":false, + "name":"panel_action_create", + "parent":{ + "name":"graph", + "path":"folders/panels/graph.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 8a69cfc37..65490fe84 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -2897,6 +2897,16 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { _ji.setFrom(_to.outputs[| 0]); } + function createAction() { + if(array_empty(nodes_selecting)) return; + + var pan = new Panel_Action_Create(); + pan.setNodes(nodes_selecting); + pan.spr = PANEL_PREVIEW.getNodePreviewSurface(); + + var dia = dialogPanelCall(pan); + } + //// =========== Serialize =========== static serialize = function() { diff --git a/scripts/scrollBox/scrollBox.gml b/scripts/scrollBox/scrollBox.gml index 30a881122..48df9ca66 100644 --- a/scripts/scrollBox/scrollBox.gml +++ b/scripts/scrollBox/scrollBox.gml @@ -25,30 +25,37 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor open_ry = 0; align = fa_center; + horizontal = false; extra_button = noone; + padding = ui(8); + item_pad = ui(8); - static trigger = function() { #region + static trigger = function() { if(is_method(data_list)) data = data_list(); else data = data_list; var ind = array_find(data, curr_text); open = true; - with(dialogCall(o_dialog_scrollbox, x + open_rx, y + open_ry)) { - initScroll(other); + with(dialogCall(horizontal? o_dialog_scrollbox_horizontal : o_dialog_scrollbox, x + open_rx, y + open_ry)) { initVal = ind; + font = other.font; align = other.align; + text_pad = other.padding; + item_pad = other.item_pad; update_hover = other.update_hover; + + initScroll(other); } - } #endregion + } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry); - } #endregion + } - static draw = function(_x, _y, _w, _h, _val, _m = mouse_ui, _rx = 0, _ry = 0) { #region + static draw = function(_x, _y, _w, _h, _val, _m = mouse_ui, _rx = 0, _ry = 0) { x = _x; y = _y; open_rx = _rx; @@ -64,6 +71,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor if(is_numeric(_val)) _selVal = array_safe_get_fast(data, _val); var _text = is_instanceof(_selVal, scrollItem)? _selVal.name : _selVal; + _text = string_trim_start(_text, ["-", ">", " "]); curr_text = _text; w = _w; @@ -115,7 +123,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor if(_h >= line_get_height()) { draw_set_alpha(0.5 + 0.5 * interactable); if(align == fa_center) draw_text_add((_x0 + _x1) / 2, _yc, _text, _sps); - else if(align == fa_left) draw_text_add(_x0 + ui(8), _yc, _text, _sps); + else if(align == fa_left) draw_text_add(_x0 + padding, _yc, _text, _sps); draw_set_alpha(1); } @@ -129,11 +137,11 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new scrollBox(data, onModify, update_hover); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index e4b3c59b2..3b1bdb631 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -13,8 +13,6 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor color = COLORS._main_text; boxColor = c_white; - auto_update = false; - _input_text_line = []; _input_text_line_index = []; diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index 8365de168..f4f825da1 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -17,7 +17,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { suffix = ""; no_empty = true; - auto_update = false; slidable = false; sliding = false; diff --git a/scripts/textInput/textInput.gml b/scripts/textInput/textInput.gml index c395131b1..6056223e1 100644 --- a/scripts/textInput/textInput.gml +++ b/scripts/textInput/textInput.gml @@ -2,6 +2,7 @@ function textInput(_input, _onModify) : widget() constructor { input = _input; onModify = _onModify; selecting = false; + auto_update = false; typing = false; @@ -20,12 +21,11 @@ function textInput(_input, _onModify) : widget() constructor { static onKey = function(key) {} - static setSideButton = function(_button) { #region - self.side_button = _button; - return self; - } #endregion + static setAutoUpdate = function() /*=>*/ { auto_update = true; return self; } - static breakCharacter = function(ch) { return ch == " " || ch == "\n"; } + static setSideButton = function(_button) /*=>*/ { self.side_button = _button; return self; } + + static breakCharacter = function(ch) /*=>*/ { return ch == " " || ch == "\n"; } static clone = function() { var _onModify = onModify; diff --git a/sprites/s_action_add/a9e33950-c332-4822-8f9a-b230149a29bc.png b/sprites/s_action_add/a9e33950-c332-4822-8f9a-b230149a29bc.png new file mode 100644 index 000000000..79a956142 Binary files /dev/null and b/sprites/s_action_add/a9e33950-c332-4822-8f9a-b230149a29bc.png differ diff --git a/sprites/s_action_add/layers/a9e33950-c332-4822-8f9a-b230149a29bc/170193c4-ea39-4c4d-b671-28e48d4bfb58.png b/sprites/s_action_add/layers/a9e33950-c332-4822-8f9a-b230149a29bc/170193c4-ea39-4c4d-b671-28e48d4bfb58.png new file mode 100644 index 000000000..79a956142 Binary files /dev/null and b/sprites/s_action_add/layers/a9e33950-c332-4822-8f9a-b230149a29bc/170193c4-ea39-4c4d-b671-28e48d4bfb58.png differ diff --git a/sprites/s_action_add/s_action_add.yy b/sprites/s_action_add/s_action_add.yy new file mode 100644 index 000000000..42b68eff0 --- /dev/null +++ b/sprites/s_action_add/s_action_add.yy @@ -0,0 +1,90 @@ +{ + "$GMSprite":"", + "%Name":"s_action_add", + "bboxMode":0, + "bbox_bottom":59, + "bbox_left":4, + "bbox_right":59, + "bbox_top":4, + "collisionKind":1, + "collisionTolerance":0, + "DynamicTexturePage":false, + "edgeFiltering":false, + "For3D":false, + "frames":[ + {"$GMSpriteFrame":"","%Name":"a9e33950-c332-4822-8f9a-b230149a29bc","name":"a9e33950-c332-4822-8f9a-b230149a29bc","resourceType":"GMSpriteFrame","resourceVersion":"2.0",}, + ], + "gridX":0, + "gridY":0, + "height":64, + "HTile":false, + "layers":[ + {"$GMImageLayer":"","%Name":"170193c4-ea39-4c4d-b671-28e48d4bfb58","blendMode":0,"displayName":"default","isLocked":false,"name":"170193c4-ea39-4c4d-b671-28e48d4bfb58","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + ], + "name":"s_action_add", + "nineSlice":null, + "origin":4, + "parent":{ + "name":"misc", + "path":"folders/sprites/misc.yy", + }, + "preMultiplyAlpha":false, + "resourceType":"GMSprite", + "resourceVersion":"2.0", + "sequence":{ + "$GMSequence":"", + "%Name":"s_action_add", + "autoRecord":true, + "backdropHeight":768, + "backdropImageOpacity":0.5, + "backdropImagePath":"", + "backdropWidth":1366, + "backdropXOffset":0.0, + "backdropYOffset":0.0, + "events":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "eventStubScript":null, + "eventToFunction":{}, + "length":1.0, + "lockOrigin":false, + "moments":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "name":"s_action_add", + "playback":1, + "playbackSpeed":30.0, + "playbackSpeedType":0, + "resourceType":"GMSequence", + "resourceVersion":"2.0", + "showBackdrop":true, + "showBackdropImage":false, + "timeUnits":1, + "tracks":[ + {"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore":"","Keyframes":[ + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"a9e33950-c332-4822-8f9a-b230149a29bc","path":"sprites/s_action_add/s_action_add.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"fee36448-f2e9-4132-8798-c1a278ab33c3","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange":null, + "volume":1.0, + "xorigin":32, + "yorigin":32, + }, + "swatchColours":null, + "swfPrecision":0.5, + "textureGroupId":{ + "name":"Default", + "path":"texturegroups/Default", + }, + "type":0, + "VTile":false, + "width":64, +} \ No newline at end of file