- [Graph Panel] Fix inspector action connection lines not rendering.

This commit is contained in:
Tanasart 2024-06-20 15:56:43 +07:00
parent 84e4affbdc
commit a4176b2139
2 changed files with 39 additions and 41 deletions

View file

@ -1409,6 +1409,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
} #endregion
__draw_inputs = []
static drawConnections = function(params = {}) { #region
if(!active) return;
@ -1442,41 +1443,39 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
var st = 0;
if(NODE_HAS_INSP1) st = -1;
if(NODE_HAS_INSP2) st = -2;
__draw_inputs = array_verify(__draw_inputs, ds_list_size(inputs));
var _len = 0;
var _jun, _hov;
var _inputs = array_create(ds_list_size(inputs));
var _len = 0;
if(NODE_HAS_INSP1) {
_hov = inspectInput1.drawConnections(params);
if(_hov) hovering = _hov;
}
if(NODE_HAS_INSP2) {
_hov = inspectInput2.drawConnections(params);
if(_hov) hovering = _hov;
}
var drawLineIndex = 1;
for(var i = st; i < ds_list_size(inputs); i++) {
var jun;
if(i == -1) jun = inspectInput1;
else if(i == -2) jun = inspectInput2;
else jun = inputs[| i];
for(var i = 0, n = ds_list_size(inputs); i < n; i++) {
_jun = inputs[| i];
_jun.draw_blend_color = bg;
_jun.draw_blend = high? PREFERENCES.connection_line_highlight_fade : -1;
if(high) {
jun.draw_blend_color = bg;
jun.draw_blend = PREFERENCES.connection_line_highlight_fade;
} else {
jun.draw_blend_color = bg;
jun.draw_blend = -1;
}
if( _jun.value_from == noone) continue;
if(!_jun.value_from.node.active) continue;
if(!_jun.isVisible()) continue;
if( jun.value_from == noone) continue;
if(!jun.value_from.node.active) continue;
if(!jun.isVisible()) continue;
if(i >= 0) _inputs[_len++] = jun;
if(i >= 0) __draw_inputs[_len++] = _jun;
}
for( var i = 0; i < _len; i++ ) {
var jun = _inputs[i];
_jun = __draw_inputs[i];
_jun.drawLineIndex = 1 + (i > _len / 2? (_len - 1 - i) : i) * 0.5;
jun.drawLineIndex = 1 + (i > _len / 2? (_len - 1 - i) : i) * 0.5;
var hov = jun.drawConnections(params);
if(hov) hovering = hov;
_hov = _jun.drawConnectionsRaw(params);
if(_hov) hovering = _hov;
}
if(attributes.show_update_trigger) {

View file

@ -1589,42 +1589,42 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(_valueFrom == value_from) {
if(log) noti_warning("whaT");
return -1;
return -2;
}
if(_valueFrom == self) {
if(log) noti_warning("setFrom: Self connection is not allowed.",, node);
return -1;
return -3;
}
if(!typeCompatible(_valueFrom.type, type)) {
noti_warning($"Connection error: Incompatible type {_valueFrom.type} to {type}",, node);
return -1;
return -4;
}
if(typeIncompatible(_valueFrom, self)) {
noti_warning("Connection error: Incompatible type",, node);
return -1;
return -5;
}
if(connect_type == _valueFrom.connect_type) {
if(log) noti_warning("setFrom: Connect type mismatch",, node);
return -1;
return -6;
}
if(checkRecur && _valueFrom.searchNodeBackward(node)) {
if(log) noti_warning("setFrom: Cyclic connection not allowed.",, node);
return -9;
return -7;
}
if(!accept_array && isArray(_valueFrom.getValue())) {
noti_warning($"Connection error: {name} does not support array input.",, node);
return -1;
return -8;
}
if(!accept_array && _valueFrom.type == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float)) {
if(log) noti_warning("setFrom: Array mismatch",, node);
return -1;
return -9;
}
return 1;
@ -1633,7 +1633,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static triggerSetFrom = function() { node.valueUpdate(index); }
static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region ////Set from
// print($"Connecting {_valueFrom.name} to {name}");
if(is_dummy) {
var _targ = dummy_get();
@ -1910,13 +1909,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
draw_set_alpha(1);
} #endregion
static drawConnections = function(params = {}) { #region
if(value_from == noone) return noone;
if(!value_from.node.active) return noone;
if(!isVisible()) return noone;
static drawConnectionsRaw = function(params = {}) { return drawJuncConnection(value_from, self, params); }
static drawConnections = function(params = {}) {
if(value_from == noone || !value_from.node.active || !isVisible())
return noone;
return drawJuncConnection(value_from, self, params);
} #endregion
}
static drawConnectionMouse = function(params, _mx, _my, target) { #region
var ss = params.s;
@ -2303,6 +2301,7 @@ function drawJuncConnection(from, to, params) { #region
to.draw_line_shift_hover = false;
var downDirection = to.type == VALUE_TYPE.action || from.type == VALUE_TYPE.action;
// if(downDirection) print($"{to} : {from}");
#endregion
#region +++++ CHECK HOVER +++++