Pixel-Composer/scripts/node_feedback_input/node_feedback_input.gml

26 lines
926 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-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) {
2022-12-16 09:18:09 +01:00
var _node_output = noone;
2024-08-08 06:57:51 +02:00
for( var i = 0; i < array_length(outputs[1].value_to); i++ ) {
var vt = outputs[1].value_to[i];
if(vt.value_from == outputs[1])
2022-12-16 09:18:09 +01:00
_node_output = vt;
}
2024-04-01 11:10:01 +02:00
if(CURRENT_FRAME > 0 && _node_output != noone && _node_output.node.cache_value != noone) { //use cache from output
arr[@ 0] = _node_output.node.cache_value;
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-08-08 06:57:51 +02:00
outputs[1] = nodeValue_Output("Feedback loop", self, VALUE_TYPE.node, 0).nonForward();
2022-12-16 09:18:09 +01:00
}