New Array unique node.

This commit is contained in:
Tanasart 2025-01-14 10:48:38 +07:00
parent fb625e5b0a
commit 7c8543af45
10 changed files with 158 additions and 5 deletions

View file

@ -214,18 +214,18 @@
{"name":"tiler","order":17,"path":"folders/nodes/icons/tiler.yy",}, {"name":"tiler","order":17,"path":"folders/nodes/icons/tiler.yy",},
{"name":"transform","order":13,"path":"folders/nodes/icons/transform.yy",}, {"name":"transform","order":13,"path":"folders/nodes/icons/transform.yy",},
{"name":"value","order":14,"path":"folders/nodes/icons/value.yy",}, {"name":"value","order":14,"path":"folders/nodes/icons/value.yy",},
{"name":"array","order":4,"path":"folders/nodes/icons/value/array.yy",}, {"name":"bool","order":2,"path":"folders/nodes/icons/value/bool.yy",},
{"name":"bool","order":1,"path":"folders/nodes/icons/value/bool.yy",},
{"name":"color","order":10,"path":"folders/nodes/icons/value/color.yy",}, {"name":"color","order":10,"path":"folders/nodes/icons/value/color.yy",},
{"name":"gradient","order":12,"path":"folders/nodes/icons/value/gradient.yy",}, {"name":"gradient","order":12,"path":"folders/nodes/icons/value/gradient.yy",},
{"name":"matrix","order":3,"path":"folders/nodes/icons/value/matrix.yy",}, {"name":"matrix","order":4,"path":"folders/nodes/icons/value/matrix.yy",},
{"name":"mesh","order":9,"path":"folders/nodes/icons/value/mesh.yy",}, {"name":"mesh","order":9,"path":"folders/nodes/icons/value/mesh.yy",},
{"name":"number","order":1,"path":"folders/nodes/icons/value/number.yy",},
{"name":"palette","order":11,"path":"folders/nodes/icons/value/palette.yy",}, {"name":"palette","order":11,"path":"folders/nodes/icons/value/palette.yy",},
{"name":"path","order":5,"path":"folders/nodes/icons/value/path.yy",}, {"name":"path","order":5,"path":"folders/nodes/icons/value/path.yy",},
{"name":"string","order":7,"path":"folders/nodes/icons/value/string.yy",}, {"name":"string","order":7,"path":"folders/nodes/icons/value/string.yy",},
{"name":"struct","order":8,"path":"folders/nodes/icons/value/struct.yy",}, {"name":"struct","order":8,"path":"folders/nodes/icons/value/struct.yy",},
{"name":"surface","order":6,"path":"folders/nodes/icons/value/surface.yy",}, {"name":"surface","order":6,"path":"folders/nodes/icons/value/surface.yy",},
{"name":"vector","order":2,"path":"folders/nodes/icons/value/vector.yy",}, {"name":"vector","order":3,"path":"folders/nodes/icons/value/vector.yy",},
{"name":"VFX","order":16,"path":"folders/nodes/icons/VFX.yy",}, {"name":"VFX","order":16,"path":"folders/nodes/icons/VFX.yy",},
{"name":"values","order":2,"path":"folders/nodes/values.yy",}, {"name":"values","order":2,"path":"folders/nodes/values.yy",},
{"name":"3d","order":1,"path":"folders/nodes/values/types/3d.yy",}, {"name":"3d","order":1,"path":"folders/nodes/values/types/3d.yy",},
@ -730,7 +730,7 @@
{"name":"node_array_find","order":1,"path":"scripts/node_array_find/node_array_find.yy",}, {"name":"node_array_find","order":1,"path":"scripts/node_array_find/node_array_find.yy",},
{"name":"node_array_get","order":7,"path":"scripts/node_array_get/node_array_get.yy",}, {"name":"node_array_get","order":7,"path":"scripts/node_array_get/node_array_get.yy",},
{"name":"node_array_length","order":8,"path":"scripts/node_array_length/node_array_length.yy",}, {"name":"node_array_length","order":8,"path":"scripts/node_array_length/node_array_length.yy",},
{"name":"node_array_pin","order":21,"path":"scripts/node_array_pin/node_array_pin.yy",}, {"name":"node_array_pin","order":22,"path":"scripts/node_array_pin/node_array_pin.yy",},
{"name":"node_array_range","order":9,"path":"scripts/node_array_range/node_array_range.yy",}, {"name":"node_array_range","order":9,"path":"scripts/node_array_range/node_array_range.yy",},
{"name":"node_array_rearrange","order":19,"path":"scripts/node_array_rearrange/node_array_rearrange.yy",}, {"name":"node_array_rearrange","order":19,"path":"scripts/node_array_rearrange/node_array_rearrange.yy",},
{"name":"node_array_remove","order":4,"path":"scripts/node_array_remove/node_array_remove.yy",}, {"name":"node_array_remove","order":4,"path":"scripts/node_array_remove/node_array_remove.yy",},
@ -741,6 +741,7 @@
{"name":"node_array_shuffle","order":10,"path":"scripts/node_array_shuffle/node_array_shuffle.yy",}, {"name":"node_array_shuffle","order":10,"path":"scripts/node_array_shuffle/node_array_shuffle.yy",},
{"name":"node_array_sort","order":11,"path":"scripts/node_array_sort/node_array_sort.yy",}, {"name":"node_array_sort","order":11,"path":"scripts/node_array_sort/node_array_sort.yy",},
{"name":"node_array_split","order":20,"path":"scripts/node_array_split/node_array_split.yy",}, {"name":"node_array_split","order":20,"path":"scripts/node_array_split/node_array_split.yy",},
{"name":"node_array_unique","order":21,"path":"scripts/node_array_unique/node_array_unique.yy",},
{"name":"node_array_zip","order":13,"path":"scripts/node_array_zip/node_array_zip.yy",}, {"name":"node_array_zip","order":13,"path":"scripts/node_array_zip/node_array_zip.yy",},
{"name":"node_array","order":5,"path":"scripts/node_array/node_array.yy",}, {"name":"node_array","order":5,"path":"scripts/node_array/node_array.yy",},
{"name":"node_ase_layer","order":1,"path":"scripts/node_ase_layer/node_ase_layer.yy",}, {"name":"node_ase_layer","order":1,"path":"scripts/node_ase_layer/node_ase_layer.yy",},
@ -1947,6 +1948,7 @@
{"name":"s_node_array_shuffle","order":16,"path":"sprites/s_node_array_shuffle/s_node_array_shuffle.yy",}, {"name":"s_node_array_shuffle","order":16,"path":"sprites/s_node_array_shuffle/s_node_array_shuffle.yy",},
{"name":"s_node_array_sort","order":17,"path":"sprites/s_node_array_sort/s_node_array_sort.yy",}, {"name":"s_node_array_sort","order":17,"path":"sprites/s_node_array_sort/s_node_array_sort.yy",},
{"name":"s_node_array_split","order":20,"path":"sprites/s_node_array_split/s_node_array_split.yy",}, {"name":"s_node_array_split","order":20,"path":"sprites/s_node_array_split/s_node_array_split.yy",},
{"name":"s_node_array_unique","order":22,"path":"sprites/s_node_array_unique/s_node_array_unique.yy",},
{"name":"s_node_array_zip","order":18,"path":"sprites/s_node_array_zip/s_node_array_zip.yy",}, {"name":"s_node_array_zip","order":18,"path":"sprites/s_node_array_zip/s_node_array_zip.yy",},
{"name":"s_node_ase_file_read","order":15,"path":"sprites/s_node_ase_file_read/s_node_ase_file_read.yy",}, {"name":"s_node_ase_file_read","order":15,"path":"sprites/s_node_ase_file_read/s_node_ase_file_read.yy",},
{"name":"s_node_ase_layer","order":14,"path":"sprites/s_node_ase_layer/s_node_ase_layer.yy",}, {"name":"s_node_ase_layer","order":14,"path":"sprites/s_node_ase_layer/s_node_ase_layer.yy",},

View file

@ -1109,6 +1109,7 @@
{"$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",},
@ -1119,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","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",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Iterate_Each_Inline","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Array/Node_Iterate_Each_Inline","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -1900,6 +1902,7 @@
{"id":{"name":"node_array_shuffle","path":"scripts/node_array_shuffle/node_array_shuffle.yy",},}, {"id":{"name":"node_array_shuffle","path":"scripts/node_array_shuffle/node_array_shuffle.yy",},},
{"id":{"name":"node_array_sort","path":"scripts/node_array_sort/node_array_sort.yy",},}, {"id":{"name":"node_array_sort","path":"scripts/node_array_sort/node_array_sort.yy",},},
{"id":{"name":"node_array_split","path":"scripts/node_array_split/node_array_split.yy",},}, {"id":{"name":"node_array_split","path":"scripts/node_array_split/node_array_split.yy",},},
{"id":{"name":"node_array_unique","path":"scripts/node_array_unique/node_array_unique.yy",},},
{"id":{"name":"node_array_zip","path":"scripts/node_array_zip/node_array_zip.yy",},}, {"id":{"name":"node_array_zip","path":"scripts/node_array_zip/node_array_zip.yy",},},
{"id":{"name":"node_array","path":"scripts/node_array/node_array.yy",},}, {"id":{"name":"node_array","path":"scripts/node_array/node_array.yy",},},
{"id":{"name":"node_ase_file_read","path":"scripts/node_ase_file_read/node_ase_file_read.yy",},}, {"id":{"name":"node_ase_file_read","path":"scripts/node_ase_file_read/node_ase_file_read.yy",},},
@ -3269,6 +3272,7 @@
{"id":{"name":"s_node_array_shuffle","path":"sprites/s_node_array_shuffle/s_node_array_shuffle.yy",},}, {"id":{"name":"s_node_array_shuffle","path":"sprites/s_node_array_shuffle/s_node_array_shuffle.yy",},},
{"id":{"name":"s_node_array_sort","path":"sprites/s_node_array_sort/s_node_array_sort.yy",},}, {"id":{"name":"s_node_array_sort","path":"sprites/s_node_array_sort/s_node_array_sort.yy",},},
{"id":{"name":"s_node_array_split","path":"sprites/s_node_array_split/s_node_array_split.yy",},}, {"id":{"name":"s_node_array_split","path":"sprites/s_node_array_split/s_node_array_split.yy",},},
{"id":{"name":"s_node_array_unique","path":"sprites/s_node_array_unique/s_node_array_unique.yy",},},
{"id":{"name":"s_node_array_zip","path":"sprites/s_node_array_zip/s_node_array_zip.yy",},}, {"id":{"name":"s_node_array_zip","path":"sprites/s_node_array_zip/s_node_array_zip.yy",},},
{"id":{"name":"s_node_array","path":"sprites/s_node_array/s_node_array.yy",},}, {"id":{"name":"s_node_array","path":"sprites/s_node_array/s_node_array.yy",},},
{"id":{"name":"s_node_ase_file_read","path":"sprites/s_node_ase_file_read/s_node_ase_file_read.yy",},}, {"id":{"name":"s_node_ase_file_read","path":"sprites/s_node_ase_file_read/s_node_ase_file_read.yy",},},

Binary file not shown.

View file

@ -0,0 +1,9 @@
{
"name":"Array Unique",
"baseNode":"Node_Array_Unique",
"tooltip":"Return a new array with all duplicate values removed.",
"spr":"s_node_array_unique",
"io":[
"float"
],
}

View file

@ -664,6 +664,8 @@
"Node_Statistic", "Node_Statistic",
"Node_Base_Convert", "Node_Base_Convert",
"Node_FFT", "Node_FFT",
{ "label": "/Surfaces" },
"Node_Interpret_Number",
{ "label": "Vector" }, { "label": "Vector" },
{ "label": "/Creators" }, { "label": "/Creators" },
@ -745,6 +747,7 @@
"Node_Array_Convolute", "Node_Array_Convolute",
"Node_Array_Composite", "Node_Array_Composite",
"Node_Array_Shuffle", "Node_Array_Shuffle",
"Node_Array_Unique",
{ "label": "/Group Operators" }, { "label": "/Group Operators" },
"Node_Array_Sort", "Node_Array_Sort",
"Node_Iterate_Each_Inline", "Node_Iterate_Each_Inline",

View file

@ -0,0 +1,31 @@
function Node_Array_Unique(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Array Unique";
setDimension(96, 48);
newInput(0, nodeValue("Array in", self, CONNECT_TYPE.input, VALUE_TYPE.any, []))
.setVisible(true, true);
newOutput(0, nodeValue_Output("Unique Array", self, VALUE_TYPE.any, []));
static update = function(frame = CURRENT_FRAME) {
var arr = getInputData(0);
inputs[0].setType(VALUE_TYPE.any);
outputs[0].setType(VALUE_TYPE.any);
if(!is_array(arr)) return;
arr = array_unique(arr);
if(inputs[0].value_from != noone) {
inputs[0].setType(inputs[0].value_from.type);
outputs[0].setType(inputs[0].value_from.type);
}
outputs[0].setValue(arr);
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_array_unique, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
}
}

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_array_unique",
"bboxMode":0,
"bbox_bottom":61,
"bbox_left":0,
"bbox_right":63,
"bbox_top":2,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"8ae027ea-a885-42b7-9b61-7bb6d68f4e11","name":"8ae027ea-a885-42b7-9b61-7bb6d68f4e11","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":64,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"f2ebdb8e-2cb6-4494-970b-3765ecf97e0f","blendMode":0,"displayName":"default","isLocked":false,"name":"f2ebdb8e-2cb6-4494-970b-3765ecf97e0f","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_array_unique",
"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_unique",
"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_unique",
"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":"8ae027ea-a885-42b7-9b61-7bb6d68f4e11","path":"sprites/s_node_array_unique/s_node_array_unique.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"d08bddeb-4b07-4fec-96d2-3e607164fd1d","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,
}