[Lua surface, lua compute] Fix value input not showing up in the first argument.

This commit is contained in:
Tanasart 2024-11-22 16:37:49 +07:00
parent 22ca680fe4
commit c7e22ff2bd
5 changed files with 17 additions and 10 deletions

View file

@ -185,7 +185,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
input_hash_raw = "";
inputs_amount = 0;
inputs_index = [];
in_cache_len = 0;
inputDisplayList = [];
@ -660,7 +659,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
inputs[i].visible_in_list = false;
inputs_amount = getInputJunctionAmount();
inputs_index = [];
for( var i = 0; i < inputs_amount; i++ ) {
var _input = getInputJunctionIndex(i);
@ -669,13 +667,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _inp = inputs[_input];
if(!is_struct(_inp) || !is_instanceof(_inp, NodeValue)) continue;
array_push(inputs_index, _input);
_inp.visible_in_list = true;
}
inputs_amount = array_length(inputs_index);
outputs_index = array_create_ext(getOutputJunctionAmount(), function(index) { return getOutputJunctionIndex(index); });
} //run_in(1, () => { updateIO() });
}
static setHeight = function() {
@ -781,6 +777,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
} else {
var amo = input_display_list == -1? array_length(inputs) : array_length(input_display_list);
// print($"Amo = {amo}");
for(var i = 0; i < amo; i++) {
var ind = getInputJunctionIndex(i);
@ -788,11 +785,16 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var jun = array_safe_get(inputs, ind, noone);
if(jun == noone || is_undefined(jun)) continue;
// print($"{i}: {jun.isVisible()}");
// print($" {jun.visible_manual}, {jun.visible}, {jun.index}, {jun.visible_in_list}");
if(!jun.isVisible()) continue;
array_push(inputDisplayList, jun);
}
// print($"{inputDisplayList}\n");
}
if(auto_input && dummy_input) array_push(inputDisplayList, dummy_input);

View file

@ -27,7 +27,8 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
color = COLORS.node_blend_input;
newInput(0, nodeValue_Path("Path", self, ""))
.setDisplay(VALUE_DISPLAY.path_load, { filter: "image|*.png;*.jpg" });
.setDisplay(VALUE_DISPLAY.path_load, { filter: "image|*.png;*.jpg" })
.rejectArray();
newInput(1, nodeValue_Padding("Padding", self, [0, 0, 0, 0]));
@ -98,6 +99,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
static step = function() {
var path = path_get(getInputData(0));
if(is_array(path)) return;
if(!file_exists_empty(path)) return;
if(attributes.file_checker && file_get_modify_s(path) > edit_time) {
@ -111,6 +113,8 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
var path = path_get(getInputData(0));
var pad = getInputData(1);
if(is_array(path)) return;
outputs[1].setValue(path);
updatePaths(path);

View file

@ -66,7 +66,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
array_resize(input_display_list, input_display_len);
for( var i = input_fix_len; i < array_length(inputs); i += data_length ) {
if(getInputDataForce(i) != "") {
if(inputs[i].getValue() != "") {
array_push(_in, inputs[i + 0]);
array_push(_in, inputs[i + 1]);
array_push(_in, inputs[i + 2]);
@ -90,6 +90,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
refreshInputType();
createNewInput();
refreshNodeDisplay();
}
static refreshInputType = function() {

View file

@ -69,7 +69,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
array_resize(input_display_list, input_display_len);
for( var i = input_fix_len; i < array_length(inputs); i += data_length ) {
if(getInputDataForce(i) != "") {
if(inputs[i].getValue() != "") {
array_push(_in, inputs[i + 0]);
array_push(_in, inputs[i + 1]);
array_push(_in, inputs[i + 2]);
@ -94,6 +94,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
refreshInputType();
createNewInput();
refreshNodeDisplay();
}
static refreshInputType = function() {

View file

@ -544,8 +544,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(value_from) return true;
if(visible_manual != 0) return visible_manual == 1;
if(!visible) return false;
if(index == -1) return true;
if(index == -1) return true;
return visible_in_list;
}