2023-02-28 09:43:01 +01:00
|
|
|
function Node_Fluid_Update(_x, _y, _group = noone) : Node_Fluid(_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;
|
2023-12-22 08:42:02 +01:00
|
|
|
w = 96;
|
2023-02-14 02:48:33 +01:00
|
|
|
min_h = 96;
|
|
|
|
|
2023-12-22 08:42:02 +01:00
|
|
|
manual_ungroupable = false;
|
|
|
|
|
2023-12-29 14:30:54 +01:00
|
|
|
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.sdomain, noone)
|
2023-02-14 02:48:33 +01:00
|
|
|
.setVisible(true, true);
|
|
|
|
|
|
|
|
inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
|
|
|
|
|
|
|
input_display_list = [
|
|
|
|
["Domain", false], 0,
|
|
|
|
["Update", false], 1,
|
|
|
|
]
|
|
|
|
|
2023-12-29 14:30:54 +01:00
|
|
|
outputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.output, 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
|
|
|
|
2023-02-14 02:48:33 +01:00
|
|
|
var _dom = inputs[| 0].getValue(frame);
|
|
|
|
var _act = inputs[| 1].getValue(frame);
|
2023-10-07 09:09:18 +02:00
|
|
|
|
|
|
|
FLUID_DOMAIN_CHECK
|
2023-02-14 02:48:33 +01:00
|
|
|
outputs[| 0].setValue(_dom);
|
|
|
|
|
|
|
|
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);
|
2023-10-02 08:57:44 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|