mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 14:36:13 +01:00
Array over-cache
This commit is contained in:
parent
12f185f3cd
commit
ce9006cd23
3 changed files with 17 additions and 19 deletions
|
@ -45,8 +45,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
var _n = _l[| _index];
|
var _n = _l[| _index];
|
||||||
var _in = output? _n.getValue() : getInputData(_index);
|
var _in = output? _n.getValue() : getInputData(_index);
|
||||||
|
|
||||||
//print($"Getting value {name} [{_index}, {_arr}]: {_n.isArray()} = {_in}");
|
//if(_index == 3) print($"Getting value {name} [{_index}, {_arr}]: {_n.isArray(_in)} = {_in}");
|
||||||
if(!_n.isArray()) return _in;
|
if(!_n.isArray(_in)) return _in;
|
||||||
|
|
||||||
var _aIndex = _arr;
|
var _aIndex = _arr;
|
||||||
if(!is_array(_in)) return 0;
|
if(!is_array(_in)) return 0;
|
||||||
|
|
|
@ -21,10 +21,6 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
||||||
inputs[| 3] = nodeValue("Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ])
|
inputs[| 3] = nodeValue("Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ])
|
||||||
.setDisplay(VALUE_DISPLAY.vector, { #region
|
.setDisplay(VALUE_DISPLAY.vector, { #region
|
||||||
side_button : new buttonAnchor(function(ind) {
|
side_button : new buttonAnchor(function(ind) {
|
||||||
//var _dim = getDimension();
|
|
||||||
//var _pos = getSingleValue(2);
|
|
||||||
//var _anc = getSingleValue(3);
|
|
||||||
|
|
||||||
switch(ind) {
|
switch(ind) {
|
||||||
case 0 : inputs[| 3].setValue([ 0.0, 0.0 ]); break;
|
case 0 : inputs[| 3].setValue([ 0.0, 0.0 ]); break;
|
||||||
case 1 : inputs[| 3].setValue([ 0.5, 0.0 ]); break;
|
case 1 : inputs[| 3].setValue([ 0.5, 0.0 ]); break;
|
||||||
|
@ -146,6 +142,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
||||||
|
|
||||||
var _b = inputs[| 3].editWidget.side_button;
|
var _b = inputs[| 3].editWidget.side_button;
|
||||||
var _a = anc[0] * 2 + anc[1] * 20;
|
var _a = anc[0] * 2 + anc[1] * 20;
|
||||||
|
|
||||||
switch(_a) {
|
switch(_a) {
|
||||||
case 0 : _b.index = 0; break;
|
case 0 : _b.index = 0; break;
|
||||||
case 1 : _b.index = 1; break;
|
case 1 : _b.index = 1; break;
|
||||||
|
|
|
@ -1512,7 +1512,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
if(!is_array(def_val))
|
if(!is_array(def_val))
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
if(isDynamicArray(display_type))
|
if(isDynamicArray())
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
if(isArray(val))
|
if(isArray(val))
|
||||||
|
@ -1714,35 +1714,36 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static isArray = function(val = undefined) { #region
|
static isArray = function(val = undefined) { #region
|
||||||
if(val == undefined) {
|
var _cac = val == undefined;
|
||||||
|
|
||||||
|
if(_cac) {
|
||||||
if(cache_array[0]) return cache_array[1];
|
if(cache_array[0]) return cache_array[1];
|
||||||
val = getValue();
|
val = getValue();
|
||||||
|
cache_array[0] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_array[0] = true;
|
if(!is_array(val)) { //Value is scalar
|
||||||
|
if(_cac) cache_array[1] = false;
|
||||||
if(!is_array(val)) { //Value is array
|
return false;
|
||||||
cache_array[1] = false;
|
|
||||||
return cache_array[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array_depth == 0 && !typeArray(display_type)) { //Value is not an array by default, and no array depth enforced
|
if(array_depth == 0 && !typeArray(display_type)) { //Value is not an array by default, and no array depth enforced
|
||||||
cache_array[1] = true;
|
if(_cac) cache_array[1] = true;
|
||||||
return cache_array[1];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ar = val;
|
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
|
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(!is_array(ar) || !array_length(ar)) { //empty array
|
||||||
cache_array[1] = false;
|
if(_cac) cache_array[1] = false;
|
||||||
return cache_array[1];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ar = ar[0];
|
ar = ar[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_array[1] = is_array(ar);
|
if(_cac) cache_array[1] = is_array(ar);
|
||||||
return cache_array[1];
|
return is_array(ar);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static arrayLength = function(val = undefined) { #region
|
static arrayLength = function(val = undefined) { #region
|
||||||
|
|
Loading…
Reference in a new issue