2023-02-28 09:43:01 +01:00
|
|
|
function Node_Surface_data(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
2022-01-13 05:24:03 +01:00
|
|
|
name = "Surface data";
|
2022-11-18 03:20:31 +01:00
|
|
|
color = COLORS.node_blend_number;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-03-14 14:35:19 +01:00
|
|
|
inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
outputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, [ 1, 1 ])
|
2022-01-13 05:24:03 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.vector);
|
2023-02-14 05:32:32 +01:00
|
|
|
outputs[| 1] = nodeValue("Array length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-01-17 08:11:55 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
w = 96;
|
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static update = function(frame = CURRENT_FRAME) {
|
2023-10-02 08:57:44 +02:00
|
|
|
var _insurf = getInputData(0);
|
2022-01-13 05:24:03 +01:00
|
|
|
if(is_array(_insurf)) {
|
|
|
|
var len = array_length(_insurf);
|
|
|
|
var _dim = array_create(len);
|
|
|
|
|
2022-01-16 14:28:57 +01:00
|
|
|
for( var i = 0; i < len; i++ ) {
|
2023-09-08 21:37:36 +02:00
|
|
|
_dim[i][0] = surface_get_width_safe(_insurf[i]);
|
|
|
|
_dim[i][1] = surface_get_height_safe(_insurf[i]);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
outputs[| 0].setValue(_dim);
|
|
|
|
outputs[| 1].setValue(len);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!_insurf || !surface_exists(_insurf)) return;
|
|
|
|
|
2023-09-08 21:37:36 +02:00
|
|
|
outputs[| 0].setValue([ surface_get_width_safe(_insurf), surface_get_height_safe(_insurf) ]);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
}
|