mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
aray awerning
This commit is contained in:
parent
1f06d3ebd4
commit
23c185fdd8
6 changed files with 15 additions and 29 deletions
|
@ -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[| 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." )
|
inputs[| 1] = nodeValue("Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4, "Frames delay between each particle spawn." );
|
||||||
.rejectArray();
|
|
||||||
|
|
||||||
inputs[| 2] = nodeValue("Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 2, 2 ], "Amount of particle spawn in that frame." )
|
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 });
|
.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);
|
.setDisplay(VALUE_DISPLAY.area);
|
||||||
|
|
||||||
inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||||
.rejectArray()
|
|
||||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map" ] );
|
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map" ] );
|
||||||
|
|
||||||
inputs[| 5] = nodeValue("Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 20, 30 ] )
|
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" ]);
|
.setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Random" ]);
|
||||||
|
|
||||||
inputs[| 25] = nodeValue("Boundary data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [])
|
inputs[| 25] = nodeValue("Boundary data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [])
|
||||||
|
.setArrayDepth(1)
|
||||||
.setVisible(false, true);
|
.setVisible(false, true);
|
||||||
|
|
||||||
inputs[| 26] = nodeValue("On animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, ANIM_END_ACTION.loop)
|
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[| 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))
|
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) });
|
.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 );
|
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();
|
inputs[| i].rejectArray();
|
||||||
|
|
||||||
input_len = ds_list_size(inputs);
|
input_len = ds_list_size(inputs);
|
||||||
|
|
|
@ -729,14 +729,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
static getInputData = function(index, def = 0) { #region
|
static getInputData = function(index, def = 0) { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
return array_safe_get_fast(inputs_data, index, def);
|
var _dat = array_safe_get_fast(inputs_data, index, def);
|
||||||
|
return _dat;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static setInputData = function(index, value) { #region
|
static setInputData = function(index, value) { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
inputs_data[index] = value;
|
|
||||||
var _inp = inputs[| index];
|
var _inp = inputs[| index];
|
||||||
|
inputs_data[index] = value;
|
||||||
if(is_struct(_inp)) input_value_map[$ _inp.internalName] = value;
|
if(is_struct(_inp)) input_value_map[$ _inp.internalName] = value;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
|
|
@ -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); };
|
onSurfaceSize = function() { return getInputData(input_len, DEF_SURF); };
|
||||||
|
|
||||||
inputs[| 3] = nodeValue("Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_AREA_REF )
|
inputs[| 3] = nodeValue("Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_AREA_REF )
|
||||||
|
.rejectArray()
|
||||||
.setUnitRef(onSurfaceSize, VALUE_UNIT.reference)
|
.setUnitRef(onSurfaceSize, VALUE_UNIT.reference)
|
||||||
.setDisplay(VALUE_DISPLAY.area, { onSurfaceSize });
|
.setDisplay(VALUE_DISPLAY.area, { onSurfaceSize });
|
||||||
|
|
||||||
inputs[| input_len + 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
|
inputs[| input_len + 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
|
||||||
|
.rejectArray()
|
||||||
.setDisplay(VALUE_DISPLAY.vector);
|
.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.")
|
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.")
|
||||||
|
|
|
@ -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, "")
|
inputs[| 1] = nodeValue("Divider", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "")
|
||||||
.rejectArray();
|
.rejectArray();
|
||||||
|
|
||||||
inputs[| 1].editWidget.format = TEXT_AREA_FORMAT.delimiter;
|
inputs[| 1].editWidget.format = TEXT_AREA_FORMAT.delimiter;
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, "");
|
outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, "");
|
||||||
|
|
|
@ -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 ])
|
outputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, [ 1, 1 ])
|
||||||
.setDisplay(VALUE_DISPLAY.vector);
|
.setDisplay(VALUE_DISPLAY.vector);
|
||||||
|
|
||||||
outputs[| 1] = nodeValue("Array length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0);
|
outputs[| 1] = nodeValue("Array length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1340,28 +1340,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
cache_array[0] = true;
|
cache_array[0] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_array(val)) { //Value is scalar
|
var _dep = array_get_depth(val) > array_depth + typeArray(display_type);
|
||||||
if(_cac) cache_array[1] = false;
|
if(_cac) cache_array[1] = _dep;
|
||||||
return false;
|
return _dep;
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static arrayLength = function(val = undefined) { #region
|
static arrayLength = function(val = undefined) { #region
|
||||||
|
|
Loading…
Reference in a new issue