Pixel-Composer/scripts/node_revert/node_revert.gml
2024-09-04 08:57:11 +07:00

33 lines
No EOL
812 B
Text

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));
newOutput(0, nodeValue_Output("Output", self, VALUE_TYPE.surface, noone));
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));
}
}