This commit is contained in:
Tanasart 2024-03-28 14:33:28 +07:00
parent 88ef6faf13
commit aa898c7fc4
30 changed files with 544 additions and 156 deletions

View file

@ -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",},

View file

@ -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",},},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -79,3 +79,31 @@ 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

View file

@ -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);

View file

@ -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

View file

@ -1088,9 +1088,12 @@ function Panel_Preview() : PanelContent() constructor {
#region surface array
preview_x_max = 0;
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);
@ -1128,6 +1131,7 @@ function Panel_Preview() : PanelContent() constructor {
xx += prev_sw + ui(8);
preview_x_max += prev_sw + ui(8);
}
}
#endregion
preview_x_max = max(preview_x_max - ui(100), 0);

View file

@ -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);
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);
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);
} 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);
} 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,13 +289,19 @@ 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);
var _hov = [ 0, 0 ];
var _r = 10;
if(point_in_circle(_mx, _my, _ax + _aw, _ay + _ah, 8))
draw_sprite_colored(THEME.anchor_selector, 1, _ax + _aw, _ay + _ah);
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);
@ -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);

View file

@ -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;
@ -102,8 +99,12 @@ 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;
}

View file

@ -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;

View file

@ -5,15 +5,12 @@ function preview_overlay_rotation(interact, active, _x, _y, _s, _mx, _my, _snx,
var _ax = _x + lengthdir_x(_rad, _val);
var _ay = _y + lengthdir_y(_rad, _val);
var _id = 0;
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);
index = 1;
_id = 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;
}

View file

@ -6,6 +6,7 @@ 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;
@ -37,10 +39,12 @@ function preview_overlay_scalar(interact, active, _x, _y, _s, _mx, _my, _snx, _s
}
}
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;
}

View file

@ -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 _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)) {
if(interact && point_in_circle(_mx, _my, _ax, _ay, _r)) {
hover = 1;
_id = 1;
_index = 1;
if(mouse_press(mb_left, active)) {
drag_type = 1;
@ -46,9 +47,12 @@ function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _s
}
}
draw_sprite_colored(_spr, _id, _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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_node_widget_rotator",
"parent": {
"name": "node",
"path": "folders/widgets/node.yy",
},
"type": 1,
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_node_widget_scalar",
"parent": {
"name": "node",
"path": "folders/widgets/node.yy",
},
"type": 1,
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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,
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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,
}

View file

@ -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