2024-01-07 12:18:20 +01:00
|
|
|
function Node_FLIP_Update(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|
|
|
name = "Update";
|
|
|
|
color = COLORS.node_blend_fluid;
|
|
|
|
icon = THEME.fluid_sim;
|
2024-03-28 14:18:02 +01:00
|
|
|
setDimension(96, 96);
|
2024-01-07 12:18:20 +01:00
|
|
|
|
|
|
|
manual_ungroupable = false;
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(0, nodeValue_Fdomain("Domain", self, noone))
|
2024-01-07 12:18:20 +01:00
|
|
|
.setVisible(true, true);
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(1, nodeValue_Bool("Update", self, true));
|
2024-01-07 12:18:20 +01:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(2, nodeValue_Bool("Override timestep", self, false));
|
2024-01-07 12:18:20 +01:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(3, nodeValue_Float("Timestep", self, 0.01));
|
2024-01-07 12:18:20 +01:00
|
|
|
|
|
|
|
input_display_list = [ 0, 1,
|
|
|
|
["Timestep", false], 2, 3,
|
|
|
|
];
|
|
|
|
|
2024-09-04 03:57:11 +02:00
|
|
|
newOutput(0, nodeValue_Output("Domain", self, VALUE_TYPE.fdomain, noone));
|
2024-01-07 12:18:20 +01:00
|
|
|
|
|
|
|
static update = function(frame = CURRENT_FRAME) {
|
|
|
|
var domain = getInputData(0);
|
|
|
|
var _active = getInputData(1);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
outputs[0].setValue(domain);
|
2024-01-07 12:18:20 +01:00
|
|
|
|
|
|
|
if(!instance_exists(domain)) return;
|
|
|
|
if(domain.domain == noone) return;
|
|
|
|
|
|
|
|
var _timeover = getInputData(2);
|
|
|
|
var _timestep = getInputData(3);
|
|
|
|
|
|
|
|
if(_timeover) domain.dt = _timestep;
|
|
|
|
|
|
|
|
if(_active && IS_PLAYING) domain.step();
|
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
|
|
|
var bbox = drawGetBbox(xx, yy, _s);
|
|
|
|
var _active = getInputData(1);
|
|
|
|
|
|
|
|
draw_sprite_fit(_active? s_node_fluidSim_update : s_node_fluidSim_update_paused, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
|
|
|
}
|
2024-03-22 09:44:11 +01:00
|
|
|
|
|
|
|
static getPreviewValues = function() { var domain = getInputData(0); return instance_exists(domain)? domain.domain_preview : noone; }
|
2024-01-07 12:18:20 +01:00
|
|
|
}
|