Pixel-Composer/scripts/node_surface_data/node_surface_data.gml

47 lines
1.5 KiB
Text
Raw Normal View History

function Node_Surface_data(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2022-01-13 05:24:03 +01:00
name = "Surface data";
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Surface("Surface", self));
2022-01-13 05:24:03 +01:00
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("Dimension", self, VALUE_TYPE.integer, [ 1, 1 ]))
2022-01-13 05:24:03 +01:00
.setDisplay(VALUE_DISPLAY.vector);
newOutput(1, nodeValue_Output("Width", self, VALUE_TYPE.integer, 1));
newOutput(2, nodeValue_Output("Height", self, VALUE_TYPE.integer, 1));
newOutput(3, nodeValue_Output("Format String", self, VALUE_TYPE.text, ""))
.setVisible(false);
newOutput(4, nodeValue_Output("Bit Depth", self, VALUE_TYPE.integer, 8))
.setVisible(false);
newOutput(5, nodeValue_Output("Channels", self, VALUE_TYPE.integer, 4))
.setVisible(false);
2023-01-17 08:11:55 +01:00
2024-05-02 11:05:02 +02:00
setDimension(96, 48);
2022-01-13 05:24:03 +01:00
static processData = function(_outData, _data, _output_index, _array_index = 0) {
var _surf = _data[0];
if(!is_surface(_surf)) return _outData;
var _dim = surface_get_dimension(_surf);
_outData[0] = _dim;
_outData[1] = _dim[0];
_outData[2] = _dim[1];
2022-01-13 05:24:03 +01:00
var _frm = surface_get_format(_surf);
_outData[3] = surface_format_string(_frm);
_outData[4] = surface_format_get_depth(_frm);
_outData[5] = surface_format_get_channel(_frm);
2022-01-13 05:24:03 +01:00
return _outData;
2022-01-13 05:24:03 +01:00
}
2025-01-05 01:48:23 +01:00
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_bbox_uniform(s_node_surface_data, 0, bbox);
}
2022-01-13 05:24:03 +01:00
}