diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index edea7a446..c90a16f82 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -989,6 +989,7 @@ event_inherited(); if(!struct_has(cat, "list")) continue; + if(array_length(cat.filter) && !array_exists(cat.filter, instanceof(context))) continue; diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 6672c1b54..45e3b1e84 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -44,7 +44,7 @@ LATEST_VERSION = 1_18_00_0; VERSION = 1_18_06_2; SAVE_VERSION = 1_18_05_0; - VERSION_STRING = MAC? "1.18.003m" : "1.18.7.001"; + VERSION_STRING = MAC? "1.18.003m" : "1.18.7.002"; BUILD_NUMBER = 1_18_06_2; PREF_VERSION = 1_17_1; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index ae0a4f922..ffc84bec3 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -1095,7 +1095,8 @@ function __initNodes() { addNodeObject(values, "Atlas to Struct", Node_Atlas_Struct, "Convert atlas into generic struct.").setVersion(11710); ds_list_add(values, "Surface"); - //addNodeObject(values, "Dynamic Surface", Node_dynaSurf).setVersion(11520); + addNodeObject(values, "Surface Data", Node_Surface_data, "Extract information about a surface").setTags(["surface info"]).setVersion(1_18_07_0); + // addNodeObject(values, "Dynamic Surface", Node_dynaSurf).setVersion(11520); addNodeObject(values, "IsoSurf", Node_IsoSurf, "Create a dynamic surface that changes its texture based on rotation.").setVersion(11520); addNodeObject(values, "Surface from Buffer", Node_Surface_From_Buffer, "Create surface from a valid buffer.").setTags(["buffer to surface"]).setVersion(1146); diff --git a/scripts/node_surface_data/node_surface_data.gml b/scripts/node_surface_data/node_surface_data.gml index 8125dddfb..edc3c0c83 100644 --- a/scripts/node_surface_data/node_surface_data.gml +++ b/scripts/node_surface_data/node_surface_data.gml @@ -1,35 +1,43 @@ -function Node_Surface_data(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { +function Node_Surface_data(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Surface data"; color = COLORS.node_blend_number; newInput(0, nodeValue_Surface("Surface", self)); +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + newOutput(0, nodeValue_Output("Dimension", self, VALUE_TYPE.integer, [ 1, 1 ])) .setDisplay(VALUE_DISPLAY.vector); - - newOutput(1, nodeValue_Output("Array length", self, VALUE_TYPE.integer, 0)); + newOutput(1, nodeValue_Output("Width", self, VALUE_TYPE.integer, 1)); + + newOutput(2, nodeValue_Output("Height", self, VALUE_TYPE.integer, 1)); + + newOutput(3, nodeValue_Output("Format String", self, VALUE_TYPE.text, "")) + .setVisible(false); + + newOutput(4, nodeValue_Output("Bit Depth", self, VALUE_TYPE.integer, 8)) + .setVisible(false); + + newOutput(5, nodeValue_Output("Channels", self, VALUE_TYPE.integer, 4)) + .setVisible(false); setDimension(96, 48); - static update = function(frame = CURRENT_FRAME) { - var _insurf = getInputData(0); - if(is_array(_insurf)) { - var len = array_length(_insurf); - var _dim = array_create(len); - - for( var i = 0; i < len; i++ ) { - _dim[i][0] = surface_get_width_safe(_insurf[i]); - _dim[i][1] = surface_get_height_safe(_insurf[i]); - } - - outputs[0].setValue(_dim); - outputs[1].setValue(len); - return; - } + static processData = function(_outData, _data, _output_index, _array_index = 0) { + var _surf = _data[0]; + if(!is_surface(_surf)) return _outData; - if(!_insurf || !surface_exists(_insurf)) return; + var _dim = surface_get_dimension(_surf); + _outData[0] = _dim; + _outData[1] = _dim[0]; + _outData[2] = _dim[1]; - outputs[0].setValue([ surface_get_width_safe(_insurf), surface_get_height_safe(_insurf) ]); + var _frm = surface_get_format(_surf); + _outData[3] = surface_format_string(_frm); + _outData[4] = surface_format_get_depth(_frm); + _outData[5] = surface_format_get_channel(_frm); + + return _outData; } } \ No newline at end of file diff --git a/scripts/string_functions/string_functions.gml b/scripts/string_functions/string_functions.gml index a576067d1..bf7838f79 100644 --- a/scripts/string_functions/string_functions.gml +++ b/scripts/string_functions/string_functions.gml @@ -133,47 +133,48 @@ function string_partial_match(str, key) { return -9999; } -function string_partial_match_res(str, key, keys) { +function string_partial_match_res(str, key, keys = []) { if(str == key) return [ 9999, array_create(string_length(str) + 1, 1) ]; var lenn = string_length(str); var lenm = string_length(key); var runm = 1; - var _minmat = -lenn * lenm; + var _matchw = -lenn * lenm; var _matRng = array_create(string_length(str) + 1, 0); var _mated = array_create(string_length(str) + 1, 0); + var runn = 1; + var runC = 0; - while(runm <= lenm) { + repeat(lenm) { var m = string_char_at(key, runm); - var runn = 1; var matc = -1; - while(runn <= lenn) { + var matW = 0; + + repeat(lenn) { var n = string_char_at(str, runn); if(_mated[runn] == 0 && m == n) { matc = runn; - _minmat += lenn - abs(runm - runn); - - if(runn > 1 && string_char_at(str, runn - 1) == " ") - _minmat += 2; + _matchw += lenn - matW + (matW == 0) * runC * 5; _mated[runn] = 1; _matRng[runn] = 1; + + runC = matW == 0? runC + 1 : 0; + if(++runn > lenn) runn = 1; break; } - runn++; - } - - if(matc == -1) { - _minmat = -9999; - break; + + matW++; + if(++runn > lenn) runn = 1; } + if(matc == -1) { _matchw = -9999; break; } runm++ } - return [ _minmat, _matRng ]; + return [ _matchw, _matRng ]; } function __string_partial_match_res(str, key, keys) { diff --git a/scripts/surface_functions/surface_functions.gml b/scripts/surface_functions/surface_functions.gml index 8200f16f9..c4e2128bb 100644 --- a/scripts/surface_functions/surface_functions.gml +++ b/scripts/surface_functions/surface_functions.gml @@ -537,6 +537,20 @@ function surface_reset_target_override() { __surface_reset_target(); winwin_draw return 1; } + function surface_format_get_depth(format) { + switch(format) { + case surface_rgba4unorm : return 4; break; + case surface_rgba8unorm : return 8; break; + case surface_rgba16float : return 16; break + case surface_rgba32float : return 32; break; + + case surface_r8unorm : return 8; break + case surface_r16float : return 16; break + case surface_r32float : return 32; break; + } + return 1; + } + function surface_format_get_bytes(format) { switch(format) { case surface_rgba4unorm : return 4 * 0.5; break;