aray awerning

This commit is contained in:
Tanasart 2024-06-23 12:30:42 +07:00
parent 1f06d3ebd4
commit 23c185fdd8
6 changed files with 15 additions and 29 deletions

View file

@ -4,8 +4,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
inputs[| 0] = nodeValue("Particle sprite", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone );
inputs[| 1] = nodeValue("Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4, "Frames delay between each particle spawn." )
.rejectArray();
inputs[| 1] = nodeValue("Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4, "Frames delay between each particle spawn." );
inputs[| 2] = nodeValue("Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 2, 2 ], "Amount of particle spawn in that frame." )
.setDisplay(VALUE_DISPLAY.range, { linked : true });
@ -14,7 +13,6 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
.setDisplay(VALUE_DISPLAY.area);
inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.rejectArray()
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map" ] );
inputs[| 5] = nodeValue("Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 20, 30 ] )
@ -75,6 +73,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
.setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Random" ]);
inputs[| 25] = nodeValue("Boundary data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [])
.setArrayDepth(1)
.setVisible(false, true);
inputs[| 26] = nodeValue("On animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, ANIM_END_ACTION.loop)
@ -89,7 +88,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
inputs[| 30] = nodeValue("Distribution map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
inputs[| 31] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, [] );
inputs[| 31] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, [] )
.setArrayDepth(1);
inputs[| 32] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 32].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
@ -137,7 +137,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
inputs[| 49] = nodeValue("Stretch Animation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
for (var i = 16, n = ds_list_size(inputs); i < n; i++)
for (var i = 2, n = ds_list_size(inputs); i < n; i++)
inputs[| i].rejectArray();
input_len = ds_list_size(inputs);

View file

@ -729,14 +729,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static getInputData = function(index, def = 0) { #region
INLINE
return array_safe_get_fast(inputs_data, index, def);
var _dat = array_safe_get_fast(inputs_data, index, def);
return _dat;
} #endregion
static setInputData = function(index, value) { #region
INLINE
inputs_data[index] = value;
var _inp = inputs[| index];
inputs_data[index] = value;
if(is_struct(_inp)) input_value_map[$ _inp.internalName] = value;
} #endregion

View file

@ -5,10 +5,12 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
onSurfaceSize = function() { return getInputData(input_len, DEF_SURF); };
inputs[| 3] = nodeValue("Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_AREA_REF )
.rejectArray()
.setUnitRef(onSurfaceSize, VALUE_UNIT.reference)
.setDisplay(VALUE_DISPLAY.area, { onSurfaceSize });
inputs[| input_len + 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.rejectArray()
.setDisplay(VALUE_DISPLAY.vector);
inputs[| input_len + 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering.")

View file

@ -8,6 +8,7 @@ function Node_String_Join(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 1] = nodeValue("Divider", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "")
.rejectArray();
inputs[| 1].editWidget.format = TEXT_AREA_FORMAT.delimiter;
outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, "");

View file

@ -6,6 +6,7 @@ function Node_Surface_data(_x, _y, _group = noone) : Node(_x, _y, _group) constr
outputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
outputs[| 1] = nodeValue("Array length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0);

View file

@ -1340,28 +1340,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
cache_array[0] = true;
}
if(!is_array(val)) { //Value is scalar
if(_cac) cache_array[1] = false;
return false;
}
if(array_depth == 0 && !typeArray(display_type)) { // Value is not an array by default, and no array depth enforced
if(_cac) cache_array[1] = true;
return true;
}
var ar = val;
repeat(array_depth + typeArray(display_type)) { //Recursively get the first member of subarray to check if value has depth of "array_depth" or not
if(!is_array(ar) || !array_length(ar)) { //empty array
if(_cac) cache_array[1] = false;
return false;
}
ar = ar[0];
}
if(_cac) cache_array[1] = is_array(ar);
return is_array(ar);
var _dep = array_get_depth(val) > array_depth + typeArray(display_type);
if(_cac) cache_array[1] = _dep;
return _dep;
} #endregion
static arrayLength = function(val = undefined) { #region