2023-02-28 09:43:01 +01:00
|
|
|
function Node_VFX_Override(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
2023-12-03 05:02:04 +01:00
|
|
|
name = "VFX Override";
|
2023-02-14 02:48:33 +01:00
|
|
|
color = COLORS.node_blend_vfx;
|
|
|
|
icon = THEME.vfx;
|
|
|
|
node_draw_icon = s_node_vfx_override;
|
|
|
|
|
2023-12-22 08:42:02 +01:00
|
|
|
manual_ungroupable = false;
|
2024-03-28 14:18:02 +01:00
|
|
|
setDimension(96, 80);
|
2023-02-14 02:48:33 +01:00
|
|
|
|
|
|
|
inputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, -1 )
|
|
|
|
.setVisible(true, true);
|
|
|
|
|
|
|
|
inputs[| 1] = nodeValue("Positions", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [] )
|
|
|
|
.setDisplay(VALUE_DISPLAY.vector);
|
|
|
|
|
|
|
|
inputs[| 2] = nodeValue("Rotations", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [] )
|
|
|
|
.setDisplay(VALUE_DISPLAY.vector);
|
|
|
|
|
|
|
|
inputs[| 3] = nodeValue("Scales", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 );
|
|
|
|
|
|
|
|
inputs[| 4] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white );
|
|
|
|
|
|
|
|
inputs[| 5] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 );
|
|
|
|
|
2023-03-13 10:45:56 +01:00
|
|
|
inputs[| 6] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone )
|
|
|
|
.setVisible(true, false);
|
|
|
|
|
2023-02-14 02:48:33 +01:00
|
|
|
outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, -1 );
|
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static update = function(frame = CURRENT_FRAME) {
|
2023-10-02 08:57:44 +02:00
|
|
|
var parts = getInputData(0);
|
2023-02-14 02:48:33 +01:00
|
|
|
if(!is_array(parts)) return;
|
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
var _pos = getInputData(1);
|
|
|
|
var _sca = getInputData(2);
|
|
|
|
var _rot = getInputData(3);
|
|
|
|
var _col = getInputData(4);
|
|
|
|
var _alp = getInputData(5);
|
|
|
|
var _srf = getInputData(6);
|
2023-02-14 02:48:33 +01:00
|
|
|
|
2023-11-13 07:11:52 +01:00
|
|
|
var nParts = array_create(array_length(parts));
|
|
|
|
|
|
|
|
var _a_pos = is_array(_pos);
|
|
|
|
var _a_sca = is_array(_sca);
|
|
|
|
var _a_rot = is_array(_rot);
|
|
|
|
var _a_col = is_array(_col);
|
|
|
|
var _a_alp = is_array(_alp);
|
|
|
|
var _a_srf = is_array(_srf);
|
|
|
|
|
|
|
|
var _l_pos = array_length(_pos);
|
|
|
|
var _l_sca = array_length(_sca);
|
|
|
|
var _l_rot = array_length(_rot);
|
|
|
|
var _l_col = array_length(_col);
|
|
|
|
var _l_alp = array_length(_alp);
|
|
|
|
var _l_srf = array_length(_srf);
|
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(parts); i < n; i++ ) {
|
2023-11-13 07:11:52 +01:00
|
|
|
var nPart = parts[i].clone();
|
2023-02-14 02:48:33 +01:00
|
|
|
|
2023-11-13 07:11:52 +01:00
|
|
|
if(_a_pos && _l_pos > i && is_array(_pos[i])) {
|
|
|
|
nPart.x = _pos[i][0];
|
|
|
|
nPart.y = _pos[i][1];
|
2023-02-14 02:48:33 +01:00
|
|
|
}
|
|
|
|
|
2023-11-13 07:11:52 +01:00
|
|
|
if(_a_sca && _l_sca > i && is_array(_sca[i])) {
|
|
|
|
nPart.scx = _sca[i][0];
|
|
|
|
nPart.scy = _sca[i][1];
|
2023-02-14 02:48:33 +01:00
|
|
|
}
|
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
if(_a_rot && _l_rot > i) nPart.rot = array_safe_get_fast(_rot, i);
|
|
|
|
if(_a_col && _l_col > i) nPart.blend = array_safe_get_fast(_col, i);
|
|
|
|
if(_a_alp && _l_alp > i) nPart.alp = array_safe_get_fast(_alp, i);
|
|
|
|
if(_a_srf && _l_srf > i) nPart.surf = array_safe_get_fast(_srf, i);
|
2023-03-13 10:45:56 +01:00
|
|
|
|
2023-11-13 07:11:52 +01:00
|
|
|
nParts[i] = nPart;
|
2023-02-14 02:48:33 +01:00
|
|
|
}
|
|
|
|
|
2023-11-13 07:11:52 +01:00
|
|
|
outputs[| 0].setValue(nParts);
|
2023-02-14 02:48:33 +01:00
|
|
|
}
|
|
|
|
|
2023-03-05 07:16:44 +01:00
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
2023-02-14 02:48:33 +01:00
|
|
|
var bbox = drawGetBbox(xx, yy, _s);
|
|
|
|
draw_sprite_fit(node_draw_icon, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
|
|
|
}
|
2023-10-09 16:07:33 +02:00
|
|
|
|
|
|
|
getPreviewingNode = VFX_PREVIEW_NODE;
|
2023-02-14 02:48:33 +01:00
|
|
|
}
|