From 4567c6d89acfe7a19ad3931cd2d75bbc1697c863 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sun, 9 Jun 2024 19:02:37 +0700 Subject: [PATCH] 1.17.3.001 --- PixelComposer.resource_order | 1 + PixelComposer.yyp | 1 + objects/o_dialog_add_node/Create_0.gml | 26 ++++----- scripts/d3d_scene/d3d_scene.gml | 6 +- scripts/globals/globals.gml | 2 +- .../node_pixel_sampler/node_checkerboard.yy | 12 ++++ .../node_pixel_sampler/node_pixel_sampler.gml | 58 +++++++++++++++++++ .../node_pixel_sampler/node_pixel_sampler.yy | 13 +++++ scripts/node_pixel_sampler/node_stripe.yy | 12 ++++ .../node_vector_split/node_vector_split.gml | 22 ++++--- 10 files changed, 131 insertions(+), 22 deletions(-) create mode 100644 scripts/node_pixel_sampler/node_checkerboard.yy create mode 100644 scripts/node_pixel_sampler/node_pixel_sampler.gml create mode 100644 scripts/node_pixel_sampler/node_pixel_sampler.yy create mode 100644 scripts/node_pixel_sampler/node_stripe.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 6f1130757..575ab417a 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -945,6 +945,7 @@ {"name":"node_pin","order":2,"path":"scripts/node_pin/node_pin.yy",}, {"name":"node_pixel_builder","order":4,"path":"scripts/node_pixel_builder/node_pixel_builder.yy",}, {"name":"node_pixel_cloud","order":20,"path":"scripts/node_pixel_cloud/node_pixel_cloud.yy",}, + {"name":"node_pixel_sampler","order":22,"path":"scripts/node_pixel_sampler/node_pixel_sampler.yy",}, {"name":"node_pixel_sort","order":12,"path":"scripts/node_pixel_sort/node_pixel_sort.yy",}, {"name":"node_plot_linear","order":5,"path":"scripts/node_plot_linear/node_plot_linear.yy",}, {"name":"node_polar","order":4,"path":"scripts/node_polar/node_polar.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index ac2e1def1..d01e5788c 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1388,6 +1388,7 @@ {"id":{"name":"node_pin","path":"scripts/node_pin/node_pin.yy",},}, {"id":{"name":"node_pixel_builder","path":"scripts/node_pixel_builder/node_pixel_builder.yy",},}, {"id":{"name":"node_pixel_cloud","path":"scripts/node_pixel_cloud/node_pixel_cloud.yy",},}, + {"id":{"name":"node_pixel_sampler","path":"scripts/node_pixel_sampler/node_pixel_sampler.yy",},}, {"id":{"name":"node_pixel_sort","path":"scripts/node_pixel_sort/node_pixel_sort.yy",},}, {"id":{"name":"node_plot_linear","path":"scripts/node_plot_linear/node_plot_linear.yy",},}, {"id":{"name":"node_polar","path":"scripts/node_polar/node_polar.yy",},}, diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 29e2b6781..18900e7ce 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -179,42 +179,42 @@ event_inherited(); _outputs = res[$ _node.outputNode].outputs; } else { var _new_list = APPEND(_node.path); + if(_new_list == noone) return; + _inputs = ds_list_create(); _outputs = ds_list_create(); var tx = 99999; var ty = 99999; - for( var i = 0; i < ds_list_size(_new_list); i++ ) { - tx = min(tx, _new_list[| i].x); - ty = min(tx, _new_list[| i].y); + for( var i = 0; i < array_length(_new_list); i++ ) { + tx = min(tx, _new_list[i].x); + ty = min(tx, _new_list[i].y); - if(is_instanceof(context, Node_Collection_Inline) && !is_instanceof(_new_list[| i], Node_Collection_Inline)) - context.addNode(_new_list[| i]); + if(is_instanceof(context, Node_Collection_Inline) && !is_instanceof(_new_list[i], Node_Collection_Inline)) + context.addNode(_new_list[i]); } var shx = tx - node_target_x; var shy = ty - node_target_y; - for( var i = 0; i < ds_list_size(_new_list); i++ ) { - _new_list[| i].x -= shx; - _new_list[| i].y -= shy; + for( var i = 0; i < array_length(_new_list); i++ ) { + _new_list[i].x -= shx; + _new_list[i].y -= shy; } - for( var i = 0; i < ds_list_size(_new_list); i++ ) { - var _in = _new_list[| i].inputs; + for( var i = 0; i < array_length(_new_list); i++ ) { + var _in = _new_list[i].inputs; for( var j = 0; j < ds_list_size(_in); j++ ) { if(_in[| j].value_from == noone) ds_list_add(_inputs, _in[| j]); } - var _ot = _new_list[| i].outputs; + var _ot = _new_list[i].outputs; for( var j = 0; j < ds_list_size(_ot); j++ ) { if(array_empty(_ot[| j].value_to)) ds_list_add(_outputs, _ot[| j]); } } - - ds_list_destroy(_new_list); } //try to connect diff --git a/scripts/d3d_scene/d3d_scene.gml b/scripts/d3d_scene/d3d_scene.gml index e35efc3ad..1d5cbbe18 100644 --- a/scripts/d3d_scene/d3d_scene.gml +++ b/scripts/d3d_scene/d3d_scene.gml @@ -177,7 +177,10 @@ function __3dScene(camera, name = "New scene") constructor { } #endregion static ssaoPass = function(deferData) { #region - if(!ssao_enabled) return; + if(!ssao_enabled) { + surface_free(deferData.ssao); + return; + } var _sw = surface_get_width_safe(deferData.geometry_data[0]); var _sh = surface_get_height_safe(deferData.geometry_data[0]); @@ -196,6 +199,7 @@ function __3dScene(camera, name = "New scene") constructor { surface_reset_shader(); deferData.ssao = surface_verify(deferData.ssao, _sw, _sh); + surface_set_shader(deferData.ssao, sh_d3d_ssao_blur); shader_set_f("dimension", _sw, _sh); shader_set_surface("vNormal", deferData.geometry_data[2]); diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index fc42e02ff..22c2bdc1c 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -38,7 +38,7 @@ LATEST_VERSION = 11700; VERSION = 11730; SAVE_VERSION = 11700; - VERSION_STRING = "1.17.3.0"; + VERSION_STRING = "1.17.3.001"; BUILD_NUMBER = 11730; globalvar HOTKEYS, HOTKEY_CONTEXT; diff --git a/scripts/node_pixel_sampler/node_checkerboard.yy b/scripts/node_pixel_sampler/node_checkerboard.yy new file mode 100644 index 000000000..f65eb196c --- /dev/null +++ b/scripts/node_pixel_sampler/node_checkerboard.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, + "resourceVersion": "1.0", + "name": "node_checkerboard", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_pixel_sampler/node_pixel_sampler.gml b/scripts/node_pixel_sampler/node_pixel_sampler.gml new file mode 100644 index 000000000..693e9c02a --- /dev/null +++ b/scripts/node_pixel_sampler/node_pixel_sampler.gml @@ -0,0 +1,58 @@ +function Node_Pixel_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Pixel Sampler"; + + inputs[| 0] = nodeValue("Base Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); + + inputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, cola(c_white)); + + inputs[| 2] = nodeValue("Empty", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + + inputs[| 4] = nodeValue("Use mask dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ + ["Surfaces", false], 0, 3, 4, + ["Solid", false], 1, 2, + ]; + + attribute_surface_depth(); + + static processData = function(_outSurf, _data, _output_index, _array_index) { + var _dim = _data[0]; + var _col = _data[1]; + var _emp = _data[2]; + var _msk = _data[3]; + var _msd = _data[4]; + + var _maskUse = is_surface(_msk); + + inputs[| 4].setVisible(_maskUse); + if(_maskUse && _msd) _dim = [ surface_get_width_safe(_msk), surface_get_height_safe(_msk) ]; + + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); + + if(_emp) { + surface_set_target(_outSurf); + DRAW_CLEAR + surface_reset_target(); + return _outSurf; + } + + if(_maskUse) { + surface_set_shader(_outSurf, sh_solid); + draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], _col, _color_get_alpha(_col)); + surface_reset_shader(); + + return _outSurf; + } + + surface_set_target(_outSurf); + draw_clear(_col); + surface_reset_target(); + + return _outSurf; + } +} \ No newline at end of file diff --git a/scripts/node_pixel_sampler/node_pixel_sampler.yy b/scripts/node_pixel_sampler/node_pixel_sampler.yy new file mode 100644 index 000000000..b2402b507 --- /dev/null +++ b/scripts/node_pixel_sampler/node_pixel_sampler.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"", + "%Name":"node_pixel_sampler", + "isCompatibility":false, + "isDnD":false, + "name":"node_pixel_sampler", + "parent":{ + "name":"generator", + "path":"folders/nodes/data/generator.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/node_pixel_sampler/node_stripe.yy b/scripts/node_pixel_sampler/node_stripe.yy new file mode 100644 index 000000000..3c179d416 --- /dev/null +++ b/scripts/node_pixel_sampler/node_stripe.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, + "resourceVersion": "1.0", + "name": "node_stripe", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_vector_split/node_vector_split.gml b/scripts/node_vector_split/node_vector_split.gml index 5be41c65d..cb63d1295 100644 --- a/scripts/node_vector_split/node_vector_split.gml +++ b/scripts/node_vector_split/node_vector_split.gml @@ -7,6 +7,7 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) + .setArrayDynamic() .setVisible(true, true); outputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); @@ -14,8 +15,9 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro outputs[| 2] = nodeValue("z", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); outputs[| 3] = nodeValue("w", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - static step = function() { #region + static step = function() { if(inputs[| 0].value_from == noone) return; + var type = VALUE_TYPE.float; if(inputs[| 0].value_from.type == VALUE_TYPE.integer) type = VALUE_TYPE.integer; @@ -23,13 +25,19 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 0].setType(type); for( var i = 0; i < 4; i++ ) outputs[| i].setType(type); - } #endregion + } - static processData = function(_output, _data, _output_index, _array_index = 0) { #region - return array_safe_get_fast(_data[0], _output_index); - } #endregion + static processData = function(_output, _data, _output_index, _array_index = 0) { + var _arr = _data[0]; + if(!is_array(_arr)) return _arr; + + if(_output_index < array_length(_arr)) + return _arr[_output_index]; + + return 0; + } - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); var str = ""; for( var i = 0; i < 4; i++ ) @@ -39,5 +47,5 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var bbox = drawGetBbox(xx, yy, _s); var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); - } #endregion + } } #endregion \ No newline at end of file