From 2714540e4aa783aa4efd74473ded7b1796cc3bcd Mon Sep 17 00:00:00 2001 From: Tanasart Date: Tue, 1 Oct 2024 10:46:28 +0700 Subject: [PATCH] graph overlay --- PixelComposer.resource_order | 2 +- PixelComposer.yyp | 2 +- scripts/argumentRenderer/argumentRenderer.gml | 6 +- scripts/draw_tooltip/draw_tooltip.gml | 44 ++++++++++ scripts/globals/globals.gml | 2 +- .../node_array_convolute.gml | 61 +++++++++---- .../node_collection_inline.gml | 16 ++-- scripts/node_de_corner/node_de_corner.gml | 8 +- .../node_iterate_each_inline.gml | 10 +-- .../node_iterate_filter_inline.gml | 34 ++++---- .../node_iterate_sort_inline.gml | 50 +++++------ scripts/node_lua_compute/node_lua_compute.gml | 2 +- .../node_mk_delay_machine.gml} | 0 .../node_mk_delay_machine.yy} | 4 +- scripts/node_registry/node_registry.gml | 36 ++++---- .../node_string_merge/node_string_merge.gml | 7 +- scripts/node_value_types/node_value_types.gml | 20 +++-- .../node_wav_file_read/node_wav_file_read.gml | 2 +- scripts/panel_graph/panel_graph.gml | 87 +++++++++++++++++-- 19 files changed, 271 insertions(+), 122 deletions(-) rename scripts/{nodd_mk_delay_machine/nodd_mk_delay_machine.gml => node_mk_delay_machine/node_mk_delay_machine.gml} (100%) rename scripts/{nodd_mk_delay_machine/nodd_mk_delay_machine.yy => node_mk_delay_machine/node_mk_delay_machine.yy} (74%) diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 789a08b7d..65cf20c12 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -683,7 +683,6 @@ {"name":"meta_data","order":12,"path":"scripts/meta_data/meta_data.yy",}, {"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",}, {"name":"mtl_reader","order":6,"path":"scripts/mtl_reader/mtl_reader.yy",}, - {"name":"nodd_mk_delay_machine","order":11,"path":"scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.yy",}, {"name":"node_3d_camera_set","order":1,"path":"scripts/node_3d_camera_set/node_3d_camera_set.yy",}, {"name":"node_3d_instancer","order":3,"path":"scripts/node_3d_instancer/node_3d_instancer.yy",}, {"name":"node_3d_light_point","order":2,"path":"scripts/node_3d_light_point/node_3d_light_point.yy",}, @@ -934,6 +933,7 @@ {"name":"node_mk_blinker","order":10,"path":"scripts/node_mk_blinker/node_mk_blinker.yy",}, {"name":"node_mk_brownian","order":8,"path":"scripts/node_mk_brownian/node_mk_brownian.yy",}, {"name":"node_mk_cable","order":4,"path":"scripts/node_mk_cable/node_mk_cable.yy",}, + {"name":"node_mk_delay_machine","order":11,"path":"scripts/node_mk_delay_machine/node_mk_delay_machine.yy",}, {"name":"node_mk_fall","order":9,"path":"scripts/node_mk_fall/node_mk_fall.yy",}, {"name":"node_mk_flag","order":5,"path":"scripts/node_mk_flag/node_mk_flag.yy",}, {"name":"node_mk_flame","order":7,"path":"scripts/node_mk_flame/node_mk_flame.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 4480a2572..7bdeff3ee 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1220,7 +1220,6 @@ {"id":{"name":"migration_function","path":"scripts/migration_function/migration_function.yy",},}, {"id":{"name":"mouse_input","path":"scripts/mouse_input/mouse_input.yy",},}, {"id":{"name":"mtl_reader","path":"scripts/mtl_reader/mtl_reader.yy",},}, - {"id":{"name":"nodd_mk_delay_machine","path":"scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.yy",},}, {"id":{"name":"node_2d_light","path":"scripts/node_2d_light/node_2d_light.yy",},}, {"id":{"name":"node_3d_camera_set","path":"scripts/node_3d_camera_set/node_3d_camera_set.yy",},}, {"id":{"name":"node_3d_camera","path":"scripts/node_3d_camera/node_3d_camera.yy",},}, @@ -1513,6 +1512,7 @@ {"id":{"name":"node_mk_blinker","path":"scripts/node_mk_blinker/node_mk_blinker.yy",},}, {"id":{"name":"node_mk_brownian","path":"scripts/node_mk_brownian/node_mk_brownian.yy",},}, {"id":{"name":"node_mk_cable","path":"scripts/node_mk_cable/node_mk_cable.yy",},}, + {"id":{"name":"node_mk_delay_machine","path":"scripts/node_mk_delay_machine/node_mk_delay_machine.yy",},}, {"id":{"name":"node_mk_fall","path":"scripts/node_mk_fall/node_mk_fall.yy",},}, {"id":{"name":"node_mk_flag","path":"scripts/node_mk_flag/node_mk_flag.yy",},}, {"id":{"name":"node_mk_flame","path":"scripts/node_mk_flame/node_mk_flame.yy",},}, diff --git a/scripts/argumentRenderer/argumentRenderer.gml b/scripts/argumentRenderer/argumentRenderer.gml index 63a3cd0fc..c936594d9 100644 --- a/scripts/argumentRenderer/argumentRenderer.gml +++ b/scripts/argumentRenderer/argumentRenderer.gml @@ -8,8 +8,8 @@ function argumentRenderer(_typeArray = []) { var tx = _x; var ty = _y + ui(8); var hh = ui(8); - var _fn = f_p1; - var _th = line_get_height(f_p0, 12); + var _fn = spc? f_p1 : f_p2; + var _th = spc? line_get_height(f_p0, 12) : line_get_height(f_p2, 12); for( var i = input_fix_len; i < array_length(inputs); i += data_length ) { var _jType = inputs[i + 1]; @@ -31,7 +31,7 @@ function argumentRenderer(_typeArray = []) { draw_set_text(_fn, fa_left, fa_top, COLORS._main_text_sub); draw_text_add(tx + ui(8), ty + _th + ui(8 + 6), __txt("Value")); - var params = new widgetParam(tx + ui(64), ty + _th + ui(10), _w - ui(64), TEXTBOX_HEIGHT, _jValue.showValue(), {}, _m, argument_renderer.rx, argument_renderer.ry); + var params = new widgetParam(tx + ui(64), ty + _th + ui(10), _w - ui(64), _th, _jValue.showValue(), {}, _m, argument_renderer.rx, argument_renderer.ry); params.font = _fn; _jValue.editWidget.setFocusHover(_focus, _hover); diff --git a/scripts/draw_tooltip/draw_tooltip.gml b/scripts/draw_tooltip/draw_tooltip.gml index f2c7c5d73..3cd809ccc 100644 --- a/scripts/draw_tooltip/draw_tooltip.gml +++ b/scripts/draw_tooltip/draw_tooltip.gml @@ -315,3 +315,47 @@ function draw_tooltip_curve(curve) { draw_rectangle(x0, y0, x1, y1, true); } + +function tooltip_modifiers(title, keys) constructor { + self.title = title; + self.keys = keys; + + static drawTooltip = function() { + + draw_set_font(f_p1); + var w1 = string_width(title); + var h1 = string_height(title); + + draw_set_font(f_p2); + var w2 = 0; + var h2 = 0; + + for( var i = 0, n = array_length(keys); i < n; i++ ) { + w2 = max(w2, string_width(keys[i][0]) + string_width(keys[i][1]) + ui(16)); + h2 += line_get_height(); + } + + var tw = max(w1, w2); + var th = h1 + ui(8) + h2; + + var mx = min(__mouse_tx + ui(16), __win_tw - (tw + ui(16))); + var my = min(__mouse_ty + ui(16), __win_th - (th + ui(16))); + + draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16)); + draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16)); + + draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text); + draw_text(mx + ui(8), my + ui(8), title); + + draw_set_font(f_p2); + + for( var i = 0, n = array_length(keys); i < n; i++ ) { + var _hx = mx + ui(12) + string_width(keys[i][0]); + var _hy = my + ui(8) + h1 + ui(4) + h2 / 2 + ui(4); + hotkey_draw(keys[i][0], _hx, _hy); + + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text); + draw_text(_hx + ui(8), my + ui(8) + h1 + ui(6), keys[i][1]); + } + } +} \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 431f82283..7e1940fdd 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -42,7 +42,7 @@ LATEST_VERSION = 1_17_00; VERSION = 1_17_12_0; SAVE_VERSION = 1_17_10_0; - VERSION_STRING = MAC? "1.18.003m" : "1.18.0.1"; + VERSION_STRING = MAC? "1.18.003m" : "1.18.1"; BUILD_NUMBER = 1_18_00_0; HOTKEYS = ds_map_create(); diff --git a/scripts/node_array_convolute/node_array_convolute.gml b/scripts/node_array_convolute/node_array_convolute.gml index 38e1011df..f9d0264fc 100644 --- a/scripts/node_array_convolute/node_array_convolute.gml +++ b/scripts/node_array_convolute/node_array_convolute.gml @@ -2,7 +2,7 @@ function Node_Array_Convolute(_x, _y, _group = noone) : Node(_x, _y, _group) con name = "Array Convolute"; setDimension(96, 32 + 24); - newInput(0, nodeValue_Float("Array", self, 0)) + newInput(0, nodeValue_Float("Array", self, [])) .setArrayDepth(1) .setVisible(true, true); @@ -10,36 +10,65 @@ function Node_Array_Convolute(_x, _y, _group = noone) : Node(_x, _y, _group) con .setArrayDepth(1) .setVisible(true, true); + newInput(2, nodeValue_Enum_Scroll("Boundary", self, 0, [ "Zero", "Wrap", "Skip" ])) + .setArrayDepth(1); + newOutput(0, nodeValue_Output("Array", self, VALUE_TYPE.float, 0)) .setArrayDepth(1); static convolute = function(arr, ker) { - __tmp_ker = ker; - __tmp_arr = arr; - __tmp_len = array_length(ker); - __tmp_arn = array_length(arr); - __tmp_st = floor((__tmp_len - 1) / 2); + var _bnd = getInputData(2); - return array_map(arr, function(val, ind) { - var ret = 0; + var _len = array_length(ker); + var _arn = array_length(arr); + var _st = floor((_len - 1) / 2); + var r, _a; + + if(_bnd == 2) { + var _ll = _arn - _len + 1; + _a = array_create(_ll); - for(var i = 0; i < __tmp_len; i++) { - var _ind = ind + i - __tmp_st; - if(_ind < 0) continue; - if(_ind >= __tmp_arn) continue; + for(var i = 0; i < _ll; i++ ) { + r = 0; - ret += __tmp_arr[_ind] * __tmp_ker[i]; + for(var j = 0; j < _len; j++) { + var _ind = i + j; + if(_ind < 0 || _ind >= _arn) continue; + + r += arr[_ind] * ker[j]; + } + + _a[i] = r; } - return ret; - }); + } else { + _a = array_create(_arn); + + for( var i = 0; i < _arn; i++ ) { + r = 0; + + for(var j = 0; j < _len; j++) { + var _ind = i + j - _st; + if(_ind < 0 || _ind >= _arn) { + if(_bnd == 0) continue; + _ind = safe_mod(_ind + _arn, _arn); + } + + r += arr[_ind] * ker[j]; + } + + _a[i] = r; + } + } + + return _a; } static update = function(frame = CURRENT_FRAME) { var _arr = getInputData(0); var _ker = getInputData(1); - if(!is_array(_arr) || !is_array(_ker)) return; + if(!is_array(_arr) || !is_array(_ker)) return; if(array_empty(_arr) || array_empty(_ker)) return; var res; diff --git a/scripts/node_collection_inline/node_collection_inline.gml b/scripts/node_collection_inline/node_collection_inline.gml index b205c2834..989ece1bb 100644 --- a/scripts/node_collection_inline/node_collection_inline.gml +++ b/scripts/node_collection_inline/node_collection_inline.gml @@ -75,15 +75,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c static refreshMember = function() { nodes = []; - - for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { - if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { - print($"Node not found {attributes.members[i]}"); - continue; - } - - addNode(PROJECT.nodeMap[? attributes.members[i]]); - } + array_foreach(attributes.members, function(m) /*=>*/ { if(ds_map_exists(PROJECT.nodeMap, m)) addNode(PROJECT.nodeMap[? m]); }) } static refreshGroupBG = function() { @@ -184,8 +176,10 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c if(PANEL_GRAPH.node_dragging && PANEL_GRAPH.frame_hovering == self) { var _list = PANEL_GRAPH.nodes_selecting; - - if(key_mod_press(SHIFT)) { + + PANEL_GRAPH.addKeyOverlay("Inline group", [[ "Shift", "Add/remove" ]]); + + if(key_mod_down(SHIFT)) { if(group_hovering) { group_adding = true; for( var i = 0, n = array_length(_list); i < n; i++ ) { diff --git a/scripts/node_de_corner/node_de_corner.gml b/scripts/node_de_corner/node_de_corner.gml index 9776744e9..0c91d191b 100644 --- a/scripts/node_de_corner/node_de_corner.gml +++ b/scripts/node_de_corner/node_de_corner.gml @@ -33,11 +33,11 @@ function Node_De_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) temp_surface = [ noone, noone ]; - static step = function() { #region + static step = function() { __step_mask_modifier(); - } #endregion + } - static processData = function(_outSurf, _data, _output_index, _array_index) { #region + static processData = function(_outSurf, _data, _output_index, _array_index) { var surf = _data[0]; var _tol = _data[2]; var _itr = _data[3]; @@ -76,6 +76,6 @@ function Node_De_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); return _outSurf; - } #endregion + } } \ No newline at end of file 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 b9f61648b..0a3543ba2 100644 --- a/scripts/node_iterate_each_inline/node_iterate_each_inline.gml +++ b/scripts/node_iterate_each_inline/node_iterate_each_inline.gml @@ -63,12 +63,12 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli nodes = []; for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { - if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { - print($"Node not found {attributes.members[i]}"); - continue; - } + var m = attributes.members[i]; - var _node = PROJECT.nodeMap[? attributes.members[i]]; + if(!ds_map_exists(PROJECT.nodeMap, m)) + continue; + + var _node = PROJECT.nodeMap[? m]; _node.inline_context = self; array_push(nodes, _node); 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 d43c656b4..0d6592f16 100644 --- a/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml +++ b/scripts/node_iterate_filter_inline/node_iterate_filter_inline.gml @@ -10,7 +10,7 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In output_node_type = Node_Iterator_Filter_Inline_Output; iterated = 0; - if(!LOADING && !APPENDING) { #region + if(!LOADING && !APPENDING) { var input = nodeBuild("Node_Iterator_Filter_Inline_Input", x, y); var output = nodeBuild("Node_Iterator_Filter_Inline_Output", x + 256, y); @@ -31,18 +31,18 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In 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() { LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, "[outputNextNode] Get next node from inline iterate"); @@ -55,18 +55,18 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In 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++ ) { - if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { - print($"Node not found {attributes.members[i]}"); - continue; - } + var m = attributes.members[i]; - var _node = PROJECT.nodeMap[? attributes.members[i]]; + if(!ds_map_exists(PROJECT.nodeMap, m)) + continue; + + var _node = PROJECT.nodeMap[? m]; _node.inline_context = self; array_push(nodes, _node); @@ -86,9 +86,9 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In 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(); @@ -98,6 +98,6 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In iterated = 0; output_node.outputs[0].setValue([]); - } #endregion + } } \ No newline at end of file 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 a6694d96f..664885044 100644 --- a/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml +++ b/scripts/node_iterate_sort_inline/node_iterate_sort_inline.gml @@ -14,7 +14,7 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli output_node_type = Node_Iterator_Sort_Inline_Output; iterated = 0; - if(!LOADING && !APPENDING) { #region + if(!LOADING && !APPENDING) { var input = nodeBuild("Node_Iterator_Sort_Inline_Input", x, y); var output = nodeBuild("Node_Iterator_Sort_Inline_Output", x + 256, y); @@ -33,29 +33,29 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli array_push(APPEND_LIST, input, output); } - } #endregion + } - static isActiveDynamic = function(frame = CURRENT_FRAME) { #region + static isActiveDynamic = function(frame = CURRENT_FRAME) { for( var i = 0, n = array_length(nodes); i < n; i++ ) if(nodes[i].isActiveDynamic(frame)) return true; return false; - } #endregion + } - static getNextNodes = function() { #region + static getNextNodes = function() { return output_node.getNextNodes(); - } #endregion + } - static refreshMember = function() { #region + static refreshMember = function() { nodes = []; for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { - if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { - print($"Node not found {attributes.members[i]}"); - continue; - } + var m = attributes.members[i]; - var _node = PROJECT.nodeMap[? attributes.members[i]]; + if(!ds_map_exists(PROJECT.nodeMap, m)) + continue; + + var _node = PROJECT.nodeMap[? m]; _node.inline_context = self; array_push(nodes, _node); @@ -75,9 +75,9 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli if(output_node) output_node.destroy(); destroy(); } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { if(input_node == noone || output_node == noone) { if(input_node) input_node.destroy(); if(output_node) output_node.destroy(); @@ -91,17 +91,17 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli input_node.startSort = true; //sortArray(); - } #endregion + } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - static swap = function(arr, a, b) { #region + static swap = function(arr, a, b) { var temp = arr[a]; arr[@ a] = arr[b]; arr[@ b] = temp; - } #endregion + } - static compareValue = function(val1, val2) { #region + static compareValue = function(val1, val2) { input_node.outputs[0].setValue(val1,,, false); input_node.outputs[1].setValue(val2,,, false); @@ -112,9 +112,9 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli //print($"Comparing value {val1}, {val2} > [{res}]"); return res; - } #endregion + } - static partition = function(arr, low, high) { #region + static partition = function(arr, low, high) { var pv = arr[high]; var i = low - 1; @@ -127,18 +127,18 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli swap(arr, i + 1, high); return i + 1; - } #endregion + } - static quickSort = function(arr, low, high) { #region + static quickSort = function(arr, low, high) { if(low >= high) return; var p = partition(arr, low, high); quickSort(arr, low, p - 1); quickSort(arr, p + 1, high); - } #endregion + } - static sortArray = function() { #region + static sortArray = function() { iterated = 0; loop_start_time = get_timer(); @@ -160,6 +160,6 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli quickSort(arrOut, 0, array_length(arrOut) - 1); output_node.outputs[0].setValue(arrOut); - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index a2078447e..c4fcd28b5 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -16,7 +16,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru newOutput(0, nodeValue_Output("Execution thread", self, VALUE_TYPE.node, noone )); - newOutput(1, nodeValue_Output("Return value", self, VALUE_TYPE.surface, noone)); + newOutput(1, nodeValue_Output("Return value", self, VALUE_TYPE.any, noone)); argumentRenderer(global.lua_arguments); diff --git a/scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.gml b/scripts/node_mk_delay_machine/node_mk_delay_machine.gml similarity index 100% rename from scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.gml rename to scripts/node_mk_delay_machine/node_mk_delay_machine.gml diff --git a/scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.yy b/scripts/node_mk_delay_machine/node_mk_delay_machine.yy similarity index 74% rename from scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.yy rename to scripts/node_mk_delay_machine/node_mk_delay_machine.yy index 13814e391..00a5b1196 100644 --- a/scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.yy +++ b/scripts/node_mk_delay_machine/node_mk_delay_machine.yy @@ -1,9 +1,9 @@ { "$GMScript":"v1", - "%Name":"nodd_mk_delay_machine", + "%Name":"node_mk_delay_machine", "isCompatibility":false, "isDnD":false, - "name":"nodd_mk_delay_machine", + "name":"node_mk_delay_machine", "parent":{ "name":"MKFX", "path":"folders/nodes/data/MKFX.yy", diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index e86a9bdb5..856d08790 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -314,7 +314,7 @@ function __initNodes() { #region for var iter = ds_list_create(); - NODE_ADD_CAT("Loop", iter, ["Node_Iterate"], COLORS.node_blend_loop); + NODE_ADD_CAT("Loop", iter, ["Node_Iterate"], COLORS.node_blend_loop); //#For ds_list_add(iter, "Groups"); addNodeObject(iter, "Loop Input", s_node_loop_input, "Node_Iterator_Input", [1, Node_Iterator_Input]).hideRecent(); addNodeObject(iter, "Loop Output", s_node_loop_output, "Node_Iterator_Output", [1, Node_Iterator_Output]).hideRecent(); @@ -329,7 +329,7 @@ function __initNodes() { #region for inline var iter_il = ds_list_create(); - NODE_ADD_CAT("Loop", iter_il, ["Node_Iterate_Inline"], COLORS.node_blend_loop); + NODE_ADD_CAT("Loop", iter_il, ["Node_Iterate_Inline"], COLORS.node_blend_loop); //#For inline ds_list_add(iter_il, "Loops"); addNodeObject(iter_il, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]).hideRecent(); addNodeObject(iter_il, "Loop amount", s_node_iterator_amount, "Node_Iterator_Length", [1, Node_Iterator_Length]).hideRecent(); @@ -337,7 +337,7 @@ function __initNodes() { #region for each var itere = ds_list_create(); - NODE_ADD_CAT("Loop", itere, ["Node_Iterate_Each"], COLORS.node_blend_loop); + NODE_ADD_CAT("Loop", itere, ["Node_Iterate_Each"], COLORS.node_blend_loop); //#Foreach ds_list_add(itere, "Groups"); addNodeObject(itere, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]).hideRecent(); addNodeObject(itere, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]).hideRecent(); @@ -350,7 +350,7 @@ function __initNodes() { #region for each inline var itere_il = ds_list_create(); - NODE_ADD_CAT("Loop", itere_il, ["Node_Iterate_Each_Inline"], COLORS.node_blend_loop); + NODE_ADD_CAT("Loop", itere_il, ["Node_Iterate_Each_Inline"], COLORS.node_blend_loop); //#Foreach inline ds_list_add(itere_il, "Loops"); addNodeObject(itere_il, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]).hideRecent(); addNodeObject(itere_il, "Array Length", s_node_iterator_length, "Node_Iterator_Length", [1, Node_Iterator_Length]).hideRecent(); @@ -358,7 +358,7 @@ function __initNodes() { #region iterate filter var filter = ds_list_create(); - NODE_ADD_CAT("Filter", filter, ["Node_Iterate_Filter"], COLORS.node_blend_loop); + NODE_ADD_CAT("Filter", filter, ["Node_Iterate_Filter"], COLORS.node_blend_loop); //#Loop filter ds_list_add(filter, "Groups"); addNodeObject(filter, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]).hideRecent(); addNodeObject(filter, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]).hideRecent(); @@ -371,7 +371,7 @@ function __initNodes() { #region iterate filter inline var filter_il = ds_list_create(); - NODE_ADD_CAT("Filter", filter_il, ["Node_Iterate_Filter_Inline"], COLORS.node_blend_loop); + NODE_ADD_CAT("Filter", filter_il, ["Node_Iterate_Filter_Inline"], COLORS.node_blend_loop); //#Loop filter inline ds_list_add(filter_il, "Loops"); addNodeObject(filter_il, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]).hideRecent(); addNodeObject(filter_il, "Array Length", s_node_iterator_length, "Node_Iterator_Length", [1, Node_Iterator_Length]).hideRecent(); @@ -379,7 +379,7 @@ function __initNodes() { #region iterate feedback var feed = ds_list_create(); - NODE_ADD_CAT("Feedback", feed, ["Node_Feedback"], COLORS.node_blend_feedback); + NODE_ADD_CAT("Feedback", feed, ["Node_Feedback"], COLORS.node_blend_feedback); //#Feedback ds_list_add(feed, "Groups"); addNodeObject(feed, "Input", s_node_feedback_input, "Node_Feedback_Input", [1, Node_Feedback_Input]).hideRecent(); addNodeObject(feed, "Output", s_node_feedback_output, "Node_Feedback_Output", [1, Node_Feedback_Output]).hideRecent(); @@ -582,8 +582,6 @@ function __initNodes() { #region filter var filter = ds_list_create(); addNodeCatagory("Filter", filter); - //ds_list_add(filter, "Seasonal"); - //addNodeObject(filter, "Lovify", s_node_lovify, "Node_Lovify", [1, Node_Lovify],, "Add love to your image.").setIcon(s_lovify_icon); ds_list_add(filter, "Combines"); addNodeObject(filter, "Blend", s_node_blend, "Node_Blend", [0, Node_create_Blend], global.node_blend_keys, "Blend 2 images using different blend modes."); @@ -891,7 +889,7 @@ function __initNodes() { addNodeObject(values, "To Text", s_node_to_text, "Node_To_Text", [1, Node_To_Text]).setVersion(1145); addNodeObject(values, "Unicode", s_node_unicode, "Node_Unicode", [1, Node_Unicode]); addNodeObject(values, "Text Length", s_node_text_length, "Node_String_Length", [1, Node_String_Length]).setVersion(1138); - addNodeObject(values, "Combine Text", s_node_text_combine, "Node_String_Merge", [1, Node_String_Merge]); + addNodeObject(values, "Combine Text", s_node_text_combine, "Node_String_Merge", [1, Node_String_Merge], ["join text", "concatenate text"]); addNodeObject(values, "Join Text", s_node_text_join, "Node_String_Join", [1, Node_String_Join]).setVersion(1120); addNodeObject(values, "Split Text", s_node_text_splice, "Node_String_Split", [1, Node_String_Split]); addNodeObject(values, "Trim Text", s_node_text_trim, "Node_String_Trim", [1, Node_String_Trim]).setVersion(1080); @@ -924,7 +922,7 @@ function __initNodes() { addNodeObject(values, "Shuffle Array", s_node_array_shuffle, "Node_Array_Shuffle", [1, Node_Array_Shuffle], ["array shuffle"]).setVersion(1120); addNodeObject(values, "Loop Array", s_node_loop_array, "Node_Iterate_Each_Inline", [1, Node_Iterate_Each_Inline], ["iterate each", "for each", "array loop"], "Create group that iterate to each member in an array."); addNodeObject(values, "Filter Array", s_node_filter_array, "Node_Iterate_Filter_Inline", [1, Node_Iterate_Filter_Inline], ["array filter"], "Filter array using condition.").setVersion(1140); - addNodeObject(values, "Sort Array (inline)",s_node_sort_array, "Node_Iterate_Sort_Inline", [1, Node_Iterate_Sort_Inline], ["array sort"], "Sort array using node graph.").setVersion(1143); + addNodeObject(values, "Sort Array Inline", s_node_sort_array, "Node_Iterate_Sort_Inline", [1, Node_Iterate_Sort_Inline], ["array sort"], "Sort array using node graph.").setVersion(1143); addNodeObject(values, "Parse CSV", s_node_csv_parse, "Node_Array_CSV_Parse", [1, Node_Array_CSV_Parse]).setVersion(1145); ds_list_add(values, "Paths"); @@ -1115,7 +1113,7 @@ function __initNodes() { #region pb_group var pb_group = ds_list_create(); - addNodePBCatagory("Group", pb_group); + addNodePBCatagory("Group", pb_group); //#PB Group ds_list_add(pb_group, "Groups"); addNodeObject(pb_group, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]).hideRecent(); addNodeObject(pb_group, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]).hideRecent(); @@ -1123,7 +1121,7 @@ function __initNodes() { #region pb_draw var pb_draw = ds_list_create(); - addNodePBCatagory("Draw", pb_draw); + addNodePBCatagory("Draw", pb_draw); //#PB Draw ds_list_add(pb_draw, "Fill"); addNodeObject(pb_draw, "Fill", s_node_pb_draw_fill, "Node_PB_Draw_Fill", [1, Node_PB_Draw_Fill]).hideRecent(); @@ -1141,7 +1139,7 @@ function __initNodes() { #region pb_box var pb_box = ds_list_create(); - addNodePBCatagory("Box", pb_box); + addNodePBCatagory("Box", pb_box); //#PB Box ds_list_add(pb_box, "Layer"); addNodeObject(pb_box, "Layer", s_node_pb_layer, "Node_PB_Layer", [1, Node_PB_Layer]).hideRecent(); @@ -1157,7 +1155,7 @@ function __initNodes() { #region pb_fx var pb_fx = ds_list_create(); - addNodePBCatagory("Effects", pb_fx); + addNodePBCatagory("Effects", pb_fx); //#PB Effects ds_list_add(pb_fx, "Effect"); addNodeObject(pb_fx, "Outline", s_node_pb_fx_outline, "Node_PB_Fx_Outline", [1, Node_PB_Fx_Outline]).hideRecent(); addNodeObject(pb_fx, "Stack", s_node_pb_fx_stack, "Node_PB_Fx_Stack", [1, Node_PB_Fx_Stack]).hideRecent(); @@ -1180,7 +1178,7 @@ function __initNodes() { #region pb_arr var pb_arr = ds_list_create(); - addNodePBCatagory("Array", pb_arr); + addNodePBCatagory("Array", pb_arr); //#PB Array addNodeObject(pb_arr, "Array", s_node_array, "Node_Array", [1, Node_Array]).hideRecent(); addNodeObject(pb_arr, "Array Get", s_node_array_get, "Node_Array_Get", [1, Node_Array_Get], ["get array"]).hideRecent(); addNodeObject(pb_arr, "Array Set", s_node_array_set, "Node_Array_Set", [1, Node_Array_Set], ["set array"]).hideRecent().setVersion(1120); @@ -1192,14 +1190,14 @@ function __initNodes() { #region pcx_var var pcx_var = ds_list_create(); - addNodePCXCatagory("Variable", pcx_var); + addNodePCXCatagory("Variable", pcx_var); //#PCX Variable addNodeObject(pcx_var, "Variable", s_node_array, "Node_PCX_var", [1, Node_PCX_var]).hideRecent(); addNodeObject(pcx_var, "Fn Variable", s_node_array, "Node_PCX_fn_var", [1, Node_PCX_fn_var]).hideRecent(); #endregion #region pcx_fn var pcx_fn = ds_list_create(); - addNodePCXCatagory("Functions", pcx_fn); + addNodePCXCatagory("Functions", pcx_fn); //#PCX Functions addNodeObject(pcx_fn, "Equation", s_node_array, "Node_PCX_Equation", [1, Node_PCX_Equation]).hideRecent(); ds_list_add(pcx_fn, "Numbers"); @@ -1217,7 +1215,7 @@ function __initNodes() { #region pcx_flow var pcx_flow = ds_list_create(); - addNodePCXCatagory("Flow Control", pcx_flow); + addNodePCXCatagory("Flow Control", pcx_flow); //#PCX flow control addNodeObject(pcx_flow, "Condition", s_node_array, "Node_PCX_Condition", [1, Node_PCX_Condition]).hideRecent(); #endregion diff --git a/scripts/node_string_merge/node_string_merge.gml b/scripts/node_string_merge/node_string_merge.gml index 1e4ce4a28..c1e06e93e 100644 --- a/scripts/node_string_merge/node_string_merge.gml +++ b/scripts/node_string_merge/node_string_merge.gml @@ -12,12 +12,15 @@ function Node_String_Merge(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro .setVisible(true, true); return inputs[index]; - } setDynamicInput(1, true, VALUE_TYPE.text); + } + + setDynamicInput(1, true, VALUE_TYPE.text); static processData = function(_output, _data, _index = 0) { var _str = ""; + for( var i = 0, n = array_length(_data); i < n; i++ ) - _str += _data[i]; + _str += string(_data[i]); return _str; } diff --git a/scripts/node_value_types/node_value_types.gml b/scripts/node_value_types/node_value_types.gml index 2b52de710..fe99f362f 100644 --- a/scripts/node_value_types/node_value_types.gml +++ b/scripts/node_value_types/node_value_types.gml @@ -559,8 +559,13 @@ function nodeValueUnit(_nodeValue) constructor { } else if(is_array(value)) { if(inv) { base = [ - base[0] == 0? 0 : 1 / base[0], - base[1] == 0? 0 : 1 / base[1], + base[0] == 0? 0 : 1 / array_safe_get(base, 0), + base[1] == 0? 0 : 1 / array_safe_get(base, 1), + ]; + } else { + base = [ + array_safe_get(base, 0), + array_safe_get(base, 1) ]; } @@ -569,15 +574,20 @@ function nodeValueUnit(_nodeValue) constructor { case VALUE_DISPLAY.vector : case VALUE_DISPLAY.vector_range : var _val = array_create(array_length(value)); + for( var i = 0, n = array_length(value); i < n; i++ ) - _val[i] = value[i] * base[i % 2]; + _val[i] = is_real(value[i])? value[i] * base[i % 2] : value[i]; + return _val; case VALUE_DISPLAY.area : - var _val = array_clone(value); + var _val = array_create(array_length(value)); + for( var i = 0; i < 4; i++ ) - _val[i] = value[i] * base[i % 2]; + _val[i] = is_real(value[i])? value[i] * base[i % 2] : value[i]; + _val[4] = array_safe_get(value, 4); + return _val; } } diff --git a/scripts/node_wav_file_read/node_wav_file_read.gml b/scripts/node_wav_file_read/node_wav_file_read.gml index 56a828c2a..b3d197065 100644 --- a/scripts/node_wav_file_read/node_wav_file_read.gml +++ b/scripts/node_wav_file_read/node_wav_file_read.gml @@ -50,7 +50,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const newOutput(3, nodeValue_Output("Channels", self, VALUE_TYPE.integer, 2)) .setVisible(false); - newOutput(4, nodeValue_Output("Duration (s)", self, VALUE_TYPE.float, 0)) + newOutput(4, nodeValue_Output("Duration", self, VALUE_TYPE.float, 0)) .setVisible(false); content = noone; diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 032bb2e9f..52aa340a4 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -284,6 +284,17 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { bg_color = c_black; slider_width = 0; + + tooltip_overlay = {}; + + function addKeyOverlay(title, keys) { + if(struct_has(tooltip_overlay, title)) { + array_append(tooltip_overlay[$ title], keys); + return; + } + + tooltip_overlay[$ title] = keys; + } #endregion #region // ---- position ---- @@ -1239,7 +1250,13 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { // ++++++++++++ interaction ++++++++++++ if(mouse_on_graph && pHOVER) { - + if(node_dragging == noone && value_dragging == noone) { + if(value_focus) + addKeyOverlay("Select junction(s)", [[ "Shift", "Peek content" ]]); + else if(node_hovering) + addKeyOverlay("Select node(s)", [[ "Shift", "Toggle selection" ]]); + } + // select var _anc = nodes_select_anchor; if(mouse_press(mb_left, _focus)) _anc = noone; @@ -1251,6 +1268,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { NODE_DROPPER_TARGET.expressionUpdate(); } } else if(mouse_press(mb_left, _focus)) { + if(key_mod_press(SHIFT)) { if(node_hovering) { if(array_exists(nodes_selecting, node_hovering)) @@ -1268,6 +1286,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } else { if(is_instanceof(node_hovering, Node_Frame)) { + addKeyOverlay("Frames selection", [[ "Ctrl", "Exclude contents" ]]); + var fx0 = (node_hovering.x + graph_x) * graph_s; var fy0 = (node_hovering.y + graph_y) * graph_s; var fx1 = fx0 + node_hovering.w * graph_s; @@ -1581,6 +1601,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { nodes_list[i].groupCheck(gr_x, gr_y, graph_s, mx, my); if(node_dragging && !key_mod_press(ALT)) { + addKeyOverlay("Dragging node(s)", [[ "Ctrl", "Disable snapping" ]]); + var nx = node_drag_sx + (mouse_graph_x - node_drag_mx); var ny = node_drag_sy + (mouse_graph_y - node_drag_my); @@ -1588,7 +1610,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { nx = round(nx / project.graphGrid.size) * project.graphGrid.size; ny = round(ny / project.graphGrid.size) * project.graphGrid.size; } - + if(node_drag_ox == -1 || node_drag_oy == -1) { node_drag_ox = nx; node_drag_oy = ny; @@ -1791,10 +1813,15 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { value_dragging.node.triggerRender(); if(value_focus != value_dragging) { + var ctx = is_instanceof(frame_hovering, Node_Collection_Inline)? frame_hovering : getCurrentContext(); - if(value_dragging.node.inline_context && !key_mod_press(SHIFT)) - ctx = value_dragging.node.inline_context; + if(value_dragging.node.inline_context) { + addKeyOverlay("Connecting (inline)", [[ "Alt", "Connect to outside" ]]); + + if(!key_mod_press(ALT)) + ctx = value_dragging.node.inline_context; + } if(is_instanceof(ctx, Node_Collection_Inline) && !ctx.junctionIsInside(value_dragging)) ctx = noone; @@ -1854,6 +1881,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { return; } + addKeyOverlay("Connecting", [[ "Ctrl", "Disable auto connect" ], [ "Shift", "Select multiple" ], [ "Double Shift", "Select all of same type" ]]); + if(key_mod_double(SHIFT)) { var _n = value_dragging.node; var _l = value_dragging.connect_type == CONNECT_TYPE.input? _n.inputs : _n.outputs; @@ -2501,7 +2530,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { drawSlideShow(); - ////////////////////////////////// File drop ////////////////////////////////// + ///////////////////////////////////// File drop ///////////////////////////////////// if(pHOVER) { var gr_x = graph_x * graph_s; @@ -2527,7 +2556,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1); if(FILE_IS_DROPPING) - _tip = file_drop_tooltip; + addKeyOverlay("Droping file(s)", [[ "Shift", "Options..." ]]); if(DRAGGING) { // file dropping if(_node_hover && _node_hover.droppable(DRAGGING)) { @@ -2555,6 +2584,48 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(_tip != "") TOOLTIP = _tip; } + ////////////////////////////////// Tooltip Overlay ////////////////////////////////// + + var _over = variable_struct_get_names(tooltip_overlay); + if(!array_empty(_over)) { + var _tx = ui(16); + var _ty = h - toolbar_height - ui(10); + + for( var j = 0, m = array_length(_over); j < m; j++ ) { + var _title = _over[j]; + var _keys = tooltip_overlay[$ _title]; + + draw_set_text(f_p2, fa_left, fa_bottom, COLORS._main_text); + + var _tw = 0; + for( var i = 0, n = array_length(_keys); i < n; i++ ) + _tw = max(_tw, string_width(_keys[i][0])); + var _ttx = _tx + _tw + ui(16); + + for( var i = array_length(_keys) - 1; i >= 0; i-- ) { + draw_set_color(COLORS._main_icon); + draw_set_alpha(0.5); + draw_text_add(_tx, _ty, _keys[i][0]); + + draw_set_color(COLORS._main_text); + draw_set_alpha(0.5); + draw_text_add(_ttx, _ty, _keys[i][1]); + + _ty -= line_get_height(); + } + + _ty -= ui(4); + draw_set_text(f_p1b, fa_left, fa_bottom, COLORS._main_text); + draw_set_alpha(0.5); + draw_text_add(_tx, _ty, _title); + + _ty -= line_get_height() + ui(8); + } + + draw_set_alpha(1); + } + + tooltip_overlay = {}; } //// ============ Action ============ @@ -3311,7 +3382,7 @@ function Panel_Graph_Drop_tooltip(panel) constructor { static drawTooltip = function() { var _drop = __txt("Import File"); - var _shft = __txt("Options..."); + var _shft = __txt("Options") + "..."; draw_set_font(f_p1); var w1 = string_width(_drop); @@ -3338,7 +3409,7 @@ function Panel_Graph_Drop_tooltip(panel) constructor { var _hy = my + ui(8) + h1 + ui(4) + h2 / 2 + ui(4); hotkey_draw("Shift", _hx, _hy); - draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text); draw_text(_hx + ui(8), my + ui(8) + h1 + ui(6), _shft); } } \ No newline at end of file