New Array boolean opr node.

This commit is contained in:
Tanasart 2025-01-14 11:42:27 +07:00
parent 7c8543af45
commit f075d11357
26 changed files with 610 additions and 372 deletions

View file

@ -723,6 +723,7 @@
{"name":"node_armature_sample","order":13,"path":"scripts/node_armature_sample/node_armature_sample.yy",}, {"name":"node_armature_sample","order":13,"path":"scripts/node_armature_sample/node_armature_sample.yy",},
{"name":"node_armature","order":9,"path":"scripts/node_armature/node_armature.yy",}, {"name":"node_armature","order":9,"path":"scripts/node_armature/node_armature.yy",},
{"name":"node_array_add","order":6,"path":"scripts/node_array_add/node_array_add.yy",}, {"name":"node_array_add","order":6,"path":"scripts/node_array_add/node_array_add.yy",},
{"name":"node_array_boolean_opr","order":23,"path":"scripts/node_array_boolean_opr/node_array_boolean_opr.yy",},
{"name":"node_array_composite","order":17,"path":"scripts/node_array_composite/node_array_composite.yy",}, {"name":"node_array_composite","order":17,"path":"scripts/node_array_composite/node_array_composite.yy",},
{"name":"node_array_convolute","order":16,"path":"scripts/node_array_convolute/node_array_convolute.yy",}, {"name":"node_array_convolute","order":16,"path":"scripts/node_array_convolute/node_array_convolute.yy",},
{"name":"node_array_copy","order":14,"path":"scripts/node_array_copy/node_array_copy.yy",}, {"name":"node_array_copy","order":14,"path":"scripts/node_array_copy/node_array_copy.yy",},
@ -1929,6 +1930,7 @@
{"name":"s_node_armature_sample","order":18,"path":"sprites/s_node_armature_sample/s_node_armature_sample.yy",}, {"name":"s_node_armature_sample","order":18,"path":"sprites/s_node_armature_sample/s_node_armature_sample.yy",},
{"name":"s_node_armature","order":16,"path":"sprites/s_node_armature/s_node_armature.yy",}, {"name":"s_node_armature","order":16,"path":"sprites/s_node_armature/s_node_armature.yy",},
{"name":"s_node_array_add","order":1,"path":"sprites/s_node_array_add/s_node_array_add.yy",}, {"name":"s_node_array_add","order":1,"path":"sprites/s_node_array_add/s_node_array_add.yy",},
{"name":"s_node_array_boolean_opr","order":23,"path":"sprites/s_node_array_boolean_opr/s_node_array_boolean_opr.yy",},
{"name":"s_node_array_composite","order":2,"path":"sprites/s_node_array_composite/s_node_array_composite.yy",}, {"name":"s_node_array_composite","order":2,"path":"sprites/s_node_array_composite/s_node_array_composite.yy",},
{"name":"s_node_array_convolute","order":3,"path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",}, {"name":"s_node_array_convolute","order":3,"path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",},
{"name":"s_node_array_copy","order":4,"path":"sprites/s_node_array_copy/s_node_array_copy.yy",}, {"name":"s_node_array_copy","order":4,"path":"sprites/s_node_array_copy/s_node_array_copy.yy",},

View file

@ -1101,6 +1101,7 @@
{"$GMIncludedFile":"","%Name":"tooltip_spr.png","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Transform/Node_Warp","name":"tooltip_spr.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"tooltip_spr.png","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Transform/Node_Warp","name":"tooltip_spr.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Transform/Node_Wrap_Area","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Transform/Node_Wrap_Area","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Add","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Add","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Boolean_Opr","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Composite","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Composite","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Convolute","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Convolute","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Copy","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Copy","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -1109,7 +1110,6 @@
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Get","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Get","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Insert","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Insert","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Length","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Length","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Range copy","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Range","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Range","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Rearrange","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Rearrange","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Remove","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Remove","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -1120,6 +1120,7 @@
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Shuffle","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Shuffle","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Sort","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Sort","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Split","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Split","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Unique copy","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Unique","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Unique","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Zip","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array_Zip","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Array","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -1883,6 +1884,7 @@
{"id":{"name":"node_armature_sample","path":"scripts/node_armature_sample/node_armature_sample.yy",},}, {"id":{"name":"node_armature_sample","path":"scripts/node_armature_sample/node_armature_sample.yy",},},
{"id":{"name":"node_armature","path":"scripts/node_armature/node_armature.yy",},}, {"id":{"name":"node_armature","path":"scripts/node_armature/node_armature.yy",},},
{"id":{"name":"node_array_add","path":"scripts/node_array_add/node_array_add.yy",},}, {"id":{"name":"node_array_add","path":"scripts/node_array_add/node_array_add.yy",},},
{"id":{"name":"node_array_boolean_opr","path":"scripts/node_array_boolean_opr/node_array_boolean_opr.yy",},},
{"id":{"name":"node_array_composite","path":"scripts/node_array_composite/node_array_composite.yy",},}, {"id":{"name":"node_array_composite","path":"scripts/node_array_composite/node_array_composite.yy",},},
{"id":{"name":"node_array_convolute","path":"scripts/node_array_convolute/node_array_convolute.yy",},}, {"id":{"name":"node_array_convolute","path":"scripts/node_array_convolute/node_array_convolute.yy",},},
{"id":{"name":"node_array_copy","path":"scripts/node_array_copy/node_array_copy.yy",},}, {"id":{"name":"node_array_copy","path":"scripts/node_array_copy/node_array_copy.yy",},},
@ -3253,6 +3255,7 @@
{"id":{"name":"s_node_armature_sample","path":"sprites/s_node_armature_sample/s_node_armature_sample.yy",},}, {"id":{"name":"s_node_armature_sample","path":"sprites/s_node_armature_sample/s_node_armature_sample.yy",},},
{"id":{"name":"s_node_armature","path":"sprites/s_node_armature/s_node_armature.yy",},}, {"id":{"name":"s_node_armature","path":"sprites/s_node_armature/s_node_armature.yy",},},
{"id":{"name":"s_node_array_add","path":"sprites/s_node_array_add/s_node_array_add.yy",},}, {"id":{"name":"s_node_array_add","path":"sprites/s_node_array_add/s_node_array_add.yy",},},
{"id":{"name":"s_node_array_boolean_opr","path":"sprites/s_node_array_boolean_opr/s_node_array_boolean_opr.yy",},},
{"id":{"name":"s_node_array_composite","path":"sprites/s_node_array_composite/s_node_array_composite.yy",},}, {"id":{"name":"s_node_array_composite","path":"sprites/s_node_array_composite/s_node_array_composite.yy",},},
{"id":{"name":"s_node_array_convolute","path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",},}, {"id":{"name":"s_node_array_convolute","path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",},},
{"id":{"name":"s_node_array_copy","path":"sprites/s_node_array_copy/s_node_array_copy.yy",},}, {"id":{"name":"s_node_array_copy","path":"sprites/s_node_array_copy/s_node_array_copy.yy",},},

Binary file not shown.

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"color" "color"
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"color" "color"
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"color" "color"
], ],
"pxc_version":118069,
} }

View file

@ -0,0 +1,10 @@
{
"name":"Array Boolean Opr",
"baseNode":"Node_Array_Boolean_Opr",
"tooltip":"Apply a boolean operation bewteen two arrays.",
"spr":"s_node_array_boolean_opr",
"io":[
"float"
],
"pxc_version":118069,
}

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float" "float"
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -7,4 +7,5 @@
"float", "float",
"surface" "surface"
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -6,4 +6,5 @@
"io":[ "io":[
"float", "float",
], ],
"pxc_version":118069,
} }

View file

@ -748,6 +748,7 @@
"Node_Array_Composite", "Node_Array_Composite",
"Node_Array_Shuffle", "Node_Array_Shuffle",
"Node_Array_Unique", "Node_Array_Unique",
"Node_Array_Boolean_Opr",
{ "label": "/Group Operators" }, { "label": "/Group Operators" },
"Node_Array_Sort", "Node_Array_Sort",
"Node_Iterate_Each_Inline", "Node_Iterate_Each_Inline",

View file

@ -1,390 +1,433 @@
function array_create_2d(_x, _y, val = 0) { #region creation
var _arr = array_create(_x); function array_create_2d(_x, _y, val = 0) {
for( var i = 0; i < _x; i++ ) var _arr = array_create(_x);
_arr[i] = array_create(_y, val); for( var i = 0; i < _x; i++ )
return _arr; _arr[i] = array_create(_y, val);
}
function array_create_from_list(list) {
if(list == undefined) return [];
if(!ds_exists(list, ds_type_list)) return [];
var arr = array_create(ds_list_size(list));
for( var i = 0; i < ds_list_size(list); i++ )
arr[i] = list[| i];
return arr;
}
function array_safe_set(arr, index, value, fill = 0) {
if(!is_array(arr)) return arr;
if(is_array(index)) return arr;
if(index < 0) return arr;
if(index >= array_length(arr)) {
var i = array_length(arr);
for(; i <= index; i++ )
arr[i] = fill;
arr[index] = value;
return arr;
}
array_set(arr, index, value);
return arr;
}
function array_safe_length(arr) {
INLINE
return is_array(arr)? array_length(arr) : 0;
}
function array_fill(arr, startIndex, endIndex, value = 0) {
INLINE
for( var i = max(0, startIndex); i < endIndex; i++ )
arr[i] = value;
}
function array_resize_fill(arr, size, fill = 0) {
if(size < array_length(arr)) {
array_resize(arr, size);
return arr;
}
var i = array_length(arr);
for(; i < size; i++)
arr[i] = fill;
return arr;
}
enum ARRAY_OVERFLOW {
_default,
loop,
pingpong,
clamp
}
#macro aGetF array_safe_get_fast
function array_safe_get_fast(arr, index, def = 0) {
INLINE
return is_array(arr) && index >= 0 && index < array_length(arr)? arr[index] : def;
}
function array_safe_get(arr, index, def = 0, overflow = ARRAY_OVERFLOW._default) {
INLINE
if(!is_array(arr)) return def;
if(is_array(index)) return def;
var len = array_length(arr);
if(len == 0) return def;
if(overflow == ARRAY_OVERFLOW.clamp) {
index = clamp(index, 0, len - 1);
} else if(overflow == ARRAY_OVERFLOW.loop) {
if(index < 0)
index = len - safe_mod(abs(index), len);
index = index % len;
} else if(overflow == ARRAY_OVERFLOW.pingpong) {
if(index < 0) index = len - safe_mod(abs(index), len);
var _plen = len * 2 - 1;
index = index % _plen;
if(index >= len)
index = _plen - index;
}
if(index < 0) return def;
if(index >= len) return def;
return arr[index] == undefined? def : arr[index];
}
function array_push_create(arr, val) {
INLINE
if(!is_array(arr)) return [ val ];
array_push(arr, val);
return arr;
}
function array_get_decimal(arr, index, color = false) {
INLINE
if(!is_array(arr)) return 0;
if(frac(index) == 0) return array_safe_get_fast(arr, index);
var v0 = array_safe_get_fast(arr, floor(index));
var v1 = array_safe_get_fast(arr, floor(index) + 1);
return color?
merge_color(v0, v1, frac(index)) :
lerp(v0, v1, frac(index));
}
function array_exists(arr, val) {
INLINE
self.__temp_val = val;
if(!is_array(arr)) return false;
var _a = array_any(arr, function(_val, _ind) { return isEqual(_val, self.__temp_val); });
self.__temp_val = 0;
return _a;
}
function array_overlap(arr0, arr1) {
INLINE
self.__temp_arr = arr1;
if(!is_array(arr0)) return false;
if(!is_array(arr1)) return false;
var _a = array_any(arr0, function(_val, _ind) { return array_exists(self.__temp_arr, _val); });
self.__temp_arr = 0;
return _a;
}
function array_empty(arr) { INLINE return is_array(arr) && array_length(arr) == 0; }
function array_valid(arr) { INLINE return is_array(arr) && array_length(arr) > 0; }
function array_invalid(arr) { INLINE return !is_array(arr) || array_length(arr) == 0; }
function array_find(arr, val) {
INLINE
self.__temp_val = val;
if(!is_array(arr)) return -1;
var _a = array_find_index(arr, function(_val, _ind) { return isEqual(_val, self.__temp_val); });
self.__temp_val = 0;
return _a;
}
function array_find_string(arr, val) {
INLINE
self.__temp_val = string_lower(val);
if(!is_array(arr)) return -1;
var _a = array_find_index(arr, function(_val, _ind) { return string_lower(_val) == self.__temp_val; });
self.__temp_val = 0;
return _a;
}
function array_remove(arr, val) {
INLINE
if(!is_array(arr)) return;
if(!array_exists(arr, val)) return;
var ind = array_find(arr, val);
array_delete(arr, ind, 1);
}
function array_push_unique(arr, val) {
INLINE
if(!is_array(arr)) return;
if(array_exists(arr, val)) return;
array_push(arr, val);
}
function array_insert_unique(arr, ind, val) {
INLINE
if(!is_array(arr)) return;
if(array_exists(arr, val)) return;
array_insert(arr, ind, val);
}
function array_append(arr, arr0) {
INLINE
if(is_undefined(arr0)) return arr;
if(!is_array(arr)) return arr;
if(!is_array(arr0)) { array_push(arr, arr0); return arr; }
for( var i = 0, n = array_length(arr0); i < n; i++ )
array_push(arr, arr0[i]);
return arr;
}
function array_merge() {
INLINE
var arr = [];
for( var i = 0; i < argument_count; i++ )
array_append(arr, argument[i]);
return arr;
}
function array_clone(arr, _depth = -1) {
INLINE
if(_depth == 0) return arr;
if(!is_array(arr)) return arr;
var _res = [];
for( var i = 0, n = array_length(arr); i < n; i++ )
_res[i] = array_clone(arr[i], _depth--);
return _res;
}
function array_min(arr) {
INLINE
if(!is_array(arr) || array_length(arr) == 0) return 0;
var mn = arr[0];
for( var i = 0, n = array_length(arr); i < n; i++ )
mn = min(mn, arr[i]);
return mn;
}
function array_max(arr) {
INLINE
if(!is_array(arr) || array_length(arr) == 0) return 0;
var mx = arr[0];
for( var i = 0, n = array_length(arr); i < n; i++ )
mx = max(mx, arr[i]);
return mx;
}
function array_get_dimension(arr) {
INLINE
return is_array(arr)? array_length(arr) : 1;
}
function array_shape(arr, first = true, isSurface = false) {
if(!is_array(arr)) {
if(isSurface && is_surface(arr))
return (first? "" : " x ") + string(surface_get_width_safe(arr)) + " x " + string(surface_get_height_safe(arr)) + " px";
return "";
}
var dim = string(array_length(arr));
if(array_length(arr))
dim += array_shape(arr[0], false, isSurface);
return (first? "" : " x ") + dim;
}
function __array_get_depth(arr) { // Read all member, slower
INLINE
if(!is_array(arr)) return 0;
var dep = 0;
for (var i = 0, n = array_length(arr); i < n; i++)
dep = max(dep, __array_get_depth(arr[i]));
return 1 + dep;
}
function array_get_depth(arr) { // Read only the first member, faster
INLINE
if(!is_array(arr)) return 0;
var d = 0;
var p = arr;
while(is_array(p) && !array_empty(p)) {
d++;
p = p[0];
}
return d;
}
function array_spread(arr, _arr = [], _minDepth = 0) {
INLINE
if(array_get_depth(arr) == _minDepth) {
array_push(_arr, arr);
return _arr; return _arr;
} }
for( var i = 0, n = array_length(arr); i < n; i++ ) function array_create_from_list(list) {
array_spread(arr[i], _arr, _minDepth); if(list == undefined) return [];
if(!ds_exists(list, ds_type_list)) return [];
return _arr; var arr = array_create(ds_list_size(list));
} for( var i = 0; i < ds_list_size(list); i++ )
arr[i] = list[| i];
return arr;
}
function array_clone(arr, _depth = -1) {
INLINE
if(_depth == 0) return arr;
if(!is_array(arr)) return arr;
var _res = [];
for( var i = 0, n = array_length(arr); i < n; i++ )
_res[i] = array_clone(arr[i], _depth--);
return _res;
}
#endregion
function array_verify_new(arr, length) { #region check
INLINE function array_empty(arr) { INLINE return is_array(arr) && array_length(arr) == 0; }
function array_valid(arr) { INLINE return is_array(arr) && array_length(arr) > 0; }
function array_invalid(arr) { INLINE return !is_array(arr) || array_length(arr) == 0; }
if(!is_array(arr)) return array_create(length); function array_verify_new(arr, length) {
if(array_length(arr) == length) return arr; INLINE
if(!is_array(arr)) return array_create(length);
if(array_length(arr) == length) return arr;
arr = array_clone(arr, 1);
array_resize(arr, length);
return arr;
}
arr = array_clone(arr, 1); function array_verify(arr, length) {
array_resize(arr, length); INLINE
return arr;
} if(!is_array(arr)) return array_create(length);
if(array_length(arr) == length) return arr;
array_resize(arr, length);
return arr;
}
function array_verify_ext(arr, length, generator) {
INLINE
if(!is_array(arr)) return array_create_ext(length, generator);
var _len = array_length(arr);
if(_len == length) return arr;
array_resize(arr, length);
var i = _len;
repeat(length - _len)
arr[i++] = generator();
return arr;
}
function array_verify(arr, length) { #endregion
INLINE
if(!is_array(arr)) return array_create(length);
if(array_length(arr) == length) return arr;
array_resize(arr, length);
return arr;
}
function array_verify_ext(arr, length, generator) { #region get set
INLINE
if(!is_array(arr)) return array_create_ext(length, generator); enum ARRAY_OVERFLOW {
_default,
loop,
pingpong,
clamp
}
var _len = array_length(arr); #macro aGetF array_safe_get_fast
if(_len == length) return arr; function array_safe_get_fast(arr, index, def = 0) {
INLINE
return is_array(arr) && index >= 0 && index < array_length(arr)? arr[index] : def;
}
array_resize(arr, length); function array_safe_get(arr, index, def = 0, overflow = ARRAY_OVERFLOW._default) {
var i = _len; INLINE
if(!is_array(arr)) return def;
if(is_array(index)) return def;
var len = array_length(arr);
if(len == 0) return def;
if(overflow == ARRAY_OVERFLOW.clamp) {
index = clamp(index, 0, len - 1);
} else if(overflow == ARRAY_OVERFLOW.loop) {
if(index < 0)
index = len - safe_mod(abs(index), len);
index = index % len;
} else if(overflow == ARRAY_OVERFLOW.pingpong) {
if(index < 0) index = len - safe_mod(abs(index), len);
var _plen = len * 2 - 1;
index = index % _plen;
if(index >= len)
index = _plen - index;
}
if(index < 0) return def;
if(index >= len) return def;
return arr[index] == undefined? def : arr[index];
}
repeat(length - _len) function array_get_decimal(arr, index, color = false) {
arr[i++] = generator(); INLINE
if(!is_array(arr)) return 0;
if(frac(index) == 0) return array_safe_get_fast(arr, index);
var v0 = array_safe_get_fast(arr, floor(index));
var v1 = array_safe_get_fast(arr, floor(index) + 1);
return color?
merge_color(v0, v1, frac(index)) :
lerp(v0, v1, frac(index));
}
return arr; function array_safe_length(arr) {
} INLINE
return is_array(arr)? array_length(arr) : 0;
}
function array_insert_after(arr, before, values) { function array_get_dimension(arr) {
INLINE INLINE
return is_array(arr)? array_length(arr) : 1;
}
var _ind = array_find(arr, before) + 1; function array_shape(arr, first = true, isSurface = false) {
if(!is_array(arr)) {
if(isSurface && is_surface(arr))
return (first? "" : " x ") + string(surface_get_width_safe(arr)) + " x " + string(surface_get_height_safe(arr)) + " px";
return "";
}
var dim = string(array_length(arr));
if(array_length(arr))
dim += array_shape(arr[0], false, isSurface);
return (first? "" : " x ") + dim;
}
for( var i = 0, n = array_length(values); i < n; i++ ) function __array_get_depth(arr) { // Read all member, slower
array_insert(arr, _ind + i, values[i]); INLINE
}
if(!is_array(arr)) return 0;
var dep = 0;
for (var i = 0, n = array_length(arr); i < n; i++)
dep = max(dep, __array_get_depth(arr[i]));
return 1 + dep;
}
function array_insert_before(arr, before, values) { function array_get_depth(arr) { // Read only the first member, faster
INLINE INLINE
var _ind = array_find(arr, before); if(!is_array(arr)) return 0;
var d = 0;
for( var i = 0, n = array_length(values); i < n; i++ ) var p = arr;
array_insert(arr, _ind + i, values[i]);
} while(is_array(p) && !array_empty(p)) {
d++;
p = p[0];
}
return d;
}
function array_push_to_back(arr, value) { function array_safe_set(arr, index, value, fill = 0) {
if(!array_exists(arr, value)) return; if(!is_array(arr)) return arr;
if(is_array(index)) return arr;
if(index < 0) return arr;
if(index >= array_length(arr)) {
var i = array_length(arr);
for(; i <= index; i++ )
arr[i] = fill;
arr[index] = value;
return arr;
}
array_set(arr, index, value);
return arr;
}
array_remove(arr, value); function array_fill(arr, startIndex, endIndex, value = 0) {
array_push(arr, value); INLINE
}
for( var i = max(0, startIndex); i < endIndex; i++ )
arr[i] = value;
}
#macro array_equals array_equals_overwrite #endregion
#macro __array_equals array_equals
function array_equals_overwrite(arr1, arr2) { #region find
if(!is_array(arr1) && is_array(arr2)) return false;
if( is_array(arr1) && !is_array(arr2)) return false; function array_exists(arr, val) {
if(!is_array(arr1) && !is_array(arr2)) return arr1 == arr2; INLINE
return __array_equals(arr1, arr2) self.__temp_val = val;
}
if(!is_array(arr)) return false;
var _a = array_any(arr, function(_val, _ind) { return isEqual(_val, self.__temp_val); });
self.__temp_val = 0;
return _a;
}
function array_find(arr, val) {
INLINE
self.__temp_val = val;
if(!is_array(arr)) return -1;
var _a = array_find_index(arr, function(_val, _ind) { return isEqual(_val, self.__temp_val); });
self.__temp_val = 0;
return _a;
}
function array_find_string(arr, val) {
INLINE
self.__temp_val = string_lower(val);
if(!is_array(arr)) return -1;
var _a = array_find_index(arr, function(_val, _ind) { return string_lower(_val) == self.__temp_val; });
self.__temp_val = 0;
return _a;
}
function array_min(arr) {
INLINE
if(!is_array(arr) || array_length(arr) == 0) return 0;
var mn = arr[0];
for( var i = 0, n = array_length(arr); i < n; i++ )
mn = min(mn, arr[i]);
return mn;
}
function array_max(arr) {
INLINE
if(!is_array(arr) || array_length(arr) == 0) return 0;
var mx = arr[0];
for( var i = 0, n = array_length(arr); i < n; i++ )
mx = max(mx, arr[i]);
return mx;
}
#endregion
#region modify
function array_resize_fill(arr, size, fill = 0) {
if(size < array_length(arr)) {
array_resize(arr, size);
return arr;
}
var i = array_length(arr);
for(; i < size; i++)
arr[i] = fill;
return arr;
}
function array_push_create(arr, val) {
INLINE
if(!is_array(arr)) return [ val ];
array_push(arr, val);
return arr;
}
function array_remove(arr, val) {
INLINE
if(!is_array(arr)) return;
if(!array_exists(arr, val)) return;
var ind = array_find(arr, val);
array_delete(arr, ind, 1);
}
function array_push_unique(arr, val) {
INLINE
if(!is_array(arr)) return;
if(array_exists(arr, val)) return;
array_push(arr, val);
}
function array_insert_unique(arr, ind, val) {
INLINE
if(!is_array(arr)) return;
if(array_exists(arr, val)) return;
array_insert(arr, ind, val);
}
function array_insert_after(arr, before, values) {
INLINE
var _ind = array_find(arr, before) + 1;
for( var i = 0, n = array_length(values); i < n; i++ )
array_insert(arr, _ind + i, values[i]);
}
function array_insert_before(arr, before, values) {
INLINE
var _ind = array_find(arr, before);
for( var i = 0, n = array_length(values); i < n; i++ )
array_insert(arr, _ind + i, values[i]);
}
function array_push_to_back(arr, value) {
if(!array_exists(arr, value)) return;
array_remove(arr, value);
array_push(arr, value);
}
function array_spread(arr, _arr = [], _minDepth = 0) {
INLINE
if(array_get_depth(arr) == _minDepth) {
array_push(_arr, arr);
return _arr;
}
for( var i = 0, n = array_length(arr); i < n; i++ )
array_spread(arr[i], _arr, _minDepth);
return _arr;
}
#endregion
#region binary opr
function array_overlap(arr0, arr1) {
INLINE
self.__temp_arr = arr1;
if(!is_array(arr0)) return false;
if(!is_array(arr1)) return false;
var _a = array_any(arr0, function(_val, _ind) { return array_exists(self.__temp_arr, _val); });
self.__temp_arr = 0;
return _a;
}
function array_append(arr, arr0) {
INLINE
if(is_undefined(arr0)) return arr;
if(!is_array(arr)) return arr;
if(!is_array(arr0)) { array_push(arr, arr0); return arr; }
for( var i = 0, n = array_length(arr0); i < n; i++ )
array_push(arr, arr0[i]);
return arr;
}
function array_merge() {
INLINE
var arr = [];
for( var i = 0; i < argument_count; i++ )
array_append(arr, argument[i]);
return arr;
}
#macro array_equals array_equals_overwrite
#macro __array_equals array_equals
function array_equals_overwrite(arr1, arr2) {
if(!is_array(arr1) && is_array(arr2)) return false;
if( is_array(arr1) && !is_array(arr2)) return false;
if(!is_array(arr1) && !is_array(arr2)) return arr1 == arr2;
return __array_equals(arr1, arr2)
}
function array_substract(arr1, arr2) {
if(!is_array(arr1) || !is_array(arr2)) return;
var _hsh = {};
var _arr = [];
for( var i = 0, n = array_length(arr2); i < n; i++ )
_hsh[$ arr2[i]] = (_hsh[$ arr2[i]] ?? 0) + 1;
for( var i = 0, n = array_length(arr1); i < n; i++ ) {
if(!struct_has(_hsh, arr1[i]) || _hsh[$ arr1[i]]-- <= 0)
array_push(_arr, arr1[i]);
}
return _arr;
}
function array_xor(arr1, arr2) {
if(!is_array(arr1) || !is_array(arr2)) return;
var _arr = array_union(array_substract(arr1, arr2), array_substract(arr2, arr1));
return _arr;
}
#endregion

View file

@ -0,0 +1,62 @@
function Node_Array_Boolean_Opr(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Array Boolean Opr";
setDimension(96, 32 + 24);
newInput(0, nodeValue("Array 1", self, CONNECT_TYPE.input, VALUE_TYPE.any, 0))
.setVisible(true, true);
newInput(1, nodeValue("Array 2", self, CONNECT_TYPE.input, VALUE_TYPE.any, 0))
.setVisible(true, true);
newInput(2, nodeValue_Enum_Scroll("Operation", self, 0, [ "Union", "Subtract", "Intersect", "XOR" ]))
.setVisible(true, true);
newOutput(0, nodeValue_Output("Array out", self, VALUE_TYPE.any, []));
input_display_list = [ 2, 0, 1 ];
static update = function(frame = CURRENT_FRAME) {
var arr1 = getInputData(0);
var arr2 = getInputData(1);
var opr = getInputData(2);
inputs[0].setType(VALUE_TYPE.any);
inputs[1].setType(VALUE_TYPE.any);
outputs[0].setType(VALUE_TYPE.any);
if(inputs[0].value_from != noone) {
inputs[0].setType(inputs[0].value_from.type);
inputs[1].setType(inputs[1].value_from.type);
outputs[0].setType(inputs[0].value_from.type);
}
if(!is_array(arr1) || !is_array(arr2)) return;
var _arr;
switch(opr) {
case 0 : _arr = array_union(arr1, arr2); break;
case 1 : _arr = array_substract(arr1, arr2); break;
case 2 : _arr = array_intersection(arr1, arr2); break;
case 3 : _arr = array_xor(arr1, arr2); break;
}
outputs[0].setValue(_arr);
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
var opr = getInputData(2);
var str = "";
switch(opr) {
case 0 : str = "union" break;
case 1 : str = "substract" break;
case 2 : str = "intersection" break;
case 3 : str = "xor" break;
}
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
draw_text_bbox(bbox, str);
}
}

View file

@ -0,0 +1,14 @@
{
"$GMScript":"v1",
"%Name":"node_array_boolean_opr",
"isCompatibility":false,
"isDnD":false,
"name":"node_array_boolean_opr",
"parent":{
"name":"array",
"path":"folders/nodes/data/value/array.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
"tags":[],
}

View file

@ -18,8 +18,8 @@ function __NodeValue_Float(_name, _node, _value, _tooltip = "") : NodeValue(_nam
var dis = nod.display_type; var dis = nod.display_type;
if(typ != VALUE_TYPE.surface) { if(typ != VALUE_TYPE.surface) {
if(typ == VALUE_TYPE.text) val = toNumber(val); if(typ == VALUE_TYPE.text) val = toNumber(val);
if(struct_has(val, "to_real")) val = val.to_real(); if(is_struct(val) && struct_has(val, "to_real")) val = val.to_real();
return valueProcess(val, nod, applyUnit); return valueProcess(val, nod, applyUnit);
} }

View file

@ -20,7 +20,7 @@ function __NodeValue_Int(_name, _node, _value, _tooltip = "") : NodeValue(_name,
if(typ != VALUE_TYPE.surface) { if(typ != VALUE_TYPE.surface) {
if(typ == VALUE_TYPE.text) val = toNumber(val); if(typ == VALUE_TYPE.text) val = toNumber(val);
if(struct_has(val, "to_real")) val = val.to_real(); if(is_struct(val) && struct_has(val, "to_real")) val = val.to_real();
return valueProcess(val, nod, applyUnit); return valueProcess(val, nod, applyUnit);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_array_boolean_opr",
"bboxMode":0,
"bbox_bottom":63,
"bbox_left":0,
"bbox_right":63,
"bbox_top":0,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"3f6813f5-0553-4de8-96d6-c7d745fffe40","name":"3f6813f5-0553-4de8-96d6-c7d745fffe40","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":64,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"8b6cb694-da18-4679-b77a-1770cc5ebe4f","blendMode":0,"displayName":"default","isLocked":false,"name":"8b6cb694-da18-4679-b77a-1770cc5ebe4f","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_array_boolean_opr",
"nineSlice":null,
"origin":4,
"parent":{
"name":"array",
"path":"folders/nodes/icons/value/array.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_array_boolean_opr",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_node_array_boolean_opr",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"3f6813f5-0553-4de8-96d6-c7d745fffe40","path":"sprites/s_node_array_boolean_opr/s_node_array_boolean_opr.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"dd4a2d62-327f-4cc6-856a-909eead3e7d3","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":32,
"yorigin":32,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":64,
}