Pixel-Composer/scripts/node_atlas_get/node_atlas_get.gml

49 lines
1.4 KiB
Text
Raw Normal View History

function Node_Atlas_Get(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2023-04-16 15:26:52 +02:00
name = "Atlas Get";
previewable = true;
dimension_index = -1;
setDimension(96, 48);
2023-04-16 15:26:52 +02:00
newInput(0, nodeValue_Atlas("Atlas", self))
2023-04-16 15:26:52 +02:00
.setVisible(true, true);
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("Surface", self, VALUE_TYPE.surface, []))
2023-04-16 15:26:52 +02:00
.setArrayDepth(1);
2024-09-04 03:57:11 +02:00
newOutput(1, nodeValue_Output("Position", self, VALUE_TYPE.float, []))
2023-04-16 15:26:52 +02:00
.setDisplay(VALUE_DISPLAY.vector)
.setArrayDepth(1);
2024-09-04 03:57:11 +02:00
newOutput(2, nodeValue_Output("Rotation", self, VALUE_TYPE.float, []))
2023-04-16 15:26:52 +02:00
.setArrayDepth(1);
2024-09-04 03:57:11 +02:00
newOutput(3, nodeValue_Output("Scale", self, VALUE_TYPE.float, []))
2023-04-16 15:26:52 +02:00
.setDisplay(VALUE_DISPLAY.vector)
.setArrayDepth(1);
2024-09-04 03:57:11 +02:00
newOutput(4, nodeValue_Output("Blend", self, VALUE_TYPE.color, []))
2023-04-16 15:26:52 +02:00
.setArrayDepth(1);
2024-09-04 03:57:11 +02:00
newOutput(5, nodeValue_Output("Alpha", self, VALUE_TYPE.float, []))
2023-04-16 15:26:52 +02:00
.setArrayDepth(1);
static processData = function(_outData, _data, _output_index, _array_index = 0) {
var atl = _data[0];
2023-04-16 15:26:52 +02:00
if(!is(atl, Atlas)) return _outData;
_outData[0] = atl.getSurface();
_outData[1] = [ atl.x, atl.y ];
_outData[2] = atl.rotation;
_outData[3] = [ atl.sx, atl.sy ];
_outData[4] = atl.blend;
_outData[5] = atl.alpha;
2023-04-16 15:26:52 +02:00
return _outData;
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_bbox_uniform(s_node_atlas_get, 0, bbox);
2023-04-16 15:26:52 +02:00
}
}