Pixel-Composer/scripts/node_smoke_update/node_smoke_update.gml

41 lines
1.2 KiB
Text
Raw Normal View History

2024-03-19 09:49:29 +01:00
function Node_Smoke_Update(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group) constructor {
2023-02-14 02:48:33 +01:00
name = "Update Fluid";
2023-11-10 11:32:46 +01:00
color = COLORS.node_blend_smoke;
icon = THEME.smoke_sim;
2024-03-28 14:18:02 +01:00
setDimension(96, 96);
2023-02-14 02:48:33 +01:00
manual_ungroupable = false;
2024-08-20 10:15:53 +02:00
newInput(0, nodeValue("Domain", self, CONNECT_TYPE.input, VALUE_TYPE.sdomain, noone))
2023-02-14 02:48:33 +01:00
.setVisible(true, true);
2024-08-18 06:16:20 +02:00
newInput(1, nodeValue_Bool("Active", self, true));
2023-02-14 02:48:33 +01:00
input_display_list = [
["Domain", false], 0,
["Update", false], 1,
]
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("Domain", self, VALUE_TYPE.sdomain, noone));
2023-02-14 02:48:33 +01:00
2023-10-09 16:07:33 +02:00
static update = function(frame = CURRENT_FRAME) {
2023-07-06 19:49:16 +02:00
if(!PROJECT.animator.is_playing) return;
2023-03-02 07:59:14 +01:00
2024-08-08 06:57:51 +02:00
var _dom = inputs[0].getValue(frame);
var _act = inputs[1].getValue(frame);
2023-10-07 09:09:18 +02:00
FLUID_DOMAIN_CHECK
2024-08-08 06:57:51 +02:00
outputs[0].setValue(_dom);
2023-02-14 02:48:33 +01:00
if(!_act) return;
if(is_surface(_dom.sf_world))
fd_rectangle_update(_dom);
texture_set_interpolation(false);
}
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);
var _act = getInputData(1);
2023-11-10 11:32:46 +01:00
draw_sprite_fit(_act? s_node_smokeSim_update : s_node_smokeSim_update_paused, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
2023-02-14 02:48:33 +01:00
}
}