Pixel-Composer/scripts/node_pb/node_pb.gml

42 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-07-21 12:40:20 +02:00
function Node_PB(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "PB Element";
icon = THEME.pixel_builder;
fullUpdate = true;
2024-03-28 14:18:02 +01:00
2023-07-21 12:40:20 +02:00
static getNextNodesRaw = getNextNodes;
2024-03-14 14:35:19 +01:00
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
2023-07-23 20:21:35 +02:00
if(drawOverlayPB != noone)
drawOverlayPB(active, _x, _y, _s, _mx, _my, _snx, _sny);
2024-08-08 06:57:51 +02:00
for( var i = 0; i < array_length(outputs); i++ ) {
if(outputs[i].type != VALUE_TYPE.pbBox) continue;
2023-07-23 20:21:35 +02:00
2024-08-08 06:57:51 +02:00
var _box = outputs[i].getValue();
2023-07-23 20:21:35 +02:00
if(!is_array(_box)) _box = [ _box ];
for( var j = 0; j < array_length(_box); j++ ) {
if(!is_instanceof(_box[j], __pbBox)) continue;
_box[j].drawOverlay(_x, _y, _s, c_red);
}
}
}
static drawOverlayPB = noone;
2023-07-21 12:40:20 +02:00
static getNextNodes = function() {
if(!struct_has(group, "checkComplete")) return [];
2024-08-08 06:57:51 +02:00
for( var i = 0; i < array_length(outputs); i++ ) {
var _ot = outputs[i];
2023-07-21 12:40:20 +02:00
var _tos = _ot.getJunctionTo();
if(array_length(_tos) > 0)
return getNextNodesRaw();
}
return group.checkComplete();
}
2024-08-08 06:57:51 +02:00
static getPreviewValues = function() { return group.outputs[0].getValue(); }
2023-07-21 12:40:20 +02:00
}