Pixel-Composer/scripts/node_revert/node_revert.gml

33 lines
812 B
Plaintext
Raw Normal View History

2024-08-30 11:08:30 +02:00
function Node_Revert(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Revert";
use_cache = CACHE_USE.manual;
newInput(0, nodeValue_Surface("Surface in", self));
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("Output", self, VALUE_TYPE.surface, noone));
2024-08-30 11:08:30 +02:00
input_display_list = [
["Surfaces", true], 0,
];
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
static onInspector2Update = function() {
clearCache(true);
}
static update = function() {
if(!inputs[0].value_from) return;
if(!inputs[0].value_from.node.renderActive) return;
var _surf = getInputData(0);
cacheCurrentFrame(_surf);
var _frm = TOTAL_FRAMES - CURRENT_FRAME - 1;
if(!cacheExist(_frm)) return;
outputs[0].setValue(getCacheFrame(_frm));
}
}