Pixel-Composer/scripts/node_pb_layer/node_pb_layer.gml

32 lines
931 B
Plaintext
Raw Normal View History

2023-07-21 12:40:20 +02:00
function Node_PB_Layer(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "PB Layer";
icon = THEME.pixel_builder;
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Int("Layer", self, 0 ));
2023-07-21 12:40:20 +02:00
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("pBox", self, VALUE_TYPE.pbBox, noone );
2023-07-21 12:40:20 +02:00
2023-11-26 13:16:38 +01:00
static update = function() {
var _dim = group.getInputData(0);
var _box = new __pbBox();
_box.layer = getInputData(0);
2024-03-31 05:36:11 +02:00
_box.w = array_safe_get_fast(_dim, 0, 1);
_box.h = array_safe_get_fast(_dim, 1, 1);
_box.layer_w = array_safe_get_fast(_dim, 0, 1);
_box.layer_h = array_safe_get_fast(_dim, 1, 1);
2023-11-26 13:16:38 +01:00
2024-08-08 06:57:51 +02:00
outputs[0].setValue(_box);
2023-11-26 13:16:38 +01:00
}
2023-07-21 12:40:20 +02:00
2024-08-08 06:57:51 +02:00
static getPreviewValues = function() { return group.outputs[0].getValue(); }
2023-07-21 12:40:20 +02:00
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s)
.toSquare()
.pad(8);
draw_set_color(c_white);
draw_rectangle_border(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 2);
}
}