2022-01-24 02:21:25 +01:00
|
|
|
enum COLLECTION_TAG {
|
|
|
|
group = 1,
|
|
|
|
loop = 2
|
|
|
|
}
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
function groupNodes(nodeArray, _group = noone, record = true, check_connect = true) {
|
|
|
|
UNDO_HOLDING = true;
|
|
|
|
|
|
|
|
if(_group == noone) {
|
|
|
|
var cx = 0;
|
|
|
|
var cy = 0;
|
|
|
|
for(var i = 0; i < array_length(nodeArray); i++) {
|
|
|
|
var _node = nodeArray[i];
|
|
|
|
cx += _node.x;
|
|
|
|
cy += _node.y;
|
|
|
|
}
|
|
|
|
cx = round(cx / array_length(nodeArray) / 32) * 32;
|
|
|
|
cy = round(cy / array_length(nodeArray) / 32) * 32;
|
|
|
|
|
|
|
|
_group = new Node_Group(cx, cy, PANEL_GRAPH.getCurrentContext());
|
|
|
|
}
|
|
|
|
|
|
|
|
var _content = [];
|
|
|
|
|
|
|
|
for(var i = 0; i < array_length(nodeArray); i++) {
|
|
|
|
_group.add(nodeArray[i]);
|
|
|
|
_content[i] = nodeArray[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
var _io = [];
|
|
|
|
if(check_connect)
|
|
|
|
for(var i = 0; i < array_length(nodeArray); i++)
|
|
|
|
array_append(_io, nodeArray[i].checkConnectGroup());
|
|
|
|
|
|
|
|
UNDO_HOLDING = false;
|
|
|
|
if(record) recordAction(ACTION_TYPE.group, _group, { io: _io, content: _content });
|
|
|
|
|
|
|
|
return _group;
|
|
|
|
}
|
|
|
|
|
|
|
|
function upgroupNode(collection, record = true) {
|
|
|
|
UNDO_HOLDING = true;
|
|
|
|
var _content = [];
|
|
|
|
var _io = [];
|
2023-02-28 09:43:01 +01:00
|
|
|
var node_list = collection.getNodeList();
|
|
|
|
while(!ds_list_empty(node_list)) {
|
|
|
|
var remNode = node_list[| 0];
|
2023-02-14 05:32:32 +01:00
|
|
|
if(remNode.destroy_when_upgroup)
|
|
|
|
array_push(_io, remNode);
|
|
|
|
else
|
|
|
|
array_push(_content, remNode);
|
|
|
|
|
|
|
|
collection.remove(remNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
nodeDelete(collection);
|
|
|
|
UNDO_HOLDING = false;
|
|
|
|
|
|
|
|
if(record) recordAction(ACTION_TYPE.ungroup, collection, { io: _io, content: _content });
|
|
|
|
}
|
|
|
|
|
2023-02-28 09:43:01 +01:00
|
|
|
function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
2022-01-13 05:24:03 +01:00
|
|
|
nodes = ds_list_create();
|
2023-07-17 19:58:33 +02:00
|
|
|
ungroupable = true;
|
|
|
|
auto_render_time = false;
|
2023-02-19 13:49:20 +01:00
|
|
|
combine_render_time = true;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-01 10:32:21 +02:00
|
|
|
reset_all_child = false;
|
2023-07-17 19:58:33 +02:00
|
|
|
isInstancer = false;
|
|
|
|
instanceBase = noone;
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2023-07-17 19:58:33 +02:00
|
|
|
custom_input_index = 0;
|
2022-01-23 04:08:16 +01:00
|
|
|
custom_output_index = 0;
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
metadata = new MetaDataManager();
|
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
attributes.separator = [];
|
|
|
|
attributes.w = 128;
|
|
|
|
attributes.h = 128;
|
2023-03-08 07:35:51 +01:00
|
|
|
|
2023-07-17 19:58:33 +02:00
|
|
|
tool_node = noone;
|
2023-09-11 16:08:58 +02:00
|
|
|
draw_input_overlay = true;
|
2023-07-17 19:58:33 +02:00
|
|
|
|
2023-07-14 20:34:35 +02:00
|
|
|
array_push(attributeEditors, ["Edit separator", function() { return attributes.separator; },
|
2023-03-19 09:17:39 +01:00
|
|
|
button(function() {
|
|
|
|
var dia = dialogCall(o_dialog_group_input_order);
|
|
|
|
dia.node = self;
|
|
|
|
}) ]);
|
|
|
|
|
2023-06-04 18:28:29 +02:00
|
|
|
insp1UpdateTooltip = __txtx("panel_inspector_execute", "Execute node contents");
|
2023-03-28 06:58:28 +02:00
|
|
|
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
static inspector1Update = function() { onInspector1Update(); }
|
|
|
|
static onInspector1Update = function() { RenderListAction(nodes, group); }
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static hasInspector1Update = function(group = false) { #region
|
2023-03-02 07:59:14 +01:00
|
|
|
if(!group) return false;
|
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(nodes); i++ ) {
|
2023-03-28 06:58:28 +02:00
|
|
|
if(nodes[| i].hasInspector1Update())
|
2023-03-02 07:59:14 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static getNodeBase = function() { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
if(instanceBase == noone) return self;
|
|
|
|
return instanceBase.getNodeBase();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static getNodeList = function() { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
if(instanceBase == noone) return nodes;
|
|
|
|
return instanceBase.getNodeList();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static setHeight = function() { #region
|
2023-03-11 01:40:17 +01:00
|
|
|
var _hi = ui(32);
|
|
|
|
var _ho = ui(32);
|
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(inputs); i++ )
|
|
|
|
if(inputs[| i].isVisible()) _hi += 24;
|
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(outputs); i++ )
|
|
|
|
if(outputs[| i].isVisible()) _ho += 24;
|
|
|
|
|
|
|
|
var preH = (preview_surface && previewable)? 128 : 0;
|
|
|
|
|
|
|
|
h = max(min_h, preH, _hi, _ho);
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
2023-09-11 16:08:58 +02:00
|
|
|
if(!draw_input_overlay) return;
|
2023-01-01 02:06:02 +01:00
|
|
|
for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
|
2023-03-11 01:40:17 +01:00
|
|
|
var _in = inputs[| i];
|
2023-10-02 08:57:44 +02:00
|
|
|
var _show = _in.from.getInputData(6);
|
2023-01-01 02:06:02 +01:00
|
|
|
|
|
|
|
if(!_show) continue;
|
|
|
|
_in.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
|
|
|
}
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static getOutputNodes = function() { #region
|
2023-06-13 14:42:06 +02:00
|
|
|
var nodes = [];
|
|
|
|
for( var i = custom_output_index; i < ds_list_size(outputs); i++ ) {
|
|
|
|
var _junc = outputs[| i];
|
|
|
|
|
|
|
|
for( var j = 0; j < ds_list_size(_junc.value_to); j++ ) {
|
|
|
|
var _to = _junc.value_to[| j];
|
|
|
|
if(_to.value_from != _junc) continue;
|
|
|
|
array_push_unique(nodes, _to.node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nodes;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-06-13 14:42:06 +02:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static getNextNodes = function() { #region //get node inside the group
|
2023-04-03 11:55:45 +02:00
|
|
|
LOG_BLOCK_START();
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"→→→→→ Call get next node from group");
|
2023-06-01 10:32:21 +02:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
var nodes = [];
|
2023-06-17 14:30:49 +02:00
|
|
|
if(isRenderActive()) {
|
2023-06-13 14:42:06 +02:00
|
|
|
var allReady = true;
|
|
|
|
for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
|
|
|
|
var _in = inputs[| i].from;
|
2023-06-17 14:30:49 +02:00
|
|
|
if(!_in.isRenderActive()) continue;
|
2022-12-16 09:18:09 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
if(!_in.isRenderable()) {
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Node {_in.internalName} not ready, loop skip.");
|
2023-06-13 14:42:06 +02:00
|
|
|
LOG_BLOCK_END();
|
|
|
|
return [];
|
|
|
|
}
|
2023-06-01 10:32:21 +02:00
|
|
|
}
|
2023-06-13 14:42:06 +02:00
|
|
|
|
|
|
|
nodes = __nodeLeafList(getNodeList());
|
2022-12-16 09:18:09 +01:00
|
|
|
}
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-04-03 11:55:45 +02:00
|
|
|
LOG_BLOCK_END();
|
2023-03-28 06:58:28 +02:00
|
|
|
return nodes;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-12-16 09:18:09 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static getNextNodesExternal = function() { #region //get node connected to the parent object
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Checking next node external for {INAME}");
|
2023-07-28 19:41:57 +02:00
|
|
|
LOG_BLOCK_START();
|
|
|
|
|
2023-06-01 10:32:21 +02:00
|
|
|
var nodes = [];
|
|
|
|
for( var i = 0; i < ds_list_size(outputs); i++ ) {
|
|
|
|
var _ot = outputs[| i];
|
2023-07-28 19:41:57 +02:00
|
|
|
var _tos = _ot.getJunctionTo();
|
2023-06-01 10:32:21 +02:00
|
|
|
|
2023-07-28 19:41:57 +02:00
|
|
|
for( var j = 0, n = array_length(_tos); j < n; j++ ) {
|
|
|
|
var _to = _tos[j];
|
2023-06-01 10:32:21 +02:00
|
|
|
var _node = _to.node;
|
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Checking node {_node.internalName} : {_node.isRenderable()}");
|
2023-07-28 19:41:57 +02:00
|
|
|
if(!_node.isRenderable()) continue;
|
2023-06-01 10:32:21 +02:00
|
|
|
|
2023-07-28 19:41:57 +02:00
|
|
|
array_push(nodes, _to.node);
|
2023-06-01 10:32:21 +02:00
|
|
|
}
|
|
|
|
}
|
2023-07-28 19:41:57 +02:00
|
|
|
LOG_BLOCK_END();
|
2023-06-01 10:32:21 +02:00
|
|
|
|
|
|
|
return nodes;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-06-01 10:32:21 +02:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static setRenderStatus = function(result) { #region
|
2023-04-03 11:55:45 +02:00
|
|
|
LOG_BLOCK_START();
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Set render status for {INAME} : {result}");
|
2022-12-12 09:08:03 +01:00
|
|
|
rendered = result;
|
|
|
|
|
2023-07-28 19:41:57 +02:00
|
|
|
if(result)
|
|
|
|
for( var i = custom_output_index, n = ds_list_size(outputs); i < n; i++ ) {
|
|
|
|
var _o = outputs[| i];
|
|
|
|
if(_o.from.rendered) continue;
|
2022-12-16 09:18:09 +01:00
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Set fail because {_o.from.internalName} is not rendered.");
|
2023-07-28 19:41:57 +02:00
|
|
|
rendered = false;
|
|
|
|
break;
|
2022-12-12 09:08:03 +01:00
|
|
|
}
|
2023-04-09 21:24:16 +02:00
|
|
|
|
|
|
|
if(rendered)
|
|
|
|
exitGroup();
|
|
|
|
|
2023-02-28 09:43:01 +01:00
|
|
|
if(!result && group != noone)
|
2022-12-12 09:08:03 +01:00
|
|
|
group.setRenderStatus(result);
|
2023-07-28 19:41:57 +02:00
|
|
|
LOG_BLOCK_END();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-12-12 09:08:03 +01:00
|
|
|
|
2023-04-09 21:24:16 +02:00
|
|
|
static exitGroup = function() {}
|
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static add = function(_node) { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
ds_list_add(getNodeList(), _node);
|
|
|
|
var list = _node.group == noone? PANEL_GRAPH.nodes_list : _node.group.getNodeList();
|
2022-01-13 05:24:03 +01:00
|
|
|
var _pos = ds_list_find_index(list, _node);
|
|
|
|
ds_list_delete(list, _pos);
|
|
|
|
|
|
|
|
recordAction(ACTION_TYPE.group_added, self, _node);
|
|
|
|
_node.group = self;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static remove = function(_node) { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
var node_list = getNodeList();
|
|
|
|
var _pos = ds_list_find_index(node_list, _node);
|
|
|
|
ds_list_delete(node_list, _pos);
|
|
|
|
var list = group == noone? PANEL_GRAPH.nodes_list : group.getNodeList();
|
2022-01-13 05:24:03 +01:00
|
|
|
ds_list_add(list, _node);
|
|
|
|
|
|
|
|
recordAction(ACTION_TYPE.group_removed, self, _node);
|
2022-01-29 14:25:18 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
if(struct_has(_node, "ungroup"))
|
|
|
|
_node.ungroup();
|
|
|
|
|
|
|
|
if(_node.destroy_when_upgroup)
|
|
|
|
nodeDelete(_node);
|
|
|
|
else
|
|
|
|
_node.group = group;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static clearCache = function() { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
var node_list = getNodeList();
|
|
|
|
for(var i = 0; i < ds_list_size(node_list); i++) {
|
|
|
|
node_list[| i].clearCache();
|
2022-12-10 05:06:01 +01:00
|
|
|
}
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-12-10 05:06:01 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static stepBegin = function() { #region
|
2023-10-02 14:41:44 +02:00
|
|
|
use_cache = CACHE_USE.none;
|
2022-12-23 04:45:52 +01:00
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
array_safe_set(cache_result, PROJECT.animator.current_frame, true);
|
2022-12-10 05:06:01 +01:00
|
|
|
|
2023-02-28 09:43:01 +01:00
|
|
|
var node_list = getNodeList();
|
|
|
|
for(var i = 0; i < ds_list_size(node_list); i++) {
|
2023-07-25 20:12:40 +02:00
|
|
|
var _node = node_list[| i];
|
|
|
|
_node.stepBegin();
|
|
|
|
if(!_node.use_cache) continue;
|
2022-12-10 05:06:01 +01:00
|
|
|
|
2023-10-02 14:41:44 +02:00
|
|
|
use_cache = CACHE_USE.manual;
|
2023-07-25 20:12:40 +02:00
|
|
|
if(!array_safe_get(_node.cache_result, PROJECT.animator.current_frame))
|
2023-07-06 19:49:16 +02:00
|
|
|
array_safe_set(cache_result, PROJECT.animator.current_frame, false);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2022-01-25 04:05:30 +01:00
|
|
|
|
|
|
|
var out_surf = false;
|
|
|
|
|
2022-01-29 14:25:18 +01:00
|
|
|
for( var i = 0; i < ds_list_size(outputs); i++) {
|
2022-01-25 04:05:30 +01:00
|
|
|
if(outputs[| i].type == VALUE_TYPE.surface)
|
|
|
|
out_surf = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(out_surf) {
|
|
|
|
w = 128;
|
|
|
|
min_h = 128;
|
|
|
|
} else {
|
|
|
|
w = 96;
|
2023-01-17 08:11:55 +01:00
|
|
|
|
2022-01-25 04:05:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
setHeight();
|
2022-12-16 09:18:09 +01:00
|
|
|
doStepBegin();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static step = function() { #region
|
2023-02-19 13:49:20 +01:00
|
|
|
if(combine_render_time) render_time = 0;
|
|
|
|
|
2023-02-28 09:43:01 +01:00
|
|
|
var node_list = getNodeList();
|
|
|
|
for(var i = 0; i < ds_list_size(node_list); i++) {
|
|
|
|
node_list[| i].step();
|
2023-02-19 13:49:20 +01:00
|
|
|
if(combine_render_time)
|
2023-02-28 09:43:01 +01:00
|
|
|
render_time += node_list[| i].render_time;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
w = attributes.w;
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2022-12-16 09:18:09 +01:00
|
|
|
onStep();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static triggerCheck = function() { #region
|
2023-06-13 14:42:06 +02:00
|
|
|
_triggerCheck();
|
|
|
|
var node_list = getNodeList();
|
|
|
|
for(var i = 0; i < ds_list_size(node_list); i++)
|
|
|
|
node_list[| i].triggerCheck();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-06-13 14:42:06 +02:00
|
|
|
|
2022-12-16 09:18:09 +01:00
|
|
|
static onStep = function() {}
|
|
|
|
|
2023-03-08 14:59:54 +01:00
|
|
|
PATCH_STATIC
|
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
//static triggerRender = function() {
|
|
|
|
// for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
|
|
|
|
// var jun_node = inputs[| i].from;
|
|
|
|
// jun_node.triggerRender();
|
|
|
|
// }
|
|
|
|
//}
|
2022-01-23 04:08:16 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static preConnect = function() { #region
|
2022-01-18 05:31:19 +01:00
|
|
|
sortIO();
|
2022-12-12 09:08:03 +01:00
|
|
|
deserialize(load_map, load_scale);
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static sortIO = function() { #region
|
2023-03-08 07:35:51 +01:00
|
|
|
input_display_list = [];
|
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
var sep = attributes.separator;
|
2023-03-08 07:35:51 +01:00
|
|
|
array_sort(sep, function(a0, a1) { return a0[0] - a1[0]; });
|
2022-01-18 05:31:19 +01:00
|
|
|
var siz = ds_list_size(inputs);
|
2023-03-08 07:35:51 +01:00
|
|
|
var ar = ds_priority_create();
|
2022-01-18 05:31:19 +01:00
|
|
|
|
2022-01-23 04:08:16 +01:00
|
|
|
for( var i = custom_input_index; i < siz; i++ ) {
|
2022-01-18 05:31:19 +01:00
|
|
|
var _in = inputs[| i];
|
2023-09-11 16:08:58 +02:00
|
|
|
var _or = _in.from.attributes.input_priority;
|
2022-01-18 05:31:19 +01:00
|
|
|
|
|
|
|
ds_priority_add(ar, _in, _or);
|
|
|
|
}
|
|
|
|
|
2023-03-08 07:35:51 +01:00
|
|
|
for( var i = siz - 1; i >= custom_input_index; i-- )
|
2022-01-23 04:08:16 +01:00
|
|
|
ds_list_delete(inputs, i);
|
|
|
|
|
2023-03-08 07:35:51 +01:00
|
|
|
for( var i = 0; i < custom_input_index; i++ )
|
|
|
|
array_push(input_display_list, i);
|
|
|
|
|
2022-01-23 04:08:16 +01:00
|
|
|
for( var i = custom_input_index; i < siz; i++ ) {
|
2022-01-18 05:31:19 +01:00
|
|
|
var _jin = ds_priority_delete_min(ar);
|
|
|
|
_jin.index = i;
|
|
|
|
ds_list_add(inputs, _jin);
|
2023-03-08 07:35:51 +01:00
|
|
|
array_push(input_display_list, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for( var i = array_length(sep) - 1; i >= 0; i-- ) {
|
|
|
|
array_insert(input_display_list, sep[i][0], [ sep[i][1], false, i ]);
|
2022-01-18 05:31:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ds_priority_destroy(ar);
|
|
|
|
|
|
|
|
var siz = ds_list_size(outputs);
|
|
|
|
var ar = ds_priority_create();
|
|
|
|
|
2022-01-23 04:08:16 +01:00
|
|
|
for( var i = custom_output_index; i < siz; i++ ) {
|
2022-01-18 05:31:19 +01:00
|
|
|
var _out = outputs[| i];
|
2023-09-11 16:08:58 +02:00
|
|
|
var _or = _out.from.attributes.input_priority;
|
2022-01-18 05:31:19 +01:00
|
|
|
|
|
|
|
ds_priority_add(ar, _out, _or);
|
|
|
|
}
|
|
|
|
|
2022-01-23 04:08:16 +01:00
|
|
|
for( var i = siz - 1; i >= custom_output_index; i-- ) {
|
|
|
|
ds_list_delete(outputs, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for( var i = custom_output_index; i < siz; i++ ) {
|
2022-01-18 05:31:19 +01:00
|
|
|
var _jout = ds_priority_delete_min(ar);
|
|
|
|
_jout.index = i;
|
|
|
|
ds_list_add(outputs, _jout);
|
|
|
|
}
|
|
|
|
|
|
|
|
ds_priority_destroy(ar);
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-01-19 03:51:53 +01:00
|
|
|
|
2023-07-17 19:58:33 +02:00
|
|
|
static getTool = function() {
|
2023-09-13 16:24:01 +02:00
|
|
|
for(var i = 0; i < ds_list_size(nodes); i++) { #region
|
2023-07-17 19:58:33 +02:00
|
|
|
var _node = nodes[| i];
|
|
|
|
if(_node.isTool) return _node.getTool();
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-07-17 19:58:33 +02:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static onClone = function(_newNode, target = PANEL_GRAPH.getCurrentContext()) { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
if(instanceBase != noone) {
|
|
|
|
_newNode.instanceBase = instanceBase;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
var dups = ds_list_create();
|
|
|
|
|
|
|
|
for(var i = 0; i < ds_list_size(nodes); i++) {
|
|
|
|
var _node = nodes[| i];
|
|
|
|
var _cnode = _node.clone(target);
|
|
|
|
ds_list_add(dups, _cnode);
|
|
|
|
|
|
|
|
APPEND_MAP[? _node.node_id] = _cnode.node_id;
|
2022-01-19 03:51:53 +01:00
|
|
|
}
|
2023-02-14 05:32:32 +01:00
|
|
|
|
|
|
|
APPENDING = true;
|
|
|
|
for(var i = 0; i < ds_list_size(dups); i++) {
|
|
|
|
var _node = dups[| i];
|
|
|
|
_node.connect();
|
|
|
|
}
|
|
|
|
APPENDING = false;
|
|
|
|
|
|
|
|
ds_list_destroy(dups);
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-02-14 05:32:32 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static enable = function() { #region
|
2023-02-14 05:32:32 +01:00
|
|
|
active = true;
|
2023-02-28 09:43:01 +01:00
|
|
|
var node_list = getNodeList();
|
|
|
|
for( var i = 0; i < ds_list_size(node_list); i++ )
|
|
|
|
node_list[| i].enable();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-02-14 05:32:32 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static disable = function() { #region
|
2023-02-14 05:32:32 +01:00
|
|
|
active = false;
|
2023-02-28 09:43:01 +01:00
|
|
|
var node_list = getNodeList();
|
|
|
|
for( var i = 0; i < ds_list_size(node_list); i++ )
|
|
|
|
node_list[| i].disable();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-01-25 04:05:30 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static resetRender = function() { #region
|
2023-04-03 11:55:45 +02:00
|
|
|
LOG_BLOCK_START();
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Reset Render for {INAME}");
|
2023-04-03 11:55:45 +02:00
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(nodes); i++ ) {
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Reseting {nodes[| i].internalName}");
|
2023-06-01 10:32:21 +02:00
|
|
|
nodes[| i].resetRender();
|
2022-01-25 04:05:30 +01:00
|
|
|
}
|
2023-04-03 11:55:45 +02:00
|
|
|
|
2023-06-01 10:32:21 +02:00
|
|
|
setRenderStatus(false);
|
2023-04-03 11:55:45 +02:00
|
|
|
|
|
|
|
LOG_BLOCK_END();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2022-12-21 02:30:23 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static setInstance = function(node) { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
instanceBase = node;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static resetInstance = function() { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
instanceBase = noone;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static onDoubleClick = function(panel) { #region
|
2023-07-15 20:01:29 +02:00
|
|
|
panel.addContext(self);
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-07-15 20:01:29 +02:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static processSerialize = function(_map) { #region
|
2023-02-28 09:43:01 +01:00
|
|
|
_map[? "instance_base"] = instanceBase? instanceBase.node_id : noone;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static preConnect = function() { #region
|
2023-06-13 14:42:06 +02:00
|
|
|
instanceBase = GetAppendID(struct_try_get(load_map, "instance_base", noone));
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2022-12-21 02:30:23 +01:00
|
|
|
sortIO();
|
2023-01-17 08:11:55 +01:00
|
|
|
applyDeserialize();
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-03-08 07:35:51 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static attributeSerialize = function() { #region
|
2023-06-13 14:42:06 +02:00
|
|
|
var att = {};
|
|
|
|
att.separator = json_stringify(attributes.separator);
|
|
|
|
att.w = attributes.w;
|
|
|
|
att.h = attributes.h;
|
2023-03-08 07:35:51 +01:00
|
|
|
return att;
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-03-08 07:35:51 +01:00
|
|
|
|
2023-09-13 16:24:01 +02:00
|
|
|
static attributeDeserialize = function(attr) { #region
|
2023-06-13 14:42:06 +02:00
|
|
|
if(struct_has(attr, "separator"))
|
|
|
|
attributes.separator = json_parse(attr.separator);
|
2023-06-17 14:30:49 +02:00
|
|
|
attributes.w = struct_try_get(attr, "w", 128);
|
|
|
|
attributes.h = struct_try_get(attr, "h", 128);
|
2023-09-13 16:24:01 +02:00
|
|
|
} #endregion
|
2023-03-08 07:35:51 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|