mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
[Tunnel] Fix deleted node still getting check for key duplication.
This commit is contained in:
parent
5b2043c117
commit
d9f8d006b7
2 changed files with 53 additions and 17 deletions
|
@ -14,6 +14,9 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
|
||||
newOutput(0, nodeValue_Output("Color", self, VALUE_TYPE.color, c_white));
|
||||
|
||||
attribute_oversample(true);
|
||||
attributes.oversample = 1;
|
||||
|
||||
static getPreviewValues = function() { return getInputData(0); }
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
|
@ -65,10 +68,27 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
for( var j = -_sam; j <= _sam; j++ ) {
|
||||
var px = _pos[0] + i;
|
||||
var py = _pos[1] + j;
|
||||
if(px < 0) continue;
|
||||
if(py < 0) continue;
|
||||
if(px >= ww) continue;
|
||||
if(py >= hh) continue;
|
||||
|
||||
if(px < 0 || py < 0 || px >= ww || py >= hh) {
|
||||
switch(attributes.oversample) {
|
||||
case 0 : continue;
|
||||
|
||||
case 1 :
|
||||
px = clamp(px, 0, ww - 1);
|
||||
py = clamp(py, 0, hh - 1);
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
px = safe_mod(px, ww - 1);
|
||||
py = safe_mod(py, hh - 1);
|
||||
break;
|
||||
|
||||
case 3 :
|
||||
a += 255;
|
||||
amo++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var cc = int64(surface_get_pixel_ext(_surf, px, py));
|
||||
|
||||
|
@ -79,10 +99,12 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
amo++;
|
||||
}
|
||||
|
||||
r /= amo;
|
||||
g /= amo;
|
||||
b /= amo;
|
||||
a /= amo;
|
||||
if(amo > 0) {
|
||||
r /= amo;
|
||||
g /= amo;
|
||||
b /= amo;
|
||||
a /= amo;
|
||||
}
|
||||
|
||||
return make_color_rgba(r, g, b, _alp? a : 255);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
}
|
||||
|
||||
if(dup && error_notification == noone) {
|
||||
error_notification = noti_error("Duplicated key: " + string(_key));
|
||||
error_notification = noti_error($"Duplicated key: {_key}");
|
||||
error_notification.onClick = function() { PANEL_GRAPH.focusNode(self); };
|
||||
} else if(!dup && error_notification) {
|
||||
noti_remove(error_notification);
|
||||
|
@ -72,15 +72,19 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
var amo = ds_map_size(project.tunnels_in_map);
|
||||
var k = ds_map_find_first(project.tunnels_in_map);
|
||||
repeat(amo) {
|
||||
if(ds_map_exists(PROJECT.nodeMap, k) && struct_has(PROJECT.nodeMap[? k], "resetMap"))
|
||||
PROJECT.nodeMap[? k].resetMap();
|
||||
var _n = project.nodeMap[? k];
|
||||
if(_n.active && is_instanceof(_n, Node_Tunnel_In))
|
||||
_n.resetMap();
|
||||
|
||||
k = ds_map_find_next(project.tunnels_in_map, k);
|
||||
}
|
||||
|
||||
var k = ds_map_find_first(project.tunnels_in_map);
|
||||
repeat(amo) {
|
||||
if(ds_map_exists(PROJECT.nodeMap, k) && struct_has(PROJECT.nodeMap[? k], "checkDuplicate"))
|
||||
PROJECT.nodeMap[? k].checkDuplicate();
|
||||
var _n = project.nodeMap[? k];
|
||||
if(_n.active && is_instanceof(_n, Node_Tunnel_In))
|
||||
_n.checkDuplicate();
|
||||
|
||||
k = ds_map_find_next(project.tunnels_in_map, k);
|
||||
}
|
||||
|
||||
|
@ -102,11 +106,11 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
}
|
||||
|
||||
static getNextNodes = function() {
|
||||
var nodes = [];
|
||||
var nodes = [];
|
||||
var nodeNames = [];
|
||||
var _key = inputs[0].getValue();
|
||||
var amo = ds_map_size(project.tunnels_out);
|
||||
var k = ds_map_find_first(project.tunnels_out);
|
||||
var _key = inputs[0].getValue();
|
||||
var amo = ds_map_size(project.tunnels_out);
|
||||
var k = ds_map_find_first(project.tunnels_out);
|
||||
|
||||
LOG_BLOCK_START();
|
||||
LOG_IF(global.FLAG.render == 1, $"→→→→→ Call get next node from: {INAME}");
|
||||
|
@ -255,5 +259,15 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
static onDestroy = function() {
|
||||
if(error_notification != noone)
|
||||
noti_remove(error_notification);
|
||||
|
||||
var _key = inputs[0].getValue();
|
||||
|
||||
ds_map_delete(project.tunnels_in_map, node_id);
|
||||
ds_map_delete(project.tunnels_in, _key);
|
||||
}
|
||||
|
||||
static onRestore = function() {
|
||||
resetMap();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue