2022-01-25 04:05:30 +01:00
|
|
|
enum RENDER_TYPE {
|
|
|
|
none = 0,
|
|
|
|
partial = 1,
|
|
|
|
full = 2
|
|
|
|
}
|
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
#region globalvar
|
2023-10-02 10:45:30 +02:00
|
|
|
globalvar UPDATE, RENDER_QUEUE, RENDER_ORDER, UPDATE_RENDER_ORDER;
|
|
|
|
UPDATE_RENDER_ORDER = false;
|
2023-10-07 16:23:40 +02:00
|
|
|
global.FLAG.render = 0;
|
2023-10-07 09:26:47 +02:00
|
|
|
global.group_io = [
|
|
|
|
"Node_Group_Input", "Node_Group_Output",
|
|
|
|
"Node_Feedback_Input", "Node_Feedback_Output",
|
|
|
|
"Node_Iterator_Input", "Node_Iterator_Output",
|
|
|
|
"Node_Iterator_Each_Input", "Node_Iterator_Each_Output",
|
|
|
|
"Node_Iterator_Filter_Input", "Node_Iterator_Filter_Output",
|
2023-10-07 16:23:40 +02:00
|
|
|
"Node_Tunnel_In", "Node_Tunnel_Out"
|
2023-10-07 09:26:47 +02:00
|
|
|
];
|
2023-10-02 10:45:30 +02:00
|
|
|
|
|
|
|
#macro RENDER_ALL_REORDER UPDATE_RENDER_ORDER = true; UPDATE |= RENDER_TYPE.full;
|
|
|
|
#macro RENDER_ALL UPDATE |= RENDER_TYPE.full;
|
|
|
|
#macro RENDER_PARTIAL UPDATE |= RENDER_TYPE.partial;
|
2023-03-28 06:58:28 +02:00
|
|
|
#endregion
|
2022-12-13 09:20:36 +01:00
|
|
|
|
2023-10-02 10:45:30 +02:00
|
|
|
function __nodeLeafList(_list) { #region
|
2023-03-28 06:58:28 +02:00
|
|
|
var nodes = [];
|
2023-06-01 10:32:21 +02:00
|
|
|
var nodeNames = [];
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-08-01 19:21:51 +02:00
|
|
|
for( var i = 0, n = ds_list_size(_list); i < n; i++ ) {
|
2022-01-24 02:21:25 +01:00
|
|
|
var _node = _list[| i];
|
2022-12-13 09:20:36 +01:00
|
|
|
if(!_node.active) continue;
|
2023-06-17 14:30:49 +02:00
|
|
|
if(!_node.isRenderActive()) continue;
|
2022-12-13 09:20:36 +01:00
|
|
|
|
2023-03-26 07:13:36 +02:00
|
|
|
var _startNode = _node.isRenderable();
|
2022-12-13 09:20:36 +01:00
|
|
|
if(_startNode) {
|
2023-03-28 06:58:28 +02:00
|
|
|
array_push(nodes, _node);
|
2023-06-01 10:32:21 +02:00
|
|
|
array_push(nodeNames, _node.internalName);
|
2022-01-24 02:21:25 +01:00
|
|
|
}
|
|
|
|
}
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_LINE_IF(global.FLAG.render == 1, $"Push node {nodeNames} to queue");
|
2023-03-28 06:58:28 +02:00
|
|
|
return nodes;
|
2023-10-02 10:45:30 +02:00
|
|
|
} #endregion
|
2022-01-24 02:21:25 +01:00
|
|
|
|
2023-10-10 07:12:42 +02:00
|
|
|
function __nodeManualManaged(_node) { #region
|
2022-12-16 09:18:09 +01:00
|
|
|
var gr = _node.group;
|
2023-02-28 09:43:01 +01:00
|
|
|
while(gr != noone) {
|
2023-10-10 07:12:42 +02:00
|
|
|
if(gr.managedRenderOrder) return true;
|
2022-12-16 09:18:09 +01:00
|
|
|
gr = gr.group;
|
|
|
|
}
|
|
|
|
return false;
|
2023-10-02 10:45:30 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
function ResetAllNodesRender() { #region
|
2023-10-09 16:07:33 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"XXXXXXXXXXXXXXXXXXXX RESETTING ALL NODES [frame {CURRENT_FRAME}] XXXXXXXXXXXXXXXXXXXX");
|
2023-10-07 16:23:40 +02:00
|
|
|
|
2023-10-02 10:45:30 +02:00
|
|
|
var _key = ds_map_find_first(PROJECT.nodeMap);
|
|
|
|
var amo = ds_map_size(PROJECT.nodeMap);
|
|
|
|
|
|
|
|
repeat(amo) {
|
|
|
|
var _node = PROJECT.nodeMap[? _key];
|
|
|
|
_node.setRenderStatus(false);
|
2023-10-04 05:52:20 +02:00
|
|
|
|
|
|
|
for( var i = 0, n = ds_list_size(_node.inputs); i < n; i++ )
|
|
|
|
_node.inputs[| i].resetCache();
|
|
|
|
|
2023-10-02 10:45:30 +02:00
|
|
|
_key = ds_map_find_next(PROJECT.nodeMap, _key);
|
|
|
|
}
|
|
|
|
} #endregion
|
2022-12-16 09:18:09 +01:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
function NodeTopoSort() { #region
|
|
|
|
var _key = ds_map_find_first(PROJECT.nodeMap);
|
|
|
|
var amo = ds_map_size(PROJECT.nodeMap);
|
|
|
|
|
|
|
|
repeat(amo) {
|
|
|
|
var _node = PROJECT.nodeMap[? _key];
|
|
|
|
_node.topoSorted = false;
|
|
|
|
_key = ds_map_find_next(PROJECT.nodeMap, _key);
|
|
|
|
}
|
|
|
|
|
|
|
|
ds_list_clear(PROJECT.nodeTopo);
|
|
|
|
__sortGraph(PROJECT.nodeTopo, PROJECT.nodes);
|
2023-10-08 04:14:35 +02:00
|
|
|
|
2023-10-08 08:02:38 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"+++++++ Topo Sort Completed: {ds_list_size(PROJECT.nodeTopo)} nodes sorted +++++++");
|
2023-10-07 16:23:40 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
function __sortGraph(_list, _nodeList) { #region
|
|
|
|
var _root = [];
|
|
|
|
|
|
|
|
for( var i = 0, n = ds_list_size(_nodeList); i < n; i++ ) {
|
|
|
|
var _node = _nodeList[| i];
|
|
|
|
var _isRoot = true;
|
|
|
|
|
|
|
|
for( var j = 0, m = ds_list_size(_node.outputs); j < m; j++ ) {
|
|
|
|
if(!array_empty(_node.outputs[| j].getJunctionTo())) {
|
|
|
|
_isRoot = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_isRoot) array_push(_root, _node);
|
|
|
|
}
|
|
|
|
|
|
|
|
var _st = ds_stack_create();
|
|
|
|
|
|
|
|
for( var i = 0, n = array_length(_root); i < n; i++ )
|
|
|
|
ds_stack_push(_st, _root[i]);
|
|
|
|
|
|
|
|
while(!ds_stack_empty(_st)) {
|
|
|
|
var _node = ds_stack_pop(_st);
|
|
|
|
if(_node.topoSorted) continue;
|
|
|
|
|
|
|
|
var _isLeaf = true;
|
|
|
|
var _childs = [];
|
|
|
|
|
|
|
|
for( var i = 0, n = ds_list_size(_node.inputs); i < n; i++ ) {
|
|
|
|
var _in = _node.inputs[| i];
|
2023-10-27 13:55:31 +02:00
|
|
|
if(_in.isLeaf()) continue;
|
2023-10-07 16:23:40 +02:00
|
|
|
if(_in.value_from.node.topoSorted) continue;
|
|
|
|
|
|
|
|
array_push(_childs, _in.value_from.node);
|
|
|
|
_isLeaf = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_isLeaf) {
|
|
|
|
ds_list_add(_list, _node);
|
|
|
|
_node.topoSorted = true;
|
|
|
|
|
|
|
|
if(is_instanceof(_node, Node_Collection))
|
|
|
|
__sortGraph(_list, _node.nodes);
|
|
|
|
} else {
|
|
|
|
ds_stack_push(_st, _node);
|
|
|
|
for( var i = 0, n = array_length(_childs); i < n; i++ )
|
|
|
|
ds_stack_push(_st, _childs[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} #endregion
|
|
|
|
|
2023-10-02 10:45:30 +02:00
|
|
|
function Render(partial = false, runAction = false) { #region
|
2023-04-03 11:55:45 +02:00
|
|
|
LOG_BLOCK_START();
|
2023-10-09 16:07:33 +02:00
|
|
|
LOG_IF(global.FLAG.render, $"============================== RENDER START [{partial? "PARTIAL" : "FULL"}] [frame {CURRENT_FRAME}] ==============================");
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
try {
|
2023-10-05 06:29:20 +02:00
|
|
|
var t = get_timer();
|
|
|
|
var t1 = get_timer();
|
|
|
|
|
|
|
|
var _render_time = 0;
|
|
|
|
var _leaf_time = 0;
|
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
var rendering = noone;
|
2023-06-01 10:32:21 +02:00
|
|
|
var error = 0;
|
|
|
|
var reset_all = !partial || ALWAYS_FULL;
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-06-01 10:32:21 +02:00
|
|
|
if(reset_all) {
|
2023-07-06 19:49:16 +02:00
|
|
|
var _key = ds_map_find_first(PROJECT.nodeMap);
|
|
|
|
var amo = ds_map_size(PROJECT.nodeMap);
|
2022-12-16 09:18:09 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
repeat(amo) {
|
2023-07-06 19:49:16 +02:00
|
|
|
var _node = PROJECT.nodeMap[? _key];
|
2023-02-14 02:51:14 +01:00
|
|
|
_node.setRenderStatus(false);
|
2023-07-06 19:49:16 +02:00
|
|
|
_key = ds_map_find_next(PROJECT.nodeMap, _key);
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
2022-12-10 05:06:01 +01:00
|
|
|
}
|
2023-10-02 10:45:30 +02:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
// get leaf node
|
2023-10-08 04:14:35 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"----- Finding leaf from {ds_list_size(PROJECT.nodeTopo)} nodes -----");
|
2023-06-01 10:32:21 +02:00
|
|
|
RENDER_QUEUE.clear();
|
2023-10-07 16:23:40 +02:00
|
|
|
for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) {
|
|
|
|
var _node = PROJECT.nodeTopo[| i];
|
|
|
|
_node.passiveDynamic = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) {
|
|
|
|
var _node = PROJECT.nodeTopo[| i];
|
2023-04-03 11:55:45 +02:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(is_undefined(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip undefiend [{_node}]"); continue; }
|
|
|
|
if(!is_instanceof(_node, Node)) { LOG_IF(global.FLAG.render == 1, $"Skip non-node [{_node}]"); continue; }
|
2023-10-02 14:41:44 +02:00
|
|
|
_node.render_time = 0;
|
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(array_exists(global.group_io, instanceof(_node))) {
|
|
|
|
LOG_IF(global.FLAG.render == 1, $"Skip group IO [{_node.internalName}]"); continue; }
|
2023-03-29 15:02:03 +02:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive [{_node.internalName}]"); continue; }
|
|
|
|
if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive [{_node.internalName}]"); continue; }
|
|
|
|
if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update [{_node.internalName}]"); continue; }
|
2023-10-10 07:12:42 +02:00
|
|
|
if(__nodeManualManaged(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop [{_node.internalName}]"); continue; }
|
2023-03-29 15:02:03 +02:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(_node.passiveDynamic) {
|
|
|
|
_node.forwardPassiveDynamic(); LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic [{_node.internalName}]"); continue; }
|
2023-04-03 11:55:45 +02:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(_node.rendered && !_node.isActiveDynamic()) { LOG_IF(global.FLAG.render == 1, $"Skip rendered static [{_node.internalName}]"); continue; }
|
2023-04-03 11:55:45 +02:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $" Found leaf [{_node.internalName}]");
|
|
|
|
RENDER_QUEUE.enqueue(_node);
|
|
|
|
_node.forwardPassiveDynamic();
|
2022-12-10 05:06:01 +01:00
|
|
|
}
|
2023-04-03 11:55:45 +02:00
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
_leaf_time = get_timer() - t;
|
|
|
|
LOG_IF(global.FLAG.render >= 1, $"Get leaf complete: found {RENDER_QUEUE.size()} leaves in {(get_timer() - t) / 1000} ms."); t = get_timer();
|
|
|
|
LOG_IF(global.FLAG.render == 1, "================== Start rendering ==================");
|
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
// render forward
|
2023-06-01 10:32:21 +02:00
|
|
|
while(!RENDER_QUEUE.empty()) {
|
|
|
|
LOG_BLOCK_START();
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE} [{RENDER_QUEUE.size()}] ");
|
2023-10-07 16:23:40 +02:00
|
|
|
|
2023-06-01 10:32:21 +02:00
|
|
|
rendering = RENDER_QUEUE.dequeue();
|
2023-04-04 13:44:37 +02:00
|
|
|
var renderable = rendering.isRenderable();
|
2023-04-03 11:55:45 +02:00
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Rendering {rendering.internalName} ({rendering.display_name}) : {renderable? "Update" : "Pass"}");
|
2023-03-29 15:02:03 +02:00
|
|
|
|
2023-04-04 13:44:37 +02:00
|
|
|
if(renderable) {
|
2023-10-05 06:29:20 +02:00
|
|
|
var _render_pt = get_timer();
|
2023-03-02 07:59:14 +01:00
|
|
|
rendering.doUpdate();
|
2023-10-05 06:29:20 +02:00
|
|
|
_render_time += get_timer() - _render_pt;
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
var nextNodes = rendering.getNextNodes();
|
2023-10-02 10:45:30 +02:00
|
|
|
for( var i = 0, n = array_length(nextNodes); i < n; i++ ) {
|
2023-06-01 10:32:21 +02:00
|
|
|
RENDER_QUEUE.enqueue(nextNodes[i]);
|
2023-10-02 10:45:30 +02:00
|
|
|
}
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
if(runAction && rendering.hasInspector1Update())
|
|
|
|
rendering.inspector1Update();
|
2023-06-13 14:42:06 +02:00
|
|
|
}
|
2023-03-29 15:02:03 +02:00
|
|
|
|
2023-04-03 11:55:45 +02:00
|
|
|
LOG_BLOCK_END();
|
2023-03-02 07:59:14 +01:00
|
|
|
}
|
2023-10-05 06:29:20 +02:00
|
|
|
|
|
|
|
_render_time /= 1000;
|
|
|
|
|
|
|
|
LOG_IF(global.FLAG.render >= 1, $"=== RENDER COMPLETE IN {(get_timer() - t1) / 1000} ms ===\n");
|
|
|
|
LOG_IF(global.FLAG.render > 1, $"=== RENDER SUMMARY STA ===");
|
|
|
|
LOG_IF(global.FLAG.render > 1, $" total time: {(get_timer() - t1) / 1000} ms");
|
|
|
|
LOG_IF(global.FLAG.render > 1, $" leaf: {_leaf_time / 1000} ms");
|
|
|
|
LOG_IF(global.FLAG.render > 1, $" render loop: {(get_timer() - t) / 1000} ms");
|
|
|
|
LOG_IF(global.FLAG.render > 1, $" render only: {_render_time} ms");
|
|
|
|
LOG_IF(global.FLAG.render > 1, $"=== RENDER SUMMARY END ===");
|
|
|
|
|
2023-05-08 10:50:42 +02:00
|
|
|
} catch(e) {
|
2023-03-02 07:59:14 +01:00
|
|
|
noti_warning(exception_print(e));
|
2023-05-08 10:50:42 +02:00
|
|
|
}
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-04-03 11:55:45 +02:00
|
|
|
LOG_END();
|
2023-10-02 10:45:30 +02:00
|
|
|
} #endregion
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
function NodeListSort(_list, _nodeList) { #region
|
|
|
|
for( var i = 0, n = ds_list_size(_nodeList); i < n; i++ )
|
|
|
|
_nodeList[| i].topoSorted = false;
|
|
|
|
|
|
|
|
ds_list_clear(_list);
|
|
|
|
__sortGraph(_list, _nodeList);
|
|
|
|
} #endregion
|
|
|
|
|
2023-10-02 10:45:30 +02:00
|
|
|
function __renderListReset(list) { #region
|
2023-03-02 07:59:14 +01:00
|
|
|
for( var i = 0; i < ds_list_size(list); i++ ) {
|
|
|
|
list[| i].setRenderStatus(false);
|
2023-03-24 05:55:34 +01:00
|
|
|
|
2023-03-02 07:59:14 +01:00
|
|
|
if(struct_has(list[| i], "nodes"))
|
|
|
|
__renderListReset(list[| i].nodes);
|
|
|
|
}
|
2023-10-02 10:45:30 +02:00
|
|
|
} #endregion
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-10-08 08:02:38 +02:00
|
|
|
function RenderList(list, skipInLoop = true) { #region
|
2023-04-23 16:47:33 +02:00
|
|
|
LOG_BLOCK_START();
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, "=============== RENDER LIST START ===============");
|
2023-04-23 16:47:33 +02:00
|
|
|
var queue = ds_queue_create();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var rendering = noone;
|
|
|
|
var error = 0;
|
|
|
|
var t = current_time;
|
|
|
|
|
|
|
|
__renderListReset(list);
|
|
|
|
|
|
|
|
// get leaf node
|
2023-10-07 16:23:40 +02:00
|
|
|
for( var i = 0, n = ds_list_size(list); i < n; i++ ) {
|
|
|
|
var _node = list[| i];
|
|
|
|
_node.passiveDynamic = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( var i = 0, n = ds_list_size(list); i < n; i++ ) {
|
2023-04-23 16:47:33 +02:00
|
|
|
var _node = list[| i];
|
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(is_undefined(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip undefiend {_node}"); continue; }
|
|
|
|
if(!is_instanceof(_node, Node)) { LOG_IF(global.FLAG.render == 1, $"Skip non-node {_node}"); continue; }
|
|
|
|
_node.render_time = 0;
|
2023-04-23 16:47:33 +02:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(array_exists(global.group_io, instanceof(_node))) {
|
|
|
|
LOG_IF(global.FLAG.render == 1, $"Skip group IO {_node.internalName}");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive {_node.internalName}"); continue; }
|
|
|
|
if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive {_node.internalName}"); continue; }
|
|
|
|
if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update {_node.internalName}"); continue; }
|
|
|
|
|
2023-10-10 07:12:42 +02:00
|
|
|
if(skipInLoop && __nodeManualManaged(_node)) { LOG_IF(global.FLAG.render == 1, $"Skip in-loop {_node.internalName}"); continue; }
|
2023-10-07 16:23:40 +02:00
|
|
|
|
|
|
|
if(_node.passiveDynamic) {
|
|
|
|
_node.forwardPassiveDynamic();
|
|
|
|
LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic {_node.internalName}");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_node.rendered && !_node.isActiveDynamic()) { LOG_IF(global.FLAG.render == 1, $"Skip rendered static {_node.internalName}"); continue; }
|
|
|
|
//if() { LOG_IF(global.FLAG.render == 1, $"Skip static {_node.internalName}"); continue; }
|
|
|
|
|
|
|
|
LOG_BLOCK_START();
|
|
|
|
|
|
|
|
LOG_IF(global.FLAG.render == 1, $"Found leaf {_node.internalName}");
|
|
|
|
ds_queue_enqueue(queue, _node);
|
|
|
|
_node.forwardPassiveDynamic();
|
|
|
|
|
|
|
|
LOG_BLOCK_END();
|
2023-04-23 16:47:33 +02:00
|
|
|
}
|
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, "Get leaf complete: found " + string(ds_queue_size(queue)) + " leaves.");
|
|
|
|
LOG_IF(global.FLAG.render == 1, "=== Start rendering ===");
|
2023-04-23 16:47:33 +02:00
|
|
|
|
|
|
|
// render forward
|
|
|
|
while(!ds_queue_empty(queue)) {
|
2023-06-13 14:42:06 +02:00
|
|
|
LOG_BLOCK_START();
|
2023-10-07 16:23:40 +02:00
|
|
|
rendering = ds_queue_dequeue(queue)
|
2023-06-13 14:42:06 +02:00
|
|
|
if(!ds_list_exist(list, rendering)) continue;
|
|
|
|
var renderable = rendering.isRenderable();
|
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Rendering {rendering.internalName} ({rendering.display_name}) : {renderable? "Update" : "Pass"}");
|
2023-04-23 16:47:33 +02:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
if(renderable) {
|
|
|
|
rendering.doUpdate();
|
2023-04-23 16:47:33 +02:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
var nextNodes = rendering.getNextNodes();
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(nextNodes); i < n; i++ )
|
2023-10-07 16:23:40 +02:00
|
|
|
ds_queue_enqueue(queue, nextNodes[i]);
|
|
|
|
}
|
2023-06-13 14:42:06 +02:00
|
|
|
|
|
|
|
LOG_BLOCK_END();
|
2023-04-23 16:47:33 +02:00
|
|
|
}
|
|
|
|
|
2023-05-08 10:50:42 +02:00
|
|
|
} catch(e) {
|
2023-04-23 16:47:33 +02:00
|
|
|
noti_warning(exception_print(e));
|
2023-05-08 10:50:42 +02:00
|
|
|
}
|
2023-04-23 16:47:33 +02:00
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, "=== RENDER COMPLETE ===\n");
|
2023-04-23 16:47:33 +02:00
|
|
|
LOG_END();
|
|
|
|
|
|
|
|
ds_queue_destroy(queue);
|
2023-10-02 10:45:30 +02:00
|
|
|
} #endregion
|
2023-04-23 16:47:33 +02:00
|
|
|
|
2023-10-02 10:45:30 +02:00
|
|
|
function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { #region
|
2023-10-09 16:07:33 +02:00
|
|
|
printIf(global.FLAG.render, "=== RENDER LIST ACTION START [frame " + string(CURRENT_FRAME) + "] ===");
|
2023-03-24 05:55:34 +01:00
|
|
|
|
2023-03-02 07:59:14 +01:00
|
|
|
try {
|
|
|
|
var rendering = noone;
|
2023-03-24 05:55:34 +01:00
|
|
|
var error = 0;
|
|
|
|
var t = current_time;
|
2023-03-02 07:59:14 +01:00
|
|
|
|
|
|
|
__renderListReset(list);
|
|
|
|
|
|
|
|
// get leaf node
|
2023-06-01 10:32:21 +02:00
|
|
|
RENDER_QUEUE.clear();
|
2023-03-02 07:59:14 +01:00
|
|
|
for( var i = 0; i < ds_list_size(list); i++ ) {
|
|
|
|
var _node = list[| i];
|
|
|
|
|
|
|
|
if(is_undefined(_node)) continue;
|
2023-06-17 14:30:49 +02:00
|
|
|
if(!is_struct(_node)) continue;
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-06-17 14:30:49 +02:00
|
|
|
if(!_node.active) continue;
|
|
|
|
if(!_node.isRenderActive()) continue;
|
|
|
|
if(_node.rendered) continue;
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-03-24 05:55:34 +01:00
|
|
|
if(_node.isRenderable()) {
|
2023-06-01 10:32:21 +02:00
|
|
|
RENDER_QUEUE.enqueue(_node);
|
2023-10-02 14:41:44 +02:00
|
|
|
printIf(global.FLAG.render, $" > Push {_node.internalName} node to queue");
|
2023-03-02 07:59:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// render forward
|
2023-06-01 10:32:21 +02:00
|
|
|
while(!RENDER_QUEUE.empty()) {
|
2023-06-13 14:42:06 +02:00
|
|
|
LOG_BLOCK_START();
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE}");
|
2023-06-01 10:32:21 +02:00
|
|
|
rendering = RENDER_QUEUE.dequeue();
|
2023-06-13 14:42:06 +02:00
|
|
|
if(!ds_list_exist(list, rendering)) continue;
|
|
|
|
var renderable = rendering.isRenderable();
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
LOG_IF(global.FLAG.render == 1, $"Rendering {rendering.internalName} ({rendering.display_name}) : {renderable? "Update" : "Pass"}");
|
2023-03-29 15:02:03 +02:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
if(renderable) {
|
2023-02-14 02:51:14 +01:00
|
|
|
rendering.doUpdate();
|
2023-03-28 06:58:28 +02:00
|
|
|
|
|
|
|
var nextNodes = rendering.getNextNodes();
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(nextNodes); i < n; i++ )
|
2023-06-01 10:32:21 +02:00
|
|
|
RENDER_QUEUE.enqueue(nextNodes[i]);
|
2023-06-13 14:42:06 +02:00
|
|
|
|
|
|
|
if(runAction && rendering.hasInspector1Update())
|
|
|
|
rendering.inspector1Update();
|
2023-06-17 14:30:49 +02:00
|
|
|
} else if(rendering.isRenderActive()) {
|
2023-06-13 14:42:06 +02:00
|
|
|
RENDER_QUEUE.enqueue(rendering);
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
2023-03-29 15:02:03 +02:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
LOG_BLOCK_END();
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2022-12-12 09:08:03 +01:00
|
|
|
|
2023-05-22 20:31:55 +02:00
|
|
|
printIf(global.FLAG.render, "=== RENDER COMPLETE IN {" + string(current_time - t) + "ms} ===\n");
|
2023-05-08 10:50:42 +02:00
|
|
|
} catch(e) {
|
2023-07-14 20:34:35 +02:00
|
|
|
noti_warning(exception_print(e));
|
2023-05-08 10:50:42 +02:00
|
|
|
}
|
2023-10-02 10:45:30 +02:00
|
|
|
} #endregion
|