array pin

This commit is contained in:
Tanasart 2024-07-07 17:55:27 +07:00
parent a661d3ed06
commit be26b6413a
14 changed files with 248 additions and 12 deletions

View file

@ -699,6 +699,7 @@
{"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_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_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_remove","order":4,"path":"scripts/node_array_remove/node_array_remove.yy",},
@ -1979,6 +1980,7 @@
{"name":"s_node_pb_fx_subtract","order":1,"path":"sprites/s_node_pb_fx_subtract/s_node_pb_fx_subtract.yy",},
{"name":"s_node_pb_layer","order":18,"path":"sprites/s_node_pb_layer/s_node_pb_layer.yy",},
{"name":"s_node_perlin_extra","order":31,"path":"sprites/s_node_perlin_extra/s_node_perlin_extra.yy",},
{"name":"s_node_pin_array","order":42,"path":"sprites/s_node_pin_array/s_node_pin_array.yy",},
{"name":"s_node_pin","order":2,"path":"sprites/s_node_pin/s_node_pin.yy",},
{"name":"s_node_pixel_cloud","order":40,"path":"sprites/s_node_pixel_cloud/s_node_pixel_cloud.yy",},
{"name":"s_node_pixel_find","order":18,"path":"sprites/s_node_pixel_find/s_node_pixel_find.yy",},

View file

@ -1065,6 +1065,7 @@
{"id":{"name":"node_array_get","path":"scripts/node_array_get/node_array_get.yy",},},
{"id":{"name":"node_array_insert","path":"scripts/node_array_insert/node_array_insert.yy",},},
{"id":{"name":"node_array_length","path":"scripts/node_array_length/node_array_length.yy",},},
{"id":{"name":"node_array_pin","path":"scripts/node_array_pin/node_array_pin.yy",},},
{"id":{"name":"node_array_range","path":"scripts/node_array_range/node_array_range.yy",},},
{"id":{"name":"node_array_rearrange","path":"scripts/node_array_rearrange/node_array_rearrange.yy",},},
{"id":{"name":"node_array_remove","path":"scripts/node_array_remove/node_array_remove.yy",},},
@ -2523,6 +2524,7 @@
{"id":{"name":"s_node_pb_fx_subtract","path":"sprites/s_node_pb_fx_subtract/s_node_pb_fx_subtract.yy",},},
{"id":{"name":"s_node_pb_layer","path":"sprites/s_node_pb_layer/s_node_pb_layer.yy",},},
{"id":{"name":"s_node_perlin_extra","path":"sprites/s_node_perlin_extra/s_node_perlin_extra.yy",},},
{"id":{"name":"s_node_pin_array","path":"sprites/s_node_pin_array/s_node_pin_array.yy",},},
{"id":{"name":"s_node_pin","path":"sprites/s_node_pin/s_node_pin.yy",},},
{"id":{"name":"s_node_pixel_builder","path":"sprites/s_node_pixel_builder/s_node_pixel_builder.yy",},},
{"id":{"name":"s_node_pixel_cloud","path":"sprites/s_node_pixel_cloud/s_node_pixel_cloud.yy",},},

View file

@ -2,8 +2,8 @@
"$GMObject":"",
"%Name":"o_dialog_add_multiple_images",
"eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_dialog_add_multiple_images",

View file

@ -38,7 +38,7 @@
LATEST_VERSION = 11700;
VERSION = 11761;
SAVE_VERSION = 11700;
VERSION_STRING = "1.17.7.001";
VERSION_STRING = "1.17.7.002";
BUILD_NUMBER = 11761;
globalvar HOTKEYS, HOTKEY_CONTEXT;

View file

@ -0,0 +1,115 @@
function Node_Array_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Array Pin";
setDimension(32, 32);
auto_height = false;
junction_shift_y = 16;
isHovering = false;
hover_scale = 0;
hover_scale_to = 0;
hover_alpha = 0;
bg_spr = THEME.node_pin_bg;
bg_spr_add = 0;
bg_sel_spr = THEME.node_pin_bg_active;
outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []);
static createNewInput = function() {
var index = ds_list_size(inputs);
inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 )
.setVisible(true, true);
return inputs[| index];
} setDynamicInput(1);
static update = function(frame = CURRENT_FRAME) {
var res = [];
var ind = 0;
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
if(!inputs[| i].value_from) continue;
var val = getInputData(i);
array_push(res, val);
inputs[| i].setType(inputs[| i].value_from.type);
outputs[| 0].setType(inputs[| i].value_from.type);
}
outputs[| 0].setValue(res);
}
static pointIn = function(_x, _y, _mx, _my, _s) {
var xx = x * _s + _x;
var yy = y * _s + _y;
return point_in_circle(_mx, _my, xx, yy, _s * 24);
}
static preDraw = function(_x, _y, _s) {
var xx = x * _s + _x;
var yy = y * _s + _y;
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
inputs[| i].x = xx;
inputs[| i].y = yy;
}
dummy_input.x = xx;
dummy_input.y = yy;
outputs[| 0].x = xx;
outputs[| 0].y = yy;
}
static drawBadge = function(_x, _y, _s) {}
static drawJunctionNames = function(_x, _y, _mx, _my, _s) {}
static drawJunctions = function(_x, _y, _mx, _my, _s) {
var _dval = PANEL_GRAPH.value_dragging;
var hover = _dval == noone || _dval.connect_type == JUNCTION_CONNECT.input? outputs[| 0] : dummy_input;
var xx = x * _s + _x;
var yy = y * _s + _y;
isHovering = point_in_circle(_mx, _my, xx, yy, _s * 24);
var jhov = hover.drawJunction(_s, _mx, _my);
if(!isHovering) return noone;
hover_scale_to = 1;
return jhov? hover : noone;
}
static drawNode = function(_x, _y, _mx, _my, _s) {
var xx = x * _s + _x;
var yy = y * _s + _y;
hover_alpha = 0.5;
if(active_draw_index > -1) {
hover_alpha = 1;
hover_scale_to = 1;
active_draw_index = -1;
}
if(hover_scale > 0) {
var _r = hover_scale * _s * 16;
shader_set(sh_node_circle);
shader_set_color("color", COLORS._main_accent, hover_alpha);
draw_sprite_stretched(s_fx_pixel, 0, xx - _r, yy - _r, _r * 2, _r * 2);
shader_reset();
}
hover_scale = lerp_float(hover_scale, hover_scale_to, 3);
hover_scale_to = 0;
if(renamed && display_name != "" && display_name != "Array Pin") {
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
draw_text_transformed(xx, yy - 12 * _s, display_name, _s * 0.4, _s * 0.4, 0);
}
return drawJunctions(_x, _y, _mx, _my, _s);
}
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"",
"%Name":"node_array_pin",
"isCompatibility":false,
"isDnD":false,
"name":"node_array_pin",
"parent":{
"name":"array",
"path":"folders/nodes/data/value/array.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "variable",
"path": "folders/nodes/data/variable.yy",
},
"resourceVersion": "1.0",
"name": "node_counter",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -55,7 +55,6 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
static drawJunctionNames = function(_x, _y, _mx, _my, _s) {}
static drawJunctions = function(_x, _y, _mx, _my, _s) {
var _dval = PANEL_GRAPH.value_dragging;
var hover = _dval == noone || _dval.connect_type == JUNCTION_CONNECT.input? outputs[| 0] : inputs[| 0];
var xx = x * _s + _x;
@ -71,7 +70,6 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
}
static drawNode = function(_x, _y, _mx, _my, _s) {
var xx = x * _s + _x;
var yy = y * _s + _y;

View file

@ -1018,6 +1018,7 @@ function __initNodes() {
ds_list_add(node, "Organize");
addNodeObject(node, "Pin", s_node_pin, "Node_Pin", [1, Node_Pin],, "Create pin to organize your connection. Can be create by double clicking on a connection line.");
addNodeObject(node, "Array Pin", s_node_pin_array, "Node_Array_Pin", [1, Node_Array_Pin]).setVersion(11770);
addNodeObject(node, "Frame", s_node_frame, "Node_Frame", [1, Node_Frame],, "Create frame surrounding nodes.");
addNodeObject(node, "Tunnel In", s_node_tunnel_in, "Node_Tunnel_In", [1, Node_Tunnel_In],, "Create tunnel for sending value based on key matching.");
addNodeObject(node, "Tunnel Out", s_node_tunnel_out, "Node_Tunnel_Out", [1, Node_Tunnel_Out],, "Receive value from tunnel in of the same key.");

View file

@ -79,6 +79,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
.setDisplay(VALUE_DISPLAY.rotation_range);
inputs[| 9] = nodeValue("Corner radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setValidator(VV_clamp(0, .5))
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.001] });
inputs[| 9].overlay_draw_text = false;
@ -220,7 +221,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
draw_set_color(COLORS._main_accent);
draw_arc(cx, cy, _cor - _corr, ar, ar + 90, 2);
hv = inputs[| 9].drawOverlay(_int, active, _x0, _y0, _s, _mx, _my, _snx, _sny, aa, _max_s); _hov |= hv; _int &= !_hov;
hv = inputs[| 9].drawOverlay(_int, active, _x0, _y0, _s, _mx, _my, _snx, _sny, aa, _max_s, 1); _hov |= hv; _int &= !_hov;
}
}

View file

@ -13,12 +13,14 @@ function preview_overlay_scalar(interact, active, _x, _y, _s, _mx, _my, _snx, _s
if(drag_type) {
index = 1;
var dist = point_distance(_mx, _my, _x, _y) / (_s * _scale);
var _dist = point_distance(_mx, _my, _x, _y) / (_s * _scale);
var _sign = abs(angle_difference(point_direction(_mx, _my, _x, _y), _angle)) > 90? 1 : -1;
if(key_mod_press(CTRL))
dist = round(dist);
_dist = round(_dist);
_dist *= _sign;
if(setValueInspector( dist ))
if(setValueInspector( _dist ))
UNDO_HOLDING = true;
if(mouse_release(mb_left)) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_pin_array",
"bboxMode":0,
"bbox_bottom":29,
"bbox_left":0,
"bbox_right":31,
"bbox_top":2,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"efdb099c-6a09-49f8-b757-7c61da7d3788","name":"efdb099c-6a09-49f8-b757-7c61da7d3788","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":32,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"d4ee30a5-0c99-4fd9-963a-8ed42dfb2b50","blendMode":0,"displayName":"default","isLocked":false,"name":"d4ee30a5-0c99-4fd9-963a-8ed42dfb2b50","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_pin_array",
"nineSlice":null,
"origin":4,
"parent":{
"name":"misc",
"path":"folders/nodes/icons/misc.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_pin_array",
"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_pin_array",
"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":"efdb099c-6a09-49f8-b757-7c61da7d3788","path":"sprites/s_node_pin_array/s_node_pin_array.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"a34b85e7-1398-4d9d-933b-5c858d7598ae","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":16,
"yorigin":16,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":32,
}