diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 8b7f821fb..c97ade831 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -12,8 +12,8 @@ {"name":"menu","order":10,"path":"folders/dialog/menu.yy",}, {"name":"preview","order":7,"path":"folders/dialog/preview.yy",}, {"name":"widget","order":9,"path":"folders/dialog/widget.yy",}, - {"name":"Extensions","order":9,"path":"folders/Extensions.yy",}, - {"name":"MAC","order":7,"path":"folders/Extensions/MAC.yy",}, + {"name":"_Extensions","order":9,"path":"folders/_Extensions.yy",}, + {"name":"MAC","order":7,"path":"folders/_Extensions/MAC.yy",}, {"name":"font","order":7,"path":"folders/font.yy",}, {"name":"functions","order":6,"path":"folders/functions.yy",}, {"name":"animation","order":19,"path":"folders/functions/animation.yy",}, @@ -143,6 +143,7 @@ {"name":"sprites","order":12,"path":"folders/sprites.yy",}, {"name":"gameframe","order":2,"path":"folders/sprites/gameframe.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, + {"name":"custom","order":4,"path":"folders/addons/custom.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -288,6 +289,7 @@ {"name":"sh_cell_noise_round","order":9,"path":"shaders/sh_cell_noise_round/sh_cell_noise_round.yy",}, {"name":"s_node_cross_product_2d","order":12,"path":"sprites/s_node_cross_product_2d/s_node_cross_product_2d.yy",}, {"name":"s_node_path_plot","order":12,"path":"sprites/s_node_path_plot/s_node_path_plot.yy",}, + {"name":"__initAddon","order":2,"path":"scripts/__initAddon/__initAddon.yy",}, {"name":"json_functions","order":8,"path":"scripts/json_functions/json_functions.yy",}, {"name":"event_recorder","order":4,"path":"scripts/event_recorder/event_recorder.yy",}, {"name":"s_node_path_l_system","order":10,"path":"sprites/s_node_path_l_system/s_node_path_l_system.yy",}, @@ -535,6 +537,7 @@ {"name":"__background_get_internal","order":2,"path":"scripts/__background_get_internal/__background_get_internal.yy",}, {"name":"sh_combine_hsv","order":41,"path":"shaders/sh_combine_hsv/sh_combine_hsv.yy",}, {"name":"s_node_array_insert","order":4,"path":"sprites/s_node_array_insert/s_node_array_insert.yy",}, + {"name":"addon_lua","order":1,"path":"scripts/addon_lua/addon_lua.yy",}, {"name":"nodeValue_drawer","order":1,"path":"scripts/nodeValue_drawer/nodeValue_drawer.yy",}, {"name":"node_noise","order":17,"path":"scripts/node_noise/node_noise.yy",}, {"name":"mtl_reader","order":6,"path":"scripts/mtl_reader/mtl_reader.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 94ad1f998..8795ddc31 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -31,9 +31,9 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"menu","folderPath":"folders/dialog/menu.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"preview","folderPath":"folders/dialog/preview.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/dialog/widget.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Extensions","folderPath":"folders/Extensions.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Gameframe","folderPath":"folders/Extensions/Gameframe.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"MAC","folderPath":"folders/Extensions/MAC.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"_Extensions","folderPath":"folders/_Extensions.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Gameframe","folderPath":"folders/_Extensions/Gameframe.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"MAC","folderPath":"folders/_Extensions/MAC.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"font","folderPath":"folders/font.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"functions","folderPath":"folders/functions.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"3d","folderPath":"folders/functions/3d.yy",}, @@ -179,6 +179,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Steamworks","folderPath":"folders/Steamworks.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"UGC","folderPath":"folders/Steamworks/UGC.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"custom","folderPath":"folders/addons/custom.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","CopyToMask":-1,"filePath":"datafiles",}, @@ -998,6 +999,7 @@ {"id":{"name":"sh_cell_noise_round","path":"shaders/sh_cell_noise_round/sh_cell_noise_round.yy",},}, {"id":{"name":"s_node_cross_product_2d","path":"sprites/s_node_cross_product_2d/s_node_cross_product_2d.yy",},}, {"id":{"name":"s_node_path_plot","path":"sprites/s_node_path_plot/s_node_path_plot.yy",},}, + {"id":{"name":"__initAddon","path":"scripts/__initAddon/__initAddon.yy",},}, {"id":{"name":"json_functions","path":"scripts/json_functions/json_functions.yy",},}, {"id":{"name":"event_recorder","path":"scripts/event_recorder/event_recorder.yy",},}, {"id":{"name":"s_node_path_l_system","path":"sprites/s_node_path_l_system/s_node_path_l_system.yy",},}, @@ -1278,6 +1280,7 @@ {"id":{"name":"__background_get_internal","path":"scripts/__background_get_internal/__background_get_internal.yy",},}, {"id":{"name":"sh_combine_hsv","path":"shaders/sh_combine_hsv/sh_combine_hsv.yy",},}, {"id":{"name":"s_node_array_insert","path":"sprites/s_node_array_insert/s_node_array_insert.yy",},}, + {"id":{"name":"addon_lua","path":"scripts/addon_lua/addon_lua.yy",},}, {"id":{"name":"nodeValue_drawer","path":"scripts/nodeValue_drawer/nodeValue_drawer.yy",},}, {"id":{"name":"node_noise","path":"scripts/node_noise/node_noise.yy",},}, {"id":{"name":"mtl_reader","path":"scripts/mtl_reader/mtl_reader.yy",},}, @@ -1891,6 +1894,7 @@ {"id":{"name":"s_node_regex_replace","path":"sprites/s_node_regex_replace/s_node_regex_replace.yy",},}, {"id":{"name":"paddingBox","path":"scripts/paddingBox/paddingBox.yy",},}, {"id":{"name":"fd_rectangle_set_visualization_shader","path":"scripts/fd_rectangle_set_visualization_shader/fd_rectangle_set_visualization_shader.yy",},}, + {"id":{"name":"addonPanel","path":"scripts/addonPanel/addonPanel.yy",},}, {"id":{"name":"s_node_ase_layer","path":"sprites/s_node_ase_layer/s_node_ase_layer.yy",},}, {"id":{"name":"_f_p1","path":"fonts/_f_p1/_f_p1.yy",},}, {"id":{"name":"tuple_functions","path":"scripts/tuple_functions/tuple_functions.yy",},}, diff --git a/objects/o_dialog_panel/Draw_64.gml b/objects/o_dialog_panel/Draw_64.gml index fedc7c75c..5543d7ba8 100644 --- a/objects/o_dialog_panel/Draw_64.gml +++ b/objects/o_dialog_panel/Draw_64.gml @@ -9,14 +9,14 @@ if !ready exit; draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h); #endregion -#region content +#region content if(!is_undefined(content) && content != noone) { var cx = dialog_x + content.showHeader * padding; var cy = dialog_y + content.showHeader * (padding + title_height); content.x = cx; content.y = cy; content.onStepBegin(); - + content.pFOCUS = sFOCUS && m_in; content.pHOVER = sHOVER && m_in; @@ -34,6 +34,8 @@ if !ready exit; gpu_set_blendmode(bm_normal); surface_reset_target(); + content.drawGUI(); + draw_surface(panel, cx, cy); } #endregion diff --git a/objects/o_dialog_preset/Create_0.gml b/objects/o_dialog_preset/Create_0.gml index 7d9ce6d44..8e202944a 100644 --- a/objects/o_dialog_preset/Create_0.gml +++ b/objects/o_dialog_preset/Create_0.gml @@ -20,13 +20,13 @@ event_inherited(); if(!ds_map_exists(global.PRESETS_MAP, folder)) return 0; var pres = global.PRESETS_MAP[? folder]; - var amo = array_length(pres); - var hh = line_height() + ui(8); - var _h = amo * hh; + var amo = array_length(pres); + var hh = line_height() + ui(8); + var _h = amo * (hh + ui(4)) + ui(32); for( var i = 0; i < amo; i++ ) { var preset = pres[i]; - var _yy = _y + hh * i; + var _yy = _y + (hh + ui(4)) * i; if(sHOVER && sc_presets.hover && point_in_rectangle(_m[0], _m[1], 0, _yy, sc_presets.w, _yy + hh)) { draw_sprite_stretched(THEME.node_bg, 0, 0, _yy, sc_presets.w - ui(12), hh); diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index dd6578671..eff876d5c 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -71,6 +71,7 @@ __initNodeData(); __initNodes(); __initSteamUGC(); + __initAddon(); PREF_APPLY(); loadFonts(); diff --git a/scripts/__initAddon/__initAddon.gml b/scripts/__initAddon/__initAddon.gml new file mode 100644 index 000000000..4a177a968 --- /dev/null +++ b/scripts/__initAddon/__initAddon.gml @@ -0,0 +1,16 @@ +function __initAddon() { + var dirPath = DIRECTORY + "Addons"; + globalvar ADDONS; + ADDONS = []; + + if(!directory_exists(dirPath)) { + directory_create(dirPath); + return; + } + + var f = file_find_first(dirPath + "\\*", fa_directory); + while(f != "") { + array_push(ADDONS, f); + f = file_find_next(); + } +} \ No newline at end of file diff --git a/scripts/__initAddon/__initAddon.yy b/scripts/__initAddon/__initAddon.yy new file mode 100644 index 000000000..bb8fc5da7 --- /dev/null +++ b/scripts/__initAddon/__initAddon.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "__initAddon", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "custom", + "path": "folders/addons/custom.yy", + }, +} \ No newline at end of file diff --git a/scripts/addonPanel/addonPanel.gml b/scripts/addonPanel/addonPanel.gml new file mode 100644 index 000000000..b96d98558 --- /dev/null +++ b/scripts/addonPanel/addonPanel.gml @@ -0,0 +1,60 @@ +function addonPanel(directory) : PanelContent() constructor { + thread = lua_create(); + lua_error_handler = _lua_error; + __addon_lua_setup(thread); + + self.directory = directory; + + title = filename_name_only(directory); + showHeader = true; + + var propPath = directory + "\\meta.json"; + if(file_exists(propPath)) { + var meta = json_load_struct(propPath); + w = meta[$ "w"]; + h = meta[$ "h"]; + } + + icon = THEME.addon; + var iconPath = directory + "\\icon.png"; + if(file_exists(iconPath)) { + icon = sprite_add(iconPath, 0, false, false, 0, 0); + sprite_set_offset(icon, sprite_get_width(icon) / 2, sprite_get_height(icon) / 2); + } + + scriptPath = directory + "\\script.lua"; + if(!file_exists(scriptPath)) { + noti_warning(title + " Addon error: script.lua not found."); + return self; + } + + static init = function() { + lua_add_file(thread, scriptPath); + var runResult = lua_call(thread, "init"); + } + init(); + + function stepBegin() { + var runResult = lua_call(thread, "step"); + } + + function drawGUI() { + var runResult = lua_call(thread, "drawUI"); + } + + // + + function onResize() { + + } + + function drawContent(panel) { + var runResult = lua_call(thread, "draw"); + } + + // + + static cleanUp = function() { + lua_state_destroy(thread); + } +} \ No newline at end of file diff --git a/scripts/addonPanel/addonPanel.yy b/scripts/addonPanel/addonPanel.yy new file mode 100644 index 000000000..fba808a73 --- /dev/null +++ b/scripts/addonPanel/addonPanel.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "addonPanel", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "custom", + "path": "folders/addons/custom.yy", + }, +} \ No newline at end of file diff --git a/scripts/addon_lua/addon_lua.gml b/scripts/addon_lua/addon_lua.gml new file mode 100644 index 000000000..e5bfcea15 --- /dev/null +++ b/scripts/addon_lua/addon_lua.gml @@ -0,0 +1,30 @@ +#region + global.__lua_functions = [ + [ "print", print ], + + [ "draw_sprite", draw_sprite ], + [ "draw_sprite_ext", draw_sprite_ext ], + [ "draw_sprite_stretched", draw_sprite_stretched ], + [ "draw_sprite_stretched_ext", draw_sprite_stretched_ext ], + + [ "draw_surface", draw_surface ], + [ "draw_surface_ext", draw_surface_ext ], + [ "draw_surface_stretched", draw_surface_stretched ], + [ "draw_surface_stretched_ext", draw_surface_stretched_ext ], + + [ "draw_set_color", draw_set_color ], + [ "draw_set_alpha", draw_set_alpha ], + + [ "draw_circle", draw_circle ], + [ "draw_rectangle", draw_rectangle ], + [ "draw_line", draw_line ], + [ "draw_line_width", draw_line_width ], + ]; +#endregion + +function __addon_lua_setup(lua) { + for( var i = 0; i < array_length(global.__lua_functions); i++ ) { + var _func = global.__lua_functions[i]; + lua_add_function(lua, _func[0], _func[1]); + } +} \ No newline at end of file diff --git a/scripts/addon_lua/addon_lua.yy b/scripts/addon_lua/addon_lua.yy new file mode 100644 index 000000000..cfbf70309 --- /dev/null +++ b/scripts/addon_lua/addon_lua.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "addon_lua", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "custom", + "path": "folders/addons/custom.yy", + }, +} \ No newline at end of file diff --git a/scripts/gameframe/gameframe.yy b/scripts/gameframe/gameframe.yy index 6cb8f1fe0..a7858346d 100644 --- a/scripts/gameframe/gameframe.yy +++ b/scripts/gameframe/gameframe.yy @@ -6,6 +6,6 @@ "isDnD": false, "parent": { "name": "Gameframe", - "path": "folders/Extensions/Gameframe.yy", + "path": "folders/_Extensions/Gameframe.yy", }, } \ No newline at end of file diff --git a/scripts/gameframe_macros/gameframe_macros.yy b/scripts/gameframe_macros/gameframe_macros.yy index 98db3eded..6248e1b38 100644 --- a/scripts/gameframe_macros/gameframe_macros.yy +++ b/scripts/gameframe_macros/gameframe_macros.yy @@ -6,6 +6,6 @@ "isDnD": false, "parent": { "name": "Gameframe", - "path": "folders/Extensions/Gameframe.yy", + "path": "folders/_Extensions/Gameframe.yy", }, } \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 57977cf24..98a410cbc 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -34,7 +34,7 @@ globalvar COLLECTION_VERSION, THEME_VERSION; VERSION = 1142; - SAVEFILE_VERSION = 1400; + SAVEFILE_VERSION = 1420; COLLECTION_VERSION = 1140.090; THEME_VERSION = 1140.090; VERSION_STRING = "1.14.2"; diff --git a/scripts/gradients_function/gradients_function.gml b/scripts/gradients_function/gradients_function.gml index 9944844fe..a99dad690 100644 --- a/scripts/gradients_function/gradients_function.gml +++ b/scripts/gradients_function/gradients_function.gml @@ -136,11 +136,28 @@ function gradientObject(color = c_black) constructor { } static serialize = function() { - return json_stringify(self); + return json_stringify(self, false); } static deserialize = function(str) { - var s = json_try_parse(str); + var s; + + if(is_string(str)) + s = json_try_parse(str); + else if(is_struct(str)) + s = str; + else if(ds_exists(str, ds_type_list)) { + + keys = []; + for( var i = 0; i < ds_list_size(str); i++ ) { + if(!ds_exists(str[| i], ds_type_map)) continue; + + keys[i] = new gradientKey(str[| i][? "time"], str[| i][? "value"]); + } + + return self; + } + type = s.type; keys = []; for( var i = 0; i < array_length(s.keys); i++ ) diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index d1f790e5a..d440b2df6 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1270,6 +1270,13 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x doDeserialize(); processDeserialize(); + + if(preset) { + postDeserialize(); + applyDeserialize(); + + triggerRender(); + } } static doDeserialize = function() {} diff --git a/scripts/node_line/node_line.gml b/scripts/node_line/node_line.gml index b2060b3e3..f1263a616 100644 --- a/scripts/node_line/node_line.gml +++ b/scripts/node_line/node_line.gml @@ -86,10 +86,10 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons if(array_length(points) < 2) continue; for( var j = 1; j < array_length(points); j++ ) { - var x0 = points[j - 1][0]; - var y0 = points[j - 1][1]; - var x1 = points[j][0]; - var y1 = points[j][1]; + var x0 = points[j - 1].x; + var y0 = points[j - 1].y; + var x1 = points[j].x; + var y1 = points[j].y; x0 = _x + x0 * _s; y0 = _y + y0 * _s; @@ -176,7 +176,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); var _ox, _nx, _nx1, _oy, _ny, _ny1; - var _ow, _nw, _oa, _na, _oc, _nc; + var _ow, _nw, _oa, _na, _oc, _nc, _owg, _nwg; lines = []; if(_use_path) { @@ -208,7 +208,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var _prog = _prog_curr + 1; //Record previous position to delete from _total var _prog_total = 0; //Record how far the pointer have moved so far var points = []; - var p; + var p, wght; if(_useDistance) { _pathStr *= _pathLength; @@ -236,12 +236,20 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons else _prog_next = min(_prog_curr + _stepLen, 1); //Move forward _stepLen or _total (if less) stop at 1 } - - if(_useDistance) + + wght = 1; + if(_useDistance) { p = _pat.getPointDistance(_prog_curr, i); - else if(!_useDistance) + + if(struct_has(_pat, "getWeightRatio")) + wght = _pat.getWeightRatio(_prog_curr, i); + } else if(!_useDistance) { p = _pat.getPointRatio(_prog_curr, i); + if(struct_has(_pat, "getWeightDistance")) + wght = _pat.getWeightDistance(_prog_curr, i); + } + _nx = p.x; _ny = p.y; @@ -251,10 +259,9 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _ny += lengthdir_y(random1D(_sed + _sedIndex, -_wig, _wig), _d + 90); _sedIndex++; } - if(_prog_total >= _pathStr) { //Do not add point before range start. Do this instead of starting at _rtStr to prevent wiggle. - array_push(points, [ _nx, _ny, _prog_total / _pathEnd, _prog_curr / _pathLength ]); - } - + if(_prog_total >= _pathStr) //Do not add point before range start. Do this instead of starting at _rtStr to prevent wiggle. + array_push(points, { x: _nx, y: _ny, prog: _prog_total / _pathEnd, progCrop: _prog_curr / _pathLength, weight: wght }); + if(_prog_next > _prog_curr) { _prog_total += _prog_next - _prog_curr; _total -= _prog_next - _prog_curr; @@ -302,7 +309,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _ny += lengthdir_y(wgLen, _d + 90); if(_prog_total > _rtStr) //prevent drawing point before range start. - array_push(points, [_nx, _ny, _prog_total / _rtMax, _prog_curr]); + array_push(points, { x: _nx, y: _ny, prog: _prog_total / _rtMax, progCrop: _prog_curr, weight: 1 }); if(_prog_curr > _prog) _total -= (_prog_curr - _prog); @@ -338,10 +345,10 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons for( var j = 0; j < array_length(points); j++ ) { var p0 = points[j]; - var _nx = p0[0]; - var _ny = p0[1]; - var prog = p0[2]; - var prgc = p0[3]; + var _nx = p0.x; + var _ny = p0.y; + var prog = p0.prog; + var prgc = p0.progCrop; if(_1px) { _nx = _nx - 0.5; @@ -350,6 +357,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _nw = random_range(_wid[0], _wid[1]); _nw *= eval_curve_x(_widc, _widap? prog : prgc); + _nw *= p0.weight; _nc = _color.eval(_colP? prog : prgc); @@ -391,8 +399,8 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons if(j < array_length(points) - 1) { var p2 = points[j + 1]; - var _nnx = p2[0]; - var _nny = p2[1]; + var _nnx = p2.x; + var _nny = p2.y; _nd1 = point_direction(_nx, _ny, _nnx, _nny); _nd = _nd0 + angle_difference(_nd1, _nd0) / 2; @@ -420,7 +428,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons draw_line_width2_angle(_ox, _oy, _nx, _ny, _ow, _nw, _od + 90, _nd + 90, _oc, _nc, _colW); } else { var p1 = points[j + 1]; - _nd = point_direction(_nx, _ny, p1[0], p1[1]); + _nd = point_direction(_nx, _ny, p1.x, p1.y); } _ox = _nx; diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index 68b60e31b..9e6abb745 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -184,7 +184,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru lua_projectData(getState()); var res = 0; - try res = lua_call_w(getState(), _func, argument_val); + try res = lua_call_w(getState(), _func, argument_val); catch(e) noti_warning(exception_print(e),, self); outputs[| 1].setValue(res); diff --git a/scripts/node_path_l_system/node_path_l_system.gml b/scripts/node_path_l_system/node_path_l_system.gml index 2183d433d..a6bc23d6d 100644 --- a/scripts/node_path_l_system/node_path_l_system.gml +++ b/scripts/node_path_l_system/node_path_l_system.gml @@ -1,10 +1,12 @@ -function L_Turtle(x = 0, y = 0, ang = 90) constructor { +function L_Turtle(x = 0, y = 0, ang = 90, w = 1, color = c_white) constructor { self.x = x; self.y = y; self.ang = ang; + self.w = w; + self.color = color; static clone = function() { - return new L_Turtle(x, y, ang); + return new L_Turtle(x, y, ang, w, color); } } @@ -121,9 +123,9 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); draw_set_color(COLORS._main_accent); - for( var i = 0; i < array_length(lines); i += 2 ) { - var p0 = lines[i + 0]; - var p1 = lines[i + 1]; + for( var i = 0; i < array_length(lines); i++ ) { + var p0 = lines[i][0]; + var p1 = lines[i][1]; var x0 = p0[0]; var y0 = p0[1]; @@ -141,18 +143,32 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const static getBoundary = function() { return boundary; } - static getLineCount = function() { return floor(array_length(lines) / 2); } + static getLineCount = function() { return array_length(lines); } static getSegmentCount = function() { return 1; } static getLength = function() { return current_length; } static getAccuLength = function() { return [ 0, current_length ]; } - static getPointDistance = function(_dist, ind = 0) { - return getPointRatio(_dist / current_length, ind); + static getWeightDistance = function (_dist, _ind = 0) { + return getWeightRatio(_dist / current_length, _ind); + } + + static getWeightRatio = function (_rat, _ind = 0) { + var _p0 = lines[_ind][0]; + var _p1 = lines[_ind][1]; + + if(!is_array(_p0) || array_length(_p0) < 2) return 1; + if(!is_array(_p1) || array_length(_p1) < 2) return 1; + + return lerp(_p0[2], _p1[2], _rat); + } + + static getPointDistance = function(_dist, _ind = 0) { + return getPointRatio(_dist / current_length, _ind); } static getPointRatio = function(_rat, _ind = 0) { - var _p0 = array_safe_get(lines, _ind * 2 + 0,, ARRAY_OVERFLOW._default); - var _p1 = array_safe_get(lines, _ind * 2 + 1,, ARRAY_OVERFLOW._default); + var _p0 = lines[_ind][0]; + var _p1 = lines[_ind][1]; if(!is_array(_p0) || array_length(_p0) < 2) return new Point(); if(!is_array(_p1) || array_length(_p1) < 2) return new Point(); @@ -226,7 +242,7 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const var nx = t.x + lengthdir_x(_len, t.ang); var ny = t.y + lengthdir_y(_len, t.ang); - array_push(lines, [t.x, t.y], [nx, ny]); + array_push(lines, [ [t.x, t.y, t.w], [nx, ny, t.w] ]); t.x = nx; t.y = ny; @@ -239,7 +255,7 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const var nx = t.x + lengthdir_x(_len * frac(_itr), t.ang); var ny = t.y + lengthdir_y(_len * frac(_itr), t.ang); - array_push(lines, [t.x, t.y], [nx, ny]); + array_push(lines, [ [t.x, t.y, t.w], [nx, ny, t.w] ]); t.x = nx; t.y = ny; @@ -249,6 +265,9 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const case "|": t.ang += 180; break; case "[": ds_stack_push(st, t.clone()); break; case "]": t = ds_stack_pop(st); break; + + case ">": t.w += 0.1; break; + case "<": t.w -= 0.1; break; } } @@ -256,7 +275,7 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const boundary = new BoundingBox(); for( var i = 0; i < array_length(lines); i++ ) - boundary.addPoint(lines[i][0], lines[i][1]); + boundary.addPoint(lines[i][0][0], lines[i][0][1], lines[i][1][0], lines[i][1][1]); outputs[| 0].setValue(self); } diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 7b60c2d4b..5a5922629 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -32,7 +32,7 @@ function Panel_Menu() : PanelContent() constructor { menuItem(get_text("panel_menu_splash_screen", "Splash screen"), function() { dialogCall(o_dialog_splash); }), -1, menuItem(get_text("panel_menu_addons", "Addons"), function(_x, _y, _depth) { - return submenuCall(_x, _y, _depth, [ + var arr = [ menuItem(get_text("panel_menu_addons_key", "Key displayer"), function() { if(instance_exists(addon_key_displayer)) { instance_destroy(addon_key_displayer); @@ -41,7 +41,19 @@ function Panel_Menu() : PanelContent() constructor { instance_create_depth(0, 0, 0, addon_key_displayer); }), - ]); + -1 + ]; + + for( var i = 0; i < array_length(ADDONS); i++ ) { + var _dir = ADDONS[i]; + + array_push(arr, menuItem(_dir, function(_x, _y, _depth, _path) { + var addonPath = DIRECTORY + "Addons\\" + _path; + dialogPanelCall(new addonPanel(addonPath)); + } )); + } + + return submenuCall(_x, _y, _depth, arr); }, THEME.addon ).setIsShelf(), -1, menuItem(get_text("fullscreen", "Toggle fullscreen"), function() { diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index c1058824d..e221a9bea 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -409,7 +409,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod if(self == WIDGET_CURRENT) { draw_set_text(font, fa_left, fa_top, COLORS._main_text); - draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, hh, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, hh, COLORS._main_accent, 1); editText(); #region cursor