diff --git a/objects/o_dialog_color_selector/Draw_64.gml b/objects/o_dialog_color_selector/Draw_64.gml index 3857bbb2a..9993a5950 100644 --- a/objects/o_dialog_color_selector/Draw_64.gml +++ b/objects/o_dialog_color_selector/Draw_64.gml @@ -40,7 +40,7 @@ if !ready exit; var by = dialog_y + ui(12); if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh) == 2) - presetCollect(); + __initPalette(); bx -= ui(32); if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txtx("color_selector_open_palette", "Open palette folder"), THEME.folder) == 2) { diff --git a/objects/o_dialog_gradient/Draw_64.gml b/objects/o_dialog_gradient/Draw_64.gml index 60aeba8f5..38d36660b 100644 --- a/objects/o_dialog_gradient/Draw_64.gml +++ b/objects/o_dialog_gradient/Draw_64.gml @@ -45,9 +45,7 @@ if !ready exit; var bx = presets_x + presets_w - ui(44); var by = dialog_y + ui(12); - var _b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txtx("add_preset", "Add to preset")); - - if(_b == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txtx("add_preset", "Add to preset")) == 2) { var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8)); dia.onModify = function (txt) { var gradStr = ""; @@ -62,7 +60,7 @@ if !ready exit; var file = file_text_open_write(txt + ".txt"); file_text_write_string(file, gradStr); file_text_close(file); - presetCollect(); + __initGradient(); }; dia.path = DIRECTORY + "Gradients/" } @@ -70,7 +68,7 @@ if !ready exit; bx -= ui(32); if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh) == 2) - presetCollect(); + __initGradient(); bx -= ui(32); if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txtx("graident_editor_open_folder", "Open gradient folder"), THEME.folder) == 2) { diff --git a/objects/o_dialog_palette/Create_0.gml b/objects/o_dialog_palette/Create_0.gml index 952a7510d..952ac346f 100644 --- a/objects/o_dialog_palette/Create_0.gml +++ b/objects/o_dialog_palette/Create_0.gml @@ -2,17 +2,17 @@ event_inherited(); #region data - dialog_w = ui(812); - dialog_h = ui(440); + dialog_w = ui(812); + dialog_h = ui(440); title_height = 52; destroy_on_click_out = true; - name = __txtx("palette_editor_title", "Palette editor"); + name = __txtx("palette_editor_title", "Palette editor"); palette = 0; index_selecting = 0; - index_dragging = -1; - interactable = true; + index_dragging = -1; + interactable = true; setColor = function(color) { if(index_selecting == -1 || palette == 0) return; @@ -22,9 +22,9 @@ event_inherited(); onApply(palette); } - onApply = noone; + onApply = noone; selector = new colorSelector(setColor); - selector.dropper_close = false; + selector.dropper_close = false; selector.discretize_pal = false; previous_palette = c_black; @@ -58,7 +58,7 @@ event_inherited(); sp_preset_w = ui(240 - 32 - 16); sp_presets = new scrollPane(sp_preset_w, dialog_h - ui(62), function(_y, _m) { - var ww = sp_preset_w - ui(40); + var ww = sp_preset_w - ui(40); var hh = ui(32); var yy = _y + ui(8); var hg = ui(52); @@ -87,7 +87,7 @@ event_inherited(); } if(mouse_press(mb_right, interactable && sFOCUS)) { - hovering_name = pal.name; + hovering_name = pal.path; menuCall("palette_window_preset_menu",,, [ menuItem(__txtx("palette_editor_delete", "Delete palette"), function() { file_delete(hovering_name); diff --git a/objects/o_dialog_palette/Draw_64.gml b/objects/o_dialog_palette/Draw_64.gml index d714d219b..a934e1440 100644 --- a/objects/o_dialog_palette/Draw_64.gml +++ b/objects/o_dialog_palette/Draw_64.gml @@ -53,15 +53,15 @@ if palette == 0 exit; file_text_writeln(file); } file_text_close(file); - presetCollect(); + __initPalette(); }; dia.path = DIRECTORY + "Palettes/" } bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh) == 2) { - presetCollect(); - } + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh) == 2) + __initPalette(); + draw_sprite_ui_uniform(THEME.refresh, 0, bx + ui(14), by + ui(14), 1, COLORS._main_icon); bx -= ui(32); diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index 82dc031c1..5d4e4a4d5 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -100,7 +100,6 @@ function __part(_node) constructor { life_total = life; if(node.onPartCreate != noone) node.onPartCreate(self); - trailActive = true; trailLife = 0; x_history = array_create(life); y_history = array_create(life); @@ -176,6 +175,7 @@ function __part(_node) constructor { static step = function(frame = 0) { #region gml_pragma("forceinline"); + //if(life_total > 0) print($"Step {seed}: {trailLife}"); trailLife++; if(!active) return; @@ -201,7 +201,11 @@ function __part(_node) constructor { dirr += wig_dir.get(seed + life); if(turning != 0) { - var trn = turnSpd? turning * diss : turning; + var trn = turning; + + if(turnSpd > 0) trn = turning * diss * turnSpd; + else if(turnSpd < 0) trn = turning / diss * turnSpd; + dirr += trn } } diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index d043dc86c..c3e4e1720 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -116,7 +116,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co inputs[| 35] = nodeValue("Turn both directions", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Apply randomized 1, -1 multiplier to the turning speed." ) .rejectArray(); - inputs[| 36] = nodeValue("Turn scale with speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ) + inputs[| 36] = nodeValue("Turn scale with speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, false ) .rejectArray(); inputs[| 37] = nodeValue("Collide ground", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ) @@ -426,6 +426,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co } } + //print($"\n===== Running VFX {_time} =====") //var activeParts = 0; for(var i = 0; i < array_length(parts); i++) { //activeParts++; diff --git a/scripts/draw_line_width2/draw_line_width2.gml b/scripts/draw_line_width2/draw_line_width2.gml index 0fd7ffae6..c11ba67b6 100644 --- a/scripts/draw_line_width2/draw_line_width2.gml +++ b/scripts/draw_line_width2/draw_line_width2.gml @@ -23,30 +23,60 @@ function draw_line_width2(x0, y0, x1, y1, w0, w1, cap = false) { } } -function draw_line_width2_angle(x0, y0, x1, y1, w0, w1, a0 = 0, a1 = 0, _oc = c_white, _nc = c_white, widColor = false) { - var _x0 = x0 + lengthdir_x(w0 / 2, a0); - var _y0 = y0 + lengthdir_y(w0 / 2, a0); - var _x1 = x1 + lengthdir_x(w1 / 2, a1); - var _y1 = y1 + lengthdir_y(w1 / 2, a1); +function draw_line_width2_angle(x0, y0, x1, y1, w0, w1, a0 = 0, a1 = 0, _oc = c_white, _nc = c_white) { + var _d0x = lengthdir_x(w0 / 2, a0); + var _d0y = lengthdir_y(w0 / 2, a0); + var _d1x = lengthdir_x(w1 / 2, a1); + var _d1y = lengthdir_y(w1 / 2, a1); + + var _x0 = x0 + _d0x; + var _y0 = y0 + _d0y; + var _x1 = x1 + _d1x; + var _y1 = y1 + _d1y; //draw_set_color(c_red); - draw_primitive_begin(pr_trianglestrip); - draw_vertex_color( x0, y0, widColor? merge_color(_oc, c_black, 0.5) : _oc, 1); - draw_vertex_color( x1, y1, widColor? merge_color(_nc, c_black, 0.5) : _nc, 1); - draw_vertex_color(_x0, _y0, widColor? merge_color(_oc, c_black, 0.0) : _oc, 1); - draw_vertex_color(_x1, _y1, widColor? merge_color(_nc, c_black, 0.0) : _nc, 1); - draw_primitive_end(); + draw_vertex_color( x0, y0, _oc, 1); + draw_vertex_color( x1, y1, _nc, 1); + draw_vertex_color(_x0, _y0, _oc, 1); + draw_vertex_color(_x1, _y1, _nc, 1); - var _x0 = x0 + lengthdir_x(w0 / 2, a0 + 180); - var _y0 = y0 + lengthdir_y(w0 / 2, a0 + 180); - var _x1 = x1 + lengthdir_x(w1 / 2, a1 + 180); - var _y1 = y1 + lengthdir_y(w1 / 2, a1 + 180); + var _x0 = x0 - _d0x; + var _y0 = y0 - _d0y; + var _x1 = x1 - _d1x; + var _y1 = y1 - _d1y; //draw_set_color(c_blue); - draw_primitive_begin(pr_trianglestrip); - draw_vertex_color( x0, y0, widColor? merge_color(_oc, c_black, 0.5) : _oc, 1); - draw_vertex_color( x1, y1, widColor? merge_color(_nc, c_black, 0.5) : _nc, 1); - draw_vertex_color(_x0, _y0, widColor? merge_color(_oc, c_black, 1.0) : _oc, 1); - draw_vertex_color(_x1, _y1, widColor? merge_color(_nc, c_black, 1.0) : _nc, 1); - draw_primitive_end(); + draw_vertex_color( x0, y0, _oc, 1); + draw_vertex_color( x1, y1, _nc, 1); + draw_vertex_color(_x0, _y0, _oc, 1); + draw_vertex_color(_x1, _y1, _nc, 1); +} + +function draw_line_width2_angle_width(x0, y0, x1, y1, w0, w1, a0 = 0, a1 = 0, _oc = c_white, _nc = c_white) { + var _d0x = lengthdir_x(w0 / 2, a0); + var _d0y = lengthdir_y(w0 / 2, a0); + var _d1x = lengthdir_x(w1 / 2, a1); + var _d1y = lengthdir_y(w1 / 2, a1); + + var _x0 = x0 + _d0x; + var _y0 = y0 + _d0y; + var _x1 = x1 + _d1x; + var _y1 = y1 + _d1y; + + //draw_set_color(c_red); + draw_vertex_color( x0, y0, _oc, 1); + draw_vertex_color( x1, y1, _nc, 1); + draw_vertex_color(_x0, _y0, 0, 1); + draw_vertex_color(_x1, _y1, 0, 1); + + var _x0 = x0 - _d0x; + var _y0 = y0 - _d0y; + var _x1 = x1 - _d1x; + var _y1 = y1 - _d1y; + + //draw_set_color(c_blue); + draw_vertex_color( x0, y0, _oc, 1); + draw_vertex_color( x1, y1, _nc, 1); + draw_vertex_color(_x0, _y0, c_black, 1); + draw_vertex_color(_x1, _y1, c_black, 1); } \ No newline at end of file diff --git a/scripts/node_VFX_spawner/node_VFX_spawner.gml b/scripts/node_VFX_spawner/node_VFX_spawner.gml index e71fe0b3f..dbeb83b76 100644 --- a/scripts/node_VFX_spawner/node_VFX_spawner.gml +++ b/scripts/node_VFX_spawner/node_VFX_spawner.gml @@ -5,7 +5,9 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y reloop = true; attributes.Output_pool = false; - + array_push(attributeEditors, ["Output all particles", function() { return attributes.Output_pool; }, + new checkBox(function() { attributes.Output_pool = !attributes.Output_pool; }) ]); + inputs[| 21].setVisible(false, false); inputs[| input_len + 0] = nodeValue("Spawn trigger", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, false) @@ -23,7 +25,8 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y UPDATE_PART_FORWARD static onUpdate = function(frame = CURRENT_FRAME) { #region - runVFX(frame); + if(PROJECT.animator.frame_progress) + runVFX(frame); if(attributes.Output_pool) { outputs[| 0].setValue(parts); diff --git a/scripts/node_VFX_trail_path/node_VFX_trail_path.gml b/scripts/node_VFX_trail_path/node_VFX_trail_path.gml index 2bf1fb27d..7380539ae 100644 --- a/scripts/node_VFX_trail_path/node_VFX_trail_path.gml +++ b/scripts/node_VFX_trail_path/node_VFX_trail_path.gml @@ -98,6 +98,7 @@ function Node_VFX_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _trail_st = max(1, _vfx.trailLife - _life); var _trail_len = _trail_ed - _trail_st; + //if(_vfx.life_total > 0) print($"{_vfx.active} | {_vfx.seed} : {_vfx.trailLife}") if(_trail_len <= 0) continue; var _lngh = 0; diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 7ad61c7a5..01fa5c179 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -367,6 +367,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru static onDestroy = function() { #region if(is_undefined(inParent)) return; ds_list_remove(group.inputs, inParent); + group.sortIO(); } #endregion static ungroup = function() { #region diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index eea40e82a..d8505668d 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -122,7 +122,8 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr static onDestroy = function() { #region if(is_undefined(outParent)) return; - ds_list_delete(group.outputs, ds_list_find_index(group.outputs, outParent)); + ds_list_remove(group.outputs, outParent); + group.sortIO(); } #endregion static ungroup = function() { #region @@ -139,7 +140,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr static onLoadGroup = function() { #region if(group == noone) nodeDelete(self); } #endregion - + //static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region // var bbox = drawGetBbox(xx, yy, _s); // draw_set_text(f_h5, fa_center, fa_center, c_white); diff --git a/scripts/node_line/node_line.gml b/scripts/node_line/node_line.gml index 0a2c8a138..7d3bfe74f 100644 --- a/scripts/node_line/node_line.gml +++ b/scripts/node_line/node_line.gml @@ -77,6 +77,8 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons lines = []; + widthMap = ds_map_create(); + attribute_surface_depth(); attribute_interpolation(); @@ -122,39 +124,42 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { - var _dim = _data[0]; - var _bg = _data[1]; - var _seg = _data[2]; - var _wid = _data[3]; - var _wig = _data[4]; - var _sed = _data[5]; - var _ang = _data[6] % 360; - var _pat = _data[7]; - var _ratio = _data[8]; - var _shift = _data[9]; + #region data + var _dim = _data[0]; + var _bg = _data[1]; + var _seg = _data[2]; + var _wid = _data[3]; + var _wig = _data[4]; + var _sed = _data[5]; + var _ang = _data[6] % 360; + var _pat = _data[7]; + var _ratio = _data[8]; + var _shift = _data[9]; - var _color = _data[10]; - var _widc = _data[11]; - var _widap = _data[12]; + var _color = _data[10]; + var _widc = _data[11]; + var _widap = _data[12]; - var _cap = _data[13]; - var _capP = _data[14]; - var _colP = _data[15]; - var _colW = _data[16]; - var _1px = _data[17]; + var _cap = _data[13]; + var _capP = _data[14]; + var _colP = _data[15]; + var _colW = _data[16]; + var _1px = _data[17]; - var _fixL = _data[19]; - var _segL = _data[20]; + var _fixL = _data[19]; + var _segL = _data[20]; - var _tex = _data[18]; - var _texPos = _data[21]; - var _texRot = _data[22]; - var _texSca = _data[23]; + var _tex = _data[18]; + var _texPos = _data[21]; + var _texRot = _data[22]; + var _texSca = _data[23]; - var _colb = _data[24]; - - inputs[| 14].setVisible(_cap); + var _colb = _data[24]; + #endregion + if(CURRENT_FRAME == 0 || inputs[| 11].is_anim) + ds_map_clear(widthMap); + var _rangeMin = min(_ratio[0], _ratio[1]); var _rangeMax = max(_ratio[0], _ratio[1]); if(_rangeMax == 1) _rangeMax = 0.99999; @@ -334,6 +339,10 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons lines = [ points ]; } #endregion + #region draw + + //print($"==== Drawing frame {CURRENT_FRAME} ====") + surface_set_target(_outSurf); if(_bg) draw_clear_alpha(0, 1); else DRAW_CLEAR @@ -347,14 +356,15 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons shader_set_f("scale", _texSca); shader_set_interpolation(_tex); - draw_primitive_begin_texture(pr_trianglestrip, tex); } - for( var i = 0, n = array_length(lines); i < n; i++ ) { var points = lines[i]; if(array_length(points) < 2) continue; + if(_useTex) draw_primitive_begin_texture(pr_trianglestrip, tex); + else draw_primitive_begin(pr_trianglestrip); + random_set_seed(_sed + i); var pxs = []; var dat = array_safe_get(_pathData, i, noone); @@ -369,12 +379,16 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var prgc = p0.progCrop; if(_1px) { - _nx = _nx - 0.5; + _nx = _nx - 0.5; _ny = _ny - 0.5; } - _nw = random_range(_wid[0], _wid[1]); - _nw *= eval_curve_x(_widc, _widap? prog : prgc); + var widProg = value_snap_real(_widap? prog : prgc, 0.01); + + _nw = random_range(_wid[0], _wid[1]); + if(!ds_map_exists(widthMap, widProg)) + widthMap[? widProg] = eval_curve_x(_widc, widProg, 0.1); + _nw *= widthMap[? widProg]; _nw *= p0.weight; _nc = colorMultiply(_col_base, _color.eval(_colP? prog : prgc)); @@ -443,8 +457,10 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons draw_vertex_texture_color(ox1, oy1, 1, (j - 1) / _len, _oc, 1); draw_vertex_texture_color(nx0, ny0, 0, (j - 0) / _len, _nc, 1); draw_vertex_texture_color(nx1, ny1, 1, (j - 0) / _len, _nc, 1); - } else - draw_line_width2_angle(_ox, _oy, _nx, _ny, _ow, _nw, _od + 90, _nd + 90, _oc, _nc, _colW); + } else if(_colW) + draw_line_width2_angle_width(_ox, _oy, _nx, _ny, _ow, _nw, _od + 90, _nd + 90, merge_color(_oc, c_black, 0.5), merge_color(_nc, c_black, 0.5)); + else + draw_line_width2_angle(_ox, _oy, _nx, _ny, _ow, _nw, _od + 90, _nd + 90, _oc, _nc); } else { var p1 = points[j + 1]; _nd = point_direction(_nx, _ny, p1.x, p1.y); @@ -458,12 +474,12 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons } } - if(_useTex) { - draw_primitive_end(); - shader_reset(); - } + draw_primitive_end(); } + + if(_useTex) shader_reset(); surface_reset_target(); + #endregion return _outSurf; } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 11662147c..4d8963cd2 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -425,20 +425,20 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio ///**/ addNodeObject(d3d, "3D Instancer", s_node_3d_set_material, "Node_3D_Instancer", [1, Node_3D_Instancer]).setVersion(11560); ///**/ addNodeObject(d3d, "3D Particle", s_node_3d_set_material, "Node_3D_Particle", [1, Node_3D_Particle]).setVersion(11560); - ds_list_add(d3d, "Legacy"); ////////////////////////////////////////////////////////////////////////////////////////////////////////////// - addNodeObject(d3d, "3D Plane", s_node_3d_plane, "__Node_3D_Plane", [1, __Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated(); - addNodeObject(d3d, "3D Cube", s_node_3d_cube, "__Node_3D_Cube", [1, __Node_3D_Cube]).isDeprecated(); - addNodeObject(d3d, "3D Cylinder", s_node_3d_cylinder, "__Node_3D_Cylinder", [1, __Node_3D_Cylinder]).isDeprecated(); - addNodeObject(d3d, "3D Sphere", s_node_3d_sphere, "__Node_3D_Sphere", [1, __Node_3D_Sphere]).setVersion(1090).isDeprecated(); - addNodeObject(d3d, "3D Cone", s_node_3d_cone, "__Node_3D_Cone", [1, __Node_3D_Cone]).setVersion(1090).isDeprecated(); - addNodeObject(d3d, "3D Extrude", s_node_3d_extrude, "__Node_3D_Extrude", [1, __Node_3D_Extrude],, "Extrude 2D image into 3D object.").isDeprecated(); + //ds_list_add(d3d, "Legacy"); ////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //addNodeObject(d3d, "3D Plane", s_node_3d_plane, "__Node_3D_Plane", [1, __Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated(); + //addNodeObject(d3d, "3D Cube", s_node_3d_cube, "__Node_3D_Cube", [1, __Node_3D_Cube]).isDeprecated(); + //addNodeObject(d3d, "3D Cylinder", s_node_3d_cylinder, "__Node_3D_Cylinder", [1, __Node_3D_Cylinder]).isDeprecated(); + //addNodeObject(d3d, "3D Sphere", s_node_3d_sphere, "__Node_3D_Sphere", [1, __Node_3D_Sphere]).setVersion(1090).isDeprecated(); + //addNodeObject(d3d, "3D Cone", s_node_3d_cone, "__Node_3D_Cone", [1, __Node_3D_Cone]).setVersion(1090).isDeprecated(); + //addNodeObject(d3d, "3D Extrude", s_node_3d_extrude, "__Node_3D_Extrude", [1, __Node_3D_Extrude],, "Extrude 2D image into 3D object.").isDeprecated(); - addNodeObject(d3d, "3D Transform", s_node_3d_transform, "__Node_3D_Transform", [1, __Node_3D_Transform]).setVersion(1080).isDeprecated(); - addNodeObject(d3d, "3D Combine", s_node_3d_obj_combine, "__Node_3D_Combine", [1, __Node_3D_Combine],, "Combine multiple 3D object to a single scene,").setVersion(1080).isDeprecated(); - addNodeObject(d3d, "3D Repeat", s_node_3d_array, "__Node_3D_Repeat", [1, __Node_3D_Repeat], ["3d array"], "Repeat 3D object multiple times.").setVersion(1080).isDeprecated(); - addNodeObject(d3d, "3D Displace", s_node_3d_displace, "__Node_3D_Displace", [1, __Node_3D_Displace]).setVersion(1143).isDeprecated(); + //addNodeObject(d3d, "3D Transform", s_node_3d_transform, "__Node_3D_Transform", [1, __Node_3D_Transform]).setVersion(1080).isDeprecated(); + //addNodeObject(d3d, "3D Combine", s_node_3d_obj_combine, "__Node_3D_Combine", [1, __Node_3D_Combine],, "Combine multiple 3D object to a single scene,").setVersion(1080).isDeprecated(); + //addNodeObject(d3d, "3D Repeat", s_node_3d_array, "__Node_3D_Repeat", [1, __Node_3D_Repeat], ["3d array"], "Repeat 3D object multiple times.").setVersion(1080).isDeprecated(); + //addNodeObject(d3d, "3D Displace", s_node_3d_displace, "__Node_3D_Displace", [1, __Node_3D_Displace]).setVersion(1143).isDeprecated(); - addNodeObject(d3d, "3D Export", s_node_3d_export, "__Node_3D_Export", [1, __Node_3D_Export]).setVersion(1143).isDeprecated(); + //addNodeObject(d3d, "3D Export", s_node_3d_export, "__Node_3D_Export", [1, __Node_3D_Export]).setVersion(1143).isDeprecated(); #endregion var generator = ds_list_create(); #region diff --git a/scripts/node_sprite_stack/node_sprite_stack.gml b/scripts/node_sprite_stack/node_sprite_stack.gml index b63c6d28d..19d91e358 100644 --- a/scripts/node_sprite_stack/node_sprite_stack.gml +++ b/scripts/node_sprite_stack/node_sprite_stack.gml @@ -127,7 +127,7 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var _surf = getInputData(0); var _arry = getInputData(12); - inputs[| 2].setVisible(_arry && is_array(_surf)); + inputs[| 2].setVisible(_arry == 0 || !is_array(_surf)); inputs[| 10].setVisible(_high); inputs[| 11].setVisible(_high); diff --git a/scripts/node_stripe/node_stripe.gml b/scripts/node_stripe/node_stripe.gml index 9c5735d36..9b3eeb04f 100644 --- a/scripts/node_stripe/node_stripe.gml +++ b/scripts/node_stripe/node_stripe.gml @@ -1,23 +1,6 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Stripe"; - shader = sh_stripe; - uniform_grad_use = shader_get_uniform(shader, "gradient_use"); - uniform_grad_blend = shader_get_uniform(shader, "gradient_blend"); - uniform_grad = shader_get_uniform(shader, "gradient_color"); - uniform_grad_time = shader_get_uniform(shader, "gradient_time"); - uniform_grad_key = shader_get_uniform(shader, "gradient_keys"); - - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_pos = shader_get_uniform(shader, "position"); - uniform_angle = shader_get_uniform(shader, "angle"); - uniform_amount = shader_get_uniform(shader, "amount"); - uniform_blend = shader_get_uniform(shader, "blend"); - uniform_rand = shader_get_uniform(shader, "rand"); - - uniform_clr0 = shader_get_uniform(shader, "color0"); - uniform_clr1 = shader_get_uniform(shader, "color1"); - inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF ) .setDisplay(VALUE_DISPLAY.vector); @@ -44,26 +27,29 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 9] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 10] = nodeValue("Strip ratio", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + .setDisplay(VALUE_DISPLAY.slider); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", true], 0, - ["Pattern", false], 1, 2, 4, 5, + ["Pattern", false], 1, 10, 2, 4, 5, ["Render", false], 6, 7, 8, 9, 3 ]; attribute_surface_depth(); - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var pos = getInputData(4); var px = _x + pos[0] * _s; var py = _y + pos[1] * _s; inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny); - } + } #endregion - static processData = function(_outSurf, _data, _output_index, _array_index) { + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _dim = _data[0]; var _amo = _data[1]; var _ang = _data[2]; @@ -71,8 +57,9 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var _pos = _data[4]; var _rnd = _data[5]; - var _clr0 = _data[8]; - var _clr1 = _data[9]; + var _clr0 = _data[ 8]; + var _clr1 = _data[ 9]; + var _rat = _data[10]; var _grad_use = _data[6]; inputs[| 7].setVisible(_grad_use); @@ -87,28 +74,27 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); - surface_set_target(_outSurf); - shader_set(shader); - shader_set_uniform_f(uniform_dim, _dim[0], _dim[1]); - shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); - shader_set_uniform_f(uniform_angle, degtorad(_ang)); - shader_set_uniform_f(uniform_amount, _amo); - shader_set_uniform_f(uniform_blend, _bnd); - shader_set_uniform_f(uniform_rand, _rnd); + surface_set_shader(_outSurf, sh_stripe); + shader_set_f("dimension", _dim[0], _dim[1]); + shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]); + shader_set_f("angle", degtorad(_ang)); + shader_set_f("amount", _amo); + shader_set_f("blend", _bnd); + shader_set_f("randomAmount", _rnd); + shader_set_f("ratio", _rat); - shader_set_uniform_f_array_safe(uniform_clr0, colToVec4(_clr0)); - shader_set_uniform_f_array_safe(uniform_clr1, colToVec4(_clr1)); + shader_set_f("color0", colToVec4(_clr0)); + shader_set_f("color1", colToVec4(_clr1)); - shader_set_uniform_i(uniform_grad_use, _grad_use); - shader_set_uniform_i(uniform_grad_blend, _gra.type); - shader_set_uniform_f_array_safe(uniform_grad, _grad_color); - shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time); - shader_set_uniform_i(uniform_grad_key, array_length(_gra.keys)); + shader_set_i("gradient_use", _grad_use); + shader_set_i("gradient_blend", _gra.type); + shader_set_f("gradient_color", _grad_color); + shader_set_f("gradient_time", _grad_time); + shader_set_i("gradient_keys", array_length(_gra.keys)); - draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); - shader_reset(); - surface_reset_target(); + draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); + surface_reset_shader(); return _outSurf; - } + } #endregion } \ No newline at end of file diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 3c96a2fc6..70e3ee527 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -409,8 +409,8 @@ function Panel_Collection() : PanelContent() constructor { rootx = _x; - var bx = w - ui(44); - var by = ui(12); + var bx = w - ui(40); + var by = ui(9); var bs = ui(32); if(search_string == "") { diff --git a/scripts/panel_palette/panel_palette.gml b/scripts/panel_palette/panel_palette.gml index 38f32bce0..a3b5e6809 100644 --- a/scripts/panel_palette/panel_palette.gml +++ b/scripts/panel_palette/panel_palette.gml @@ -99,7 +99,7 @@ function Panel_Palette() : PanelContent() constructor { var by = title_height / 2 - ui(16 + !in_dialog * 2); if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Refresh"), THEME.refresh, 1, COLORS._main_icon) == 2) - presetCollect(); + __initPalette(); bx -= ui(32) if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("palette_change_preview_size", "Change preview size"), THEME.icon_visibility, 1, COLORS._main_icon) == 2) diff --git a/scripts/shell_functions/shell_functions.gml b/scripts/shell_functions/shell_functions.gml index 26b1a925f..6edd338d8 100644 --- a/scripts/shell_functions/shell_functions.gml +++ b/scripts/shell_functions/shell_functions.gml @@ -8,12 +8,12 @@ function shell_execute(path, command, ref = noone) { gml_pragma("forceinline"); var txt = $"{path} {command}"; - noti_status(txt, THEME.noti_icon_console,, ref); + if(global.PROC_ID == 0) noti_status(txt, THEME.noti_icon_console,, ref); try { var res = execute_shell(path, command); - noti_status("Execute shell complete", THEME.noti_icon_console,, ref); + if(global.PROC_ID == 0) noti_status("Execute shell complete", THEME.noti_icon_console,, ref); } catch(e) { - noti_warning($"Execute shell failed: {e}", THEME.noti_icon_console_failed, COLORS._main_value_negative, ref); + if(global.PROC_ID == 0) noti_warning($"Execute shell failed: {e}", THEME.noti_icon_console_failed, COLORS._main_value_negative, ref); } } \ No newline at end of file diff --git a/scripts/value_snap/value_snap.gml b/scripts/value_snap/value_snap.gml index 043cec9cb..06217fdeb 100644 --- a/scripts/value_snap/value_snap.gml +++ b/scripts/value_snap/value_snap.gml @@ -1,13 +1,16 @@ +function value_snap_real(val, snap = 1) { + gml_pragma("forceinline") + return snap == 0? val : round(val / snap) * snap; +} + function value_snap(val, snap = 1) { gml_pragma("forceinline") - if(!is_array(val)) { - if(snap == 0) return val; - return round(val / snap) * snap; - } + if(!is_array(val)) + return value_snap_real(val, snap); var _val = []; for( var i = 0, n = array_length(val); i < n; i++ ) - _val[i] = snap == 0? val[i] : round(val[i] / snap) * snap; + _val[i] = value_snap(val[i], snap); return _val; } \ No newline at end of file diff --git a/shaders/sh_stripe/sh_stripe.fsh b/shaders/sh_stripe/sh_stripe.fsh index 069603ad4..ad4b52533 100644 --- a/shaders/sh_stripe/sh_stripe.fsh +++ b/shaders/sh_stripe/sh_stripe.fsh @@ -4,29 +4,28 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; -#define GRADIENT_LIMIT 128 - -uniform int gradient_use; -uniform int gradient_blend; -uniform vec4 gradient_color[GRADIENT_LIMIT]; -uniform float gradient_time[GRADIENT_LIMIT]; -uniform int gradient_keys; - -uniform vec4 color0; -uniform vec4 color1; - -uniform vec2 dimension; -uniform vec2 position; -uniform float angle; -uniform float amount; -uniform float rand; -uniform int blend; - #define PI 3.14159265359 -float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); } +uniform vec2 dimension; +uniform vec2 position; +uniform float angle; +uniform float amount; +uniform float ratio; +uniform float randomAmount; +uniform int blend; -vec3 rgb2hsv(vec3 c) { +#define GRADIENT_LIMIT 128 + +uniform int gradient_use; +uniform int gradient_blend; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; +uniform int gradient_keys; + +uniform vec4 color0; +uniform vec4 color1; + +vec3 rgb2hsv(vec3 c) { #region vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); @@ -34,21 +33,21 @@ vec3 rgb2hsv(vec3 c) { float d = q.x - min(q.w, q.y); float e = 0.0000000001; return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); - } +} #endregion -vec3 hsv2rgb(vec3 c) { +vec3 hsv2rgb(vec3 c) { #region vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} +} #endregion -float hueDist(float a0, float a1, float t) { +float hueDist(float a0, float a1, float t) { #region float da = fract(a1 - a0); float ds = fract(2. * da) - da; return a0 + ds * t; -} +} #endregion -vec3 hsvMix(vec3 c1, vec3 c2, float t) { +vec3 hsvMix(vec3 c1, vec3 c2, float t) { #region vec3 h1 = rgb2hsv(c1); vec3 h2 = rgb2hsv(c2); @@ -58,9 +57,9 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { h.z = mix(h1.z, h2.z, t); return hsv2rgb(h); -} +} #endregion -vec4 gradientEval(in float prog) { +vec4 gradientEval(in float prog) { #region vec4 col = vec4(0.); for(int i = 0; i < GRADIENT_LIMIT; i++) { @@ -88,28 +87,26 @@ vec4 gradientEval(in float prog) { } return col; -} +} #endregion -void main() { - vec2 pos = v_vTexcoord - position; - float ratio = dimension.x / dimension.y; - float prog = pos.x * ratio * cos(angle) - pos.y * sin(angle); - float _a = 1. / amount; +float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); } + +void main() { #region + vec2 pos = v_vTexcoord - position; + float aspect = dimension.x / dimension.y; + float prog = pos.x * aspect * cos(angle) - pos.y * sin(angle); + float _a = 1. / amount; - float slot = floor(prog / _a); - float ground = (slot + (random(vec2(slot + 0.)) * 2. - 1.) * rand * 0.5 + 0.) * _a; - float ceiling = (slot + (random(vec2(slot + 1.)) * 2. - 1.) * rand * 0.5 + 1.) * _a; - float _s = (prog - ground) / (ceiling - ground); + float slot = floor(prog / _a); + float ground = (slot + (random(vec2(slot + 0.)) * 2. - 1.) * randomAmount * 0.5 + 0.) * _a; + float ceiling = (slot + (random(vec2(slot + 1.)) * 2. - 1.) * randomAmount * 0.5 + 1.) * _a; + float _s = (prog - ground) / (ceiling - ground); if(gradient_use == 0) { - if(blend == 0) { - gl_FragColor = _s > .5? color0 : color1; - } else - gl_FragColor = vec4(vec3(sin(_s * 2. * PI) * 0.5 + 0.5), 1.); + if(blend == 0) gl_FragColor = _s > ratio? color0 : color1; + else gl_FragColor = vec4(vec3(sin(_s * 2. * PI) * 0.5 + 0.5), 1.); } else { - if(_s > .5) - gl_FragColor = vec4(gradientEval(random(vec2(slot))).rgb, 1.); - else - gl_FragColor = vec4(gradientEval(random(vec2(slot + 1.))).rgb, 1.); + if(_s > ratio) gl_FragColor = vec4(gradientEval(random(vec2(slot))).rgb, 1.); + else gl_FragColor = vec4(gradientEval(random(vec2(slot + 1.))).rgb, 1.); } -} +} #endregion