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

View file

@ -358,7 +358,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
load_group = noone; load_group = noone;
#endregion #endregion
//// NAME ////- NAME
static initTooltip = function() { static initTooltip = function() {
if(IS_CMD) return; 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 getFullName = function() { return renamed? $"[{name}] " + display_name : name; }
static getDisplayName = function() { return renamed? display_name : name; } static getDisplayName = function() { return renamed? display_name : name; }
/////DYNAMIC IO ////- DYNAMIC IO
dummy_input = noone; dummy_input = noone;
auto_input = false; auto_input = false;
@ -560,7 +560,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
triggerRender(); triggerRender();
} }
/////INSPECTOR ////- INSPECTOR
static onInspector1Update = noone; static onInspector1Update = noone;
static inspector1Update = function() { INLINE onInspector1Update(); } 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 inspector2Update = function() { INLINE onInspector2Update(); }
static hasInspector2Update = function() { INLINE return onInspector2Update != noone; } static hasInspector2Update = function() { INLINE return onInspector2Update != noone; }
/////STEP ////- STEP
static stepBegin = function() { static stepBegin = function() {
@ -658,7 +658,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static focusStep = function() {} static focusStep = function() {}
static inspectorStep = function() {} static inspectorStep = function() {}
/////JUNCTIONS ////- JUNCTIONS
static newInput = function(index, junction) { inputs[index] = junction; return junction; } static newInput = function(index, junction) { inputs[index] = junction; return junction; }
static newOutput = function(index, junction) { outputs[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; set_default = true;
@ -987,7 +987,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}); });
} }
/////UPDATE ////- UPDATE
static forceUpdate = function() { static forceUpdate = function() {
input_hash = ""; input_hash = "";
@ -1000,15 +1000,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
render_timer = get_timer(); render_timer = get_timer();
setRenderStatus(true); setRenderStatus(true);
//////////////////////////////////////////////
if(attributes.update_graph) { if(attributes.update_graph) {
try { update(frame); } try { update(frame); }
catch(e) { log_warning("RENDER", exception_print(e), self); } catch(e) { log_warning("RENDER", exception_print(e), self); }
} }
//////////////////////////////////////////////
render_time = get_timer() - render_timer; 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 onValueUpdate = function(index = 0) {}
static onValueFromUpdate = function(index) {} static onValueFromUpdate = function(index) {}
/////RENDER ////- RENDER
static isAnimated = function(frame = CURRENT_FRAME) { static isAnimated = function(frame = CURRENT_FRAME) {
if(update_on_frame) return true; if(update_on_frame) return true;
@ -1349,7 +1345,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
return nodes; return nodes;
} }
/////DRAW ////- DRAW
static setShowParameter = function(showParam) { static setShowParameter = function(showParam) {
show_parameter = 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) {} static drawAnimationTimeline = function(_w, _h, _s) {}
/////PREVIEW ////- PREVIEW
static getPreviewValues = function() { static getPreviewValues = function() {
if(preview_channel >= array_length(outputs)) return noone; 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)); return BBOX().fromWH(preview_x, preview_y, surface_get_width_safe(_surf), surface_get_height_safe(_surf));
} }
/////CACHE ////- CACHE
static cacheCheck = function() { static cacheCheck = function() {
INLINE 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) { static isUsingTool = function(index = undefined, subtool = noone) {
if(tools == -1) if(tools == -1)
@ -2379,7 +2375,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static drawTools = noone; static drawTools = noone;
/////SERIALIZE ////- SERIALIZE
static serialize = function(scale = false, preset = false) { static serialize = function(scale = false, preset = false) {
if(!active) return; if(!active) return;
@ -2466,7 +2462,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static doSerialize = function(_map) {} static doSerialize = function(_map) {}
static processSerialize = function(_map) {} static processSerialize = function(_map) {}
/////DESERIALIZE ////- DESERIALIZE
static deserialize = function(_map, scale = false, preset = false) { 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() {} static postLoad = function() {}
/////CLEAN UP ////- CLEAN UP
static cleanUp = function() { static cleanUp = function() {
for( var i = 0; i < array_length(inputs); i++ ) { inputs[i].cleanUp(); delete inputs[i]; } 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() {} static onCleanUp = function() {}
/////ACTION ////- ACTION
static setDimension = function(_w = 128, _h = 128, _apply = true) { static setDimension = function(_w = 128, _h = 128, _apply = true) {
INLINE INLINE
@ -2848,7 +2844,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static onClone = function(_NewNode, target = PANEL_GRAPH.getCurrentContext()) {} static onClone = function(_NewNode, target = PANEL_GRAPH.getCurrentContext()) {}
/////MISC ////- MISC
static isInLoop = function() { static isInLoop = function() {
return array_exists(global.loop_nodes, instanceof(group)); 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; color = COLORS.node_blend_collection;
preview_draw = false; preview_draw = false;
is_group_io = true; is_group_io = true;
inParent = undefined;
destroy_when_upgroup = true; destroy_when_upgroup = true;
inParent = undefined;
skipDefault(); skipDefault();
setDimension(96, 32 + 24); 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) { inputs[10].setFrom_condition = function(_valueFrom) {
if(is_instanceof(_valueFrom.node, Node_Group_Input)) return true; if(is_instanceof(_valueFrom.node, Node_Group_Input)) return true;
noti_warning("Group IO visibility must be connected directly to another group input.",, self); noti_warning("Group IO visibility must be connected directly to another group input.",, self);
return false; return false;
} }
@ -155,11 +154,35 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[2].setValue(ind); inputs[2].setValue(ind);
} }
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { static createInput = function() {
if(inParent.isArray()) return; if(group == noone || !is_struct(group)) return noone;
return inParent.drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
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) static isRenderable = function(log = false) { //Check if every input is ready (updated)
if(!active) return false; if(!active) return false;
if(!isRenderActive()) return false; if(!isRenderActive()) return false;
@ -370,34 +393,6 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
visibleCheck(); 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() { static updateGroupInput = function() {
var _dstype = getInputData(0); var _dstype = getInputData(0);
var _data = getInputData(2); var _data = getInputData(2);
@ -482,12 +477,17 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
__data = _data; __data = _data;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////- Draw
static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); } static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static drawNodeDef = drawNode; 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) { 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); 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); 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); } static postDeserialize = function() { createInput(false); }
@ -525,7 +525,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
group.sortIO(); group.sortIO();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////- Actions
static onDestroy = function() { static onDestroy = function() {
if(is_undefined(inParent)) return; 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(); } static onLoadGroup = function() { if(group == noone) destroy(); }
if(!LOADING && !APPENDING) createInput();
} }