From 88511088da4341dc3e81e0fee7061b7b79348fdb Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sat, 7 Dec 2024 16:35:29 +0700 Subject: [PATCH] pure function stuff --- PixelComposer.resource_order | 1 + PixelComposer.yyp | 1 + objects/o_dialog_splash/Create_0.gml | 6 +- objects/o_dialog_splash/Draw_64.gml | 12 +- objects/o_main/Other_2.gml | 2 +- scripts/node_VFX_group/node_VFX_group.gml | 2 +- .../node_VFX_group_inline.gml | 2 +- scripts/node_collection/node_collection.gml | 49 ++++- scripts/node_condition/node_condition.gml | 19 +- scripts/node_data/node_data.gml | 106 ++++++----- .../node_display_text/node_display_text.gml | 26 ++- scripts/node_feedback/node_feedback.gml | 6 +- scripts/node_frame/node_frame.gml | 25 ++- scripts/node_group_input/node_group_input.gml | 69 ++++--- .../node_group_output/node_group_output.gml | 3 +- .../node_iterate_each_inline.gml | 32 ++-- .../node_iterate_filter_inline.gml | 10 +- .../node_iterate_inline.gml | 8 +- .../node_iterate_sort/node_iterate_sort.gml | 2 +- .../node_iterate_sort_inline.gml | 2 +- .../node_iterator_each_inline_output.gml | 8 +- .../node_iterator_each_output.gml | 2 +- .../node_iterator_filter_inline_output.gml | 2 +- .../node_iterator_filter_output.gml | 2 +- .../node_iterator_output.gml | 2 +- .../node_iterator_sort_output.gml | 2 +- scripts/node_math/node_math.gml | 175 +++++++++--------- scripts/node_number/node_number.gml | 5 +- scripts/node_pb/node_pb.gml | 2 +- .../node_pixel_builder/node_pixel_builder.gml | 2 +- scripts/node_tunnel_in/node_tunnel_in.gml | 21 ++- scripts/node_tunnel_out/node_tunnel_out.gml | 1 - scripts/node_value/node_value.gml | 11 +- scripts/node_value_float/node_value_float.gml | 19 +- scripts/panel_graph/panel_graph.gml | 1 + scripts/panel_inspector/panel_inspector.gml | 5 +- .../panel_profile_render.gml | 170 ++++++++++++++--- scripts/project_data/project_data.gml | 3 + scripts/render_data/render_data.gml | 48 +++-- .../tooltip_recent_files.gml | 39 ++++ .../tooltip_recent_files.yy | 13 ++ 41 files changed, 619 insertions(+), 297 deletions(-) create mode 100644 scripts/tooltip_recent_files/tooltip_recent_files.gml create mode 100644 scripts/tooltip_recent_files/tooltip_recent_files.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 24fea2e3e..fdcabacd9 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1339,6 +1339,7 @@ {"name":"timeline_data","order":18,"path":"scripts/timeline_data/timeline_data.yy",}, {"name":"toggleGroup","order":7,"path":"scripts/toggleGroup/toggleGroup.yy",}, {"name":"tooltip_hotkey","order":2,"path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",}, + {"name":"tooltip_recent_files","order":3,"path":"scripts/tooltip_recent_files/tooltip_recent_files.yy",}, {"name":"tooltip_selector_object","order":1,"path":"scripts/tooltip_selector_object/tooltip_selector_object.yy",}, {"name":"transformBox","order":15,"path":"scripts/transformBox/transformBox.yy",}, {"name":"tunnel_server","order":2,"path":"scripts/tunnel_server/tunnel_server.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 36e528d3c..9e20e8ea9 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1971,6 +1971,7 @@ {"id":{"name":"timer_function","path":"scripts/timer_function/timer_function.yy",},}, {"id":{"name":"toggleGroup","path":"scripts/toggleGroup/toggleGroup.yy",},}, {"id":{"name":"tooltip_hotkey","path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",},}, + {"id":{"name":"tooltip_recent_files","path":"scripts/tooltip_recent_files/tooltip_recent_files.yy",},}, {"id":{"name":"tooltip_selector_object","path":"scripts/tooltip_selector_object/tooltip_selector_object.yy",},}, {"id":{"name":"transformBox","path":"scripts/transformBox/transformBox.yy",},}, {"id":{"name":"tunnel_server","path":"scripts/tunnel_server/tunnel_server.yy",},}, diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index 16ebca216..1451a6a2b 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -67,9 +67,9 @@ event_inherited(); if(sHOVER && sp_recent.hover && point_in_rectangle(_m[0], _m[1], fx, _y, fx + ww, _y + hg)) { sp_recent.hover_content = true; - TOOLTIP = [ _dat.getThumbnail(), VALUE_TYPE.surface ]; - - draw_sprite_stretched_ext(THEME.node_bg, 1, fx, _y, ww, hg, COLORS._main_accent, 1); + TOOLTIP = new tooltipRecentFile(_rec, sp_recent.rx + fx, sp_recent.ry + _y, ww, hg); + + draw_sprite_stretched_ext(THEME.ui_panel, 1, fx, _y, ww, hg, COLORS._main_accent, 1); if(mouse_press(mb_left, sFOCUS)) { LOAD_PATH(_rec); diff --git a/objects/o_dialog_splash/Draw_64.gml b/objects/o_dialog_splash/Draw_64.gml index a055f1dd9..7fab5d735 100644 --- a/objects/o_dialog_splash/Draw_64.gml +++ b/objects/o_dialog_splash/Draw_64.gml @@ -44,6 +44,8 @@ if !ready exit; draw_text(x0, y0 - ui(4), __txt("Recent files")); sp_recent.setFocusHover(sFOCUS, sHOVER); + sp_recent.rx = x0 + ui(6); + sp_recent.ry = y0; sp_recent.draw(x0 + ui(6), y0); draw_sprite_stretched_ext(THEME.ui_panel, 1, x0, y0, x1 - x0, y1 - y0, COLORS.panel_frame); @@ -55,11 +57,11 @@ if !ready exit; RECENT_SAVE(); } - bx -= ui(28 + 4); - txt = recent_thumbnail? __txtx("splash_hide_thumbnail", "Hide thumbnail") : __txtx("splash_show_thumbnail", "Show thumbnail"); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.splash_thumbnail, recent_thumbnail) == 2) { - recent_thumbnail = !recent_thumbnail; - } + // bx -= ui(28 + 4); + // txt = recent_thumbnail? __txtx("splash_hide_thumbnail", "Hide thumbnail") : __txtx("splash_show_thumbnail", "Show thumbnail"); + // if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.splash_thumbnail, recent_thumbnail) == 2) { + // recent_thumbnail = !recent_thumbnail; + // } bx -= ui(28 + 4); txt = __txtx("splash_open_autosave", "Open autosave folder"); diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index bb0d9c648..8f359b575 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -56,7 +56,7 @@ #endregion #region Set up - var t = current_time; + var t = get_timer(); PREF_LOAD(); log_message("SESSION", $"> init Preferences | complete in {get_timer() - t}"); t = get_timer(); if(!IS_CMD) { __initLocale(); log_message("SESSION", $"> init Locale | complete in {get_timer() - t}"); t = get_timer(); } diff --git a/scripts/node_VFX_group/node_VFX_group.gml b/scripts/node_VFX_group/node_VFX_group.gml index e2d39a179..a5a76d201 100644 --- a/scripts/node_VFX_group/node_VFX_group.gml +++ b/scripts/node_VFX_group/node_VFX_group.gml @@ -26,7 +26,7 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group preview_node = output; } - static getNextNodes = function() { return allCached? getNextNodesExternal() : getNextNodesInternal(); } + static getNextNodes = function(checkLoop = false) { return allCached? getNextNodesExternal() : getNextNodesInternal(); } setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]); diff --git a/scripts/node_VFX_group_inline/node_VFX_group_inline.gml b/scripts/node_VFX_group_inline/node_VFX_group_inline.gml index dca643fe1..bd3e69122 100644 --- a/scripts/node_VFX_group_inline/node_VFX_group_inline.gml +++ b/scripts/node_VFX_group_inline/node_VFX_group_inline.gml @@ -35,7 +35,7 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline( static onRemoveNode = function(node) { node.in_VFX = noone; } static onAddNode = function(node) { node.in_VFX = self; } - static getNextNodes = function() { return __nodeLeafList(nodes); } + static getNextNodes = function(checkLoop = false) { return __nodeLeafList(nodes); } static reset = function() { for( var i = 0, n = array_length(nodes); i < n; i++ ) { diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 7c03e8371..5502a8ea1 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -173,12 +173,16 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc nodes = []; node_length = 0; modifiable = true; + setDimension(w, 0); ungroupable = true; auto_render_time = false; combine_render_time = true; previewable = true; + isPure = false; + nodeTopo = []; + reset_all_child = false; isInstancer = false; instanceBase = noone; @@ -193,7 +197,6 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc group_output_display_list = []; attributes.input_display_list = []; attributes.output_display_list = []; - attributes.lock_input = false; managedRenderOrder = false; @@ -226,11 +229,15 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc attribute_interpolation(); attribute_oversample(); + attributes.lock_input = false; + attributes.pure_function = true; + tool_node = noone; draw_input_overlay = true; - array_push(attributeEditors, "Group IO"); - array_push(attributeEditors, ["Lock Input", function() /*=>*/ {return attributes.lock_input}, new checkBox(function() /*=>*/ { attributes.lock_input = !attributes.lock_input }) ]); + array_push(attributeEditors, "Group"); + array_push(attributeEditors, ["Pure Function", function() /*=>*/ {return attributes.pure_function}, new checkBox(function() /*=>*/ { attributes.pure_function = !attributes.pure_function }) ]); + array_push(attributeEditors, ["Lock Input", function() /*=>*/ {return attributes.lock_input}, new checkBox(function() /*=>*/ { attributes.lock_input = !attributes.lock_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); }) ]); @@ -259,15 +266,28 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc hasInsp2 = false; node_length = array_length(nodes); + checkPureFunction(); + } + + static checkPureFunction = function(updateTopo = true) { + var p = attributes.pure_function; - var i = 0; - repeat(node_length) { - hasInsp1 |= nodes[i].hasInspector1Update(); - hasInsp2 |= nodes[i].hasInspector2Update(); + for( var i = 0, n = array_length(nodes); i < n; i++ ) { + var _node = nodes[i]; + hasInsp1 |= _node.hasInspector1Update(); + hasInsp2 |= _node.hasInspector2Update(); - i++; + p &= !is(_node, Node_Collection_Inline); + p &= !is(_node, Node_Collection); + p &= !_node.isAnimated(); } + icon_blend = p? COLORS._main_value_positive : c_white; + + if(updateTopo || !isPure && p) nodeTopo = NodeListSort(nodes); + isPure = p; + + if(group) group.checkPureFunction(updateTopo); } static getNodeBase = function() { return instanceBase == noone? self : instanceBase.getNodeBase(); } @@ -398,7 +418,18 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc /////========== RENDERING =========== - static getNextNodes = function() { return getNextNodesInternal(); } + doUpdate = doUpdateLite; + + static update = function() { + if(!isPure) return; + + for( var i = 0, n = array_length(nodeTopo); i < n; i++ ) { + var _node = nodeTopo[i]; + _node.doUpdate(); + } + } + + static getNextNodes = function(checkLoop = false) { return isPure? getNextNodesExternal() : getNextNodesInternal(); } static getNextNodesInternal = function() { //get node inside the group LOG_BLOCK_START(); diff --git a/scripts/node_condition/node_condition.gml b/scripts/node_condition/node_condition.gml index b4fdf57d3..d2c73d4f4 100644 --- a/scripts/node_condition/node_condition.gml +++ b/scripts/node_condition/node_condition.gml @@ -43,18 +43,19 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct newOutput(0, nodeValue_Output("Result", self, VALUE_TYPE.any, [])); newOutput(1, nodeValue_Output("Bool", self, VALUE_TYPE.boolean, false)); + doUpdate = doUpdateLite; static update = function(frame = CURRENT_FRAME) { - var _true = getInputData(3); - var _fals = getInputData(4); + var _true = inputs[3].getValue(); + var _fals = inputs[4].getValue(); - var _mode = getInputData(5); + var _mode = inputs[5].getValue(); - var _chck = getInputData(0); - var _cond = getInputData(1); - var _valu = getInputData(2); - var _bool = getInputData(6); - var _txt1 = getInputData(7); - var _txt2 = getInputData(8); + var _chck = inputs[0].getValue(); + var _cond = inputs[1].getValue(); + var _valu = inputs[2].getValue(); + var _bool = inputs[6].getValue(); + var _txt1 = inputs[7].getValue(); + var _txt2 = inputs[8].getValue(); inputs[0].setVisible(_mode == 1, _mode == 1); inputs[1].setVisible(_mode == 1); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index d79f04493..dd449233d 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -81,6 +81,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { color = c_white; icon = noone; icon_24 = noone; + icon_blend = c_white; bg_spr = THEME.node_bg; bg_spr_add = 0.1; bg_spr_add_clr = c_white; @@ -272,6 +273,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { #region ---- rendering ---- rendered = false; update_on_frame = false; + render_timer = 0; render_time = 0; render_cached = false; auto_render_time = true; @@ -326,8 +328,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { messages_bub = false; messages_dbg = []; - render_report_latest = noone; - static logNode = function(text, noti = 0) { var _time = $"{string_lead_zero(current_hour, 2)}:{string_lead_zero(current_minute, 2)}.{string_lead_zero(current_second, 2)}"; messages_bub = true; @@ -961,7 +961,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { targ.setFrom(junctionFrom); } - static getInputData = function(index, def = 0) { return array_safe_get_fast(inputs_data, index, def); } + static getInputData = function(index, def = 0) { array_safe_get_fast(inputs_data, index, def); } static getInputDataForce = function(index, def = 0) { return inputs[index].getValue(); } // static setInputData = function(index, value) { @@ -981,7 +981,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var val = _inp.getValue(__frame); - _inp.bypass_junc.setValue(val); + if(_inp.bypass_junc.visible) _inp.bypass_junc.setValue(val); inputs_data[i] = val; // setInputData(i, val); input_value_map[$ _inp.internalName] = val; }); @@ -996,12 +996,28 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static postUpdate = function(frame = CURRENT_FRAME) {} - static doUpdate = function(frame = CURRENT_FRAME) { + static doUpdateLite = function(frame = CURRENT_FRAME) { + 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; + } + + static doUpdateFull = function(frame = CURRENT_FRAME) { if(PROJECT.safeMode) return; if(NODE_EXTRACT) return; - var render_timer = get_timer(); + render_timer = get_timer(); var _updateRender = !is_instanceof(self, Node_Collection) || !managedRenderOrder; if(_updateRender) setRenderStatus(true); @@ -1049,15 +1065,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { updatedOutTrigger.setValue(true); - if(!is_instanceof(self, Node_Collection)) - render_time = get_timer() - render_timer; + if(!is(self, Node_Collection)) render_time = get_timer() - render_timer; LOG_BLOCK_END(); - - render_report_latest = generateNodeRenderReport(); - if(PROFILER_STAT) array_push(PROFILER_DATA, render_report_latest); } + doUpdate = doUpdateFull; + static valueUpdate = function(index) { onValueUpdate(index); @@ -1079,6 +1093,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { /////============ RENDER ============ + static isAnimated = function(frame = CURRENT_FRAME) { + if(update_on_frame) return true; + return array_any(inputs, function(inp) /*=>*/ {return inp.is_anim}); + } + static isActiveDynamic = function(frame = CURRENT_FRAME) { if(update_on_frame) return true; if(!rendered) return true; @@ -1086,11 +1105,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { force_requeue = false; __temp_frame = frame; return array_any(inputs, function(inp) /*=>*/ {return inp.isActiveDynamic(__temp_frame)}); - - // for(var i = 0; i < array_length(inputs); i++) - // if(inputs[i].isActiveDynamic(frame)) return true; - - // return false; } static triggerRender = function(resetSelf = true) { @@ -1238,35 +1252,42 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static onGetPreviousNodes = function(arr) {} - static getNextNodes = function() { - var nodes = []; - var nodeNames = []; - - LOG_BLOCK_START(); - LOG_IF(global.FLAG.render == 1, $"→→→→→ Call get next node from: {INAME}"); + __nextNodes = noone; + __nextNodesToLoop = noone; + + static getNextNodes = function(checkLoop = false) { + if(checkLoop) { + if(__nextNodesToLoop != noone && __nextNodesToLoop.bypassNextNode()) + __nextNodesToLoop.getNextNodes(); + return; + } + __nextNodesToLoop = noone; for(var i = 0; i < array_length(outputs); i++) { var _ot = outputs[i]; if(!_ot.forward) continue; for( var j = 0, n = array_length(_ot.value_to_loop); j < n; j++ ) { var _to = _ot.value_to_loop[j]; - if(!_to.active) continue; - if(!_to.bypassNextNode()) continue; + if(!_to.active) continue; - LOG_BLOCK_END(); - + __nextNodesToLoop = _to; + if(!_to.bypassNextNode()) continue; return _to.getNextNodes(); } + } + if(__nextNodes != noone) return __nextNodes; + var nodes = []; + + for(var i = 0; i < array_length(outputs); i++) { + var _ot = outputs[i]; + if(!_ot.forward) continue; + var _tos = _ot.getJunctionTo(); for( var j = 0; j < array_length(_tos); j++ ) { var _to = _tos[j]; - array_push(nodes, _to.node); - array_push(nodeNames, _to.node.internalName); - - //LOG_IF(global.FLAG.render == 1, $"→→ Check output: {_ot.name} connect to node {_to.node.internalName}"); } } @@ -1277,7 +1298,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { for( var j = 0; j < array_length(_tos); j++ ) { var _to = _tos[j]; array_push(nodes, _to.node); - array_push(nodeNames, _to.node.internalName); } } @@ -1288,13 +1308,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var _tos = _in.bypass_junc.getJunctionTo(); for( var j = 0; j < array_length(_tos); j++ ) { var _to = _tos[j]; - array_push(nodes, _to.node); - array_push(nodeNames, _to.node.internalName); } } - LOG_BLOCK_END(); + __nextNodes = nodes; return nodes; } @@ -1497,7 +1515,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { __draw_bbox = BBOX(); static drawGetBbox = function(xx, yy, _s, label = true) { - var pad_label = (display_parameter.avoid_label || label) && draw_name; + var pad_label = ((display_parameter.avoid_label || label) && draw_name) || label == 2; var x0 = xx; var x1 = xx + w * _s; @@ -1557,8 +1575,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(icon) { tx += _s * 6; - draw_sprite_ui_uniform(icon, 0, round(tx) + 1, round(yy + nh / 2) + 1, _s, c_black, 1); - draw_sprite_ui_uniform(icon, 0, round(tx), round(yy + nh / 2), _s, cc, 1); + draw_sprite_ui_uniform(icon, 0, round(tx) + 1, round(yy + nh / 2) + 1, _s, c_black, 1); + draw_sprite_ui_uniform(icon, 0, round(tx), round(yy + nh / 2), _s, icon_blend, 1); tx += _s * 12; tw -= _s * (12 + 6); } @@ -2905,6 +2923,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } run_in(1, function() /*=>*/ { checkGroup(); }); + nextn = []; static generateNodeRenderReport = function() { var _report = {}; @@ -2930,23 +2949,26 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } _report.logs = array_clone(messages_dbg); - _report.time = render_time; - _report.nextn = []; + _report.nextn = nextn; _report.queue = array_clone(RENDER_QUEUE.data, 1); + nextn = []; + return _report; } - static summarizeReport = function() { + static summarizeReport = function(_startTime) { var _srcstr = $"{getFullName()}"; - var _report = render_report_latest; + var _report = generateNodeRenderReport(); for( var i = 0, n = array_length(_report.nextn); i < n; i++ ) _srcstr += $"{_report.nextn[i].getFullName()}"; for( var i = 0, n = array_length(_report.queue); i < n; i++ ) _srcstr += $"{_report.queue[i].getFullName()}"; + _report.time = get_timer() - _startTime; + _report.renderTime = render_time; _report.search_string = _srcstr; - + array_push(PROFILER_DATA, _report); } static toString = function() { return $"Node [{internalName}] [{instanceof(self)}]: {node_id}"; } diff --git a/scripts/node_display_text/node_display_text.gml b/scripts/node_display_text/node_display_text.gml index 8620efe6f..aaa82ccfb 100644 --- a/scripts/node_display_text/node_display_text.gml +++ b/scripts/node_display_text/node_display_text.gml @@ -402,9 +402,13 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr } static onValueUpdate = function(index = 0) { - if(index == 1 || index == 4) line_update(getInputData(1), getInputData(4)); + if(index == 1 || index == 4) line_update(inputs[1].getValue(), inputs[4].getValue()); } + static isRenderable = function() /*=>*/ {return false}; + static doUpdate = function() {} + static update = function() {} + static preDraw = function(_x, _y, _s) { var xx = (x - 3) * _s + _x; var yy = y * _s + _y; @@ -434,18 +438,18 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr } static drawNodeBase = function(xx, yy, mx, my, _s) { - if(draw_graph_culled && !init_size) return; + if(draw_graph_culled) return; - var color = getInputData(0); - var txt = getInputData(1); + var color = inputs[0].getValue(); + var txt = inputs[1].getValue(); if(txt == "") txt = "..." draw_simple = string_pos("<", txt) == 0; - var sty = getInputData(2); + var sty = inputs[2].getValue(); var alp = _color_get_alpha(color); - var wid = getInputData(4); - var posi = getInputData(5); - line_h = getInputData(6); + var wid = inputs[4].getValue(); + var posi = inputs[5].getValue(); + line_h = inputs[6].getValue(); pos_x = posi[0]; pos_y = posi[1]; @@ -504,8 +508,6 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr draw_scale = _s; w = ww + 8; h = hh + 8; - - init_size = false; } static drawJunctions = function(_draw, _x, _y, _mx, _my, _s) { @@ -524,10 +526,6 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr return hover; } - static update = function() { - init_size = true; - } - static drawNode = function(_draw, _x, _y, _mx, _my, _s) { if(!_draw) return drawJunctions(_draw, _x, _y, _mx, _my, _s); diff --git a/scripts/node_feedback/node_feedback.gml b/scripts/node_feedback/node_feedback.gml index 8bbef2af3..ecf78508a 100644 --- a/scripts/node_feedback/node_feedback.gml +++ b/scripts/node_feedback/node_feedback.gml @@ -15,7 +15,9 @@ function Node_Feedback(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) output.inputs[1].setFrom(input.outputs[1]); } #endregion - static getNextNodes = function() { #region + static getNextNodes = function(checkLoop = false) { + if(checkLoop) return; + var allReady = true; for(var i = custom_input_index; i < array_length(inputs); i++) { var _in = inputs[i].from; @@ -27,5 +29,5 @@ function Node_Feedback(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) if(!allReady) return []; return __nodeLeafList(getNodeList()); - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_frame/node_frame.gml b/scripts/node_frame/node_frame.gml index 2fad2adc2..6cbc73380 100644 --- a/scripts/node_frame/node_frame.gml +++ b/scripts/node_frame/node_frame.gml @@ -54,22 +54,29 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { input_display_list = [ 0, 1, 3, 4 ]; - static onValueUpdate = function(index = 3) { global.__FRAME_LABEL_SCALE = getInputData(3); } - - static setHeight = function() {} - - static update = function() { + static onValueUpdate = function(index = 3) { previewable = true; + global.__FRAME_LABEL_SCALE = inputs[3].getValue(); - var sz = getInputData(0); + var sz = inputs[0].getValue(); w = sz[0]; h = sz[1]; - color = getInputData(1); + color = inputs[1].getValue(); alpha = _color_get_alpha(color); - scale = getInputData(3); - lcolor = getInputData(4); + scale = inputs[3].getValue(); + lcolor = inputs[4].getValue(); + } + + static setHeight = function() {} + + static isRenderable = function() /*=>*/ {return false}; + static doUpdate = function() {} + static update = function() {} + + static postApplyDeserialize = function() { + onValueUpdate(); } static drawNode = function() { return noone; } diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index bd4d911d3..df1dd8efb 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -363,7 +363,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru switch(_val_type) { case VALUE_TYPE.trigger : var bname = getInputData(8); - inParent.setDisplay(VALUE_DISPLAY.button, { name: bname, onClick: function() { doTrigger = 1; } }); + inParent.setDisplay(VALUE_DISPLAY.button, { name: bname, onClick: function() /*=>*/ { doTrigger = 1; } }); break; } @@ -398,32 +398,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru } if(!LOADING && !APPENDING) createInput(); - static step = function() { - if(is_undefined(inParent)) return; - - if(inParent.name != display_name) { - inParent.name = display_name; - group.inputMap[$ string_replace_all(display_name, " ", "_")] = inParent; - } - - if(inParent.type != VALUE_TYPE.trigger) return; - - switch(doTrigger) { - case 1 : - outputs[0].setValue(true); - doTrigger = -1; - break; - - case -1 : - outputs[0].setValue(false); - doTrigger = 0; - break; - } - } - - static update = function(frame = CURRENT_FRAME) { - if(is_undefined(inParent)) return; - + static updateGroupInput = function() { var _dstype = getInputData(0); var _data = getInputData(2); var _dsList = array_safe_get_fast(GROUP_IO_DISPLAY, _data); @@ -431,7 +406,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[0].display_data.data = _dsList; inputs[0].editWidget.data_list = _dsList; - + _dstype = array_safe_get_fast(_dsList, _dstype); var _datype = array_safe_get_fast(GROUP_IO_TYPE_MAP, _data, VALUE_TYPE.any); @@ -465,8 +440,46 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru } visibleCheck(); + } + + static step = function() { + if(is_undefined(inParent)) return; + if(inParent.name != display_name) { + inParent.name = display_name; + group.inputMap[$ string_replace_all(display_name, " ", "_")] = inParent; + } + + if(inParent.type != VALUE_TYPE.trigger) return; + + switch(doTrigger) { + case 1 : + outputs[0].setValue(true); + doTrigger = -1; + break; + + case -1 : + outputs[0].setValue(false); + doTrigger = 0; + break; + } + } + + doUpdate = doUpdateLite; + __dstype = noone; + __data = noone; + + static update = function(frame = CURRENT_FRAME) { outputs[0].setValue(inParent.getValue()); + + var _dstype = inputs[0].getValue(); + var _data = inputs[2].getValue(); + if(_dstype == __dstype && _data == __data) return; + getInputs(frame); + updateGroupInput(); + + __dstype = _dstype; + __data = _data; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 65fdb245e..615068863 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -28,7 +28,8 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr static onValueUpdate = function(index = 0) { if(is_undefined(outParent)) return; } - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { + if(checkLoop) return; if(is_undefined(outParent)) return []; LOG_BLOCK_START(); diff --git a/scripts/node_iterate_each_inline/node_iterate_each_inline.gml b/scripts/node_iterate_each_inline/node_iterate_each_inline.gml index 0a3543ba2..08980eabf 100644 --- a/scripts/node_iterate_each_inline/node_iterate_each_inline.gml +++ b/scripts/node_iterate_each_inline/node_iterate_each_inline.gml @@ -9,9 +9,11 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli input_node_type = Node_Iterator_Each_Inline_Input; output_node_type = Node_Iterator_Each_Inline_Output; + + iteration_count = 0; iterated = 0; - if(!LOADING && !APPENDING) { #region + if(!LOADING && !APPENDING) { var input = nodeBuild("Node_Iterator_Each_Inline_Input", x, y); var output = nodeBuild("Node_Iterator_Each_Inline_Output", x + 256, y); @@ -32,18 +34,18 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli array_push(APPEND_LIST, input, output); } - } #endregion + } - static getIterationCount = function() { #region + static getIterationCount = function() { var _arr = input_node.inputs[0].getValue(); return array_length(_arr); - } #endregion + } - static bypassNextNode = function() { #region + static bypassNextNode = function() { return iterated < getIterationCount(); - } #endregion + } - static getNextNodes = function() { #region + static getNextNodes = function(checkLoop = false) { LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, "[outputNextNode] Get next node from inline iterate"); @@ -57,9 +59,9 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli LOG_BLOCK_END(); return _nodes; - } #endregion + } - static refreshMember = function() { #region + static refreshMember = function() { nodes = []; for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { @@ -89,9 +91,9 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli if(output_node) output_node.destroy(); destroy(); } - } #endregion + } - static update = function() { #region + static update = function() { if(input_node == noone || output_node == noone) { if(input_node) input_node.destroy(); if(output_node) output_node.destroy(); @@ -99,8 +101,12 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli return; } - iterated = 0; + var _itc = getIterationCount(); + if(_itc != iteration_count) RENDER_ALL_REORDER; + iteration_count = _itc; + iterated = 0; + output_node.outputs[0].setValue([]); - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml b/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml index 0d6592f16..2828a9c56 100644 --- a/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml +++ b/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml @@ -8,6 +8,8 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In input_node_type = Node_Iterator_Filter_Inline_Input; output_node_type = Node_Iterator_Filter_Inline_Output; + + iteration_count = 0; iterated = 0; if(!LOADING && !APPENDING) { @@ -42,7 +44,7 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In return iterated < getIterationCount(); } - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, "[outputNextNode] Get next node from inline iterate"); @@ -96,7 +98,11 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In return; } - iterated = 0; + var _itc = getIterationCount(); + if(_itc != iteration_count) RENDER_ALL_REORDER; + iteration_count = _itc; + iterated = 0; + output_node.outputs[0].setValue([]); } diff --git a/scripts/node_iterate_inline/node_iterate_inline.gml b/scripts/node_iterate_inline/node_iterate_inline.gml index cdb1dc0d5..0cf08b787 100644 --- a/scripts/node_iterate_inline/node_iterate_inline.gml +++ b/scripts/node_iterate_inline/node_iterate_inline.gml @@ -18,13 +18,14 @@ function Node_Iterate_Inline(_x, _y, _group = noone) : Node_Collection_Inline(_x junc_out = noone; value_buffer = undefined; + iteration_count = 0; iterated = 0; static getIterationCount = function() { return getInputData(0); } static bypassConnection = function() { return iterated > 1 && !is_undefined(value_buffer); } static bypassNextNode = function() { return iterated < getIterationCount(); } - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, "[outputNextNode] Get next node from inline iterate"); @@ -85,7 +86,10 @@ function Node_Iterate_Inline(_x, _y, _group = noone) : Node_Collection_Inline(_x } static update = function() { - iteration_count = inputs[0].getValue(); + var _itc = inputs[0].getValue(); + if(_itc != iteration_count) RENDER_ALL_REORDER; + + iteration_count = _itc; iterated = 0; value_buffer = undefined; } diff --git a/scripts/node_iterate_sort/node_iterate_sort.gml b/scripts/node_iterate_sort/node_iterate_sort.gml index e0d16a84a..a840a1490 100644 --- a/scripts/node_iterate_sort/node_iterate_sort.gml +++ b/scripts/node_iterate_sort/node_iterate_sort.gml @@ -41,7 +41,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr return false; } #endregion - static getNextNodes = function() { return getNextNodesExternal(); } + static getNextNodes = function(checkLoop = false) { return getNextNodesExternal(); } static onStep = function() { #region var type = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type; diff --git a/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml b/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml index 664885044..9aac4b1ac 100644 --- a/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml +++ b/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml @@ -42,7 +42,7 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli return false; } - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { return output_node.getNextNodes(); } diff --git a/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml b/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml index efe8188ec..0026da38b 100644 --- a/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml +++ b/scripts/node_iterator_each_inline_output/node_iterator_each_inline_output.gml @@ -13,13 +13,13 @@ function Node_Iterator_Each_Inline_Output(_x, _y, _group = noone) : Node(_x, _y, newOutput(0, nodeValue_Output("Array out", self, VALUE_TYPE.any, [] )); - static getNextNodes = function() { #region + static getNextNodes = function(checkLoop = false) { if(loop.bypassNextNode()) return loop.getNextNodes(); return getNextNodesRaw(); - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { if(!is_instanceof(loop, Node_Iterate_Each_Inline)) return; var _typ = inputs[0].value_from == noone? VALUE_TYPE.any : inputs[0].value_from.type; @@ -46,5 +46,5 @@ function Node_Iterator_Each_Inline_Output(_x, _y, _group = noone) : Node(_x, _y, arr[@ itr] = val; outputs[0].setValue(arr); - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_iterator_each_output/node_iterator_each_output.gml b/scripts/node_iterator_each_output/node_iterator_each_output.gml index 250aa77ca..4be4052be 100644 --- a/scripts/node_iterator_each_output/node_iterator_each_output.gml +++ b/scripts/node_iterator_each_output/node_iterator_each_output.gml @@ -11,7 +11,7 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group newOutput(0, nodeValue_Output("Preview", self, VALUE_TYPE.any, 0 )) .setVisible(false, false); - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { if(!struct_has(group, "outputNextNode")) return []; return group.outputNextNode(); } diff --git a/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml b/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml index f22caaa1d..8c8bc560f 100644 --- a/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml +++ b/scripts/node_iterator_filter_inline_output/node_iterator_filter_inline_output.gml @@ -16,7 +16,7 @@ function Node_Iterator_Filter_Inline_Output(_x, _y, _group = noone) : Node(_x, _ newOutput(0, nodeValue_Output("Array out", self, VALUE_TYPE.any, [] )); - static getNextNodes = function() { #region + static getNextNodes = function(checkLoop = false) { #region if(loop.bypassNextNode()) return loop.getNextNodes(); return getNextNodesRaw(); diff --git a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml index 02947ffee..0d420d202 100644 --- a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml +++ b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml @@ -11,7 +11,7 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro newInput(1, nodeValue_Bool("Result", self, false )) .setVisible(true, true); - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { if(!struct_has(group, "outputNextNode")) return []; return group.outputNextNode(); } diff --git a/scripts/node_iterator_output/node_iterator_output.gml b/scripts/node_iterator_output/node_iterator_output.gml index 62346f5c7..feaacb9e8 100644 --- a/scripts/node_iterator_output/node_iterator_output.gml +++ b/scripts/node_iterator_output/node_iterator_output.gml @@ -32,7 +32,7 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y cache_value = -1; - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { if(!struct_has(group, "outputNextNode")) return []; return group.outputNextNode(); } diff --git a/scripts/node_iterator_sort_output/node_iterator_sort_output.gml b/scripts/node_iterator_sort_output/node_iterator_sort_output.gml index 6deeeef77..509512c6e 100644 --- a/scripts/node_iterator_sort_output/node_iterator_sort_output.gml +++ b/scripts/node_iterator_sort_output/node_iterator_sort_output.gml @@ -9,7 +9,7 @@ function Node_Iterator_Sort_Output(_x, _y, _group = noone) : Node(_x, _y, _group attributes.sort_inputs = 0; - static getNextNodes = function() { return []; } + static getNextNodes = function(checkLoop = false) { return []; } static step = function() {} diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index 6b04eb15e..9a986c9a8 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -97,9 +97,9 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { case MATH_OPERATOR.power : return power(a, b); case MATH_OPERATOR.root : return b == 0? 0 : power(a, 1 / b); - case MATH_OPERATOR.sin : return sin(use_deg? degtorad(a) : a) * b; - case MATH_OPERATOR.cos : return cos(use_deg? degtorad(a) : a) * b; - case MATH_OPERATOR.tan : return tan(use_deg? degtorad(a) : a) * b; + case MATH_OPERATOR.sin : return (use_deg? dsin(a) : sin(a)) * b; + case MATH_OPERATOR.cos : return (use_deg? dcos(a) : cos(a)) * b; + case MATH_OPERATOR.tan : return (use_deg? dtan(a) : tan(a)) * b; case MATH_OPERATOR.modulo : return safe_mod(a, b); case MATH_OPERATOR.floor : return floor(a); @@ -145,93 +145,98 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return val; } - static update = function(frame = CURRENT_FRAME) { - use_mod = getInputData(0); - use_deg = getInputData(3); + __mode = noone; + doUpdate = doUpdateLite; + static update = function(frame = CURRENT_FRAME) { - var a = getInputData(1); - var b = getInputData(2); - var c = getInputData(5); + use_mod = inputs[0].getValue(); + use_deg = inputs[3].getValue(); - var mode = getInputData(0); - - inputs[2].setVisible(false, false); - inputs[3].setVisible(false, false); - inputs[5].setVisible(false, false); - - switch(mode) { - case MATH_OPERATOR.sin : - case MATH_OPERATOR.cos : - case MATH_OPERATOR.tan : - inputs[3].setVisible(true); - break; - } - - switch(mode) { - case MATH_OPERATOR.round : - case MATH_OPERATOR.floor : - case MATH_OPERATOR.ceiling : - inputs[4].setVisible(true); - - var int = getInputData(4); - if(int) outputs[0].setType(VALUE_TYPE.integer); - else outputs[0].setType(VALUE_TYPE.float); - break; - default: - inputs[4].setVisible(false); - - outputs[0].setType(VALUE_TYPE.float); - break; - } - - switch(mode) { - case MATH_OPERATOR.add : - case MATH_OPERATOR.subtract : - case MATH_OPERATOR.multiply : - case MATH_OPERATOR.divide : - case MATH_OPERATOR.power : - case MATH_OPERATOR.root : - case MATH_OPERATOR.modulo : - inputs[2].name = "b"; - - inputs[2].setVisible(true, true); - break; - - case MATH_OPERATOR.sin : - case MATH_OPERATOR.cos : - case MATH_OPERATOR.tan : - inputs[2].name = "Amplitude"; - - inputs[2].setVisible(true, true); - break; - - case MATH_OPERATOR.lerp : - inputs[2].name = "To"; - inputs[5].name = "Amount"; - - inputs[2].setVisible(true, true); - inputs[5].setVisible(true, true); - break; - - case MATH_OPERATOR.clamp : - inputs[2].name = "Min"; - inputs[5].name = "Max"; - - inputs[2].setVisible(true, true); - inputs[5].setVisible(true, true); - break; - - case MATH_OPERATOR.snap : - inputs[2].name = "Snap"; - - inputs[2].setVisible(true, true); - break; - - default: return; - } + var a = inputs[1].getValue(); + var b = inputs[2].getValue(); + var c = inputs[5].getValue(); var val = evalArray(a, b, c); outputs[0].setValue(val); + + if(__mode != use_mod) { + inputs[2].setVisible(false, false); + inputs[3].setVisible(false, false); + inputs[5].setVisible(false, false); + + switch(use_mod) { + case MATH_OPERATOR.sin : + case MATH_OPERATOR.cos : + case MATH_OPERATOR.tan : + inputs[3].setVisible(true); + break; + } + + switch(use_mod) { + case MATH_OPERATOR.round : + case MATH_OPERATOR.floor : + case MATH_OPERATOR.ceiling : + inputs[4].setVisible(true); + + var int = getInputData(4); + if(int) outputs[0].setType(VALUE_TYPE.integer); + else outputs[0].setType(VALUE_TYPE.float); + break; + default: + inputs[4].setVisible(false); + + outputs[0].setType(VALUE_TYPE.float); + break; + } + + switch(use_mod) { + case MATH_OPERATOR.add : + case MATH_OPERATOR.subtract : + case MATH_OPERATOR.multiply : + case MATH_OPERATOR.divide : + case MATH_OPERATOR.power : + case MATH_OPERATOR.root : + case MATH_OPERATOR.modulo : + inputs[2].name = "b"; + + inputs[2].setVisible(true, true); + break; + + case MATH_OPERATOR.sin : + case MATH_OPERATOR.cos : + case MATH_OPERATOR.tan : + inputs[2].name = "Amplitude"; + + inputs[2].setVisible(true, true); + break; + + case MATH_OPERATOR.lerp : + inputs[2].name = "To"; + inputs[5].name = "Amount"; + + inputs[2].setVisible(true, true); + inputs[5].setVisible(true, true); + break; + + case MATH_OPERATOR.clamp : + inputs[2].name = "Min"; + inputs[5].name = "Max"; + + inputs[2].setVisible(true, true); + inputs[5].setVisible(true, true); + break; + + case MATH_OPERATOR.snap : + inputs[2].name = "Snap"; + + inputs[2].setVisible(true, true); + break; + + default: return; + } + } + __mode = use_mod; + } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index 9ebe9aa4e..bef50ae78 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -95,7 +95,6 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } static processNumber = function(_val, _int) { - if(is_string(_val)) return _int? round(toNumber(_val)) : toNumber(_val); if(is_numeric(_val)) return _int? round(_val) : _val; if(is_array(_val)) { @@ -147,9 +146,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor slider_value = slider_value == -1? raw : lerp_float(slider_value, raw, 2.5); var _prog = clamp((slider_value - _minn) / (_maxx - _minn), 0., 1.); - bbox = drawGetBbox(xx, yy, _s, false); - bbox.fromPoints(bbox.x0, bbox.y0 + 16 * _s, bbox.x1, bbox.y1); - + bbox = drawGetBbox(xx, yy, _s, 2); draw_set_text(f_sdf, fa_center, fa_center, _col); draw_text_transformed(bbox.xc, bbox.y0 + 16 * _s, string_real(val), _s * 0.5, _s * 0.5, 0); diff --git a/scripts/node_pb/node_pb.gml b/scripts/node_pb/node_pb.gml index 4730832ab..8bcd0ae08 100644 --- a/scripts/node_pb/node_pb.gml +++ b/scripts/node_pb/node_pb.gml @@ -24,7 +24,7 @@ function Node_PB(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr static drawOverlayPB = noone; - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { if(!struct_has(group, "checkComplete")) return []; for( var i = 0; i < array_length(outputs); i++ ) { diff --git a/scripts/node_pixel_builder/node_pixel_builder.gml b/scripts/node_pixel_builder/node_pixel_builder.gml index a4c69497d..f6bb2ca8d 100644 --- a/scripts/node_pixel_builder/node_pixel_builder.gml +++ b/scripts/node_pixel_builder/node_pixel_builder.gml @@ -17,7 +17,7 @@ function Node_Pixel_Builder(_x, _y, _group = noone) : Node_Collection(_x, _y, _g RENDER_ALL } - static getNextNodes = function() { #region + static getNextNodes = function(checkLoop = false) { #region var allReady = true; for(var i = custom_input_index; i < array_length(inputs); i++) { var _in = inputs[i].from; diff --git a/scripts/node_tunnel_in/node_tunnel_in.gml b/scripts/node_tunnel_in/node_tunnel_in.gml index a87c5b2c6..464730f7e 100644 --- a/scripts/node_tunnel_in/node_tunnel_in.gml +++ b/scripts/node_tunnel_in/node_tunnel_in.gml @@ -36,14 +36,23 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct _node.inputs[0].setValue(_key); } + __jfrom = noone; + __key = noone; + static update = function(frame = CURRENT_FRAME) { - onValueUpdate(); - + var _key = inputs[0].getValue(); var _frm = inputs[1].value_from; - inputs[1].setType( _frm? _frm.type : VALUE_TYPE.any); - inputs[1].setDisplay(_frm? _frm.display_type : VALUE_DISPLAY._default); - inputs[1].updateColor(); + if(_key != __key) onValueUpdate(); + + if(_frm != __jfrom) { + inputs[1].setType( _frm? _frm.type : VALUE_TYPE.any); + inputs[1].setDisplay(_frm? _frm.display_type : VALUE_DISPLAY._default); + inputs[1].updateColor(); + } + + __key = _key; + __jfrom = _frm; } static resetMap = function() { @@ -110,7 +119,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct value_validation[VALIDATION.error] = error_notification != noone; } - static getNextNodes = function() { + static getNextNodes = function(checkLoop = false) { var nodes = []; var nodeNames = []; var _key = inputs[0].getValue(); diff --git a/scripts/node_tunnel_out/node_tunnel_out.gml b/scripts/node_tunnel_out/node_tunnel_out.gml index 356b8fe02..f2d472905 100644 --- a/scripts/node_tunnel_out/node_tunnel_out.gml +++ b/scripts/node_tunnel_out/node_tunnel_out.gml @@ -3,7 +3,6 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc color = COLORS.node_blend_tunnel; is_group_io = true; preview_draw = false; - // custom_grid = 8; setDimension(32, 32); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 557aa85a5..2a907b253 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -498,6 +498,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru node.inputs[attributes.map_index + 1].setAnim(anim); node.refreshTimeline(); + if(NOT_LOAD && node.group) node.group.checkPureFunction(); } /////============ DISPLAY =========== @@ -2213,12 +2214,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru draw_line_shift_e = struct_try_get(_map, "shift_e", -1); is_modified = struct_try_get(_map, "is_modified", false); - if(struct_has(_map, "attri")) { - struct_append(attributes, _map.attri); - - if(struct_has(attributes, "use_project_dimension") && struct_has(node.attributes, "use_project_dimension")) - attributes.use_project_dimension = node.attributes.use_project_dimension; - } + if(struct_has(_map, "attri")) struct_append(attributes, _map.attri); + + if(struct_has(attributes, "use_project_dimension") && struct_has(node.load_map, "attri") && struct_has(node.load_map.attri, "use_project_dimension")) + attributes.use_project_dimension = node.load_map.attri.use_project_dimension; if(struct_has(_map, "linked")) display_data.linked = _map.linked; diff --git a/scripts/node_value_float/node_value_float.gml b/scripts/node_value_float/node_value_float.gml index 999b27592..5127ab0dd 100644 --- a/scripts/node_value_float/node_value_float.gml +++ b/scripts/node_value_float/node_value_float.gml @@ -1,5 +1,4 @@ function nodeValue_Float(_name, _node, _value, _tooltip = "") { return new __NodeValue_Float(_name, _node, _value, _tooltip); } - function __NodeValue_Float(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, CONNECT_TYPE.input, VALUE_TYPE.float, _value, _tooltip) constructor { /////============== GET ============= @@ -55,5 +54,23 @@ function __NodeValue_Float(_name, _node, _value, _tooltip = "") : NodeValue(_nam return array_empty(animator.values)? 0 : animator.values[0].value; } + static arrayLength = arrayLengthSimple; +} + +function nodeValue_Float_Simple(_name, _node, _value, _tooltip = "") { return new __NodeValue_Float_Simple(_name, _node, _value, _tooltip); } +function __NodeValue_Float_Simple(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, CONNECT_TYPE.input, VALUE_TYPE.float, _value, _tooltip) constructor { + + /////============== GET ============= + + static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value + getValueRecursive(self.__curr_get_val, _time); + return __curr_get_val[0]; + } + + static __getAnimValue = function(_time = CURRENT_FRAME) { + if(is_anim) return animator.getValue(_time); + return array_empty(animator.values)? 0 : animator.values[0].value; + } + static arrayLength = arrayLengthSimple; } \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 0f53b2d2d..521b2f526 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -800,6 +800,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { static setProject = function(project) { self.project = project; nodes_list = project.nodes; + connection_draw_update = true; setTitle(); run_in(2, function() /*=>*/ { diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 8084af357..836b38a6b 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -1283,8 +1283,9 @@ function Panel_Inspector() : PanelContent() constructor { else if(context != noone) txt = context.name; - draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); - draw_text_add(w / 2, ui(30), txt); + draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); + var ss = min(.5, (w - ui(96)) / string_width(txt)); + draw_text_add(w / 2, ui(30), txt, ss); if(PROJECT.meta.steam == FILE_STEAM_TYPE.steamOpen) { var _tw = string_width(txt) / 2; diff --git a/scripts/panel_profile_render/panel_profile_render.gml b/scripts/panel_profile_render/panel_profile_render.gml index b6140acc0..e85dc61c2 100644 --- a/scripts/panel_profile_render/panel_profile_render.gml +++ b/scripts/panel_profile_render/panel_profile_render.gml @@ -31,9 +31,6 @@ function Panel_Profile_Render() : PanelContent() constructor { show_io = true; show_log_level = 1; - count_render_event = 0; - count_message_event = 0; - filter_list_string = ""; tb_list = new textBox( TEXTBOX_INPUT.text, function(str) /*=>*/ { filter_list_string = str; searchData(); }) .setFont(f_p3) @@ -111,6 +108,61 @@ function Panel_Profile_Render() : PanelContent() constructor { PANEL_GRAPH.nodes_selecting = [ _report.node ]; } + count_render_event = 0; + count_message_event = 0; + node_render_time = 0; + node_render_time_type = {}; + node_render_rtim_type = {}; + node_render_time_amo = {}; + node_render_time_type_sorted = []; + pie_selecting = noone; + + function summarize() { + count_render_event = 0; + count_message_event = 0; + node_render_time = 0; + node_render_time_type = {}; + node_render_rtim_type = {}; + node_render_time_amo = {}; + node_render_time_type_sorted = []; + + for( var i = 0, n = array_length(PROFILER_DATA); i < n; i++ ) { + var _report = PROFILER_DATA[i]; + var _rtype = _report.type; + + switch(_rtype) { + case "render" : + var _node = _report.node; + var _time = _report.time; + node_render_time += _time; + + count_render_event++; + + var _typ = instanceof(_node); + node_render_time_type[$ _typ] = struct_try_get(node_render_time_type, _typ, 0) + _time; + node_render_rtim_type[$ _typ] = struct_try_get(node_render_rtim_type, _typ, 0) + _report.renderTime; + node_render_time_amo[$ _typ] = struct_try_get(node_render_time_amo, _typ, 0) + 1; + break; + + case "message" : count_message_event++; break; + } + } + + var _pr = ds_priority_create(); + var _nods = variable_struct_get_names(node_render_time_type); + for( var i = 0, n = array_length(_nods); i < n; i++ ) { + var _typ = _nods[i]; + var _c = make_color_hsv(random(255), 160, 160); + ds_priority_add(_pr, [_typ, node_render_time_type[$ _typ], _c], node_render_time_type[$ _typ]); + } + + var sz = ds_priority_size(_pr); + var i = 0; + + repeat(sz) node_render_time_type_sorted[i++] = ds_priority_delete_max(_pr); + ds_priority_destroy(_pr); + } + sc_profile_list = new scrollPane(list_w - ui(8), content_h - ui(8), function(_y, _m) { draw_clear_alpha(COLORS.panel_bg_clear_inner, 1); var _h = ui(8); @@ -188,7 +240,10 @@ function Panel_Profile_Render() : PanelContent() constructor { sc_profile_detail = new scrollPane(detail_w - ui(8), content_h - ui(8), function(_y, _m) { draw_clear_alpha(COLORS.panel_bg_clear_inner, 1); - var _h = 0; + var _h = 0; + var _ww = sc_profile_detail.surface_w; + var _hh = sc_profile_detail.surface_h; + var _hov = sc_profile_detail.hover; if(report_selecting == noone) { if(run == 0) { @@ -198,17 +253,91 @@ function Panel_Profile_Render() : PanelContent() constructor { } var _tx = ui(8); - var _ty = ui(8); + var _ty = _y + ui(8); draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); draw_text_add(_tx, _ty, $"{count_render_event} render events"); _ty += ui(20); _h += ui(20); - draw_text_add(_tx, _ty, $"Render time : {render_time / 1000}ms ({render_time})"); - return 0; + draw_text_add(_tx, _ty, $"Render time : {render_time / 1000}ms ({node_render_time} / {render_time})"); + + _ty += ui(28); _h += ui(28); + + var _a = 90; + var pr = ui(120); + var px = ui(16) + pr; + var py = max(ui(8), _ty) + pr; + + var tx_amo = px + pr + ui(32); + var tx_name = tx_amo + ui(40); + var tx_time = tx_name + ui(200); + var tx_per = tx_time + ui(80); + var tx_pern = tx_per + ui(80); + var tx_rtim = tx_pern + ui(80); + + draw_set_text(f_p3, fa_left, fa_top, COLORS._main_text_sub); + draw_text_add(tx_name, _ty, "type"); + + draw_set_halign(fa_right); + draw_text_add(tx_time + ui(80 - 8), _ty, "time (ns)"); + draw_text_add(tx_per + ui(80 - 8), _ty, "%"); + draw_text_add(tx_pern + ui(80 - 8), _ty, "time/node"); + draw_text_add(tx_rtim + ui(80 - 8), _ty, "render"); + + if(_hov && point_in_rectangle(_m[0], _m[1], tx_name, _ty, tx_time, _ty + ui(19))) TOOLTIP = "Node type"; + if(_hov && point_in_rectangle(_m[0], _m[1], tx_time, _ty, tx_per, _ty + ui(19))) TOOLTIP = "Total processing time (including graph propagation, debug data collection)"; + if(_hov && point_in_rectangle(_m[0], _m[1], tx_per, _ty, tx_pern, _ty + ui(19))) TOOLTIP = "Total time as percentage"; + if(_hov && point_in_rectangle(_m[0], _m[1], tx_pern, _ty, tx_rtim, _ty + ui(19))) TOOLTIP = "Total time per node"; + if(_hov && point_in_rectangle(_m[0], _m[1], tx_rtim, _ty, tx_rtim + ui(80), _ty + ui(19))) TOOLTIP = "Processing time"; + _ty += ui(20); _h += ui(20); + + var _pie_selecting = noone; + + for( var i = 0, n = array_length(node_render_time_type_sorted); i < n; i++ ) { + var _timn = node_render_time_type_sorted[i]; + var _node = _timn[0]; + var _time = _timn[1]; + var _colr = _timn[2]; + + var _as = _time / node_render_time * 360; + var _at = _a + _as; + draw_set_color(_colr); + if(pie_selecting != noone) draw_set_alpha(0.25 + 0.75 * (_node == pie_selecting)); + draw_circle_angle(px, py, pr, _a, _at); + draw_set_alpha(1); + _a = _at; + + if(_ty >= -16 && _ty <= _hh + 16) { + var _amo = node_render_time_amo[$ _node]; + var _rtm = node_render_rtim_type[$ _node]; + + draw_set_text(f_p3, fa_right, fa_top, COLORS._main_text_sub); + draw_text_add(tx_amo + ui(40 - 8), _ty, _amo); + + draw_set_color(_node == pie_selecting? COLORS._main_text_accent : COLORS._main_text); + draw_set_halign(fa_left); + draw_text_add(tx_name, _ty, _node); + + draw_set_halign(fa_right); + draw_text_add(tx_time + ui(80 - 8), _ty, _time); + draw_text_add(tx_per + ui(80 - 8), _ty, _time / node_render_time * 100); + draw_text_add(tx_pern + ui(80 - 8), _ty, round(_time / _amo)); + draw_text_add(tx_rtim + ui(80 - 8), _ty, _rtm); + + if(_hov && point_in_rectangle(_m[0], _m[1], tx_amo, _ty, _ww, _ty + ui(19))) + _pie_selecting = _node; + } + + _ty += ui(20); _h += ui(20); + } + + pie_selecting = _pie_selecting; + + _ty += ui(20); _h += ui(20); + + return _h; } - var _ww = sc_profile_detail.surface_w; var _hovering = sc_profile_detail.hover; var _report = report_selecting; @@ -475,7 +604,8 @@ function Panel_Profile_Render() : PanelContent() constructor { var _t = get_timer(); Render(); render_time = get_timer() - _t; - + + summarize(); PROFILER_STAT = 0; run++; } @@ -489,7 +619,8 @@ function Panel_Profile_Render() : PanelContent() constructor { var _t = get_timer(); Render(true); render_time = get_timer() - _t; - + + summarize(); PROFILER_STAT = 0; run++; } @@ -548,13 +679,9 @@ function Panel_Profile_Render() : PanelContent() constructor { draw_sprite_stretched_ext(THEME.s_box_r2, 0, _px0, _py0, _pw, _ph, COLORS._main_icon_dark, 1); - var _total_time = 0; var _selected_time = 0; var _running_time = 0; - count_render_event = 0; - count_message_event = 0; - for( var i = 0, n = array_length(PROFILER_DATA); i < n; i++ ) { var _report = PROFILER_DATA[i]; var _rtype = _report.type; @@ -562,19 +689,14 @@ function Panel_Profile_Render() : PanelContent() constructor { if(_report == report_selecting) _selected_time = _running_time; if(_rtype == "render") { - count_render_event++; var _node = _report.node; var _time = _report.time; - _total_time += _time; _running_time += _time; - - } else if(_rtype == "message") { - count_message_event++; } } - if(_total_time > 0) { + if(node_render_time > 0) { var _running_time = 0; if(mouse_release(mb_left)) render_drag = false; @@ -582,7 +704,7 @@ function Panel_Profile_Render() : PanelContent() constructor { for( var i = 0, n = array_length(PROFILER_DATA); i < n; i++ ) { var _report = PROFILER_DATA[i]; var _rtype = _report.type; - var _rx = _px0 + (_running_time / _total_time) * _pw; + var _rx = _px0 + (_running_time / node_render_time) * _pw; if(_rtype == "render") { draw_set_color(COLORS._main_icon); @@ -593,7 +715,7 @@ function Panel_Profile_Render() : PanelContent() constructor { var _time = _report.time; _running_time += _time; - var _rx1 = _px0 + (_running_time / _total_time) * _pw; + var _rx1 = _px0 + (_running_time / node_render_time) * _pw; if((pHOVER && point_in_rectangle(mx, my, _rx, _py0, _rx1, _py1) || (render_drag && mx >= _rx && mx < _rx1))) { TOOLTIP = $"Render {_report.node.getFullName()}"; @@ -622,8 +744,8 @@ function Panel_Profile_Render() : PanelContent() constructor { if(report_selecting != noone && report_selecting.type == "render") { var _time = report_selecting.time; - var _rx = _px0 + (_selected_time / _total_time) * _pw; - var _rw = (_time / _total_time) * _pw; + var _rx = _px0 + (_selected_time / node_render_time) * _pw; + var _rw = (_time / node_render_time) * _pw; draw_sprite_stretched_ext(THEME.s_box_r2, 0, _rx, _py0, _rw, _ph, COLORS._main_icon, 1); } diff --git a/scripts/project_data/project_data.gml b/scripts/project_data/project_data.gml index f84d4248f..d50452209 100644 --- a/scripts/project_data/project_data.gml +++ b/scripts/project_data/project_data.gml @@ -32,6 +32,9 @@ nodeMap = ds_map_create(); nodeNameMap = ds_map_create(); + useRenderList = false; + renderList = []; + pathInputs = []; composer = noone; diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 0edd6d032..c5d432e47 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -39,10 +39,13 @@ function NodeTopoSort() { array_foreach(PROJECT.allNodes, function(_node) { _node.clearTopoSorted(); + if(is(_node, Node_Collection)) _node.refreshNodes(); return 0; }); - PROJECT.nodeTopo = []; + PROJECT.nodeTopo = []; + PROJECT.renderList = []; + PROJECT.useRenderList = true; __topoSort(PROJECT.nodeTopo, PROJECT.nodes); LOG_IF(global.FLAG.render == 1, $"+++++++ Topo Sort Completed: {array_length(PROJECT.nodeTopo)}/{amo} nodes sorted in {(get_timer() - _t) / 1000} ms +++++++"); @@ -178,6 +181,20 @@ function Render(partial = false, runAction = false) { // global.getvalue_hit = 0; + // if(PROJECT.useRenderList && !array_empty(PROJECT.renderList)) { + // for( var i = 0, n = array_length(PROJECT.renderList); i < n; i++ ) { + + // var render_pt = get_timer(); + // var rendering = PROJECT.renderList[i]; + + // rendering.doUpdate(); + // rendering.getNextNodes(true); + + // if(PROFILER_STAT) rendering.summarizeReport(render_pt); + // } + // return; + // } + try { var t = get_timer(); var t1 = get_timer(); @@ -205,6 +222,7 @@ function Render(partial = false, runAction = false) { for( var i = 0, n = array_length(PROJECT.nodeTopo); i < n; i++ ) { var _node = PROJECT.nodeTopo[i]; _node.passiveDynamic = false; + _node.__nextNodes = noone; } for( var i = 0, n = array_length(PROJECT.nodeTopo); i < n; i++ ) { @@ -226,38 +244,42 @@ function Render(partial = false, runAction = false) { // render forward while(!RENDER_QUEUE.empty()) { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE} [{RENDER_QUEUE.size()}] "); + // LOG_IF(global.FLAG.render == 1, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE} [{RENDER_QUEUE.size()}] "); rendering = RENDER_QUEUE.dequeue(); renderable = rendering.isRenderable(); - LOG_IF(global.FLAG.render == 1, $"Rendering {rendering.internalName} ({rendering.display_name}) : {renderable? "Update" : "Pass"} ({rendering.rendered})"); + if(is(rendering, Node_Iterate_Sort_Inline)) + PROJECT.useRenderList = false; + // LOG_IF(global.FLAG.render == 1, $"Rendering {rendering.internalName} ({rendering.display_name}) : {renderable? "Update" : "Pass"} ({rendering.rendered})"); if(renderable) { - var _render_pt = get_timer(); + var render_pt = get_timer(); rendering.doUpdate(); - _render_time += get_timer() - _render_pt; + array_push(PROJECT.renderList, rendering); + _render_time += get_timer() - render_pt; var nextNodes = rendering.getNextNodes(); + for( var i = 0, n = array_length(nextNodes); i < n; i++ ) { var nextNode = nextNodes[i]; - if(!is_instanceof(nextNode, __Node_Base)) continue; - if(!nextNode.isRenderable()) continue; + if(!is(nextNode, __Node_Base)) continue; + if(!nextNode.isRenderable()) continue; - LOG_IF(global.FLAG.render == 1, $"→→ Push {nextNode.internalName} to queue."); + // LOG_IF(global.FLAG.render == 1, $"→→ Push {nextNode.internalName} to queue."); RENDER_QUEUE.enqueue(nextNode); - if(PROFILER_STAT) array_push(rendering.render_report_latest.nextn, nextNode); + if(PROFILER_STAT) array_push(rendering.nextn, nextNode); } - if(runAction && rendering.hasInspector1Update()) - rendering.inspector1Update(); + // if(runAction && rendering.hasInspector1Update()) rendering.inspector1Update(); + + if(PROFILER_STAT) rendering.summarizeReport(render_pt); + } else if(rendering.force_requeue) RENDER_QUEUE.enqueue(rendering); - if(PROFILER_STAT) rendering.summarizeReport(); - LOG_BLOCK_END(); } diff --git a/scripts/tooltip_recent_files/tooltip_recent_files.gml b/scripts/tooltip_recent_files/tooltip_recent_files.gml new file mode 100644 index 000000000..5dc0c9ee4 --- /dev/null +++ b/scripts/tooltip_recent_files/tooltip_recent_files.gml @@ -0,0 +1,39 @@ +function tooltipRecentFile(path, _x, _y, _w, _h) constructor { + self.path = path; + x = _x; + y = _y; + w = _w; + h = _h; + + static drawTooltip = function() { + var fname = filename_name_only(path); + var fdir = filename_dir(path); + + draw_set_font(f_p0b); + var _w1 = string_width(fname); + var _h1 = string_height(fname); + + draw_set_font(f_p2); + var _w2 = string_width(fdir); + var _h2 = string_height(fdir); + + var tw = max(w, _w1, _w2); + var th = _h1 + ui(2) + _h2; + + var mx = x; + var my = y; + + draw_sprite_stretched(THEME.ui_panel_bg, 1, mx, my, tw + ui(24), th + ui(14)); + draw_sprite_stretched_ext(THEME.ui_panel, 1, mx, my, tw + ui(24), th + ui(14), COLORS._main_accent, 1); + + var tx = mx + ui(12); + var ty = my + ui(6); + + draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_inner); + draw_text(tx, ty, fname); + + ty += _h1 + ui(2); + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); + draw_text(tx, ty, fdir); + } +} \ No newline at end of file diff --git a/scripts/tooltip_recent_files/tooltip_recent_files.yy b/scripts/tooltip_recent_files/tooltip_recent_files.yy new file mode 100644 index 000000000..da1a08b7f --- /dev/null +++ b/scripts/tooltip_recent_files/tooltip_recent_files.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"tooltip_recent_files", + "isCompatibility":false, + "isDnD":false, + "name":"tooltip_recent_files", + "parent":{ + "name":"tooltip", + "path":"folders/functions/tooltip.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file