This commit is contained in:
Tanasart 2025-01-06 11:32:21 +07:00
parent 4fcbe11f4d
commit b633781dff
14 changed files with 39 additions and 37 deletions

View file

@ -87,8 +87,7 @@ event_inherited();
function trigger_favourite() {
if(node_menu_selecting == noone) return;
var _node = node_menu_selecting.nodeName;
struct_toggle(global.FAV_NODES, _node);
struct_toggle(global.FAV_NODES, node_menu_selecting.nodeName);
PREF_SAVE();
}

View file

@ -9,6 +9,8 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline(
newInput(0, nodeValue_Bool("Loop", self, true ))
.rejectArray();
output_node_type = Node_VFX_Renderer;
is_simulation = true;
update_on_frame = true;
managedRenderOrder = true;

View file

@ -4,6 +4,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
icon = THEME.vfx;
use_cache = CACHE_USE.auto;
inline_output = false;
manual_ungroupable = false;
newInput(0, nodeValue_Vec2("Output dimension", self, DEF_SURF ));

View file

@ -43,6 +43,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
array_push(PROJECT.allNodes, self);
inline_input = true;
inline_output = true;
inline_context = noone;
inline_parent_object = "";

View file

@ -9,31 +9,31 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Iterator(_x, _y, _grou
custom_input_index = array_length(inputs);
custom_output_index = array_length(inputs);
if(NODE_NEW_MANUAL) { #region
if(NODE_NEW_MANUAL) {
var input = nodeBuild("Node_Iterator_Each_Input", -256, -32, self);
var output = nodeBuild("Node_Iterator_Each_Output", 256, -32, self);
output.inputs[0].setFrom(input.outputs[0]);
} #endregion
}
static onStep = function() { #region
static onStep = function() {
var type = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type;
inputs[0].setType(type);
} #endregion
}
static doInitLoop = function() { #region
static doInitLoop = function() {
var arrIn = getInputData(0);
var arrOut = outputs[0].getValue();
if(array_length(arrOut) != array_length(arrIn))
outputs[0].setValue([]);
} #endregion
}
static getIterationCount = function() { #region
static getIterationCount = function() {
var arrIn = getInputData(0);
var maxIter = is_array(arrIn)? array_length(arrIn) : 0;
if(!is_real(maxIter)) maxIter = 1;
return maxIter;
} #endregion
}
}

View file

@ -9,19 +9,19 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr
custom_input_index = array_length(inputs);
custom_output_index = array_length(inputs);
if(NODE_NEW_MANUAL) { #region
if(NODE_NEW_MANUAL) {
var input = nodeBuild("Node_Iterator_Filter_Input", -256, -32, self);
var output = nodeBuild("Node_Iterator_Filter_Output", 256, -32, self);
output.inputs[0].setFrom(input.outputs[0]);
} #endregion
}
static onStep = function() { #region
static onStep = function() {
var type = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type;
inputs[0].setType(type);
} #endregion
}
static doInitLoop = function() { #region
static doInitLoop = function() {
var arrIn = getInputData(0);
var arrOut = outputs[0].getValue();
@ -31,10 +31,8 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
var _n = nodes[i];
if(is_instanceof(_n, Node_Iterator_Filter_Input))
_int = _n;
if(is_instanceof(_n, Node_Iterator_Filter_Output))
_oup = _n;
if(is(_n, Node_Iterator_Filter_Input)) _int = _n;
if(is(_n, Node_Iterator_Filter_Output)) _oup = _n;
}
if(_int == noone) {
@ -50,17 +48,17 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr
}
var _ofr = _oup.inputs[0].value_from;
var _imm = _ofr && is_instanceof(_ofr.node, Node_Iterator_Filter_Input);
var _imm = _ofr && is(_ofr.node, Node_Iterator_Filter_Input);
if(!_imm) surface_array_free(arrOut);
outputs[0].setValue([])
} #endregion
}
static getIterationCount = function() { #region
static getIterationCount = function() {
var arrIn = getInputData(0);
var maxIter = is_array(arrIn)? array_length(arrIn) : 0;
if(!is_real(maxIter)) maxIter = 1;
return maxIter;
} #endregion
}
}

View file

@ -5,6 +5,7 @@ function Node_Iterator_Each_Inline_Input(_x, _y, _group = noone) : Node(_x, _y,
setDimension(96, 48);
clonable = false;
inline_input = false;
inline_parent_object = "Node_Iterate_Each_Inline";
manual_ungroupable = false;

View file

@ -5,6 +5,7 @@ function Node_Iterator_Each_Inline_Output(_x, _y, _group = noone) : Node(_x, _y,
setDimension(96, 48);
clonable = false;
inline_output = false;
inline_parent_object = "Node_Iterate_Each_Inline";
manual_ungroupable = false;

View file

@ -5,6 +5,7 @@ function Node_Iterator_Filter_Inline_Input(_x, _y, _group = noone) : Node(_x, _y
setDimension(96, 48);
clonable = false;
inline_input = false;
inline_parent_object = "Node_Iterate_Filter_Inline";
manual_ungroupable = false;

View file

@ -5,6 +5,7 @@ function Node_Iterator_Filter_Inline_Output(_x, _y, _group = noone) : Node(_x, _
setDimension(96, 48);
clonable = false;
inline_output = false;
inline_parent_object = "Node_Iterate_Filter_Inline";
manual_ungroupable = false;

View file

@ -5,6 +5,7 @@ function Node_Iterator_Sort_Inline_Input(_x, _y, _group = noone) : Node(_x, _y,
setDimension(96, 48);
clonable = false;
inline_input = false;
inline_parent_object = "Node_Iterate_Sort_Inline";
manual_ungroupable = false;

View file

@ -5,6 +5,7 @@ function Node_Iterator_Sort_Inline_Output(_x, _y, _group = noone) : Node(_x, _y,
setDimension(96, 48);
clonable = false;
inline_output = false;
inline_parent_object = "Node_Iterate_Sort_Inline";
manual_ungroupable = false;

View file

@ -162,7 +162,7 @@ function NodeObject(_name, _spr, _node, _tooltip = "") constructor {
draw_sprite_ui_uniform(THEME.node_deprecated_badge, 1, _x + grid_size - ui(12), _y + ui(6));
}
var fav = struct_exists(global.FAV_NODES, node);
var fav = struct_exists(global.FAV_NODES, nodeName);
if(fav) {
gpu_set_tex_filter(true);
draw_sprite_ui_uniform(THEME.star, 0, _x + grid_size - ui(10), _y + grid_size - ui(10), .8, COLORS._main_accent, 1.);
@ -188,7 +188,7 @@ function NodeObject(_name, _spr, _node, _tooltip = "") constructor {
}
static drawList = function(_x, _y, _mx, _my, _h, _w, _param = {}) {
var fav = struct_exists(global.FAV_NODES, node);
var fav = struct_exists(global.FAV_NODES, nodeName);
if(fav) {
gpu_set_tex_filter(true);
draw_sprite_ui_uniform(THEME.star, 0, _x + ui(16), _y + _h / 2, .8, COLORS._main_accent, 1.);

View file

@ -1711,16 +1711,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return _res;
}
if(_valueFrom == noone)
return removeFrom();
if(_valueFrom == noone) return removeFrom();
if(isConnectable(_valueFrom, checkRecur, log) < 0) return conn;
run_in(2, function() /*=>*/ { updateColor(getValue()); });
var conn = isConnectable(_valueFrom, checkRecur, log);
if(conn < 0) return conn;
if(setFrom_condition != -1 && !setFrom_condition(_valueFrom))
return -2;
if(setFrom_condition != -1 && !setFrom_condition(_valueFrom)) return -2;
if(value_from != noone) array_remove(value_from.value_to, self);
@ -1729,10 +1725,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
value_from = _valueFrom;
array_push(_valueFrom.value_to, self);
if(!LOADING && !APPENDING && _valueFrom.node.inline_context != noone) {
var _inline = _valueFrom.node.inline_context;
if(node.manual_ungroupable) _inline.addNode(node);
}
if(!LOADING && !APPENDING && _valueFrom.node.inline_context != noone && node.manual_ungroupable && (node.inline_input && _valueFrom.node.inline_output))
_valueFrom.node.inline_context.addNode(node);
node.valueUpdate(index, _o);
if(_update && connect_type == CONNECT_TYPE.input) {