Pixel-Composer/scripts/node_feedback_input/node_feedback_input.gml

23 lines
930 B
Plaintext
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
2022-12-27 04:00:50 +01:00
outputs[| 0].getValueDefault = method(outputs[| 0], outputs[| 0].getValueRecursive); //Get value from outside loop
2022-12-16 09:18:09 +01:00
outputs[| 0].getValueRecursive = function(_time) {
var _node_output = noone;
2023-12-19 14:30:34 +01:00
for( var i = 0; i < array_length(outputs[| 1].value_to); i++ ) {
var vt = outputs[| 1].value_to[i];
2022-12-16 09:18:09 +01:00
if(vt.value_from == outputs[| 1])
_node_output = vt;
}
2023-10-09 16:07:33 +02:00
if(CURRENT_FRAME > 0 && _node_output != noone && _node_output.node.cache_value != noone) //use cache from output
2022-12-23 04:45:52 +01:00
return [ _node_output.node.cache_value, inParent ];
2022-12-16 09:18:09 +01:00
2022-12-27 04:00:50 +01:00
return outputs[| 0].getValueDefault();
2022-12-16 09:18:09 +01:00
}
2023-06-01 10:32:21 +02:00
outputs[| 1] = nodeValue("Feedback loop", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0).nonForward();
2022-12-16 09:18:09 +01:00
}