From aa898c7fc4d345f57a37af9ffebf89453306e4b3 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Thu, 28 Mar 2024 14:33:28 +0700 Subject: [PATCH] Strip --- PixelComposer.resource_order | 4 + PixelComposer.yyp | 5 + fonts/_f_sdf/_f_sdf.old.png | Bin 82361 -> 82361 bytes fonts/_f_sdf/_f_sdf.png | Bin 82361 -> 82361 bytes fonts/_f_sdf_medium/_f_sdf_medium.old.png | Bin 59906 -> 59906 bytes fonts/_f_sdf_medium/_f_sdf_medium.png | Bin 59906 -> 59906 bytes scripts/areaBox/areaBox.gml | 2 +- .../draw_sprite_ext_override.gml | 28 ++++ scripts/node_stripe/node_stripe.gml | 33 +++- scripts/node_value/node_value.gml | 6 +- scripts/panel_preview/panel_preview.gml | 72 ++++---- .../preview_overlay_area.gml | 155 +++++++++++------- .../preview_overlay_gradient_range.gml | 25 +-- .../preview_overlay_puppet.gml | 2 + .../preview_overlay_rotation.gml | 48 ++++-- .../preview_overlay_scalar.gml | 16 +- .../preview_overlay_vector.gml | 22 ++- .../sh_node_widget_rotator.fsh | 34 ++++ .../sh_node_widget_rotator.vsh | 19 +++ .../sh_node_widget_rotator.yy | 10 ++ .../sh_node_widget_scalar.fsh | 24 +++ .../sh_node_widget_scalar.vsh | 19 +++ .../sh_node_widget_scalar.yy | 10 ++ .../sh_node_widget_scalar_cross.fsh | 38 +++++ .../sh_node_widget_scalar_cross.vsh | 19 +++ .../sh_node_widget_scalar_cross.yy | 10 ++ .../sh_node_widget_scalar_line.fsh | 38 +++++ .../sh_node_widget_scalar_line.vsh | 19 +++ .../sh_node_widget_scalar_line.yy | 10 ++ shaders/sh_stripe/sh_stripe.fsh | 32 +++- 30 files changed, 544 insertions(+), 156 deletions(-) create mode 100644 shaders/sh_node_widget_rotator/sh_node_widget_rotator.fsh create mode 100644 shaders/sh_node_widget_rotator/sh_node_widget_rotator.vsh create mode 100644 shaders/sh_node_widget_rotator/sh_node_widget_rotator.yy create mode 100644 shaders/sh_node_widget_scalar/sh_node_widget_scalar.fsh create mode 100644 shaders/sh_node_widget_scalar/sh_node_widget_scalar.vsh create mode 100644 shaders/sh_node_widget_scalar/sh_node_widget_scalar.yy create mode 100644 shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.fsh create mode 100644 shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.vsh create mode 100644 shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.yy create mode 100644 shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.fsh create mode 100644 shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.vsh create mode 100644 shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 1f28a8845..4292bbda2 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -273,6 +273,7 @@ {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, {"name":"button","order":8,"path":"folders/widgets/button.yy",}, + {"name":"node","order":14,"path":"folders/widgets/node.yy",}, {"name":"rotator","order":9,"path":"folders/widgets/rotator.yy",}, {"name":"sliders","order":12,"path":"folders/widgets/sliders.yy",}, {"name":"text","order":10,"path":"folders/widgets/text.yy",}, @@ -980,6 +981,7 @@ {"name":"pcx_parse","order":3,"path":"scripts/pcx_parse/pcx_parse.yy",}, {"name":"node_9slice","order":5,"path":"scripts/node_9slice/node_9slice.yy",}, {"name":"fd_rectangle_add_velocity_surface","order":24,"path":"scripts/fd_rectangle_add_velocity_surface/fd_rectangle_add_velocity_surface.yy",}, + {"name":"sh_node_widget_scalar_line","order":3,"path":"shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.yy",}, {"name":"s_node_gamma_map","order":60,"path":"sprites/s_node_gamma_map/s_node_gamma_map.yy",}, {"name":"s_node_midi","order":24,"path":"sprites/s_node_midi/s_node_midi.yy",}, {"name":"sh_find_boundary_stretch_y","order":2,"path":"shaders/sh_find_boundary_stretch_y/sh_find_boundary_stretch_y.yy",}, @@ -1458,6 +1460,7 @@ {"name":"steam_ugc_project","order":1,"path":"scripts/steam_ugc_project/steam_ugc_project.yy",}, {"name":"sh_fd_visualize_pixel_art_fire_glsl","order":15,"path":"shaders/sh_fd_visualize_pixel_art_fire_glsl/sh_fd_visualize_pixel_art_fire_glsl.yy",}, {"name":"struct_functions","order":4,"path":"scripts/struct_functions/struct_functions.yy",}, + {"name":"sh_node_widget_rotator","order":1,"path":"shaders/sh_node_widget_rotator/sh_node_widget_rotator.yy",}, {"name":"sh_content_sampler","order":1,"path":"shaders/sh_content_sampler/sh_content_sampler.yy",}, {"name":"s_node_trigger","order":3,"path":"sprites/s_node_trigger/s_node_trigger.yy",}, {"name":"s_node_mk_delay_machine","order":12,"path":"sprites/s_node_mk_delay_machine/s_node_mk_delay_machine.yy",}, @@ -1688,6 +1691,7 @@ {"name":"node_path_trim","order":6,"path":"scripts/node_path_trim/node_path_trim.yy",}, {"name":"s_node_rigidSim_deactivate","order":7,"path":"sprites/s_node_rigidSim_deactivate/s_node_rigidSim_deactivate.yy",}, {"name":"sh_blend_contrast","order":16,"path":"shaders/sh_blend_contrast/sh_blend_contrast.yy",}, + {"name":"sh_node_widget_scalar_cross","order":2,"path":"shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.yy",}, {"name":"__node_3d_prim_cube","order":1,"path":"scripts/__node_3d_prim_cube/__node_3d_prim_cube.yy",}, {"name":"node_surface_from_buffer","order":2,"path":"scripts/node_surface_from_buffer/node_surface_from_buffer.yy",}, {"name":"Obj_FirebaseFirestore_Collection_Listener","order":1,"path":"objects/Obj_FirebaseFirestore_Collection_Listener/Obj_FirebaseFirestore_Collection_Listener.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 4a8e24ab1..566ebbe18 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -309,6 +309,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"button","folderPath":"folders/widgets/button.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"node","folderPath":"folders/widgets/node.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"rotator","folderPath":"folders/widgets/rotator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"sliders","folderPath":"folders/widgets/sliders.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/widgets/text.yy",}, @@ -613,6 +614,7 @@ {"id":{"name":"s_node_3d_affector_shape","path":"sprites/s_node_3d_affector_shape/s_node_3d_affector_shape.yy",},}, {"id":{"name":"s_node_polar","path":"sprites/s_node_polar/s_node_polar.yy",},}, {"id":{"name":"complex_function","path":"scripts/complex_function/complex_function.yy",},}, + {"id":{"name":"sh_node_widget_scalar","path":"shaders/sh_node_widget_scalar/sh_node_widget_scalar.yy",},}, {"id":{"name":"draw_set_blend_mode_ext","path":"scripts/draw_set_blend_mode_ext/draw_set_blend_mode_ext.yy",},}, {"id":{"name":"s_node_shape_misc","path":"sprites/s_node_shape_misc/s_node_shape_misc.yy",},}, {"id":{"name":"s_flare_type","path":"sprites/s_flare_type/s_flare_type.yy",},}, @@ -1265,6 +1267,7 @@ {"id":{"name":"pcx_parse","path":"scripts/pcx_parse/pcx_parse.yy",},}, {"id":{"name":"node_9slice","path":"scripts/node_9slice/node_9slice.yy",},}, {"id":{"name":"fd_rectangle_add_velocity_surface","path":"scripts/fd_rectangle_add_velocity_surface/fd_rectangle_add_velocity_surface.yy",},}, + {"id":{"name":"sh_node_widget_scalar_line","path":"shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.yy",},}, {"id":{"name":"s_node_gamma_map","path":"sprites/s_node_gamma_map/s_node_gamma_map.yy",},}, {"id":{"name":"s_node_midi","path":"sprites/s_node_midi/s_node_midi.yy",},}, {"id":{"name":"sh_find_boundary_stretch_y","path":"shaders/sh_find_boundary_stretch_y/sh_find_boundary_stretch_y.yy",},}, @@ -1805,6 +1808,7 @@ {"id":{"name":"steam_ugc_project","path":"scripts/steam_ugc_project/steam_ugc_project.yy",},}, {"id":{"name":"sh_fd_visualize_pixel_art_fire_glsl","path":"shaders/sh_fd_visualize_pixel_art_fire_glsl/sh_fd_visualize_pixel_art_fire_glsl.yy",},}, {"id":{"name":"struct_functions","path":"scripts/struct_functions/struct_functions.yy",},}, + {"id":{"name":"sh_node_widget_rotator","path":"shaders/sh_node_widget_rotator/sh_node_widget_rotator.yy",},}, {"id":{"name":"sh_content_sampler","path":"shaders/sh_content_sampler/sh_content_sampler.yy",},}, {"id":{"name":"s_node_trigger","path":"sprites/s_node_trigger/s_node_trigger.yy",},}, {"id":{"name":"s_node_mk_delay_machine","path":"sprites/s_node_mk_delay_machine/s_node_mk_delay_machine.yy",},}, @@ -2070,6 +2074,7 @@ {"id":{"name":"node_path_trim","path":"scripts/node_path_trim/node_path_trim.yy",},}, {"id":{"name":"s_node_rigidSim_deactivate","path":"sprites/s_node_rigidSim_deactivate/s_node_rigidSim_deactivate.yy",},}, {"id":{"name":"sh_blend_contrast","path":"shaders/sh_blend_contrast/sh_blend_contrast.yy",},}, + {"id":{"name":"sh_node_widget_scalar_cross","path":"shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.yy",},}, {"id":{"name":"__node_3d_prim_cube","path":"scripts/__node_3d_prim_cube/__node_3d_prim_cube.yy",},}, {"id":{"name":"node_surface_from_buffer","path":"scripts/node_surface_from_buffer/node_surface_from_buffer.yy",},}, {"id":{"name":"Obj_FirebaseFirestore_Collection_Listener","path":"objects/Obj_FirebaseFirestore_Collection_Listener/Obj_FirebaseFirestore_Collection_Listener.yy",},}, diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index e182668ae95ac7039cc173bc781648b180f7766f..7585a8eeecfc87efb5a2481c41eb05e5aa185a79 100644 GIT binary patch delta 96 zcmdnl%(}CgwP6dRiKB=`h=HM%p{139xwe6Um4QLwyZlSjJscTjF=QAvU(cIf>By*{ WfUYNe*|&`hK;Y@>=d#Wzp$Py#e;Zf; delta 96 zcmdnl%(}CgwP6dRiKB>lh@pX%v89!PskVWEm4QJ)-i*)FJscTjF=QBx75t}HIx;FK Vpz8@!W1PSM1fH&bF6*2UngHX%7%~6= diff --git a/fonts/_f_sdf/_f_sdf.png b/fonts/_f_sdf/_f_sdf.png index d9199c9d1c840b26fadef14f0c1d35cfaac145c7..f91c772b94f18c5add4e3624e0a97ab36c5f59e7 100644 GIT binary patch delta 96 zcmdnl%(}CgwP6dRiKB=`h=GZfiGh`=iMD}(m4U&GZvPF_JscTjF=Sp|`_41H(veX? W0bS3&!`Ch|0D-5gpUXO@geCw;nH(no delta 96 zcmdnl%(}CgwP6dRiKB>lh@p{{iJ6t5fwqBxm4QLn1fTxt9*&H%7&7W-zZg%ibYxUe WK-W`n5sMH5Ln}i|D+6h|Mu}@g vNlIc#s#Qs5ZfbE!Vr~J0k%5tku7R5%Um311n=oD+5z)0|P4qgMz#npC?azDI0<=!Dy`D&%nT-QQ{g= ul9E`GYE_b%n_66wm|MVLWME{XYhbKvgsvw{jd21{4}+(xpUXO@geCxqBq4YJ diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.png b/fonts/_f_sdf_medium/_f_sdf_medium.png index 1c4e01336fafa79640ee325c08fab80f2553e864..9d68de87eacc5d5dd6bf0641a6a7cd7d9ebe52da 100644 GIT binary patch delta 119 zcmZp=!rXL)c|+|>5sMH56Dtz~D^pW#0|P4q1G_&iER!d`lnp_b@L%|62Ll6xMu}@g vNlIc#s#Qs5ZfbE!Vr~J0k%5tku7R5%Um3BP$a#D?jH?_DVF}Hxh$iT=%*T7iU2whLXjjL~fdKf%i{an^LB{Ts5$pR!e diff --git a/scripts/areaBox/areaBox.gml b/scripts/areaBox/areaBox.gml index 02e8a23a8..7811dba9d 100644 --- a/scripts/areaBox/areaBox.gml +++ b/scripts/areaBox/areaBox.gml @@ -329,7 +329,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { tb[3].draw(tb_x1, tb_y1, tb_w, tb_h, array_safe_get(_data, 3), _m); #endregion } - + //if(unit != noone && unit.reference != noone) { // unit.triggerButton.setFocusHover(active, hover); // unit.draw(_x + ui(56 + 48 + 8), _y - ui(28), ui(32), ui(32), _m); 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 2d275c338..3c32bed39 100644 --- a/scripts/draw_sprite_ext_override/draw_sprite_ext_override.gml +++ b/scripts/draw_sprite_ext_override/draw_sprite_ext_override.gml @@ -78,4 +78,32 @@ function draw_sprite_colored(spr, ind, _x, _y, scale = 1, rot = 0, color = COLOR 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) { #region + shader_set(sh_node_widget_scalar); + shader_set_color("color", COLORS._main_accent); + shader_set_f("index", _index); + + 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) { #region + shader_set(sh_node_widget_scalar_cross); + shader_set_color("color", COLORS._main_accent); + shader_set_f("index", _index); + + 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) { #region + shader_set(sh_node_widget_scalar_line); + shader_set_color("color", COLORS._main_accent); + shader_set_f("index", _index); + shader_set_f("angle", degtorad(_a)); + + draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2); + shader_reset(); } #endregion \ No newline at end of file diff --git a/scripts/node_stripe/node_stripe.gml b/scripts/node_stripe/node_stripe.gml index f09f3b247..66f406980 100644 --- a/scripts/node_stripe/node_stripe.gml +++ b/scripts/node_stripe/node_stripe.gml @@ -23,7 +23,8 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co .setDisplay(VALUE_DISPLAY.slider) .setMappable(13); - inputs[| 6] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 6] = nodeValue("Coloring", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Alternate", "Palette", "Random" ]); inputs[| 7] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) ) .setMappable(15); @@ -52,13 +53,18 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co ////////////////////////////////////////////////////////////////////////////////////////////////// + inputs[| 17] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + .setDisplay(VALUE_DISPLAY.slider); + + inputs[| 18] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black, c_white ] ) + .setDisplay(VALUE_DISPLAY.palette); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", true], 0, - ["Pattern", false], 1, 11, 10, 14, 2, 12, 4, 5, 13, - ["Render", false], 3, - ["Random Colors", false, 6], 7, 15, 8, 9, + ["Pattern", false], 1, 11, 10, 14, 2, 12, 4, 5, 13, 17, + ["Render", false], 3, 6, 7, 15, 8, 9, 18, ]; attribute_surface_depth(); @@ -74,11 +80,18 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co } #endregion static step = function() { #region + var _clr = getSingleValue(6); + inputs[| 1].mappableStep(); inputs[| 2].mappableStep(); inputs[| 5].mappableStep(); inputs[| 7].mappableStep(); inputs[| 10].mappableStep(); + + inputs[| 8].setVisible(_clr == 0); + inputs[| 9].setVisible(_clr == 0); + inputs[| 18].setVisible(_clr == 1); + inputs[| 7].setVisible(_clr == 2); } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { #region @@ -87,11 +100,10 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var _pos = _data[4]; var _clr0 = _data[8]; var _clr1 = _data[9]; + var _prg = _data[17]; + var _pal = _data[18]; - var _grad_use = _data[6]; - inputs[| 7].setVisible(_grad_use); - inputs[| 8].setVisible(!_grad_use); - inputs[| 9].setVisible(!_grad_use); + var _color = _data[6]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); @@ -99,16 +111,19 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co shader_set_f("dimension", _dim[0], _dim[1]); shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_i("blend", _bnd); + shader_set_f("progress", _prg); shader_set_f_map("amount", _data[ 1], _data[11], inputs[| 1]); shader_set_f_map("angle", _data[ 2], _data[12], inputs[| 2]); shader_set_f_map("randomAmount", _data[ 5], _data[13], inputs[| 5]); shader_set_f_map("ratio", _data[10], _data[14], inputs[| 10]); + shader_set_i("coloring", _color); + shader_set_color("color0", _clr0); shader_set_color("color1", _clr1); + shader_set_palette(_pal); - shader_set_i("gradient_use", _grad_use); shader_set_gradient(_data[7], _data[15], _data[16], inputs[| 7]); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 316a011dc..f648a47ad 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -1502,14 +1502,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var cy = (value[1] + hh - value[3]) / 2; var sw = abs((ww - value[0]) - value[2]) / 2; var sh = abs(value[1] - (hh - value[3])) / 2; - return [cx, cy, sw, sh, value[4]]; + + return [cx, cy, sw, sh, value[4], value[5]]; case AREA_MODE.two_point : var cx = (value[0] + value[2]) / 2 var cy = (value[1] + value[3]) / 2; var sw = abs(value[0] - value[2]) / 2; var sh = abs(value[1] - value[3]) / 2; - return [cx, cy, sw, sh, value[4]]; + + return [cx, cy, sw, sh, value[4], value[5]]; } } #endregion diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 895c68b69..d1d79fe91 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -1088,45 +1088,49 @@ function Panel_Preview() : PanelContent() constructor { #region surface array preview_x_max = 0; - var _xx = tool_side_drawing * ui(40); - var xx = _xx + preview_x + ui(8); - var yy = h - toolbar_height - prev_size - ui(8); - if(my > yy - 8) mouse_on_preview = 0; - var hoverable = pHOVER && point_in_rectangle(mx, my, _xx, ui(32), w, h - toolbar_height); - - for(var i = 0; i < array_length(pseq); i++) { - var prev = pseq[i]; - if(is_instanceof(prev, __d3dMaterial)) - prev = prev.surface; - if(!is_surface(prev)) continue; - - var prev_w = surface_get_width_safe(prev); - var prev_h = surface_get_height_safe(prev); - var ss = prev_size / max(prev_w, prev_h); - var prev_sw = prev_w * ss; - draw_set_color(COLORS.panel_preview_surface_outline); - draw_rectangle(xx, yy, xx + prev_w * ss, yy + prev_h * ss, true); + if(array_length(pseq) > 1) { + var _xx = tool_side_drawing * ui(40); + var xx = _xx + preview_x + ui(8); + var yy = h - toolbar_height - prev_size - ui(8); + + if(my > yy - 8) mouse_on_preview = 0; + var hoverable = pHOVER && point_in_rectangle(mx, my, _xx, ui(32), w, h - toolbar_height); + + for(var i = 0; i < array_length(pseq); i++) { + var prev = pseq[i]; + if(is_instanceof(prev, __d3dMaterial)) + prev = prev.surface; + if(!is_surface(prev)) continue; - if(hoverable && point_in_rectangle(mx, my, xx, yy, xx + prev_sw, yy + prev_h * ss)) { - if(mouse_press(mb_left, pFOCUS)) { - _node.preview_index = i; - _node.onValueUpdate(0); - if(resetViewOnDoubleClick) - do_fullView = true; + var prev_w = surface_get_width_safe(prev); + var prev_h = surface_get_height_safe(prev); + var ss = prev_size / max(prev_w, prev_h); + var prev_sw = prev_w * ss; + + draw_set_color(COLORS.panel_preview_surface_outline); + draw_rectangle(xx, yy, xx + prev_w * ss, yy + prev_h * ss, true); + + if(hoverable && point_in_rectangle(mx, my, xx, yy, xx + prev_sw, yy + prev_h * ss)) { + if(mouse_press(mb_left, pFOCUS)) { + _node.preview_index = i; + _node.onValueUpdate(0); + if(resetViewOnDoubleClick) + do_fullView = true; + } + draw_surface_ext_safe(prev, xx, yy, ss, ss, 0, c_white, 1); + } else { + draw_surface_ext_safe(prev, xx, yy, ss, ss, 0, c_white, 0.5); } - draw_surface_ext_safe(prev, xx, yy, ss, ss, 0, c_white, 1); - } else { - draw_surface_ext_safe(prev, xx, yy, ss, ss, 0, c_white, 0.5); - } - if(i == _node.preview_index) { - draw_set_color(COLORS._main_accent); - draw_rectangle(xx, yy, xx + prev_sw, yy + prev_h * ss, true); - } + if(i == _node.preview_index) { + draw_set_color(COLORS._main_accent); + draw_rectangle(xx, yy, xx + prev_sw, yy + prev_h * ss, true); + } - xx += prev_sw + ui(8); - preview_x_max += prev_sw + ui(8); + xx += prev_sw + ui(8); + preview_x_max += prev_sw + ui(8); + } } #endregion diff --git a/scripts/preview_overlay_area/preview_overlay_area.gml b/scripts/preview_overlay_area/preview_overlay_area.gml index eeb178eca..81949385f 100644 --- a/scripts/preview_overlay_area/preview_overlay_area.gml +++ b/scripts/preview_overlay_area/preview_overlay_area.gml @@ -45,13 +45,7 @@ function preview_overlay_area_padding(interact, active, _x, _y, _s, _mx, _my, _s if(!interact) return -1; - if(drawPos) draw_sprite_colored(THEME.anchor, 0, xc, yc); - if(drawSize) { - draw_sprite_colored(THEME.anchor_solid_hori, 0, xc, y0,, 0); - draw_sprite_colored(THEME.anchor_solid_hori, 0, xc, y1,, 0); - draw_sprite_colored(THEME.anchor_solid_hori, 0, x0, yc,, 90); - draw_sprite_colored(THEME.anchor_solid_hori, 0, x1, yc,, 90); - } + var _hov = [ 0, 0, 0, 0 ], _hovPos = 0; if(drag_type == 1) _r = value_snap(drag_sx - (_mx - drag_mx) / _s, _snx); else if(drag_type == 2) _t = value_snap(drag_sy + (_my - drag_my) / _s, _sny); @@ -59,7 +53,12 @@ function preview_overlay_area_padding(interact, active, _x, _y, _s, _mx, _my, _s else if(drag_type == 4) _b = value_snap(drag_sy - (_my - drag_my) / _s, _sny); if(drag_type) { - var _val = [ _r, _t, _l, _b, __at ]; + var _val = array_clone(showValue()); + if(drag_type == 1) _val[0] = _r; + else if(drag_type == 2) _val[1] = _t; + else if(drag_type == 3) _val[2] = _l; + else if(drag_type == 4) _val[3] = _b; + if(setValueInspector(_val)) UNDO_HOLDING = true; if(mouse_release(mb_left)) { @@ -68,46 +67,56 @@ function preview_overlay_area_padding(interact, active, _x, _y, _s, _mx, _my, _s } } - if(drawSize && active && point_in_circle(_mx, _my, xc, y0, 16)) { - draw_sprite_colored(THEME.anchor_solid_hori, 1, xc, y0); - hover = 1; + if(drawSize && point_in_circle(_mx, _my, xc, y0, 16)) { + _hov[0] = 1; + hover = 1; - if(mouse_press(mb_left)) { + if(mouse_press(mb_left, active)) { drag_type = 2; drag_sy = _t; drag_my = _my; } - } else if(drawSize && active && point_in_circle(_mx, _my, xc, y1, 16)) { - draw_sprite_colored(THEME.anchor_solid_hori, 1, xc, y1); + } else if(drawSize && point_in_circle(_mx, _my, xc, y1, 16)) { + _hov[1] = 1; hover = 3; - if(mouse_press(mb_left)) { + if(mouse_press(mb_left, active)) { drag_type = 4; drag_sy = _b; drag_my = _my; } - } else if(drawSize && active && point_in_circle(_mx, _my, x0, yc, 16)) { - draw_sprite_colored(THEME.anchor_solid_hori, 1, x0, yc,, 90); + } else if(drawSize && point_in_circle(_mx, _my, x0, yc, 16)) { + _hov[2] = 1; hover = 0; - if(mouse_press(mb_left)) { + if(mouse_press(mb_left, active)) { drag_type = 3; drag_sx = _l; drag_mx = _mx; } - } else if(drawSize && active && point_in_circle(_mx, _my, x1, yc, 16)) { - draw_sprite_colored(THEME.anchor_solid_hori, 1, x1, yc,, 90); + } else if(drawSize && point_in_circle(_mx, _my, x1, yc, 16)) { + _hov[3] = 1; hover = 2; - if(mouse_press(mb_left)) { + if(mouse_press(mb_left, active)) { drag_type = 1; drag_sx = _r; drag_mx = _mx; } } - draw_set_text(_f_p2b, fa_center, fa_center, COLORS._main_accent); - draw_text((x0 + x1) / 2, (y0 + y1) / 2, name); + for( var i = 0; i < 4; i++ ) + __overlay_hover[i] = lerp_float(__overlay_hover[i], _hov[i], 4); + + if(drawSize) { + if(drag_type == 0 || drag_type == 2) draw_anchor_line(__overlay_hover[0], xc, y0, 16, 0); + if(drag_type == 0 || drag_type == 4) draw_anchor_line(__overlay_hover[1], xc, y1, 16, 0); + if(drag_type == 0 || drag_type == 3) draw_anchor_line(__overlay_hover[2], x0, yc, 16, 90); + if(drag_type == 0 || drag_type == 1) draw_anchor_line(__overlay_hover[3], x1, yc, 16, 90); + } + + //draw_set_text(_f_p2b, fa_center, fa_center, COLORS._main_accent); + //draw_text_add((x0 + x1) / 2, (y0 + y1) / 2, name); return hover; } #endregion @@ -148,18 +157,18 @@ function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my, if(!interact) return -1; - if(drawPos) draw_sprite_colored(THEME.anchor, 1, xc, yc); - if(drawSize) { - draw_sprite_colored(THEME.anchor_selector, 0, x0, y0); - draw_sprite_colored(THEME.anchor_selector, 0, x1, y1); - } + var _hov = [ 0, 0, 0 ]; + var _r = 10; if(drag_type == 1) { var _xx = value_snap(drag_sx + (_mx - drag_mx) / _s, _snx); var _yy = value_snap(drag_sy + (_my - drag_my) / _s, _sny); - _val = [_xx, _yy, _x1, _y1, __at]; - if(setValueInspector(_val)) + var _sval = array_clone(showValue()); + _sval[0] = _xx; + _sval[1] = _yy; + + if(setValueInspector(_sval)) UNDO_HOLDING = true; if(mouse_release(mb_left)) { @@ -169,9 +178,12 @@ function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my, } else if(drag_type == 2) { var _xx = value_snap(drag_sx + (_mx - drag_mx) / _s, _snx); var _yy = value_snap(drag_sy + (_my - drag_my) / _s, _sny); - _val = [_x0, _y0, _xx, _yy, __at]; - if(setValueInspector(_val)) + var _sval = array_clone(showValue()); + _sval[2] = _xx; + _sval[3] = _yy; + + if(setValueInspector(_sval)) UNDO_HOLDING = true; if(mouse_release(mb_left)) { @@ -183,7 +195,11 @@ function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my, var __y0 = value_snap(drag_sy + (_my - drag_my) / _s, _sny); var __x1 = value_snap(_x1 + (__x0 - _x0), _snx); var __y1 = value_snap(_y1 + (__y0 - _y0), _sny); - _val = [__x0, __y0, __x1, __y1, __at]; + + _val[0] = __x0; + _val[1] = __y0; + _val[2] = __x1; + _val[3] = __y1; if(setValueInspector(_val)) UNDO_HOLDING = true; @@ -194,33 +210,33 @@ function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my, } } - if(drawSize && active && point_in_circle(_mx, _my, x0, y0, 8)) { - draw_sprite_colored(THEME.anchor_selector, 1, x0, y0); - hover = 1; + if(drawSize && point_in_circle(_mx, _my, x0, y0, 8)) { + _hov[1] = 1; + hover = 1; - if(mouse_press(mb_left)) { + if(mouse_press(mb_left, active)) { drag_type = 1; drag_sx = _x0; drag_sy = _y0; drag_mx = _mx; drag_my = _my; } - } else if(drawSize && active && point_in_circle(_mx, _my, x1, y1, 8)) { - draw_sprite_colored(THEME.anchor_selector, 1, x1, y1); - hover = 2; + } else if(drawSize && point_in_circle(_mx, _my, x1, y1, 8)) { + _hov[2] = 1; + hover = 2; - if(mouse_press(mb_left)) { + if(mouse_press(mb_left, active)) { drag_type = 2; drag_sx = _x1; drag_sy = _y1; drag_mx = _mx; drag_my = _my; } - } else if(drawPos && active && point_in_rectangle(_mx, _my, x0, y0, x1, y1)) { - draw_sprite_colored(THEME.anchor, 1, xc, yc); - hover = 3; + } else if(drawPos && point_in_rectangle(_mx, _my, x0, y0, x1, y1)) { + _hov[0] = 1; + hover = 3; - if(mouse_press(mb_left)) { + if(mouse_press(mb_left, active)) { drag_type = 3; drag_sx = _x0; drag_sy = _y0; @@ -229,8 +245,17 @@ function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my, } } - draw_set_text(_f_p2b, fa_center, fa_center, COLORS._main_accent); - draw_text((x0 + x1) / 2, (y0 + y1) / 2, name); + for( var i = 0; i < 3; i++ ) + __overlay_hover[i] = lerp_float(__overlay_hover[i], _hov[i], 4); + + if(drawPos && (drag_type == 0 || drag_type == 3)) draw_anchor_cross(__overlay_hover[0], xc, yc, _r + 4); + if(drawSize) { + if(drag_type == 0 || drag_type == 1) draw_anchor(__overlay_hover[1], x0, y0, _r); + if(drag_type == 0 || drag_type == 2) draw_anchor(__overlay_hover[2], x1, y1, _r); + } + + //draw_set_text(_f_p2b, fa_center, fa_center, COLORS._main_accent); + //draw_text_add((x0 + x1) / 2, (y0 + y1) / 2 - 4, name); return hover; } #endregion @@ -264,14 +289,20 @@ function preview_overlay_area_span(interact, active, _x, _y, _s, _mx, _my, _snx, if(!interact) return -1; - if(drawPos) draw_sprite_colored(THEME.anchor, 0, _ax, _ay); - if(drawSize) draw_sprite_colored(THEME.anchor_selector, 0, _ax + _aw, _ay + _ah); - - if(point_in_circle(_mx, _my, _ax + _aw, _ay + _ah, 8)) - draw_sprite_colored(THEME.anchor_selector, 1, _ax + _aw, _ay + _ah); + var _hov = [ 0, 0 ]; + var _r = 10; + + if(point_in_circle(_mx, _my, _ax + _aw, _ay + _ah, _r)) + _hov[1] = 1; else if(point_in_rectangle(_mx, _my, _ax - _aw, _ay - _ah, _ax + _aw, _ay + _ah)) - draw_sprite_colored(THEME.anchor, 0, _ax, _ay, 1.25); - + _hov[0] = 1; + + __overlay_hover[0] = lerp_float(__overlay_hover[0], _hov[0], 4); + __overlay_hover[1] = lerp_float(__overlay_hover[1], _hov[1], 4); + + if((drag_type == 0 || drag_type == 1) && drawPos) draw_anchor_cross(__overlay_hover[0], _ax, _ay, _r + 4); + if((drag_type == 0 || drag_type == 2) && drawSize) draw_anchor(__overlay_hover[1], _ax + _aw, _ay + _ah, _r); + if(drag_type == 1) { var _xx = value_snap(drag_sx + (_mx - drag_mx) / _s, _snx); var _yy = value_snap(drag_sy + (_my - drag_my) / _s, _sny); @@ -317,16 +348,18 @@ function preview_overlay_area_span(interact, active, _x, _y, _s, _mx, _my, _snx, } } - if(drawSize && active && point_in_circle(_mx, _my, _ax + _aw, _ay + _ah, 8)) { + if(drawSize && point_in_circle(_mx, _my, _ax + _aw, _ay + _ah, 8)) { hover = 2; - if(mouse_press(mb_left)) { + + if(mouse_press(mb_left, active)) { drag_type = 2; drag_mx = _ax; drag_my = _ay; } - } else if(drawPos && active && point_in_rectangle(_mx, _my, _ax - _aw, _ay - _ah, _ax + _aw, _ay + _ah)) { + } else if(drawPos && point_in_rectangle(_mx, _my, _ax - _aw, _ay - _ah, _ax + _aw, _ay + _ah)) { hover = 1; - if(mouse_press(mb_left)) { + + if(mouse_press(mb_left, active)) { drag_type = 1; drag_sx = __ax; drag_sy = __ay; @@ -335,8 +368,8 @@ function preview_overlay_area_span(interact, active, _x, _y, _s, _mx, _my, _snx, } } - draw_set_text(_f_p2b, fa_center, fa_bottom, COLORS._main_accent); - draw_text(_ax, _ay - 4, name); + //draw_set_text(_f_p2b, fa_center, fa_bottom, COLORS._main_accent); + //draw_text_add(round(_ax), round(_ay - 4), name); return hover; } #endregion @@ -348,6 +381,8 @@ function preview_overlay_area(interact, active, _x, _y, _s, _mx, _my, _snx, _sny var mode = editWidget.mode; + if(!struct_has(self, "__overlay_hover")) __overlay_hover = [ 0, 0, 0, 0, 0 ]; + switch(mode) { case AREA_MODE.area : return preview_overlay_area_span(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _flag); case AREA_MODE.padding : return preview_overlay_area_padding(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _flag, display_data); diff --git a/scripts/preview_overlay_gradient_range/preview_overlay_gradient_range.gml b/scripts/preview_overlay_gradient_range/preview_overlay_gradient_range.gml index 8e86e1acf..815f5558c 100644 --- a/scripts/preview_overlay_gradient_range/preview_overlay_gradient_range.gml +++ b/scripts/preview_overlay_gradient_range/preview_overlay_gradient_range.gml @@ -18,10 +18,11 @@ function preview_overlay_gradient_range(interact, active, _x, _y, _s, _mx, _my, var _ay1 = __y1 * _s + _y; var cc = COLORS.labels[2]; + var _r = 10; draw_set_text(f_p1, fa_left, fa_bottom, cc); - draw_text(_ax0 + ui(4), _ay0 - ui(4), "1"); - draw_text(_ax1 + ui(4), _ay1 - ui(4), "2"); + draw_text_add(_ax0 + ui(4), _ay0 - ui(4), "1"); + draw_text_add(_ax1 + ui(4), _ay1 - ui(4), "2"); var tx0, ty0, tx1, ty1; @@ -50,8 +51,8 @@ function preview_overlay_gradient_range(interact, active, _x, _y, _s, _mx, _my, var d1 = false; if(drag_type) { - if(drag_type == 1) { draw_sprite_colored(THEME.anchor_selector, 1, _ax0, _ay0, 1, 0, cc); d0 = true; } - if(drag_type == 2) { draw_sprite_colored(THEME.anchor_selector, 1, _ax1, _ay1, 1, 0, cc); d1 = true; } + if(drag_type == 1) { d0 = true; } + if(drag_type == 2) { d1 = true; } var _nx = value_snap((drag_sx + (_mx - drag_mx) - _x) / _s, _snx); var _ny = value_snap((drag_sy + (_my - drag_my) - _y) / _s, _sny); @@ -77,8 +78,6 @@ function preview_overlay_gradient_range(interact, active, _x, _y, _s, _mx, _my, d0 = true; hover = 1; - draw_sprite_colored(THEME.anchor_selector, 1, _ax0, _ay0, 1, 0, cc); - if(mouse_press(mb_left, active)) { drag_type = hover; drag_mx = _mx; @@ -90,8 +89,6 @@ function preview_overlay_gradient_range(interact, active, _x, _y, _s, _mx, _my, d1 = true; hover = 2; - draw_sprite_colored(THEME.anchor_selector, 1, _ax1, _ay1, 1, 0, cc); - if(mouse_press(mb_left, active)) { drag_type = hover; drag_mx = _mx; @@ -101,9 +98,13 @@ function preview_overlay_gradient_range(interact, active, _x, _y, _s, _mx, _my, } } } - - if(d0 == false) draw_sprite_colored(THEME.anchor_selector, 0, _ax0, _ay0, 1, 0, cc); - if(d1 == false) draw_sprite_colored(THEME.anchor_selector, 0, _ax1, _ay1, 1, 0, cc); - + + if(!struct_has(self, "__overlay_hover")) __overlay_hover = [ 0, 0 ]; + __overlay_hover[0] = lerp_float(__overlay_hover[0], d0, 4); + __overlay_hover[1] = lerp_float(__overlay_hover[1], d1, 4); + + draw_anchor(__overlay_hover[0], _ax0, _ay0, _r); + draw_anchor(__overlay_hover[0], _ax1, _ay1, _r); + return hover; } \ No newline at end of file diff --git a/scripts/preview_overlay_puppet/preview_overlay_puppet.gml b/scripts/preview_overlay_puppet/preview_overlay_puppet.gml index 9958a84e2..a976130bc 100644 --- a/scripts/preview_overlay_puppet/preview_overlay_puppet.gml +++ b/scripts/preview_overlay_puppet/preview_overlay_puppet.gml @@ -16,6 +16,7 @@ function preview_overlay_puppet(interact, active, _x, _y, _s, _mx, _my, _snx, _s var _ay1 = (__ay + __ay1) * _s + _y; draw_set_color(COLORS._main_accent); + switch(_val[PUPPET_CONTROL.mode]) { case PUPPET_FORCE_MODE.move : draw_line_width2(_ax, _ay, _ax1, _ay1, 6, 1); @@ -35,6 +36,7 @@ function preview_overlay_puppet(interact, active, _x, _y, _s, _mx, _my, _snx, _s } else draw_sprite_colored(THEME.anchor_scale_hori, drag_type == 3, _ax + __wd * _s, _ay); break; + case PUPPET_FORCE_MODE.wind : var dir = _val[PUPPET_CONTROL.fy]; var str = _val[PUPPET_CONTROL.fx] * _s; diff --git a/scripts/preview_overlay_rotation/preview_overlay_rotation.gml b/scripts/preview_overlay_rotation/preview_overlay_rotation.gml index 8e908b6d4..5dc51da3e 100644 --- a/scripts/preview_overlay_rotation/preview_overlay_rotation.gml +++ b/scripts/preview_overlay_rotation/preview_overlay_rotation.gml @@ -3,17 +3,14 @@ function preview_overlay_rotation(interact, active, _x, _y, _s, _mx, _my, _snx, var hover = -1; if(is_array(_val)) return hover; - var _ax = _x + lengthdir_x(_rad, _val); - var _ay = _y + lengthdir_y(_rad, _val); - var _id = 0; + var _ax = _x + lengthdir_x(_rad, _val); + var _ay = _y + lengthdir_y(_rad, _val); + var index = 0; + var _r = 10; if(drag_type) { - draw_set_color(COLORS._main_accent); - draw_set_alpha(0.5); - draw_circle_prec(_x, _y, _rad, true); - draw_set_alpha(1); - - _id = 1; + index = 1; + var angle = point_direction(_x, _y, _mx, _my); if(key_mod_press(CTRL)) angle = round(angle / 15) * 15; @@ -27,14 +24,10 @@ function preview_overlay_rotation(interact, active, _x, _y, _s, _mx, _my, _snx, } } - if(interact && active && point_in_circle(_mx, _my, _ax, _ay, 8)) { - draw_set_color(COLORS._main_accent); - draw_set_alpha(0.5); - draw_circle_prec(_x, _y, _rad, true); - draw_set_alpha(1); + if(interact && point_in_circle(_mx, _my, _ax, _ay, _r)) { hover = 1; + index = 1; - _id = 1; if(mouse_press(mb_left, active)) { drag_type = 1; drag_mx = _mx; @@ -44,9 +37,30 @@ function preview_overlay_rotation(interact, active, _x, _y, _s, _mx, _my, _snx, } } - draw_sprite_colored(THEME.anchor_rotate, _id, _ax, _ay, 1, _val - 90); + if(index) { + draw_set_color(COLORS._main_accent); + draw_set_alpha(0.5); + draw_circle_prec(_x, _y, _rad, true); + draw_set_alpha(1); + } + + if(!struct_has(self, "__overlay_hover")) __overlay_hover = 0; + __overlay_hover = lerp_float(__overlay_hover, index, 4); + + shader_set(sh_node_widget_rotator); + shader_set_color("color", COLORS._main_accent); + shader_set_f("index", __overlay_hover); + shader_set_f("angle", degtorad(_val + 90)); + + var _arx = _x + lengthdir_x(_rad - 4, _val); + var _ary = _y + lengthdir_y(_rad - 4, _val); + draw_sprite_stretched(s_fx_pixel, 0, _arx - _r * 2, _ary - _r * 2, _r * 4, _r * 4); + shader_reset(); + + //draw_sprite_colored(THEME.anchor_rotate, index, _ax, _ay, 1, _val - 90); + draw_set_text(_f_p2b, fa_center, fa_bottom, COLORS._main_accent); - draw_text(_ax, _ay - 4, name); + draw_text_add(round(_ax), round(_ay - 4), name); return hover; } \ No newline at end of file diff --git a/scripts/preview_overlay_scalar/preview_overlay_scalar.gml b/scripts/preview_overlay_scalar/preview_overlay_scalar.gml index fe222531c..acbd6b40b 100644 --- a/scripts/preview_overlay_scalar/preview_overlay_scalar.gml +++ b/scripts/preview_overlay_scalar/preview_overlay_scalar.gml @@ -6,7 +6,8 @@ function preview_overlay_scalar(interact, active, _x, _y, _s, _mx, _my, _snx, _s var index = 0; var __ax = lengthdir_x(_val * _scale, _angle); var __ay = lengthdir_y(_val * _scale, _angle); - + var _r = 10; + var _ax = _x + __ax * _s; var _ay = _y + __ay * _s; @@ -25,9 +26,10 @@ function preview_overlay_scalar(interact, active, _x, _y, _s, _mx, _my, _snx, _s } } - if(interact && active && point_in_circle(_mx, _my, _ax, _ay, 8)) { + if(interact && point_in_circle(_mx, _my, _ax, _ay, _r)) { hover = 1; index = 1; + if(mouse_press(mb_left, active)) { drag_type = 1; drag_mx = _mx; @@ -36,11 +38,13 @@ function preview_overlay_scalar(interact, active, _x, _y, _s, _mx, _my, _snx, _s drag_sy = _ay; } } - - draw_sprite_colored(_spr, index, _ax, _ay); - + + if(!struct_has(self, "__overlay_hover")) __overlay_hover = 0; + __overlay_hover = lerp_float(__overlay_hover, index, 4); + draw_anchor(__overlay_hover, _ax, _ay, _r); + draw_set_text(_f_p2b, fa_center, fa_bottom, COLORS._main_accent); - draw_text(_ax, _ay - 4, name); + draw_text_add(round(_ax), round(_ay - 4), name); return hover; } \ No newline at end of file diff --git a/scripts/preview_overlay_vector/preview_overlay_vector.gml b/scripts/preview_overlay_vector/preview_overlay_vector.gml index 75783041b..dc9994b85 100644 --- a/scripts/preview_overlay_vector/preview_overlay_vector.gml +++ b/scripts/preview_overlay_vector/preview_overlay_vector.gml @@ -6,13 +6,14 @@ function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _s var __ax = _val[0]; var __ay = _val[1]; + var _r = 10; - var _ax = __ax * _s + _x; - var _ay = __ay * _s + _y; - var _id = 0; + var _ax = __ax * _s + _x; + var _ay = __ay * _s + _y; + var _index = 0; if(drag_type) { - _id = 1; + _index = 1; var _nx = value_snap((drag_sx + (_mx - drag_mx) - _x) / _s, _snx); var _ny = value_snap((drag_sy + (_my - drag_my) - _y) / _s, _sny); @@ -33,9 +34,9 @@ function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _s } } - if(interact && active && point_in_circle(_mx, _my, _ax, _ay, 8)) { - hover = 1; - _id = 1; + if(interact && point_in_circle(_mx, _my, _ax, _ay, _r)) { + hover = 1; + _index = 1; if(mouse_press(mb_left, active)) { drag_type = 1; @@ -45,10 +46,13 @@ function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _s drag_sy = _ay; } } + + if(!struct_has(self, "__overlay_hover")) __overlay_hover = 0; + __overlay_hover = lerp_float(__overlay_hover, _index, 4); + draw_anchor(__overlay_hover, _ax, _ay, _r); - draw_sprite_colored(_spr, _id, _ax, _ay); draw_set_text(_f_p2b, fa_center, fa_bottom, COLORS._main_accent); - draw_text(_ax, _ay - 4, name); + draw_text_add(round(_ax), round(_ay - 4), name); return hover; } \ No newline at end of file diff --git a/shaders/sh_node_widget_rotator/sh_node_widget_rotator.fsh b/shaders/sh_node_widget_rotator/sh_node_widget_rotator.fsh new file mode 100644 index 000000000..665f120ed --- /dev/null +++ b/shaders/sh_node_widget_rotator/sh_node_widget_rotator.fsh @@ -0,0 +1,34 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec4 color; +uniform float index; +uniform float angle; + +float sdArc( in vec2 p, in float tb, in float ra, float rb ) { + vec2 sc = vec2(sin(tb), cos(tb)); + p.x = abs(p.x); + + return ((sc.y*p.x>sc.x*p.y) ? length(p-sc*ra) : + abs(length(p)-ra)) - rb; +} + +void main() { + vec2 p = v_vTexcoord - .5; + p *= mat2(cos(angle), -sin(angle), sin(angle), cos(angle)) * 2.; + + float dist = 1. - sdArc(p, .7 + index * .5, .5, .0) * 2. - 0.4; + float a; + vec4 c = vec4(0.); + + a = smoothstep(.0, .1, dist); + c = mix(c, vec4(0., 0., 0., 1.), a); + + a = smoothstep(.15, .2, dist); + c = mix(c, vec4(1., 1., 1., 1.), a); + + a = smoothstep(.3, .4, dist); + c = mix(c, color, a); + + gl_FragColor = c; +} diff --git a/shaders/sh_node_widget_rotator/sh_node_widget_rotator.vsh b/shaders/sh_node_widget_rotator/sh_node_widget_rotator.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_node_widget_rotator/sh_node_widget_rotator.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_node_widget_rotator/sh_node_widget_rotator.yy b/shaders/sh_node_widget_rotator/sh_node_widget_rotator.yy new file mode 100644 index 000000000..e0f2a78b4 --- /dev/null +++ b/shaders/sh_node_widget_rotator/sh_node_widget_rotator.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_node_widget_rotator", + "parent": { + "name": "node", + "path": "folders/widgets/node.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_node_widget_scalar/sh_node_widget_scalar.fsh b/shaders/sh_node_widget_scalar/sh_node_widget_scalar.fsh new file mode 100644 index 000000000..b9c356cd7 --- /dev/null +++ b/shaders/sh_node_widget_scalar/sh_node_widget_scalar.fsh @@ -0,0 +1,24 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec4 color; +uniform float index; + +void main() { + float dist = 1. - length(v_vTexcoord - .5) * 2.; + dist -= mix(.2, .0, index); + + float a; + vec4 c = vec4(0.); + + a = smoothstep(.0, .1, dist); + c = mix(c, vec4(0., 0., 0., 1.), a); + + a = smoothstep(.15, .2, dist); + c = mix(c, vec4(1., 1., 1., 1.), a); + + a = smoothstep(.3, .4, dist); + c = mix(c, color, a); + + gl_FragColor = c; +} diff --git a/shaders/sh_node_widget_scalar/sh_node_widget_scalar.vsh b/shaders/sh_node_widget_scalar/sh_node_widget_scalar.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_node_widget_scalar/sh_node_widget_scalar.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_node_widget_scalar/sh_node_widget_scalar.yy b/shaders/sh_node_widget_scalar/sh_node_widget_scalar.yy new file mode 100644 index 000000000..4b0a6c96d --- /dev/null +++ b/shaders/sh_node_widget_scalar/sh_node_widget_scalar.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_node_widget_scalar", + "parent": { + "name": "node", + "path": "folders/widgets/node.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.fsh b/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.fsh new file mode 100644 index 000000000..0d81e00f7 --- /dev/null +++ b/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.fsh @@ -0,0 +1,38 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec4 color; +uniform float index; + +float line_segment(in vec2 a, in vec2 b) { + vec2 p = v_vTexcoord; + + vec2 ba = b - a; + vec2 pa = p - a; + float h = clamp(dot(pa, ba) / dot(ba, ba), 0., 1.); + return length(pa - h * ba); +} + +void main() { + float dist; + float a = 0.3 - index * 0.1; + float b = 1. - a; + + dist = min(line_segment(vec2(0.5, a), vec2(0.5, b)), + line_segment(vec2(a, 0.5), vec2(b, 0.5)) + ) * 3.; + dist = 1. - dist - 0.5; + + vec4 c = vec4(0.); + + a = smoothstep(.0, .1, dist); + c = mix(c, vec4(0., 0., 0., 1.), a); + + a = smoothstep(.15, .2, dist); + c = mix(c, vec4(1., 1., 1., 1.), a); + + a = smoothstep(.3, .4, dist); + c = mix(c, color, a); + + gl_FragColor = c; +} diff --git a/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.vsh b/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.yy b/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.yy new file mode 100644 index 000000000..7e805875b --- /dev/null +++ b/shaders/sh_node_widget_scalar_cross/sh_node_widget_scalar_cross.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_node_widget_scalar_cross", + "parent": { + "name": "node", + "path": "folders/widgets/node.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.fsh b/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.fsh new file mode 100644 index 000000000..606c374c4 --- /dev/null +++ b/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.fsh @@ -0,0 +1,38 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec4 color; +uniform float index; +uniform float angle; + +float line_segment(in vec2 a, in vec2 b) { + vec2 p = v_vTexcoord; + + vec2 ba = b - a; + vec2 pa = p - a; + float h = clamp(dot(pa, ba) / dot(ba, ba), 0., 1.); + return length(pa - h * ba); +} + +void main() { + float dist; + float a = 0.2 + index * 0.1; + vec2 p0 = vec2(0.5, 0.5) - vec2(cos(angle), sin(angle)) * a; + vec2 p1 = vec2(0.5, 0.5) + vec2(cos(angle), sin(angle)) * a; + + dist = line_segment(p0, p1) * 3.; + dist = 1. - dist - 0.5; + + vec4 c = vec4(0.); + + a = smoothstep(.0, .1, dist); + c = mix(c, vec4(0., 0., 0., 1.), a); + + a = smoothstep(.15, .2, dist); + c = mix(c, vec4(1., 1., 1., 1.), a); + + a = smoothstep(.3, .4, dist); + c = mix(c, color, a); + + gl_FragColor = c; +} diff --git a/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.vsh b/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.yy b/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.yy new file mode 100644 index 000000000..4e798932d --- /dev/null +++ b/shaders/sh_node_widget_scalar_line/sh_node_widget_scalar_line.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_node_widget_scalar_line", + "parent": { + "name": "node", + "path": "folders/widgets/node.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_stripe/sh_stripe.fsh b/shaders/sh_stripe/sh_stripe.fsh index eaa391342..a11b8f167 100644 --- a/shaders/sh_stripe/sh_stripe.fsh +++ b/shaders/sh_stripe/sh_stripe.fsh @@ -2,10 +2,12 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; #define PI 3.14159265359 +#define PALETTE_LIMIT 128 uniform vec2 dimension; uniform vec2 position; uniform int blend; +uniform float progress; uniform vec2 amount; uniform int amountUseSurf; @@ -23,9 +25,12 @@ uniform vec2 ratio; uniform int ratioUseSurf; uniform sampler2D ratioSurf; +uniform int coloring; uniform vec4 color0; uniform vec4 color1; -uniform int gradient_use; + +uniform vec4 palette[PALETTE_LIMIT]; +uniform int paletteAmount; #region //////////////////////////////////// GRADIENT //////////////////////////////////// #define GRADIENT_LIMIT 128 @@ -200,10 +205,11 @@ void main() { #region float slot = floor(prog / _a); float ground = (slot + (random(vec2(slot + 0.)) * 2. - 1.) * rnd * 0.5 + 0.) * _a; float ceiling = (slot + (random(vec2(slot + 1.)) * 2. - 1.) * rnd * 0.5 + 1.) * _a; - float _s = (prog - ground) / (ceiling - ground); + float _s = fract((prog - ground) / (ceiling - ground) + progress); - if(gradient_use == 0) { + if(coloring == 0) { if(blend == 0) gl_FragColor = _s > rat? color0 : color1; + else if(blend == 1) { _s = sin(_s * 2. * PI) * 0.5 + 0.5; gl_FragColor = mix(color0, color1, _s); @@ -214,8 +220,22 @@ void main() { #region gl_FragColor = mix(color0, color1, _s); } - } else { - if(_s > rat) gl_FragColor = gradientEval(random(vec2(slot))); - else gl_FragColor = gradientEval(random(vec2(slot + 1.))); + + } else if(coloring == 1) { + int ind = int(mod(_s > rat? slot : slot + 1., float(paletteAmount))); + + if(blend == 0 || blend == 2) + gl_FragColor = palette[ind]; + + else if(blend == 1) { + vec4 c0 = _s > rat? palette[ind] : palette[int(mod(float(ind - 1 + paletteAmount), float(paletteAmount)))]; + vec4 c1 = _s > rat? palette[int(mod(float(ind + 1), float(paletteAmount)))] : palette[ind]; + + gl_FragColor = mix(c0, c1, _s > rat? _s - rat : _s + (1. - rat)); + + } + + } else if(coloring == 2) { + gl_FragColor = gradientEval(random(vec2(_s > rat? slot : slot + 1.))); } } #endregion