2023-07-21 12:40:20 +02:00
|
|
|
function Node_PB_Fx(_x, _y, _group = noone) : Node_PB(_x, _y, _group) constructor {
|
|
|
|
name = "PB FX";
|
2024-06-28 08:40:21 +02:00
|
|
|
batch_output = false;
|
2023-07-21 12:40:20 +02:00
|
|
|
|
2024-08-20 10:15:53 +02:00
|
|
|
newInput(0, nodeValue("pBox", self, CONNECT_TYPE.input, VALUE_TYPE.pbBox, noone))
|
2023-07-21 12:40:20 +02:00
|
|
|
.setVisible(true, true);
|
|
|
|
|
2024-09-04 03:57:11 +02:00
|
|
|
newOutput(0, nodeValue_Output("pBox", self, VALUE_TYPE.pbBox, noone));
|
2023-11-26 13:16:38 +01:00
|
|
|
|
|
|
|
static getGraphPreviewSurface = function() {
|
2024-08-08 06:57:51 +02:00
|
|
|
var _nbox = outputs[0].getValue();
|
2023-11-26 13:16:38 +01:00
|
|
|
if(_nbox == noone) return noone;
|
|
|
|
if(is_array(_nbox)) {
|
|
|
|
if(array_empty(_nbox)) return noone;
|
|
|
|
_nbox = _nbox[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
return _nbox.content;
|
|
|
|
}
|
2023-07-23 20:21:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#macro PB_FX_PBOX if(_output_index == 1) { \
|
2024-08-08 06:57:51 +02:00
|
|
|
var _surf = outputs[0].getValue(); \
|
2024-03-31 05:36:11 +02:00
|
|
|
if(is_array(_surf)) _surf = array_safe_get_fast(_surf, _array_index); \
|
2023-07-23 20:21:35 +02:00
|
|
|
if(!is_surface(_surf)) return noone; \
|
|
|
|
\
|
|
|
|
var _pbox = new __pbBox(); \
|
|
|
|
\
|
2023-10-12 07:07:24 +02:00
|
|
|
_pbox.w = surface_get_width_safe(_surf); \
|
|
|
|
_pbox.h = surface_get_height_safe(_surf); \
|
2023-07-23 20:21:35 +02:00
|
|
|
\
|
2023-10-12 07:07:24 +02:00
|
|
|
_pbox.layer_w = surface_get_width_safe(_surf); \
|
|
|
|
_pbox.layer_h = surface_get_height_safe(_surf); \
|
2023-07-23 20:21:35 +02:00
|
|
|
\
|
|
|
|
_pbox.mask = surface_create(_pbox.w, _pbox.h); \
|
|
|
|
surface_set_shader(_pbox.mask, sh_pb_to_mask); \
|
2024-07-10 03:45:25 +02:00
|
|
|
draw_surface_safe(_surf); \
|
2023-07-23 20:21:35 +02:00
|
|
|
surface_reset_shader(); \
|
|
|
|
\
|
|
|
|
return _pbox; \
|
|
|
|
}
|