This commit is contained in:
Tanasart 2024-08-06 19:04:41 +07:00
parent b5b999d868
commit 9e2b0fdcea
28 changed files with 382 additions and 223 deletions

View file

@ -1145,6 +1145,7 @@
{"name":"node_twirl","order":4,"path":"scripts/node_twirl/node_twirl.yy",},
{"name":"node_unicode","order":1,"path":"scripts/node_unicode/node_unicode.yy",},
{"name":"node_value_base","order":1,"path":"scripts/node_value_base/node_value_base.yy",},
{"name":"node_value_output","order":1,"path":"scripts/node_value_output/node_value_output.yy",},
{"name":"node_value_types","order":2,"path":"scripts/node_value_types/node_value_types.yy",},
{"name":"node_value_validators","order":3,"path":"scripts/node_value_validators/node_value_validators.yy",},
{"name":"node_vector_cross_2D","order":11,"path":"scripts/node_vector_cross_2D/node_vector_cross_2D.yy",},

View file

@ -1747,6 +1747,8 @@
{"id":{"name":"node_twirl","path":"scripts/node_twirl/node_twirl.yy",},},
{"id":{"name":"node_unicode","path":"scripts/node_unicode/node_unicode.yy",},},
{"id":{"name":"node_value_base","path":"scripts/node_value_base/node_value_base.yy",},},
{"id":{"name":"node_value_float","path":"scripts/node_value_float/node_value_float.yy",},},
{"id":{"name":"node_value_output","path":"scripts/node_value_output/node_value_output.yy",},},
{"id":{"name":"node_value_types","path":"scripts/node_value_types/node_value_types.yy",},},
{"id":{"name":"node_value_validators","path":"scripts/node_value_validators/node_value_validators.yy",},},
{"id":{"name":"node_value","path":"scripts/node_value/node_value.yy",},},

View file

@ -100,7 +100,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
tool_lookat = new NodeTool( "Move Target", THEME.tools_3d_transform_object );
static getToolSettings = function() { #region
static getToolSettings = function() {
var _posm = getInputData(in_d3d + 9);
switch(_posm) {
@ -110,9 +110,9 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
}
return [];
} #endregion
}
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) { #region
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
var _rot = inputs[| 1].display_data.angle_display;
tools = _rot == QUARTERNION_DISPLAY.quarterion? tool_quate : tool_euler;
if(_rot == QUARTERNION_DISPLAY.euler && isUsingTool("Rotate"))
@ -160,7 +160,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
draw_set_color(COLORS._main_icon);
draw_rectangle(_px, _py, _px + _pws, _py + _phs, true);
#endregion
} #endregion
}
static onValueUpdate = function(index) { #region
if(index == in_d3d + 9) PANEL_PREVIEW.tool_current = noone;

View file

@ -26,7 +26,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
UPDATE_PART_FORWARD
static onUpdate = function(frame = CURRENT_FRAME) { #region
static onUpdate = function(frame = CURRENT_FRAME) {
if(IS_PLAYING) runVFX(frame);
if(attributes.Output_pool) {
@ -40,13 +40,13 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
}
outputs[| 0].setValue(_parts);
}
} #endregion
}
static onSpawn = function(_time, part) { #region
static onSpawn = function(_time, part) {
part.step_int = inputs[| input_len + 1].getValue(_time);
} #endregion
}
static onPartCreate = function(part) { #region
static onPartCreate = function(part) {
var vt = outputs[| 1];
if(array_empty(vt.value_to)) return;
@ -57,9 +57,9 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
if(_n.value_from != vt) continue;
_n.node.spawn(part.frame, pv);
}
} #endregion
}
static onPartStep = function(part) { #region
static onPartStep = function(part) {
var vt = outputs[| 2];
if(array_empty(vt.value_to)) return;
@ -70,9 +70,9 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
if(_n.value_from != vt) continue;
_n.node.spawn(part.frame, pv);
}
} #endregion
}
static onPartDestroy = function(part) { #region
static onPartDestroy = function(part) {
var vt = outputs[| 3];
if(array_empty(vt.value_to)) return;
@ -83,7 +83,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
if(_n.value_from != vt) continue;
_n.node.spawn(part.frame, pv);
}
} #endregion
}
static getGraphPreviewSurface = function() { return getInputData(0); }

View file

@ -38,7 +38,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
return inputs[| index];
} setDynamicInput(1, false);
static setBone = function() { #region
static setBone = function() {
//print("Setting dem bones...");
var _b = getInputData(0);
if(_b == noone) return;
@ -89,7 +89,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
input_display_list = _input_display_list;
//print(_input_display_list);
} #endregion
}
tools = [];
@ -103,7 +103,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
posing_mx = 0;
posing_my = 0;
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var _b = outputs[| 0].getValue();
if(_b == noone) return;
@ -115,7 +115,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
var smx = value_snap(mx, _snx);
var smy = value_snap(my, _sny);
if(posing_bone) { #region
if(posing_bone) {
if(posing_type == 0 && posing_bone.parent) { //move
var ang = posing_bone.parent.pose_angle;
var pp = point_rotate(smx - posing_mx, smy - posing_my, 0, 0, -ang);
@ -161,9 +161,9 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
posing_type = noone;
UNDO_HOLDING = false;
}
} #endregion
}
if(anchor_selecting != noone && mouse_press(mb_left, active)) { #region
if(anchor_selecting != noone && mouse_press(mb_left, active)) {
if(anchor_selecting[1] == 0 || anchor_selecting[0].IKlength) { // move
posing_bone = anchor_selecting[0];
if(!ds_map_exists(boneMap, posing_bone.ID))
@ -211,11 +211,11 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
posing_mx = mx;
posing_my = my;
}
} #endregion
} #endregion
}
}
bone_prev = noone;
static step = function() { #region
static step = function() {
var _b = getInputData(0);
if(_b == noone) return;
if(bone_prev != _b) {
@ -226,9 +226,9 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
var _boneCount = ds_list_size(inputs) - input_fix_len;
if(_boneCount != _b.childCount()) setBone();
} #endregion
}
static update = function(frame = CURRENT_FRAME) { #region
static update = function(frame = CURRENT_FRAME) {
var _b = getInputData(0);
if(_b == noone) return;
@ -262,9 +262,9 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
_bone_pose.setPose();
outputs[| 0].setValue(_bone_pose);
} #endregion
}
static getPreviewBoundingBox = function() { #region
static getPreviewBoundingBox = function() {
var minx = 9999999;
var miny = 9999999;
var maxx = -9999999;
@ -297,9 +297,9 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
if(minx == 9999999) return noone;
return BBOX().fromPoints(minx, miny, maxx, maxy);
} #endregion
}
static doApplyDeserialize = function() { #region
static doApplyDeserialize = function() {
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
var inp = inputs[| i];
var idx = struct_try_get(inp.display_data, "bone_id");
@ -308,11 +308,11 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
}
setBone();
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_armature_pose, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
} #endregion
}
}

View file

@ -25,7 +25,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
palette_selecting = noone;
palette_select = [ -1, -1 ];
function setColor(colr) { #region
function setColor(colr) {
palette_selecting = noone;
var _to = array_clone(getInputData(2));
@ -34,7 +34,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
_to[i] = colr;
inputs[| 2].setValue(_to); // Not necessary due to array reference
} #endregion
}
sort_menu = [
new MenuItem("Sort Brightness", function() /*=>*/ { sortPalette(0) }),
@ -49,7 +49,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
new MenuItem("Sort Blue", function() /*=>*/ { sortPalette(7) }),
];
render_palette = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
render_palette = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
var bx = _x;
var by = _y;
@ -179,7 +179,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
}
return hh;
}); #endregion
});
input_display_list = [ 6,
["Surfaces", true], 0, 4, 5, 7, 8,
@ -200,8 +200,8 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
})]);
static sortPalette = function(type) {
var palFrom = inputs[| 1].getValue();
var palTo = inputs[| 2].getValue();
var palFrom = getInputData(1);
var palTo = getInputData(2);
var _map = ds_map_create();
for (var i = 0, n = array_length(palFrom); i < n; i++)
@ -229,8 +229,8 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
inputs[| 2].setValue(palTo);
}
static refreshPalette = function() { #region
var _surf = inputs[| 0].getValue();
static refreshPalette = function() {
var _surf = getInputData(0);
inputs[| 1].setValue([]);
inputs[| 2].setValue([]);
@ -269,19 +269,19 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
inputs[| 1].setValue(palette);
inputs[| 2].setValue(palette);
} #endregion
}
static onValueFromUpdate = function(index) { #region
static onValueFromUpdate = function(index) {
if(LOADING || APPENDING || CLONING) return;
if(index == 0 && attributes.auto_refresh) refreshPalette();
} #endregion
}
static step = function() { #region
static step = function() {
__step_mask_modifier();
} #endregion
}
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData = function(_outSurf, _data, _output_index, _array_index) {
var fr = _data[1];
var to = _data[2];
var tr = _data[3];
@ -302,5 +302,5 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
_outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]);
return _outSurf;
} #endregion
}
}

View file

@ -254,7 +254,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _bx = _mtx + ui(12);
var _by = _mdy + mh / 2;
var _acti = _modi.inputs[| _modi.active_index].getValue();
var _acti = _modi.getInputData(_modi.active_index);
if(_hover && point_in_circle(_m[0], _m[1], _bx, _by, ui(12))) {
draw_sprite_ui_uniform(THEME.visible_12, _acti, _bx, _by - ui(2), 1, c_white);

View file

@ -784,23 +784,24 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static getInputData = function(index, def = 0) { return array_safe_get_fast(inputs_data, index, def); }
static setInputData = function(index, value) {
var _inp = inputs[| index];
inputs_data[index] = value;
if(is_struct(_inp)) input_value_map[$ _inp.internalName] = value;
}
// static setInputData = function(index, value) {
// var _inp = inputs[| index];
// inputs_data[index] = value;
// if(is_struct(_inp)) input_value_map[$ _inp.internalName] = value;
// }
static getInputs = function(frame = CURRENT_FRAME) {
var i = -1;
var n = ds_list_size(inputs);
inputs_data = array_verify(inputs_data, n);
repeat(n) { i++;
var _inp = inputs[| i];
repeat(n) {
var _inp = inputs[| ++i];
if(!is_instanceof(_inp, NodeValue)) continue;
if(!_inp.isDynamic()) continue;
var val = _inp.getValue(frame);
// setInputData(i, val);
inputs_data[i] = val;
input_value_map[$ _inp.internalName] = val;

View file

@ -14,7 +14,7 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
outputs[| 2] = nodeValue("Type", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0 );
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData = function(_outSurf, _data, _output_index, _array_index) {
var gra = _data[0];
switch(_output_index) {
@ -33,14 +33,15 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
}
return 0;
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return;
var grad = inputs[| 0].getValue();
var grad = getInputData(0);
if(!is_array(grad)) grad = [ grad ];
var _h = array_length(grad) * 32;
var _y = bbox.y0;
@ -53,5 +54,5 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -106,7 +106,7 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
use_mod = 0;
use_deg = false;
static _eval = function(a, b, c = 0) { #region
static _eval = function(a, b, c = 0) {
switch(use_mod) {
case MATH_OPERATOR.add : return a + b;
case MATH_OPERATOR.subtract : return a - b;
@ -132,9 +132,9 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
case MATH_OPERATOR.snap : return value_snap(a, b);
}
return 0;
} #endregion
}
static step = function() { #region
static step = function() {
var mode = getInputData(0);
switch(mode) {
@ -219,9 +219,9 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
default: return;
}
} #endregion
}
function evalArray(a, b, c = 0) { #region
function evalArray(a, b, c = 0) {
var _as = is_array(a);
var _bs = is_array(b);
var _cs = is_array(c);
@ -248,9 +248,9 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
);
return val;
} #endregion
}
static update = function(frame = CURRENT_FRAME) { #region
static update = function(frame = CURRENT_FRAME) {
use_mod = getInputData(0);
use_deg = getInputData(3);
@ -260,9 +260,9 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
var val = evalArray(a, b, c);
outputs[| 0].setValue(val);
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
var str = "";
switch(getInputData(0)) {
@ -293,5 +293,5 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
var bbox = drawGetBbox(xx, yy, _s);
var ss = string_scale(str, bbox.w, bbox.h);
draw_text_transformed(bbox.xc, bbox.yc, str, ss * 0.8, ss * 0.8, 0);
} #endregion
}
}

View file

@ -19,7 +19,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
rotator_p = 0;
rotator_m = 0;
inputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
inputs[| 0] = nodeValue_Float("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setVisible(true, true);
inputs[| 1] = nodeValue("Integer", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
@ -34,7 +34,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 5] = nodeValue("Clamp to range", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
outputs[| 0] = nodeValue_Output("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var __ax = getInputData(0);
@ -98,13 +98,16 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
static update = function() {
var _dat = getInputData(0);
outputs[| 0].setValue(_dat);
var _int = getInputData(1);
var _res = processNumber(_dat, _int);
outputs[| 0].setValue(_res);
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
var val = getInputData(0);
var _int = getInputData(1);
@ -122,7 +125,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
switch(disp) {
case 1 : #region
case 1 :
draw_set_text(f_sdf, fa_center, fa_center, _col);
draw_text_transformed(bbox.xc, bbox.y0 + 16 * _s, string(_int? round(val) : val), _s * 0.5, _s * 0.5, 0);
@ -183,9 +186,9 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draggable = false;
}
break; #endregion
break;
case 2 : #region
case 2 :
var _ss = min(bbox.w, bbox.h);
var c0 = (draggable && !rotator_dragging)? colorMultiply(CDEF.main_grey, _col) : colorMultiply(CDEF.main_white, _col);
var c1 = colorMultiply(CDEF.main_dkgrey, _col);
@ -235,8 +238,8 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_set_text(f_sdf, fa_center, fa_center, colorMultiply(CDEF.main_white, _col));
draw_text_transformed(bbox.xc, bbox.yc, _int? string(round(val)) : string_format(val, -1, 2), _s * .5, _s * .5, 0);
break; #endregion
break;
}
} #endregion
}
}

View file

@ -50,20 +50,20 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
outputs[| 0] = nodeValue("Points", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ ])
.setDisplay(VALUE_DISPLAY.vector);
static step = function() { #region
static step = function() {
var _dist = getInputData(1);
inputs[| 2].setVisible(_dist != 2);
inputs[| 4].setVisible(_dist == 2, _dist == 2);
} #endregion
}
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
inputs[| 0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
} #endregion
}
static getPreviewValues = function() { return inputs[| 8].getValue(); }
static getPreviewValues = function() { return getInputData(8); }
static update = function(frame = CURRENT_FRAME) { #region
static update = function(frame = CURRENT_FRAME) {
var _area = getInputData(0);
var _dist = getInputData(1);
var _scat = getInputData(2);
@ -131,10 +131,10 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
});
outputs[| 0].setValue(pos);
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_scatter_point, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
} #endregion
}
}

View file

@ -56,14 +56,14 @@ function Node_Smoke_Add(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group) con
} #endregion
static update = function(frame = CURRENT_FRAME) {
var _dom = inputs[| 0].getValue(frame);
var _mat = inputs[| 1].getValue(frame);
var _pos = inputs[| 2].getValue(frame);
var _act = inputs[| 3].getValue(frame);
var _inh = inputs[| 4].getValue(frame);
var _den = inputs[| 5].getValue(frame);
var _msk = inputs[| 6].getValue(frame);
var _vel = inputs[| 7].getValue(frame);
var _dom = getInputData(0);
var _mat = getInputData(1);
var _pos = getInputData(2);
var _act = getInputData(3);
var _inh = getInputData(4);
var _den = getInputData(5);
var _msk = getInputData(6);
var _vel = getInputData(7);
FLUID_DOMAIN_CHECK
outputs[| 0].setValue(_dom);

View file

@ -37,9 +37,9 @@ function Node_Smoke_Add_Collider(_x, _y, _group = noone) : Node_Smoke(_x, _y, _g
}
static update = function(frame = CURRENT_FRAME) {
var _dom = inputs[| 0].getValue(frame);
var _mat = inputs[| 1].getValue(frame);
var _area = inputs[| 2].getValue(frame);
var _dom = getInputData(0);
var _mat = getInputData(1);
var _area = getInputData(2);
FLUID_DOMAIN_CHECK
outputs[| 0].setValue(_dom);

View file

@ -41,11 +41,11 @@ function Node_Smoke_Apply_Velocity(_x, _y, _group = noone) : Node_Smoke(_x, _y,
}
static update = function(frame = CURRENT_FRAME) {
var _dom = inputs[| 0].getValue(frame);
var _mat = inputs[| 1].getValue(frame);
var _pos = inputs[| 2].getValue(frame);
var _vel = inputs[| 3].getValue(frame);
var _act = inputs[| 4].getValue(frame);
var _dom = getInputData(0);
var _mat = getInputData(1);
var _pos = getInputData(2);
var _vel = getInputData(3);
var _act = getInputData(4);
FLUID_DOMAIN_CHECK
outputs[| 0].setValue(_dom);

View file

@ -54,18 +54,18 @@ function Node_Smoke_Domain(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group)
static update = function(frame = CURRENT_FRAME) { #region
RETURN_ON_REST
var _dim = inputs[| 0].getValue(frame);
var coll = inputs[| 1].getValue(frame);
var mdisTyp = inputs[| 2].getValue(frame);
var mdis = inputs[| 3].getValue(frame);
var vdisTyp = inputs[| 4].getValue(frame);
var vdis = inputs[| 5].getValue(frame);
var acc = inputs[| 6].getValue(frame);
var matInr = inputs[| 7].getValue(frame);
var inPress = inputs[| 8].getValue(frame);
var mMac = inputs[| 9].getValue(frame);
var vMac = inputs[| 10].getValue(frame);
var wrap = inputs[| 11].getValue(frame);
var _dim = getInputData( 0);
var coll = getInputData( 1);
var mdisTyp = getInputData( 2);
var mdis = getInputData( 3);
var vdisTyp = getInputData( 4);
var vdis = getInputData( 5);
var acc = getInputData( 6);
var matInr = getInputData( 7);
var inPress = getInputData( 8);
var mMac = getInputData( 9);
var vMac = getInputData(10);
var wrap = getInputData(11);
if(IS_FIRST_FRAME || !is_surface(domain.sf_world)) {
fd_rectangle_clear(domain);

View file

@ -38,15 +38,15 @@ function Node_Smoke_Render(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group)
if(recoverCache() || !PROJECT.animator.is_playing)
return;
var _dim = inputs[| 1].getValue(frame);
var _dim = getInputData(1);
var _outSurf = outputs[| 0].getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outputs[| 0].setValue(_outSurf);
var _dom = inputs[| 0].getValue(frame);
var _int = inputs[| 2].getValue(frame);
var _drw = inputs[| 3].getValue(frame);
var _upd = inputs[| 4].getValue(frame);
var _dom = getInputData(0);
var _int = getInputData(2);
var _drw = getInputData(3);
var _upd = getInputData(4);
FLUID_DOMAIN_CHECK

View file

@ -34,7 +34,7 @@ function Node_Smoke_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
static onInspector2Update = function() { clearCache(); }
static createOutput = function() { #region
static createOutput = function() {
if(group == noone) return;
if(!is_struct(group)) return;
@ -49,25 +49,25 @@ function Node_Smoke_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
ds_list_add(group.outputs, outParent);
group.refreshNodeDisplay();
group.sortIO();
} if(!LOADING && !APPENDING) createOutput(); #endregion
} if(!LOADING && !APPENDING) createOutput();
static step = function() { #region
static step = function() {
if(!is_instanceof(outParent, NodeValue)) return noone;
outParent.name = display_name;
} #endregion
}
static update = function(frame = CURRENT_FRAME) { #region
static update = function(frame = CURRENT_FRAME) {
if(!is_instanceof(outParent, NodeValue)) return noone;
var _dim = inputs[| 1].getValue(frame);
var _dim = getInputData(1);
var _outSurf = outParent.getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outParent.setValue(_outSurf);
var _dom = inputs[| 0].getValue(frame);
var _int = inputs[| 2].getValue(frame);
var _drw = inputs[| 3].getValue(frame);
var _upd = inputs[| 4].getValue(frame);
var _dom = getInputData(0);
var _int = getInputData(2);
var _drw = getInputData(3);
var _upd = getInputData(4);
FLUID_DOMAIN_CHECK
@ -88,9 +88,9 @@ function Node_Smoke_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
group.outputNode = self;
cacheCurrentFrame(_outSurf);
} #endregion
}
static recoverCache = function(frame = CURRENT_FRAME) { #region
static recoverCache = function(frame = CURRENT_FRAME) {
if(!is_instanceof(outParent, NodeValue)) return false;
if(!cacheExist(frame)) return false;
@ -98,15 +98,15 @@ function Node_Smoke_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
outParent.setValue(_s);
return true;
} #endregion
}
static getGraphPreviewSurface = function() { #region
static getGraphPreviewSurface = function() {
if(!is_instanceof(outParent, NodeValue)) return noone;
return outParent.getValue();
} #endregion
}
static getPreviewValues = function() { #region
static getPreviewValues = function() {
if(!is_instanceof(outParent, NodeValue)) return noone;
return outParent.getValue();
} #endregion
}
}

View file

@ -39,11 +39,11 @@ function Node_Smoke_Repulse(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group)
}
static update = function(frame = CURRENT_FRAME) {
var _dom = inputs[| 0].getValue(frame);
var _pos = inputs[| 1].getValue(frame);
var _rad = inputs[| 2].getValue(frame);
var _str = inputs[| 3].getValue(frame);
var _mod = inputs[| 4].getValue(frame);
var _dom = getInputData(0);
var _pos = getInputData(1);
var _rad = getInputData(2);
var _str = getInputData(3);
var _mod = getInputData(4);
FLUID_DOMAIN_CHECK
outputs[| 0].setValue(_dom);

View file

@ -34,12 +34,12 @@ function Node_Smoke_Turbulence(_x, _y, _group = noone) : Node_Smoke(_x, _y, _gro
}
static update = function(frame = CURRENT_FRAME) {
var _dom = inputs[| 0].getValue(frame);
var _are = inputs[| 1].getValue(frame);
var _str = inputs[| 2].getValue(frame);
var _sca = inputs[| 3].getValue(frame);
var _sed = inputs[| 4].getValue(frame);
var _mod = inputs[| 5].getValue(frame);
var _dom = getInputData(0);
var _are = getInputData(1);
var _str = getInputData(2);
var _sca = getInputData(3);
var _sed = getInputData(4);
var _mod = getInputData(5);
FLUID_DOMAIN_CHECK
outputs[| 0].setValue(_dom);

View file

@ -43,12 +43,12 @@ function Node_Smoke_Vortex(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group)
}
static update = function(frame = CURRENT_FRAME) {
var _dom = inputs[| 0].getValue(frame);
var _pos = inputs[| 1].getValue(frame);
var _rad = inputs[| 2].getValue(frame);
var _str = inputs[| 3].getValue(frame);
var _aio = inputs[| 4].getValue(frame);
var _mod = inputs[| 5].getValue(frame);
var _dom = getInputData(0);
var _pos = getInputData(1);
var _rad = getInputData(2);
var _str = getInputData(3);
var _aio = getInputData(4);
var _mod = getInputData(5);
FLUID_DOMAIN_CHECK
outputs[| 0].setValue(_dom);

View file

@ -55,7 +55,7 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
preview_custom_x_to = 0;
preview_custom_x_max = 0;
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
PROCESSOR_OVERLAY_CHECK
var pos = current_data[4];
@ -74,9 +74,9 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
var hv = inputs[| 5].drawOverlay(hover, active, px, py, _s, _mx, _my, _snx, _sny); active &= hv; _hov |= hv;
return _hov;
} #endregion
}
static drawPreviewToolOverlay = function(hover, active, _mx, _my, _panel) { #region
static drawPreviewToolOverlay = function(hover, active, _mx, _my, _panel) {
var _surf = getInputData(0);
if(!is_array(_surf)) return false;
@ -128,16 +128,16 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
preview_custom_x = lerp_float(preview_custom_x, preview_custom_x_to, 5);
return hov;
} #endregion
}
static preGetInputs = function() { #region
static preGetInputs = function() {
var _surf = inputs[| 0].getValue();
var _arry = inputs[| 12].getValue();
inputs[| 0].setArrayDepth(is_array(_surf) && _arry);
} #endregion
}
static step = function() { #region
static step = function() {
var _high = getInputData(9);
var _surf = getInputData(0);
var _arry = getInputData(12);
@ -149,13 +149,12 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
inputs[| 12].setVisible(is_array(_surf));
#region custom preview
preview_custom = preview_custom_index != noone && is_array(_surf) && _arry;
if(preview_custom) drawPreviewCustom();
#endregion
} #endregion
// custom preview
preview_custom = preview_custom_index != noone && is_array(_surf) && _arry;
if(preview_custom) drawPreviewCustom();
}
static drawPreviewCustom = function() { #region
static drawPreviewCustom = function() {
var _in = getSingleValue(0);
var _dim = getSingleValue(1);
var _shf = getSingleValue(3);
@ -205,9 +204,9 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(is_surface(_prev_s))
draw_surface_ext_safe(_prev_s, _prev_x, _prev_y, 1, 1, _rot, _col, 1);
surface_reset_target();
} #endregion
}
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _in = _data[0];
var _dim = _data[1];
var _amo = _data[2];
@ -282,9 +281,9 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
surface_reset_target();
return _outSurf;
} #endregion
}
static getPreviewValues = function() { #region
static getPreviewValues = function() {
if(preview_custom && is_surface(preview_custom_surface)) return preview_custom_surface;
if(preview_channel >= ds_list_size(outputs)) return noone;
@ -297,5 +296,5 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
}
return outputs[| preview_channel].getValue();
} #endregion
}
}

View file

@ -927,7 +927,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
/////============ RENDER ============
static isRendered = function() { #region
static isRendered = function() {
if(type == VALUE_TYPE.node) return true;
if(value_from == noone) return true;
@ -937,9 +937,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(!controlNode.isRenderActive()) return true;
return controlNode.rendered;
} #endregion
}
static isActiveDynamic = function(frame = CURRENT_FRAME) { #region
static isActiveDynamic = function() {
INLINE
if(value_from_loop) return true;
@ -957,7 +957,30 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
return is_anim;
} #endregion
}
__init_dynamic = true;
static isDynamic = function() {
INLINE
if(__init_dynamic) { __init_dynamic = false; return true; }
if(!IS_PLAYING) return true;
if(value_from_loop) return true;
if(value_from != noone) return true;
if(expUse) {
if(!is_struct(expTree)) return false;
var res = expTree.isDynamic();
switch(res) {
case EXPRESS_TREE_ANIM.none : return false;
case EXPRESS_TREE_ANIM.base_value : force_requeue = true; return is_anim;
case EXPRESS_TREE_ANIM.animated : force_requeue = true; return true;
}
}
return is_anim;
}
/////============= CACHE ============
@ -1178,35 +1201,36 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
else if(value_from && value_from != self)
value_from.getValueRecursive(arr, _time);
if(expUse && is_struct(expTree) && expTree.validate()) {
if(!expUse || !expTree.validate()) return;
if(global.EVALUATE_HEAD == self) {
noti_warning($"Expression evaluation error : recursive call detected.");
} else if(global.EVALUATE_HEAD == noone) {
global.EVALUATE_HEAD = self;
expContext = {
name : name,
node_name : node.display_name,
value : arr[0],
node_values : node.input_value_map,
};
var _exp_res = expTree.eval(variable_clone(expContext));
printIf(global.LOG_EXPRESSION, $">>>> Result = {_exp_res}");
if(is_undefined(_exp_res)) {
arr[@ 0] = 0;
noti_warning("Expression returns undefine values.");
} else
arr[@ 0] = _exp_res;
}
if(global.EVALUATE_HEAD == self) {
noti_warning($"Expression evaluation error : recursive call detected.");
return;
}
if(global.EVALUATE_HEAD == noone) {
global.EVALUATE_HEAD = noone;
global.EVALUATE_HEAD = self;
expContext = {
name : name,
node_name : node.display_name,
value : arr[0],
node_values : node.input_value_map,
};
var _exp_res = expTree.eval(variable_clone(expContext));
printIf(global.LOG_EXPRESSION, $">>>> Result = {_exp_res}");
if(is_undefined(_exp_res)) {
arr[@ 0] = 0;
noti_warning("Expression returns undefine values.");
} else
arr[@ 0] = _exp_res;
}
global.EVALUATE_HEAD = noone;
}
static arrayBalance = function(val) {
@ -1259,7 +1283,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static isTimelineVisible = function() { INLINE return is_anim && value_from == noone; }
show_val = [];
static showValue = function() { #region ////showValue
static showValue = function() { ////showValue
INLINE
var val = 0;
@ -1276,16 +1300,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
val = ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
return val;
} #endregion
}
static unitConvert = function(mode) { #region
static unitConvert = function(mode) {
var _v = animator.values;
for( var i = 0; i < ds_list_size(_v); i++ )
_v[| i].value = unit.convertUnit(_v[| i].value, mode);
} #endregion
}
static isDynamicArray = function() { #region
static isDynamicArray = function() {
if(dynamic_array) return true;
switch(display_type) {
@ -1295,7 +1319,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
return false;
} #endregion
}
static isArray = function(val = undefined) {
var _cac = val == undefined;
@ -1311,7 +1335,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return _dep;
}
static arrayLength = function(val = undefined) { #region
static arrayLength = function(val = undefined) {
val ??= getValue();
if(!isArray(val))
@ -1326,7 +1350,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
ar = ar[0];
return array_length(ar);
} #endregion
}
/////============== SET =============
@ -1427,7 +1451,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return res;
} #endregion
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) { #region
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) {
is_modified = true;
var updated = false;
var _val = val;
@ -1459,6 +1483,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
for( var i = 0, n = array_length(value_to_loop); i < n; i++ )
value_to_loop[i].updateValue();
if(connect_type == JUNCTION_CONNECT.input && self.index >= 0) {
var _val = animator.getValue(time);
// setInputData(self.index, _val);
node.inputs_data[self.index] = _val;
node.input_value_map[$ internalName] = _val;
}
if(!updated) return false;
if(value_tag == "dimension")
@ -1482,14 +1514,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return;
}
if(is_instanceof(node, Node) && self.index >= 0) {
var _val = animator.getValue(time);
// setInputData(self.index, _val);
node.inputs_data[self.index] = _val;
node.input_value_map[$ internalName] = _val;
}
if(tags == VALUE_TAG.updateInTrigger || tags == VALUE_TAG.updateOutTrigger) return true;
if(_update) {
@ -1506,7 +1530,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
onValidate();
return true;
} #endregion
}
static getString = function() {
var val = showValue();

View file

@ -0,0 +1,61 @@
function nodeValue_Float(_name, _node, _connect, _type, _value, _tooltip = "") { return new NodeValue_Float(_name, _node, _connect, _type, _value, _tooltip); }
function NodeValue_Float(_name, _node, _connect, _type, _value, _tooltip = "") : NodeValue(_name, _node, _connect, _type, _value, _tooltip) constructor {
/////============== GET =============
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) {
var typeFrom = nodeFrom == undefined? VALUE_TYPE.any : nodeFrom.type;
if(typeFrom == VALUE_TYPE.text) value = toNumber(value);
if(validator != noone) value = validator.validate(value);
return value;
}
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
draw_junction_index = type;
return _getValue(_time, applyUnit, arrIndex, log);
}
static _getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, log = false) {
getValueRecursive(self.__curr_get_val, _time);
var val = __curr_get_val[0];
var nod = __curr_get_val[1];
var typ = nod.type;
var dis = nod.display_type;
if(typ != VALUE_TYPE.surface) return valueProcess(val, nod, applyUnit, arrIndex);
// Dimension conversion
if(is_array(val)) {
var eqSize = true;
var sArr = [];
var _osZ = 0;
for( var i = 0, n = array_length(val); i < n; i++ ) {
if(!is_surface(val[i])) continue;
var surfSz = surface_get_dimension(val[i]);
array_push(sArr, surfSz);
if(i && !array_equals(surfSz, _osZ))
eqSize = false;
_osZ = surfSz;
}
if(eqSize) return _osZ;
return sArr;
} else if (is_surface(val))
return [ surface_get_width_safe(val), surface_get_height_safe(val) ];
return [ 1, 1 ];
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
}
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"",
"%Name":"node_value_float",
"isCompatibility":false,
"isDnD":false,
"name":"node_value_float",
"parent":{
"name":"types",
"path":"folders/nodes/values/types.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -0,0 +1,41 @@
function nodeValue_Output(_name, _node, _connect, _type, _value, _tooltip = "") { return new NodeValue_Output(_name, _node, _connect, _type, _value, _tooltip); }
function NodeValue_Output(_name, _node, _connect, _type, _value, _tooltip = "") : NodeValue(_name, _node, _connect, _type, _value, _tooltip) constructor {
/////============== GET =============
output_value = 0;
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
return output_value;
}
static _getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
return output_value;
}
static getValueRecursive = function(arr = __curr_get_val, _time = CURRENT_FRAME) {
arr[@ 0] = output_value;
arr[@ 1] = self;
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return output_value;
}
static showValue = function() {
return output_value;
}
/////============== SET =============
static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { ////Set value
output_value = val;
return true;
}
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) {
output_value = val;
return true;
}
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"",
"%Name":"node_value_output",
"isCompatibility":false,
"isDnD":false,
"name":"node_value_output",
"parent":{
"name":"types",
"path":"folders/nodes/values/types.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -44,8 +44,8 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
wd_maxy = 1;
}),
menuItem(__txt("Focus value"), function() {
var _x = inputs[| 0].getValue();
var _y = inputs[| 1].getValue();
var _x = getInputData(0);
var _y = getInputData(1);
wd_minx = _x - 1;
wd_miny = _y - 1;