diff --git a/objects/o_dialog_textbox_autocomplete/Draw_64.gml b/objects/o_dialog_textbox_autocomplete/Draw_64.gml index c4f2ea7ed..8ebac6411 100644 --- a/objects/o_dialog_textbox_autocomplete/Draw_64.gml +++ b/objects/o_dialog_textbox_autocomplete/Draw_64.gml @@ -1,4 +1,5 @@ /// @description +active = textbox != noone; if(textbox == noone) exit; if(textbox != WIDGET_CURRENT) exit; diff --git a/objects/o_dialog_textbox_function_guide/Draw_64.gml b/objects/o_dialog_textbox_function_guide/Draw_64.gml index dad06d3be..9bd70195a 100644 --- a/objects/o_dialog_textbox_function_guide/Draw_64.gml +++ b/objects/o_dialog_textbox_function_guide/Draw_64.gml @@ -1,4 +1,5 @@ /// @description +active = textbox != noone; if(textbox == noone) exit; if(textbox != WIDGET_CURRENT) exit; diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 10c18fa54..4b025df56 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -2,7 +2,7 @@ global.cache_call = 0; global.cache_hit = 0; -HOVERING_ELEMENT = _HOVERING_ELEMENT; +HOVERING_ELEMENT = _HOVERING_ELEMENT; _HOVERING_ELEMENT = noone; #region minimize diff --git a/scripts/animation_controller/animation_controller.gml b/scripts/animation_controller/animation_controller.gml index 7ab052842..b6408884f 100644 --- a/scripts/animation_controller/animation_controller.gml +++ b/scripts/animation_controller/animation_controller.gml @@ -24,6 +24,7 @@ is_playing = false; frame_progress = false; play_freeze = 0; + render_stop = false; rendering = []; playback = ANIMATOR_END.loop; @@ -31,19 +32,21 @@ static setFrame = function(frame, resetTime = true) { //if(frame == 0) resetAnimation(); - var _c = current_frame; - frame = clamp(frame, 0, frames_total); - real_frame = frame; + var _c = current_frame; + frame = clamp(frame, 0, frames_total); + real_frame = frame; current_frame = round(frame); if(current_frame == frames_total) { - if(array_length(rendering)) { + if(render_stop) { is_playing = false; setFrame(0); - } else if(playback == ANIMATOR_END.stop) + render_stop = false; + } else if(playback == ANIMATOR_END.stop) { is_playing = false; - else + } else { setFrame(0); + } } if(_c != current_frame) { @@ -53,6 +56,8 @@ RENDER_ALL } else frame_progress = false; + + if(array_length(rendering)) render_stop = true; } static resetAnimation = function() { diff --git a/scripts/node_displacement/node_displacement.gml b/scripts/node_displacement/node_displacement.gml index 7eed18eb5..d2264592a 100644 --- a/scripts/node_displacement/node_displacement.gml +++ b/scripts/node_displacement/node_displacement.gml @@ -1,17 +1,6 @@ function Node_Displace(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Displace"; - shader = sh_displace; - displace_map_sample = shader_get_sampler_index(shader, "map"); - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_map_dim = shader_get_uniform(shader, "map_dimension"); - uniform_position = shader_get_uniform(shader, "displace"); - uniform_strength = shader_get_uniform(shader, "strength"); - uniform_mid = shader_get_uniform(shader, "middle"); - uniform_rg = shader_get_uniform(shader, "use_rg"); - uniform_it = shader_get_uniform(shader, "iterate"); - uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Displace map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); @@ -45,11 +34,14 @@ If set, then strength value control how many times the effect applies on itself. inputs[| 10] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 10; + inputs[| 11] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Overwrite", "Min", "Max" ]); + input_display_list = [ 10, ["Output", true], 0, 8, 9, - ["Displace", false], 1, 3, 4, + ["Displace", false], 1, 3, 4, ["Color", false], 5, 2, - ["Algorithm", true], 6 + ["Algorithm", true], 6, 11, ]; outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -74,18 +66,18 @@ If set, then strength value control how many times the effect applies on itself. var mw = surface_get_width_safe(_data[1]); var mh = surface_get_height_safe(_data[1]); - surface_set_shader(_outSurf, shader); + surface_set_shader(_outSurf, sh_displace); shader_set_interpolation(_data[0]); - texture_set_stage(displace_map_sample, surface_get_texture(_data[1])); - shader_set_uniform_f_array_safe(uniform_dim, [ww, hh]); - shader_set_uniform_f_array_safe(uniform_map_dim, [mw, mh]); - shader_set_uniform_f_array_safe(uniform_position, _data[2]); - shader_set_uniform_f(uniform_strength, _data[3]); - shader_set_uniform_f(uniform_mid, _data[4]); - shader_set_uniform_i(uniform_rg, _data[5]); - shader_set_uniform_i(uniform_it, _data[6]); - shader_set_uniform_i(uniform_sam, struct_try_get(attributes, "oversample")); - draw_surface_safe(_data[0], 0, 0); + shader_set_surface("map", _data[1]); + shader_set_f("dimension", [ww, hh]); + shader_set_f("map_dimension", [mw, mh]); + shader_set_f("displace", _data[2]); + shader_set_f("strength", _data[3]); + shader_set_f("middle", _data[4]); + shader_set_i("use_rg", _data[5]); + shader_set_i("iterate", _data[6]); + shader_set_i("blendMode", _data[11]); + draw_surface_safe(_data[0]); surface_reset_shader(); _outSurf = mask_apply(_data[0], _outSurf, _data[8], _data[9]); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index 37412bdc7..4d574afaa 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -687,7 +687,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor update_on_frame = true; playing = true; played = 0; - PROJECT.animator.real_frame = -1; + PROJECT.animator.real_frame = -1; CURRENT_FRAME = -1; IS_PLAYING = true; array_push(RENDERING, node_id); @@ -769,8 +769,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor export(); - if(CURRENT_FRAME == TOTAL_FRAMES - 1 && anim == NODE_EXPORT_FORMAT.animation) - renderCompleted(); + if(CURRENT_FRAME == TOTAL_FRAMES - 1) { + if(anim == NODE_EXPORT_FORMAT.sequence) + array_remove(RENDERING, node_id); + else if(anim == NODE_EXPORT_FORMAT.animation) + renderCompleted(); + } } #endregion static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region diff --git a/scripts/node_gradient/node_gradient.gml b/scripts/node_gradient/node_gradient.gml index 20783e432..6563690d6 100644 --- a/scripts/node_gradient/node_gradient.gml +++ b/scripts/node_gradient/node_gradient.gml @@ -31,9 +31,9 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 5] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, { range: [-2, 2, 0.01] }); - inputs[| 6] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [DEF_SURF_W / 2, DEF_SURF_H / 2]) + inputs[| 6] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) .setDisplay(VALUE_DISPLAY.vector) - .setUnitRef(function(index) { return getDimension(index); }); + .setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference); inputs[| 7] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); diff --git a/scripts/node_threshold/node_threshold.gml b/scripts/node_threshold/node_threshold.gml index ae78b98dc..12dc58323 100644 --- a/scripts/node_threshold/node_threshold.gml +++ b/scripts/node_threshold/node_threshold.gml @@ -50,7 +50,7 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _bright = _data[1]; var _brightThreshold = _data[2]; var _brightSmooth = _data[3]; - + var _alpha = _data[7]; var _alphaThreshold = _data[8]; var _alphaSmooth = _data[9]; diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index bdd8387d4..94769c98c 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -136,37 +136,37 @@ function Panel_Animation() : PanelContent() constructor { function() { return __txt("Stop"); }, function() { return 4; }, function() { return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; }, - function() { return; PROJECT.animator.stop(); } + function() { PROJECT.animator.stop(); } ], [ function() { return PROJECT.animator.is_playing? __txt("Pause") : __txt("Play"); }, function() { return !PROJECT.animator.is_playing; }, function() { return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; }, - function() { return; if(PROJECT.animator.is_playing) PROJECT.animator.pause(); else PROJECT.animator.resume(); } + function() { if(PROJECT.animator.is_playing) PROJECT.animator.pause(); else PROJECT.animator.resume(); } ], [ function() { return __txtx("panel_animation_go_to_first_frame", "Go to first frame"); }, function() { return 3; }, function() { return COLORS._main_icon; }, - function() { return; PROJECT.animator.setFrame(0); } + function() { PROJECT.animator.setFrame(0); } ], [ function() { return __txtx("panel_animation_go_to_last_frame", "Go to last frame"); }, function() { return 2; }, function() { return COLORS._main_icon; }, - function() { return; PROJECT.animator.setFrame(TOTAL_FRAMES - 1); } + function() { PROJECT.animator.setFrame(TOTAL_FRAMES - 1); } ], [ function() { return __txtx("panel_animation_previous_frame", "Previous frame"); }, function() { return 5; }, function() { return COLORS._main_icon; }, - function() { return; PROJECT.animator.setFrame(PROJECT.animator.real_frame - 1); } + function() { PROJECT.animator.setFrame(PROJECT.animator.real_frame - 1); } ], [ function() { return __txtx("panel_animation_next_frame", "Next frame"); }, function() { return 6; }, function() { return COLORS._main_icon; }, - function() { return; PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1); } + function() { PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1); } ], ]; #endregion @@ -1838,8 +1838,6 @@ function Panel_Animation() : PanelContent() constructor { var row = ceil(amo / col); if(col < 1) return; - var _act = !IS_RENDERING; - for( var i = 0; i < row; i++ ) { var colAmo = min(amo - i * col, col); if(mini) @@ -1851,10 +1849,10 @@ function Panel_Animation() : PanelContent() constructor { var but = control_buttons[ind]; var txt = but[0](); var ind = but[1](); - var cc = _act? but[2]() : COLORS._main_icon_dark; + var cc = IS_RENDERING? COLORS._main_icon_dark : but[2](); var fnc = but[3]; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS && _act, pHOVER && _act, txt, THEME.sequence_control, ind, cc) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS && !IS_RENDERING, pHOVER && !IS_RENDERING, txt, THEME.sequence_control, ind, cc) == 2) fnc(); bx += ui(36); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index e1dfd29b0..d25f553f8 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -1223,10 +1223,7 @@ function Panel_Preview() : PanelContent() constructor { if(!_node) return; if(tool_current != noone) { #region tool settings - var settings = _node.getToolSettings(); - var len = array_length(settings); - for( var i = 0, n = array_length(tool_current.settings); i < n; i++ ) - settings[len + i] = tool_current.settings[i]; + var settings = array_merge(_node.getToolSettings(), tool_current.settings); tool_x = lerp_float(tool_x, tool_x_to, 5); var tolx = tool_x + ui(16); diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 94ee70c8b..5cbf283d5 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -107,7 +107,8 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor var data = autocomplete_server(pmt, localParams, autocomplete_context); if(array_length(data)) { - o_dialog_textbox_autocomplete.data = data; + o_dialog_textbox_autocomplete.data = data; + o_dialog_textbox_autocomplete.prompt = pmt; o_dialog_textbox_autocomplete.activate(self); } diff --git a/shaders/sh_displace/sh_displace.fsh b/shaders/sh_displace/sh_displace.fsh index 0dc8ea1ff..f831915c3 100644 --- a/shaders/sh_displace/sh_displace.fsh +++ b/shaders/sh_displace/sh_displace.fsh @@ -13,72 +13,71 @@ uniform float middle; uniform int iterate; uniform int use_rg; uniform int sampleMode; +uniform int blendMode; -float bright(in vec4 col) { - return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a; -} +float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a; } -/////////////// SAMPLING /////////////// +#region /////////////// SAMPLING /////////////// -const float PI = 3.14159265358979323846; -uniform int interpolation; -uniform vec2 sampleDimension; + const float PI = 3.14159265358979323846; + uniform int interpolation; + uniform vec2 sampleDimension; -const int RSIN_RADIUS = 1; + const int RSIN_RADIUS = 1; -float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } + float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } -vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { - vec2 tx = 1.0 / sampleDimension; - vec2 p = uv * sampleDimension - vec2(0.5); + vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { + vec2 tx = 1.0 / sampleDimension; + vec2 p = uv * sampleDimension - vec2(0.5); - vec4 sum = vec4(0.0); - float weights = 0.; + vec4 sum = vec4(0.0); + float weights = 0.; - for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) - for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { - float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); - if(a > 1.) continue; - float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); - vec2 offset = vec2(float(x), float(y)) * tx; - vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); - sum += w * sample; - weights += w; - } + for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) + for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { + float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); + if(a > 1.) continue; + float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); + vec2 offset = vec2(float(x), float(y)) * tx; + vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); + sum += w * sample; + weights += w; + } - return sum / weights; -} + return sum / weights; + } -vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { - uv = uv * sampleDimension + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); - uv = (uv - 0.5) / sampleDimension; - return texture2D( texture, uv ); -} + vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { + uv = uv * sampleDimension + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); + uv = (uv - 0.5) / sampleDimension; + return texture2D( texture, uv ); + } -vec4 texture2Dintp( sampler2D texture, vec2 uv ) { - if(interpolation == 2) return texture2D_bicubic( texture, uv ); - else if(interpolation == 3) return texture2D_rsin( texture, uv ); - return texture2D( texture, uv ); -} + vec4 texture2Dintp( sampler2D texture, vec2 uv ) { + if(interpolation == 2) return texture2D_bicubic( texture, uv ); + else if(interpolation == 3) return texture2D_rsin( texture, uv ); + return texture2D( texture, uv ); + } -/////////////// SAMPLING /////////////// - -vec4 sampleTexture(vec2 pos) { - if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.) - return texture2Dintp(gm_BaseTexture, pos); + vec4 sampleTexture(vec2 pos) { + if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.) + return texture2Dintp(gm_BaseTexture, pos); + + if(sampleMode == 0) + return vec4(0.); + if(sampleMode == 1) + return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); + if(sampleMode == 2) + return texture2Dintp(gm_BaseTexture, fract(pos)); - if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) - return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) - return texture2Dintp(gm_BaseTexture, fract(pos)); - - return vec4(0.); -} + } + +#endregion /////////////// SAMPLING /////////////// vec2 shiftMap(in vec2 pos, in float str) { vec4 disP = texture2Dintp( map, pos ); @@ -104,16 +103,34 @@ vec2 shiftMap(in vec2 pos, in float str) { return sam_pos; } +vec4 blend(in vec4 c0, in vec4 c1) { + if(blendMode == 0) return c1; + else if(blendMode == 1) { + float b0 = bright(c0); + float b1 = bright(c1); + return b0 < b1? c0 : c1; + } else if(blendMode == 2) { + float b0 = bright(c0); + float b1 = bright(c1); + return b0 > b1? c0 : c1; + } + + return c1; +} + void main() { vec2 samPos = v_vTexcoord; + vec4 ccol = sampleTexture( v_vTexcoord ), ncol; if(iterate == 1) { - for(float i = 0.; i < strength; i++) + for(float i = 0.; i < strength; i++) { samPos = shiftMap(samPos, 1.); - } else + ncol = blend(ccol, sampleTexture( samPos )); + } + } else { samPos = shiftMap(samPos, strength); + ncol = sampleTexture( samPos ); + } - vec4 col = sampleTexture( samPos ); - - gl_FragColor = col; + gl_FragColor = blend(ccol, ncol); }