fix ignore custom group io

This commit is contained in:
Tanasart 2024-12-11 10:29:11 +07:00
parent 9f4aaa4f31
commit 7439334b75
3 changed files with 70 additions and 73 deletions

View file

@ -223,7 +223,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
onNewInputFromGraph = noone;
/////========== Attributes ===========
////- Attributes
attribute_surface_depth();
attribute_interpolation();
@ -241,7 +241,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
array_push(attributeEditors, ["Edit Input Display", function() /*=>*/ {return 0}, button(function() /*=>*/ { dialogCall(o_dialog_group_input_order).setNode(self, CONNECT_TYPE.input); }) ]);
array_push(attributeEditors, ["Edit Output Display", function() /*=>*/ {return 0}, button(function() /*=>*/ { dialogCall(o_dialog_group_input_order).setNode(self, CONNECT_TYPE.output); }) ]);
/////========== INSPECTOR ===========
////- INSPECTOR
hasInsp1 = false;
setTrigger(1, __txtx("panel_inspector_execute", "Execute node contents"), [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ {
@ -256,7 +256,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static hasInspector1Update = function() /*=>*/ {return hasInsp1};
static hasInspector2Update = function() /*=>*/ {return hasInsp2};
/////============ GROUP =============
////- GROUP
will_refresh = false;
static refreshNodes = function() {
@ -338,7 +338,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
onRemove(_node);
}
/////============= STEP ==============
////- STEP
static stepBegin = function() {
dummy_input = attributes.lock_input? noone : __dummy_input;
@ -355,7 +355,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static onStep = function() {}
/////========== JUNCTIONS ==========
////- JUNCTIONS
static getOutputNodes = function() {
var _nodes = [];
@ -416,7 +416,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
applyDeserialize();
}
/////========== RENDERING ===========
////- RENDERING
doUpdate = doUpdateLite;
@ -529,7 +529,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
nodes[i].resetRender(_clearCache);
}
/////============= DRAW =============
////- DRAW
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(!draw_input_overlay) return;
@ -587,7 +587,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return self;
}
/////============ PREVIEW ============
////- PREVIEW
static getGraphPreviewSurface = function() {
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
@ -622,16 +622,16 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return self;
}
/////============= CACHE =============
////- CACHE
static clearCache = function() { array_foreach(getNodeList(), function(node) /*=>*/ { node.clearCache(); }); }
/////========== INSTANCING ===========
////- INSTANCING
static setInstance = function(node) { instanceBase = node; }
static resetInstance = function() { instanceBase = noone; }
/////========= SERIALIZATION =========
////- SERIALIZATION
static attributeSerialize = function() {
sortIO();
@ -654,7 +654,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
}
static preApplyDeserialize = function() {
var attr = attributes;
var attr = struct_try_get(load_map, "attri", attributes);
if(LOADING_VERSION < 11690) {
var pr = ds_priority_create();
@ -746,7 +746,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
_map.instance_base = instanceBase? instanceBase.node_id : noone;
}
/////============ ACTION ============
////- ACTION
static onClone = function(_newNode, target = PANEL_GRAPH.getCurrentContext()) {
if(instanceBase != noone) {

View file

@ -358,7 +358,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
load_group = noone;
#endregion
//// NAME
////- NAME
static initTooltip = function() {
if(IS_CMD) return;
@ -399,7 +399,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static getFullName = function() { return renamed? $"[{name}] " + display_name : name; }
static getDisplayName = function() { return renamed? display_name : name; }
/////DYNAMIC IO
////- DYNAMIC IO
dummy_input = noone;
auto_input = false;
@ -560,7 +560,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
triggerRender();
}
/////INSPECTOR
////- INSPECTOR
static onInspector1Update = noone;
static inspector1Update = function() { INLINE onInspector1Update(); }
@ -570,7 +570,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static inspector2Update = function() { INLINE onInspector2Update(); }
static hasInspector2Update = function() { INLINE return onInspector2Update != noone; }
/////STEP
////- STEP
static stepBegin = function() {
@ -658,7 +658,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static focusStep = function() {}
static inspectorStep = function() {}
/////JUNCTIONS
////- JUNCTIONS
static newInput = function(index, junction) { inputs[index] = junction; return junction; }
static newOutput = function(index, junction) { outputs[index] = junction; return junction; }
@ -924,7 +924,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
}
/////INPUTS
////- INPUTS
set_default = true;
@ -987,7 +987,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
});
}
/////UPDATE
////- UPDATE
static forceUpdate = function() {
input_hash = "";
@ -1000,15 +1000,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
render_timer = get_timer();
setRenderStatus(true);
//////////////////////////////////////////////
if(attributes.update_graph) {
try { update(frame); }
catch(e) { log_warning("RENDER", exception_print(e), self); }
}
//////////////////////////////////////////////
render_time = get_timer() - render_timer;
}
@ -1091,7 +1087,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static onValueUpdate = function(index = 0) {}
static onValueFromUpdate = function(index) {}
/////RENDER
////- RENDER
static isAnimated = function(frame = CURRENT_FRAME) {
if(update_on_frame) return true;
@ -1349,7 +1345,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
return nodes;
}
/////DRAW
////- DRAW
static setShowParameter = function(showParam) {
show_parameter = showParam;
@ -2182,7 +2178,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static drawAnimationTimeline = function(_w, _h, _s) {}
/////PREVIEW
////- PREVIEW
static getPreviewValues = function() {
if(preview_channel >= array_length(outputs)) return noone;
@ -2207,7 +2203,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
return BBOX().fromWH(preview_x, preview_y, surface_get_width_safe(_surf), surface_get_height_safe(_surf));
}
/////CACHE
////- CACHE
static cacheCheck = function() {
INLINE
@ -2334,7 +2330,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
}
/////TOOLS
////- TOOLS
static isUsingTool = function(index = undefined, subtool = noone) {
if(tools == -1)
@ -2379,7 +2375,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static drawTools = noone;
/////SERIALIZE
////- SERIALIZE
static serialize = function(scale = false, preset = false) {
if(!active) return;
@ -2466,7 +2462,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static doSerialize = function(_map) {}
static processSerialize = function(_map) {}
/////DESERIALIZE
////- DESERIALIZE
static deserialize = function(_map, scale = false, preset = false) {
@ -2689,7 +2685,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static postLoad = function() {}
/////CLEAN UP
////- CLEAN UP
static cleanUp = function() {
for( var i = 0; i < array_length(inputs); i++ ) { inputs[i].cleanUp(); delete inputs[i]; }
@ -2703,7 +2699,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static onCleanUp = function() {}
/////ACTION
////- ACTION
static setDimension = function(_w = 128, _h = 128, _apply = true) {
INLINE
@ -2848,7 +2844,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static onClone = function(_NewNode, target = PANEL_GRAPH.getCurrentContext()) {}
/////MISC
////- MISC
static isInLoop = function() {
return array_exists(global.loop_nodes, instanceof(group));

View file

@ -71,9 +71,9 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
color = COLORS.node_blend_collection;
preview_draw = false;
is_group_io = true;
inParent = undefined;
destroy_when_upgroup = true;
inParent = undefined;
skipDefault();
setDimension(96, 32 + 24);
@ -114,7 +114,6 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[10].setFrom_condition = function(_valueFrom) {
if(is_instanceof(_valueFrom.node, Node_Group_Input)) return true;
noti_warning("Group IO visibility must be connected directly to another group input.",, self);
return false;
}
@ -155,11 +154,35 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[2].setValue(ind);
}
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(inParent.isArray()) return;
return inParent.drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
static createInput = function() {
if(group == noone || !is_struct(group)) return noone;
if(!is_undefined(inParent))
array_remove(group.inputs, inParent);
inParent = nodeValue("Value", group, CONNECT_TYPE.input, VALUE_TYPE.any, -1)
.uncache()
.setVisible(true, true);
inParent.from = self;
inParent.index = array_length(group.inputs);
array_push(group.inputs, inParent);
if(is_array(group.input_display_list))
array_push(group.input_display_list, inParent.index);
if(!LOADING && !APPENDING) {
group.refreshNodeDisplay();
group.sortIO();
}
onValueUpdate(0);
return inParent;
}
////- Render
static isRenderable = function(log = false) { //Check if every input is ready (updated)
if(!active) return false;
if(!isRenderActive()) return false;
@ -370,34 +393,6 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
visibleCheck();
}
static createInput = function() {
if(group == noone || !is_struct(group)) return noone;
if(!is_undefined(inParent))
array_remove(group.inputs, inParent);
inParent = nodeValue("Value", group, CONNECT_TYPE.input, VALUE_TYPE.any, -1)
.uncache()
.setVisible(true, true);
inParent.from = self;
inParent.index = array_length(group.inputs);
array_push(group.inputs, inParent);
if(is_array(group.input_display_list))
array_push(group.input_display_list, inParent.index);
if(!LOADING && !APPENDING) {
group.refreshNodeDisplay();
group.sortIO();
}
onValueUpdate(0);
return inParent;
}
if(!LOADING && !APPENDING) createInput();
static updateGroupInput = function() {
var _dstype = getInputData(0);
var _data = getInputData(2);
@ -482,12 +477,17 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
__data = _data;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////- Draw
static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static drawNodeDef = drawNode;
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(inParent.isArray()) return;
return inParent.drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
}
static drawNode = function(_draw, _x, _y, _mx, _my, _s, display_parameter = noone, _panel = noone) {
if(_s >= .75) return drawNodeDef(_draw, _x, _y, _mx, _my, _s, display_parameter, _panel);
@ -510,7 +510,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
return _s > 0.5? drawJunctions(_draw, xx, yy, _mx, _my, _s) : drawJunctions_fast(_draw, xx, yy, _mx, _my, _s);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////- Serialize
static postDeserialize = function() { createInput(false); }
@ -525,7 +525,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
group.sortIO();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////- Actions
static onDestroy = function() {
if(is_undefined(inParent)) return;
@ -548,4 +548,5 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
static onLoadGroup = function() { if(group == noone) destroy(); }
if(!LOADING && !APPENDING) createInput();
}