diff --git a/scripts/node_ase_layer/node_ase_layer.gml b/scripts/node_ase_layer/node_ase_layer.gml index 4f3fc800a..39a1ed0f4 100644 --- a/scripts/node_ase_layer/node_ase_layer.gml +++ b/scripts/node_ase_layer/node_ase_layer.gml @@ -31,25 +31,29 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct var data = getInputDataForce(0); if(data == noone) return; - var name = getInputData(2); - setDisplayName(name); + var _lname = getInputData(2); + setDisplayName(_lname); for( var i = 0, n = array_length(data.layers); i < n; i++ ) { - if(data.layers[i].name == name) + if(data.layers[i].name == _lname) layer_object = data.layers[i]; } } static update = function(frame = CURRENT_FRAME) { findLayer(); - if(layer_object == noone) return; - - var data = getInputData(0); - var cel = layer_object.getCel(CURRENT_FRAME - data._tag_delay); + var data = getInputData(0); var celDim = getInputData(1); - var name = getInputData(2); + var _lname = getInputData(2); + outputs[1].setValue(_lname); + if(layer_object == noone) { + logNode($"Layer name {_lname} not found."); + return; + } + + var cel = layer_object.getCel(CURRENT_FRAME - data._tag_delay); var ww = data.content[$ "Width"]; var hh = data.content[$ "Height"]; var cw = cel? cel.data[$ "Width"] : 1; @@ -59,7 +63,8 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct if(celDim) surf = surface_verify(surf, cw, ch); else surf = surface_verify(surf, ww, hh); outputs[0].setValue(surf); - outputs[1].setValue(name); + + print($"Setting layer name {_lname}"); if(cel == 0) { surface_clear(surf); return; } diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 31d903d27..b9efab126 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -2143,17 +2143,30 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { cache_result = array_verify(cache_result, TOTAL_FRAMES); } - static cacheCurrentFrame = function(_frame) { + static cacheCurrentFrame = function(_surface) { cacheArrayCheck(); - if(CURRENT_FRAME < 0) return; - if(CURRENT_FRAME >= array_length(cached_output)) return; + var _frame = CURRENT_FRAME; + if(_frame < 0) return; + if(_frame >= array_length(cached_output)) return; - surface_array_free(cached_output[CURRENT_FRAME]); - cached_output[CURRENT_FRAME] = surface_array_clone(_frame); + if(is_array(_surface)) { + surface_array_free(cached_output[_frame]); + cached_output[_frame] = surface_array_clone(_surface); + + } else if(surface_exists(_surface)) { + var _sw = surface_get_width(_surface); + var _sh = surface_get_height(_surface); + + cached_output[_frame] = surface_verify(cached_output[_frame], _sw, _sh); + surface_set_target(cached_output[_frame]); + DRAW_CLEAR BLEND_OVERRIDE + draw_surface(_surface, 0, 0); + surface_reset_target(); + } - array_safe_set(cache_result, CURRENT_FRAME, true); + array_safe_set(cache_result, _frame, true); - return cached_output[CURRENT_FRAME]; + return cached_output[_frame]; } static cacheExist = function(frame = CURRENT_FRAME) { diff --git a/scripts/node_interlaced/node_interlaced.gml b/scripts/node_interlaced/node_interlaced.gml index 039ca0ad8..ef30f224c 100644 --- a/scripts/node_interlaced/node_interlaced.gml +++ b/scripts/node_interlaced/node_interlaced.gml @@ -60,7 +60,7 @@ function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group var _fram = CURRENT_FRAME - _back; if(_loop) _fram = (_fram + TOTAL_FRAMES) % TOTAL_FRAMES; - var _prev = array_safe_get_fast(cached_output, _fram, noone); + var _prev = getCacheFrameIndex(_array_index, _fram); surface_set_shader(_outSurf, sh_interlaced); shader_set_i("useSurf", is_surface(_prev)); @@ -74,7 +74,7 @@ function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group draw_surface_safe(_surf); surface_reset_shader(); - cacheCurrentFrame(_surf); + cacheCurrentFrameIndex(_array_index, _surf); __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]); diff --git a/scripts/node_mk_delay_machine/node_mk_delay_machine.gml b/scripts/node_mk_delay_machine/node_mk_delay_machine.gml index df95dc7f3..56e33872b 100644 --- a/scripts/node_mk_delay_machine/node_mk_delay_machine.gml +++ b/scripts/node_mk_delay_machine/node_mk_delay_machine.gml @@ -86,7 +86,6 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co } aa = eval_curve_x(_alpC, 1 - i / _amo); - draw_surface_ext(_s, 0, 0, 1, 1, 0, cc, aa); } diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index 878eef39f..04e7fb1f2 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -411,25 +411,43 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct ///////////////////// CACHE ///////////////////// - static cacheCurrentFrameIndex = function(_frame, index) { + static cacheCurrentFrameIndex = function(_aindex, _surface) { cacheArrayCheck(); - if(CURRENT_FRAME < 0) return; - if(CURRENT_FRAME >= array_length(cached_output)) return; + var _frame = CURRENT_FRAME; + if(_frame < 0) return; + if(_frame >= array_length(cached_output)) return; - var prev = cached_output[CURRENT_FRAME]; - surface_array_free(array_safe_get_fast(prev, index)); - cached_output[CURRENT_FRAME][index] = surface_array_clone(_frame); + var _surfs = cached_output[_frame]; + var _cache = array_safe_get_fast(_surfs, _aindex); - array_safe_set(cache_result, CURRENT_FRAME, true); + if(is_array(_surface)) { + surface_array_free(_cache); + _surfs[_aindex] = surface_array_clone(_surface); + + } else if(surface_exists(_surface)) { + var _sw = surface_get_width(_surface); + var _sh = surface_get_height(_surface); + + _cache = surface_verify(_cache, _sw, _sh); + surface_set_target(_cache); + DRAW_CLEAR BLEND_OVERRIDE + draw_surface(_surface, 0, 0); + surface_reset_target(); + + _surfs[_aindex] = _cache; + } - return cached_output[CURRENT_FRAME]; + cached_output[_frame] = _surfs; + array_safe_set(cache_result, _frame, true); + + return cached_output[_frame]; } - static getCacheFrameIndex = function(frame = CURRENT_FRAME, index = 0) { - if(frame < 0) return false; - if(!cacheExist(frame)) return noone; + static getCacheFrameIndex = function(_aindex = 0, _frame = CURRENT_FRAME) { + if(_frame < 0) return false; + if(!cacheExist(_frame)) return noone; - var surf = array_safe_get_fast(cached_output, frame); - return array_safe_get_fast(surf, index); + var surf = array_safe_get_fast(cached_output, _frame); + return array_safe_get_fast(surf, _aindex, noone); } } \ No newline at end of file diff --git a/scripts/node_rate_remap/node_rate_remap.gml b/scripts/node_rate_remap/node_rate_remap.gml index 53a8cfaf8..c607f780d 100644 --- a/scripts/node_rate_remap/node_rate_remap.gml +++ b/scripts/node_rate_remap/node_rate_remap.gml @@ -23,9 +23,7 @@ function Node_Rate_Remap(_x, _y, _group = noone) : Node_Processor(_x, _y, _group var _step = PROJECT.animator.framerate / _rate; var _targ = floor(_time / _step) * _step; - cacheCurrentFrameIndex(_surf, _array_index); - var s = getCacheFrameIndex(_targ, _array_index); - - return s; + cacheCurrentFrameIndex(_array_index, _surf); + return getCacheFrameIndex(_array_index, _targ); } } \ No newline at end of file diff --git a/scripts/node_revert/node_revert.gml b/scripts/node_revert/node_revert.gml index 7dda4b0d6..34c7b8774 100644 --- a/scripts/node_revert/node_revert.gml +++ b/scripts/node_revert/node_revert.gml @@ -18,7 +18,6 @@ function Node_Revert(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } static update = function() { - if(!inputs[0].value_from) return; if(!inputs[0].value_from.node.renderActive) return; diff --git a/scripts/node_text/node_text.gml b/scripts/node_text/node_text.gml index cce60a13c..32309ac70 100644 --- a/scripts/node_text/node_text.gml +++ b/scripts/node_text/node_text.gml @@ -2,6 +2,8 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons name = "Draw Text"; font = f_p0; + dimension_index = -1; + newInput(0, nodeValue_Text("Text", self, "")) .setVisible(true, true); @@ -282,21 +284,24 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var _use_path = _path != noone && struct_has(_path, "getPointDistance"); var _ss = 1; - if(_use_path || _dimt == 0) { + if(_use_path) { _sw = _dim[0]; _sh = _dim[1]; + + } else if (_dimt == 0) { + _sw = _dim[0]; + _sh = _dim[1]; + if(_scaF) _ss = min(_sw / ww, _sh / hh); + } else { _sw = ww; _sh = hh; + if(_wave) _sh += abs(_waveA) * 2; } - - if(_dimt == 0 && !_use_path && _scaF) - _ss = min(_sw / ww, _sh / hh); - - if(_wave) _sh += abs(_waveA) * 2; _sw += _padd[PADDING.left] + _padd[PADDING.right]; _sh += _padd[PADDING.top] + _padd[PADDING.bottom]; + _outSurf = surface_verify(_outSurf, _sw, _sh, attrDepth()); #endregion diff --git a/scripts/node_time_remap/node_time_remap.gml b/scripts/node_time_remap/node_time_remap.gml index e21cd8fb7..ed81caac4 100644 --- a/scripts/node_time_remap/node_time_remap.gml +++ b/scripts/node_time_remap/node_time_remap.gml @@ -3,11 +3,6 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc use_cache = CACHE_USE.manual; update_on_frame = true; - shader = sh_time_remap; - uniform_map = shader_get_sampler_index(shader, "map"); - uniform_min = shader_get_uniform(shader, "vMin"); - uniform_max = shader_get_uniform(shader, "vMax"); - newInput(0, nodeValue_Surface("Surface in", self)) .rejectArray(); @@ -28,11 +23,12 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc attribute_surface_depth(); - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var _inSurf = getInputData(0); var _map = getInputData(1); var _life = getInputData(2); var _loop = getInputData(3); + cacheCurrentFrame(_inSurf); var _surf = outputs[0].getValue(); _surf = surface_verify(_surf, surface_get_width_safe(_inSurf), surface_get_height_safe(_inSurf), attrDepth()); @@ -40,26 +36,22 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc var ste = 1 / _life; - surface_set_shader(_surf, shader); - texture_set_stage(uniform_map, surface_get_texture(_map)); + surface_set_shader(_surf, sh_time_remap); + shader_set_surface("map", _map); for(var i = 0; i <= _life; i++) { var _frame = CURRENT_FRAME - i; - if(_loop) - _frame = _frame < 0? TOTAL_FRAMES - 1 + _frame : _frame; - else - _frame = clamp(_frame, 0, TOTAL_FRAMES - 1); + if(_loop) _frame = _frame < 0? TOTAL_FRAMES - 1 + _frame : _frame; + else _frame = clamp(_frame, 0, TOTAL_FRAMES - 1); var s = array_safe_get_fast(cached_output, _frame); if(!is_surface(s)) continue; - shader_set_uniform_f(uniform_min, i * ste); - shader_set_uniform_f(uniform_max, i * ste + ste); + shader_set_f("vMin", i * ste); + shader_set_f("vMax", i * ste + ste); draw_surface_safe(s); } surface_reset_shader(); - - cacheCurrentFrame(_inSurf); - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_trail/node_trail.gml b/scripts/node_trail/node_trail.gml index f1bffcd23..51c2ec0fa 100644 --- a/scripts/node_trail/node_trail.gml +++ b/scripts/node_trail/node_trail.gml @@ -17,7 +17,7 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { newInput(6, nodeValue_Curve("Alpha over life", self, CURVE_DEF_11)); - newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); + newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(1, nodeValue_Output("Trail UV", self, VALUE_TYPE.surface, noone)); @@ -63,7 +63,11 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var _blend = getInputData(5); var _alpha = getInputData(6); var cDep = attrDepth(); - if(!is_surface(_surf)) return; + if(!is_surface(_surf)) { + logNode($"Surface array not supported."); + return; + } + cacheCurrentFrame(_surf); for( var i = 0, n = array_length(temp_surface); i < n; i++ ) { diff --git a/scripts/project_data/project_data.gml b/scripts/project_data/project_data.gml index 83ab46c4a..6f7a7d833 100644 --- a/scripts/project_data/project_data.gml +++ b/scripts/project_data/project_data.gml @@ -30,8 +30,7 @@ nodeMap = ds_map_create(); nodeNameMap = ds_map_create(); - composer = noone; - + composer = noone; animator = new AnimationManager(); globalNode = new Node_Global(); nodeController = new __Node_Controller(self);