mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-14 22:43:53 +01:00
fixes
This commit is contained in:
parent
3952101495
commit
7f15c0fbd3
@ -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 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; }
|
||||
|
||||
|
@ -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);
|
||||
|
||||
array_safe_set(cache_result, CURRENT_FRAME, true);
|
||||
} else if(surface_exists(_surface)) {
|
||||
var _sw = surface_get_width(_surface);
|
||||
var _sh = surface_get_height(_surface);
|
||||
|
||||
return cached_output[CURRENT_FRAME];
|
||||
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, _frame, true);
|
||||
|
||||
return cached_output[_frame];
|
||||
}
|
||||
|
||||
static cacheExist = function(frame = CURRENT_FRAME) {
|
||||
|
@ -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]);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
return cached_output[CURRENT_FRAME];
|
||||
} 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;
|
||||
}
|
||||
|
||||
static getCacheFrameIndex = function(frame = CURRENT_FRAME, index = 0) {
|
||||
if(frame < 0) return false;
|
||||
if(!cacheExist(frame)) return noone;
|
||||
cached_output[_frame] = _surfs;
|
||||
array_safe_set(cache_result, _frame, true);
|
||||
|
||||
var surf = array_safe_get_fast(cached_output, frame);
|
||||
return array_safe_get_fast(surf, index);
|
||||
return cached_output[_frame];
|
||||
}
|
||||
|
||||
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, _aindex, noone);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -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(_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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
@ -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++ ) {
|
||||
|
@ -31,7 +31,6 @@
|
||||
nodeNameMap = ds_map_create();
|
||||
|
||||
composer = noone;
|
||||
|
||||
animator = new AnimationManager();
|
||||
globalNode = new Node_Global();
|
||||
nodeController = new __Node_Controller(self);
|
||||
|
Loading…
Reference in New Issue
Block a user