FLIP fluid
|
@ -1501,6 +1501,7 @@
|
|||
{"name":"node_pb_draw_semi_ellipse","order":6,"path":"scripts/node_pb_draw_semi_ellipse/node_pb_draw_semi_ellipse.yy",},
|
||||
{"name":"s_node_sampler","order":11,"path":"sprites/s_node_sampler/s_node_sampler.yy",},
|
||||
{"name":"__background_get_element","order":1,"path":"scripts/__background_get_element/__background_get_element.yy",},
|
||||
{"name":"node_FLIP_add_rigidbody","order":15,"path":"scripts/node_FLIP_add_rigidbody/node_FLIP_add_rigidbody.yy",},
|
||||
{"name":"node_FFT","order":12,"path":"scripts/node_FFT/node_FFT.yy",},
|
||||
{"name":"s_node_random_shape","order":28,"path":"sprites/s_node_random_shape/s_node_random_shape.yy",},
|
||||
{"name":"s_node_path_bridge","order":16,"path":"sprites/s_node_path_bridge/s_node_path_bridge.yy",},
|
||||
|
|
|
@ -1854,6 +1854,7 @@
|
|||
{"id":{"name":"s_node_sampler","path":"sprites/s_node_sampler/s_node_sampler.yy",},},
|
||||
{"id":{"name":"__background_get_element","path":"scripts/__background_get_element/__background_get_element.yy",},},
|
||||
{"id":{"name":"node_anim_curve","path":"scripts/node_anim_curve/node_anim_curve.yy",},},
|
||||
{"id":{"name":"node_FLIP_add_rigidbody","path":"scripts/node_FLIP_add_rigidbody/node_FLIP_add_rigidbody.yy",},},
|
||||
{"id":{"name":"node_FFT","path":"scripts/node_FFT/node_FFT.yy",},},
|
||||
{"id":{"name":"s_node_random_shape","path":"sprites/s_node_random_shape/s_node_random_shape.yy",},},
|
||||
{"id":{"name":"s_node_path_bridge","path":"sprites/s_node_path_bridge/s_node_path_bridge.yy",},},
|
||||
|
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
@ -7,4 +7,9 @@
|
|||
yscale = 1;
|
||||
|
||||
depth = -9999;
|
||||
|
||||
type = RIGID_SHAPE.box;
|
||||
width = 1;
|
||||
height = 1;
|
||||
radius = 1;
|
||||
#endregion
|
77
scripts/node_FLIP_add_rigidbody/node_FLIP_add_rigidbody.gml
Normal file
|
@ -0,0 +1,77 @@
|
|||
function Node_FLIP_Add_Rigidbody(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Add Rigidbody";
|
||||
color = COLORS.node_blend_fluid;
|
||||
icon = THEME.fluid_sim;
|
||||
w = 96;
|
||||
min_h = 96;
|
||||
|
||||
manual_ungroupable = false;
|
||||
|
||||
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone )
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[| 1] = nodeValue("Objects", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, [] )
|
||||
.setVisible(true, true);
|
||||
|
||||
input_display_list = [ 0,
|
||||
["Collider", false], 1,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone );
|
||||
|
||||
obstracle = new FLIP_Obstracle();
|
||||
index = 0;
|
||||
toReset = true;
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
var domain = getInputData(0);
|
||||
if(!instance_exists(domain)) return;
|
||||
|
||||
outputs[| 0].setValue(domain);
|
||||
|
||||
var _objects = getInputData(1);
|
||||
if(array_empty(_objects)) return;
|
||||
|
||||
var _obj = _objects[0];
|
||||
|
||||
if(IS_FIRST_FRAME || toReset) {
|
||||
index = FLIP_createObstracle(domain.domain);
|
||||
array_push(domain.obstracles, obstracle);
|
||||
}
|
||||
|
||||
toReset = false;
|
||||
|
||||
if(_obj.type == RIGID_SHAPE.circle) {
|
||||
|
||||
var _p = point_rotate(_obj.radius, _obj.radius, 0, 0, _obj.image_angle);
|
||||
var px = _obj.phy_position_x + _p[0];
|
||||
var py = _obj.phy_position_y + _p[1];
|
||||
|
||||
obstracle.x = px;
|
||||
obstracle.y = py;
|
||||
|
||||
FLIP_setObstracle_circle(domain.domain, index, px, py, _obj.radius);
|
||||
} else if(_obj.type == RIGID_SHAPE.box) {
|
||||
|
||||
var _p = point_rotate(_obj.width / 2, _obj.height / 2, 0, 0, _obj.image_angle);
|
||||
var px = _obj.phy_position_x + _p[0];
|
||||
var py = _obj.phy_position_y + _p[1];
|
||||
|
||||
obstracle.x = px;
|
||||
obstracle.y = py;
|
||||
|
||||
FLIP_setObstracle_rectangle(domain.domain, index, px, py, _obj.width, _obj.height);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_bbox(s_node_fluidSim_add_collider, 0, bbox);
|
||||
} #endregion
|
||||
|
||||
static getPreviewValues = function() { var domain = getInputData(0); return instance_exists(domain)? domain.domain_preview : noone; }
|
||||
}
|
11
scripts/node_FLIP_add_rigidbody/node_FLIP_add_rigidbody.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_FLIP_add_rigidbody",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "FLIP",
|
||||
"path": "folders/nodes/data/simulation/FLIP.yy",
|
||||
},
|
||||
}
|
|
@ -57,8 +57,8 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
inputs[| 3].drawOverlay(hover, active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori);
|
||||
var a = inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
var a = inputs[| 3].drawOverlay(hover, active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori);
|
||||
} #endregion
|
||||
|
||||
static step = function() { #region
|
||||
|
|
|
@ -395,10 +395,11 @@ function __initNodes() {
|
|||
var rigidSim = ds_list_create(); #region
|
||||
addNodeCatagory("RigidSim", rigidSim, ["Node_Rigid_Group", "Node_Rigid_Group_Inline"]);
|
||||
ds_list_add(rigidSim, "Group");
|
||||
addNodeObject(rigidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]).hideRecent().hideGlobal();
|
||||
addNodeObject(rigidSim, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]).hideRecent().hideGlobal();
|
||||
addNodeObject(rigidSim, "Render", s_node_rigidSim_render_output, "Node_Rigid_Render_Output", [1, Node_Rigid_Render_Output]).hideRecent().hideGlobal();
|
||||
|
||||
addNodeObject(rigidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]).hideRecent().hideGlobal();
|
||||
addNodeObject(rigidSim, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]).hideRecent().hideGlobal();
|
||||
addNodeObject(rigidSim, "Render", s_node_rigidSim_render_output, "Node_Rigid_Render_Output", [1, Node_Rigid_Render_Output]).hideRecent().hideGlobal();
|
||||
addNodeObject(rigidSim, "RigidSim Global", s_node_rigidSim_global, "Node_Rigid_Global", [1, Node_Rigid_Global]).setVersion(1110).hideRecent();
|
||||
|
||||
ds_list_add(rigidSim, "RigidSim");
|
||||
addNodeObject(rigidSim, "Object", s_node_rigidSim_object, "Node_Rigid_Object", [1, Node_Rigid_Object],, "Spawn a rigidbody object.").hideRecent().setVersion(1110);
|
||||
addNodeObject(rigidSim, "Object Spawner", s_node_rigidSim_object_spawner, "Node_Rigid_Object_Spawner", [1, Node_Rigid_Object_Spawner],, "Spawn multiple rigidbody objects.").hideRecent().setVersion(1110);
|
||||
|
@ -447,6 +448,7 @@ function __initNodes() {
|
|||
ds_list_add(flipSim, "Affectors");
|
||||
addNodeObject(flipSim, "Apply Velocity", s_node_fluidSim_apply_velocity, "Node_FLIP_Apply_Velocity", [1, Node_FLIP_Apply_Velocity]).hideRecent().setVersion(11620);
|
||||
addNodeObject(flipSim, "Add Collider", s_node_fluidSim_force, "Node_FLIP_Apply_Force", [1, Node_FLIP_Apply_Force]).hideRecent().setVersion(11620);
|
||||
//addNodeObject(flipSim, "Add Rigidbody", s_node_fluidSim_force, "Node_FLIP_Add_Rigidbody", [1, Node_FLIP_Add_Rigidbody]).hideRecent().setVersion(11680);
|
||||
addNodeObject(flipSim, "Repel", s_node_fluidSim_repulse, "Node_FLIP_Repel", [1, Node_FLIP_Repel]).hideRecent().setVersion(11680);
|
||||
addNodeObject(flipSim, "Vortex", s_node_fluidSim_vortex, "Node_FLIP_Vortex", [1, Node_FLIP_Vortex]).hideRecent().setVersion(11680);
|
||||
|
||||
|
@ -1126,7 +1128,6 @@ function __initNodes() {
|
|||
addNodeObject(hid, "Sort Output", s_node_grid_hex_noise, "Node_Iterator_Sort_Output", [1, Node_Iterator_Sort_Output]).hideRecent();
|
||||
addNodeObject(hid, "Onion Skin", s_node_cache, "Node_Onion_Skin", [1, Node_Onion_Skin]).setVersion(1147).hideRecent();
|
||||
addNodeObject(hid, "RigidSim", s_node_rigidSim, "Node_Rigid_Group", [1, Node_Rigid_Group],, "Create group for rigidbody simulation.").setVersion(1110).hideRecent();
|
||||
addNodeObject(hid, "RigidSim Global", s_node_rigidSim_global, "Node_Rigid_Global", [1, Node_Rigid_Global]).setVersion(1110).hideRecent();
|
||||
addNodeObject(hid, "SmokeSim", s_node_smokeSim_group, "Node_Smoke_Group", [1, Node_Smoke_Group],, "Create group for fluid simulation.").setVersion(1120).hideRecent();
|
||||
addNodeObject(hid, "StrandSim", s_node_strandSim, "Node_Strand_Group", [1, Node_Strand_Group], ["Hair"], "Create group for hair simulation.").setVersion(1140).hideRecent();
|
||||
addNodeObject(hid, "Feedback", s_node_feedback, "Node_Feedback_Inline", [1, Node_Feedback_Inline]).hideRecent();
|
||||
|
|
|
@ -28,19 +28,15 @@ function Node_Rigid_Activate(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
var _act = getInputData(1);
|
||||
|
||||
if(!is_array(_obj)) _obj = [ _obj ];
|
||||
if(!is_array(_obj)) return;
|
||||
|
||||
for( var i = 0, n = array_length(_obj); i < n; i++ ) {
|
||||
var _o = _obj[i].object;
|
||||
if(!is_array(_o)) _o = [ _o ];
|
||||
var obj = _obj[i];
|
||||
|
||||
for( var j = 0; j < array_length(_o); j++ ) {
|
||||
var obj = _o[j];
|
||||
if(obj == noone || !instance_exists(obj)) continue;
|
||||
if(is_undefined(obj.phy_active)) continue;
|
||||
if(obj == noone || !instance_exists(obj)) continue;
|
||||
if(is_undefined(obj.phy_active)) continue;
|
||||
|
||||
obj.phy_active = _act;
|
||||
}
|
||||
obj.phy_active = _act;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,14 +61,6 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
})]);
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
if(attributes.show_objects)
|
||||
for( var i = 0, n = ds_list_size(group.nodes); i < n; i++ ) {
|
||||
var _node = group.nodes[| i];
|
||||
if(!is_instanceof(_node, Node_Rigid_Object)) continue;
|
||||
var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
active &= !_hov;
|
||||
}
|
||||
|
||||
var _typ = getInputData(1);
|
||||
var _pos = getInputData(2);
|
||||
var px = _x + _pos[0] * _s;
|
||||
|
@ -131,39 +123,42 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
if((_typ > 0) && CURRENT_FRAME != _frm)
|
||||
return;
|
||||
|
||||
if(!is_array(_obj)) _obj = [ _obj ];
|
||||
if(!is_array(_obj)) return;
|
||||
|
||||
for( var i = 0, n = array_length(_obj); i < n; i++ ) {
|
||||
var _o = _obj[i].object;
|
||||
if(!is_array(_o)) _o = [ _o ];
|
||||
var obj = _obj[i];
|
||||
|
||||
for( var j = 0; j < array_length(_o); j++ ) {
|
||||
var obj = _o[j];
|
||||
if(obj == noone || !instance_exists(obj)) continue;
|
||||
if(is_undefined(obj.phy_active)) continue;
|
||||
if(obj == noone || !instance_exists(obj)) continue;
|
||||
if(is_undefined(obj.phy_active)) continue;
|
||||
|
||||
with(obj) {
|
||||
if(_typ == 0 && _sco == 0)
|
||||
physics_apply_force(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
else if(_typ == 0 && _sco == 1)
|
||||
physics_apply_local_force(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
else if(_typ == 1 && _sco == 0)
|
||||
physics_apply_impulse(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
else if(_typ == 1 && _sco == 1)
|
||||
physics_apply_local_impulse(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
else if(_typ == 2)
|
||||
with(obj) {
|
||||
switch(_typ) {
|
||||
case 0 :
|
||||
if(_sco == 0) physics_apply_force(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
else physics_apply_local_force(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
break;
|
||||
|
||||
case 1 :
|
||||
if(_sco == 0) physics_apply_impulse(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
else physics_apply_local_impulse(_pos[0], _pos[1], _for[0], _for[1]);
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
physics_apply_torque(_tor);
|
||||
else if(_typ == 3) {
|
||||
var dir = point_direction(_pos[0], _pos[1], phy_com_x, phy_com_y);
|
||||
break;
|
||||
|
||||
case 3 :
|
||||
var dis = point_distance(_pos[0], _pos[1], phy_com_x, phy_com_y);
|
||||
|
||||
if(dis < _rad) {
|
||||
var dir = point_direction(_pos[0], _pos[1], phy_com_x, phy_com_y);
|
||||
|
||||
var str = _str * sqr(1 - dis / _rad);
|
||||
var fx = lengthdir_x(str, dir);
|
||||
var fy = lengthdir_y(str, dir);
|
||||
physics_apply_impulse(_pos[0], _pos[1], fx, fy);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
enum RIGID_SHAPE {
|
||||
box,
|
||||
circle,
|
||||
mesh
|
||||
}
|
||||
|
||||
function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Object";
|
||||
color = COLORS.node_blend_simulation;
|
||||
|
@ -58,10 +64,10 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
.rejectArray()
|
||||
.setAnimable(false);
|
||||
|
||||
inputs[| 12] = nodeValue("Collision group", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
inputs[| 12] = nodeValue("Collision group", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1)
|
||||
.rejectArray()
|
||||
|
||||
outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, self);
|
||||
outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, object);
|
||||
|
||||
input_display_list = [ 8, 12,
|
||||
["Texture", false], 6,
|
||||
|
@ -150,7 +156,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
draw_surface_ext_safe(_tex, _pr_x, _pr_y, _s, _s, 0, c_white, 0.5);
|
||||
} #endregion
|
||||
|
||||
static drawOverlayPreview = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
static drawOverlayPreview = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var _pos = getInputData(7);
|
||||
var _tex = getInputData(6);
|
||||
|
||||
|
@ -578,10 +584,12 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
if(object == noone) {
|
||||
object = instance_create_depth(ox - sw / 2, oy - sh / 2, 0, oRigidbody);
|
||||
object.surface = _tex;
|
||||
|
||||
} else if(instance_exists(object)) {
|
||||
for( var i = 0, n = array_length(object.fixture); i < n; i++ )
|
||||
physics_remove_fixture(object, object.fixture[i]);
|
||||
object.fixture = [];
|
||||
|
||||
} else
|
||||
return noone;
|
||||
|
||||
|
@ -591,6 +599,11 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
physics_fixture_set_box_shape(fixture, ww / 2, hh / 2);
|
||||
|
||||
fixtureCreate(fixture, object, ww / 2, hh / 2);
|
||||
|
||||
object.type = RIGID_SHAPE.box;
|
||||
object.width = ww;
|
||||
object.height = hh;
|
||||
|
||||
} else if(_shp == 1) {
|
||||
var fixture = physics_fixture_create();
|
||||
var rr = min(ww, hh) / 2;
|
||||
|
@ -598,6 +611,10 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
physics_fixture_set_circle_shape(fixture, rr);
|
||||
|
||||
fixtureCreate(fixture, object, rr, rr);
|
||||
|
||||
object.type = RIGID_SHAPE.circle;
|
||||
object.radius = rr;
|
||||
|
||||
} else if(_shp == 2) {
|
||||
var meshes = attributes.mesh;
|
||||
if(array_safe_get(meshes, index, noone) == noone)
|
||||
|
@ -661,6 +678,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
fixtureCreate(fixture, object, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
object.type = RIGID_SHAPE.mesh;
|
||||
}
|
||||
|
||||
return object;
|
||||
|
@ -668,6 +687,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
if(IS_FIRST_FRAME) reset();
|
||||
|
||||
outputs[| 0].setValue(object);
|
||||
} #endregion
|
||||
|
||||
static step = function() { #region
|
||||
|
|
|
@ -34,7 +34,7 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group
|
|||
|
||||
inputs[| 7] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom_range(10000, 99999))
|
||||
|
||||
outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, self);
|
||||
outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, object);
|
||||
|
||||
input_display_list = [ 0, 7,
|
||||
["Spawn", false], 6, 1, 2, 3, 5, 4,
|
||||
|
@ -54,11 +54,11 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group
|
|||
for( var i = 0, n = ds_list_size(group.nodes); i < n; i++ ) {
|
||||
var _node = group.nodes[| i];
|
||||
if(!is_instanceof(_node, Node_Rigid_Object)) continue;
|
||||
var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
var _hov = _node.drawOverlayPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
active &= !_hov;
|
||||
}
|
||||
|
||||
inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
return inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static reset = function() {
|
||||
|
@ -109,6 +109,8 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group
|
|||
spawn(_sed);
|
||||
else if(_typ == 1 && CURRENT_FRAME == _frm)
|
||||
spawn(_sed);
|
||||
|
||||
outputs[| 0].setValue(object);
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
|
|
|
@ -31,10 +31,8 @@ function Node_Rigid_Override(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, noone );
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var objNode = getInputData(0);
|
||||
outputs[| 0].setValue(objNode);
|
||||
if(!variable_struct_exists(objNode, "object")) return;
|
||||
var objs = objNode.object;
|
||||
var objs = getInputData(0);
|
||||
outputs[| 0].setValue(objs);
|
||||
|
||||
var _pos = getInputData(1);
|
||||
var _sca = getInputData(2);
|
||||
|
|
|
@ -29,6 +29,8 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
insp2UpdateTooltip = "Clear cache";
|
||||
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
|
||||
|
||||
preview_surface = noone;
|
||||
|
||||
static onInspector2Update = function() { clearCache(); }
|
||||
|
||||
static createNewInput = function() { #region
|
||||
|
@ -72,16 +74,18 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) {
|
||||
var _node = gr.nodes[| i];
|
||||
if(!is_instanceof(_node, Node_Rigid_Object)) continue;
|
||||
var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
var _hov = _node.drawOverlayPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
active &= !_hov;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
if(recoverCache() || !PROJECT.animator.is_playing)
|
||||
return;
|
||||
|
||||
var _dim = getInputData(0);
|
||||
preview_surface = surface_verify(preview_surface, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
if(!(TESTING && keyboard_check(ord("D"))) && (recoverCache() || !PROJECT.animator.is_playing))
|
||||
return;
|
||||
|
||||
var _rnd = getInputData(1);
|
||||
var _outSurf = outputs[| 0].getValue();
|
||||
|
||||
|
@ -98,28 +102,21 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
} else {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
var objNode = getInputData(i);
|
||||
if(!is_array(objNode)) objNode = [ objNode ];
|
||||
if(!is_array(objNode)) continue;
|
||||
|
||||
for( var j = 0; j < array_length(objNode); j++ ) {
|
||||
if(!variable_struct_exists(objNode[j], "object")) continue;
|
||||
var obj = objNode[j].object;
|
||||
|
||||
if(!is_array(obj)) obj = [ obj ];
|
||||
|
||||
for( var k = 0; k < array_length(obj); k++ ) {
|
||||
var _o = obj[k];
|
||||
var _o = objNode[j];
|
||||
|
||||
if(_o == noone || !instance_exists(_o)) continue;
|
||||
if(is_undefined(_o.phy_active)) continue;
|
||||
if(_o == noone || !instance_exists(_o)) continue;
|
||||
if(is_undefined(_o.phy_active)) continue;
|
||||
|
||||
var ixs = max(0, _o.xscale);
|
||||
var iys = max(0, _o.yscale);
|
||||
var ixs = max(0, _o.xscale);
|
||||
var iys = max(0, _o.yscale);
|
||||
|
||||
var xx = _rnd? round(_o.phy_position_x) : _o.phy_position_x;
|
||||
var yy = _rnd? round(_o.phy_position_y) : _o.phy_position_y;
|
||||
var xx = _rnd? round(_o.phy_position_x) : _o.phy_position_x;
|
||||
var yy = _rnd? round(_o.phy_position_y) : _o.phy_position_y;
|
||||
|
||||
draw_surface_ext_safe(_o.surface, xx, yy, ixs, iys, _o.image_angle, _o.image_blend, _o.image_alpha);
|
||||
}
|
||||
draw_surface_ext_safe(_o.surface, xx, yy, ixs, iys, _o.image_angle, _o.image_blend, _o.image_alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,4 +127,10 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
surface_reset_target();
|
||||
cacheCurrentFrame(_outSurf);
|
||||
} #endregion
|
||||
|
||||
static getPreviewValues = function() { #region
|
||||
var _surf = outputs[| 0].getValue();
|
||||
if(is_surface(_surf)) return _surf;
|
||||
return preview_surface;
|
||||
} #endregion
|
||||
}
|
|
@ -116,27 +116,21 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
|
|||
} else {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
var objNode = getInputData(i);
|
||||
if(!is_array(objNode)) objNode = [ objNode ];
|
||||
if(!is_array(objNode)) continue;
|
||||
|
||||
for( var j = 0; j < array_length(objNode); j++ ) {
|
||||
if(!variable_struct_exists(objNode[j], "object")) continue;
|
||||
var obj = objNode[j].object;
|
||||
var _o = objNode[j];
|
||||
|
||||
if(!is_array(obj)) obj = [ obj ];
|
||||
|
||||
for( var k = 0; k < array_length(obj); k++ ) {
|
||||
var _o = obj[k];
|
||||
if(_o == noone || !instance_exists(_o)) continue;
|
||||
if(is_undefined(_o.phy_active)) continue;
|
||||
if(_o == noone || !instance_exists(_o)) continue;
|
||||
if(is_undefined(_o.phy_active)) continue;
|
||||
|
||||
var ixs = max(0, _o.xscale);
|
||||
var iys = max(0, _o.yscale);
|
||||
var ixs = max(0, _o.xscale);
|
||||
var iys = max(0, _o.yscale);
|
||||
|
||||
var xx = _rnd? round(_o.phy_position_x) : _o.phy_position_x;
|
||||
var yy = _rnd? round(_o.phy_position_y) : _o.phy_position_y;
|
||||
var xx = _rnd? round(_o.phy_position_x) : _o.phy_position_x;
|
||||
var yy = _rnd? round(_o.phy_position_y) : _o.phy_position_y;
|
||||
|
||||
draw_surface_ext_safe(_o.surface, xx, yy, ixs, iys, _o.image_angle, _o.image_blend, _o.image_alpha);
|
||||
}
|
||||
draw_surface_ext_safe(_o.surface, xx, yy, ixs, iys, _o.image_angle, _o.image_blend, _o.image_alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,8 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
.setVisible(false);
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var objNode = getInputData(0);
|
||||
outputs[| 0].setValue(objNode);
|
||||
if(!variable_struct_exists(objNode, "object")) return;
|
||||
var objs = objNode.object;
|
||||
var objs = getInputData(0);
|
||||
outputs[| 0].setValue(objs);
|
||||
|
||||
var _get = [];
|
||||
var _val = [];
|
||||
|
|
|
@ -34,7 +34,8 @@ function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _s
|
|||
}
|
||||
|
||||
if(interact && active && point_in_circle(_mx, _my, _ax, _ay, 8)) {
|
||||
_id = 1;
|
||||
hover = 1;
|
||||
_id = 1;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
drag_type = 1;
|
||||
|
|