Pixel-Composer/scripts/node_feedback_input/node_feedback_input.gml

28 lines
911 B
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Feedback_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, _group) constructor {
2023-12-19 14:30:34 +01:00
name = "Feedback Input";
color = COLORS.node_blend_feedback;
2023-11-29 03:04:28 +01:00
is_group_io = true;
2024-03-28 14:18:02 +01:00
setDimension(96, 32 + 24 * 2);
2022-12-16 09:18:09 +01:00
2024-12-25 05:51:24 +01:00
feedbackOut = noone;
2024-08-08 06:57:51 +02:00
outputs[0].getValueDefault = method(outputs[0], outputs[0].getValueRecursive); //Get value from outside loop
outputs[0].getValueRecursive = function(arr, _time) {
2024-12-25 05:51:24 +01:00
if(!is(feedbackOut, NodeValue)) return;
var _vto = feedbackOut.getJunctionTo();
var _jout = array_safe_get(_vto, 0, noone);
if(_jout == noone) return;
2022-12-16 09:18:09 +01:00
2024-12-25 05:51:24 +01:00
if(CURRENT_FRAME > 0 && _jout.node.cache_value != noone) { //use cache from output
arr[@ 0] = _jout.node.cache_value;
2024-04-01 11:10:01 +02:00
arr[@ 1] = inParent;
return;
}
2022-12-16 09:18:09 +01:00
2024-08-08 06:57:51 +02:00
outputs[0].getValueDefault(arr);
2022-12-16 09:18:09 +01:00
}
2024-09-04 03:57:11 +02:00
newOutput(1, nodeValue_Output("Feedback loop", self, VALUE_TYPE.node, 0).nonForward());
2024-12-25 05:51:24 +01:00
feedbackOut = outputs[1];
2022-12-16 09:18:09 +01:00
}