diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index d97a19c82..f3a93636d 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -212,10 +212,9 @@ {"name":"value","order":14,"path":"folders/nodes/icons/value.yy",}, {"name":"VFX","order":16,"path":"folders/nodes/icons/VFX.yy",}, {"name":"values","order":2,"path":"folders/nodes/values.yy",}, - {"name":"3d","order":31,"path":"folders/nodes/values/types/3d.yy",}, - {"name":"colors","order":32,"path":"folders/nodes/values/types/colors.yy",}, - {"name":"numeric","order":30,"path":"folders/nodes/values/types/numeric.yy",}, - {"name":"object","order":33,"path":"folders/nodes/values/types/object.yy",}, + {"name":"3d","order":1,"path":"folders/nodes/values/types/3d.yy",}, + {"name":"colors","order":2,"path":"folders/nodes/values/types/colors.yy",}, + {"name":"object","order":3,"path":"folders/nodes/values/types/object.yy",}, {"name":"panels","order":333,"path":"folders/panels.yy",}, {"name":"what?","order":1,"path":"folders/panels/_others/what?.yy",}, {"name":"animation","order":1,"path":"folders/panels/animation.yy",}, @@ -1188,9 +1187,10 @@ {"name":"node_twirl","order":8,"path":"scripts/node_twirl/node_twirl.yy",}, {"name":"node_unicode","order":1,"path":"scripts/node_unicode/node_unicode.yy",}, {"name":"node_value_area","order":11,"path":"scripts/node_value_area/node_value_area.yy",}, + {"name":"node_value_atlas","order":7,"path":"scripts/node_value_atlas/node_value_atlas.yy",}, {"name":"node_value_audioBit","order":1,"path":"scripts/node_value_audioBit/node_value_audioBit.yy",}, {"name":"node_value_base","order":2,"path":"scripts/node_value_base/node_value_base.yy",}, - {"name":"node_value_bool","order":3,"path":"scripts/node_value_bool/node_value_bool.yy",}, + {"name":"node_value_bool","order":5,"path":"scripts/node_value_bool/node_value_bool.yy",}, {"name":"node_value_buffer","order":2,"path":"scripts/node_value_buffer/node_value_buffer.yy",}, {"name":"node_value_corner","order":17,"path":"scripts/node_value_corner/node_value_corner.yy",}, {"name":"node_value_curve","order":22,"path":"scripts/node_value_curve/node_value_curve.yy",}, @@ -1206,12 +1206,12 @@ {"name":"node_value_gradient","order":1,"path":"scripts/node_value_gradient/node_value_gradient.yy",}, {"name":"node_value_int","order":2,"path":"scripts/node_value_int/node_value_int.yy",}, {"name":"node_value_mesh","order":5,"path":"scripts/node_value_mesh/node_value_mesh.yy",}, - {"name":"node_value_output","order":1,"path":"scripts/node_value_output/node_value_output.yy",}, + {"name":"node_value_output","order":4,"path":"scripts/node_value_output/node_value_output.yy",}, {"name":"node_value_padding","order":16,"path":"scripts/node_value_padding/node_value_padding.yy",}, {"name":"node_value_palette","order":2,"path":"scripts/node_value_palette/node_value_palette.yy",}, {"name":"node_value_particle","order":4,"path":"scripts/node_value_particle/node_value_particle.yy",}, {"name":"node_value_path_anchor","order":18,"path":"scripts/node_value_path_anchor/node_value_path_anchor.yy",}, - {"name":"node_value_path","order":34,"path":"scripts/node_value_path/node_value_path.yy",}, + {"name":"node_value_path","order":10,"path":"scripts/node_value_path/node_value_path.yy",}, {"name":"node_value_pathnode","order":5,"path":"scripts/node_value_pathnode/node_value_pathnode.yy",}, {"name":"node_value_quarterion","order":19,"path":"scripts/node_value_quarterion/node_value_quarterion.yy",}, {"name":"node_value_range","order":3,"path":"scripts/node_value_range/node_value_range.yy",}, @@ -1221,11 +1221,11 @@ {"name":"node_value_sdf","order":6,"path":"scripts/node_value_sdf/node_value_sdf.yy",}, {"name":"node_value_slider_range","order":13,"path":"scripts/node_value_slider_range/node_value_slider_range.yy",}, {"name":"node_value_struct","order":7,"path":"scripts/node_value_struct/node_value_struct.yy",}, - {"name":"node_value_surface","order":9,"path":"scripts/node_value_surface/node_value_surface.yy",}, - {"name":"node_value_text","order":14,"path":"scripts/node_value_text/node_value_text.yy",}, + {"name":"node_value_surface","order":6,"path":"scripts/node_value_surface/node_value_surface.yy",}, + {"name":"node_value_text","order":8,"path":"scripts/node_value_text/node_value_text.yy",}, {"name":"node_value_tileset","order":9,"path":"scripts/node_value_tileset/node_value_tileset.yy",}, {"name":"node_value_toggle","order":21,"path":"scripts/node_value_toggle/node_value_toggle.yy",}, - {"name":"node_value_trigger","order":19,"path":"scripts/node_value_trigger/node_value_trigger.yy",}, + {"name":"node_value_trigger","order":9,"path":"scripts/node_value_trigger/node_value_trigger.yy",}, {"name":"node_value_types","order":3,"path":"scripts/node_value_types/node_value_types.yy",}, {"name":"node_value_validators","order":4,"path":"scripts/node_value_validators/node_value_validators.yy",}, {"name":"node_value_vec2_range","order":14,"path":"scripts/node_value_vec2_range/node_value_vec2_range.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index b0ea71889..c9c91f4bf 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1737,6 +1737,7 @@ {"id":{"name":"node_unicode","path":"scripts/node_unicode/node_unicode.yy",},}, {"id":{"name":"node_value_area","path":"scripts/node_value_area/node_value_area.yy",},}, {"id":{"name":"node_value_armature","path":"scripts/node_value_armature/node_value_armature.yy",},}, + {"id":{"name":"node_value_atlas","path":"scripts/node_value_atlas/node_value_atlas.yy",},}, {"id":{"name":"node_value_audioBit","path":"scripts/node_value_audioBit/node_value_audioBit.yy",},}, {"id":{"name":"node_value_base","path":"scripts/node_value_base/node_value_base.yy",},}, {"id":{"name":"node_value_bool","path":"scripts/node_value_bool/node_value_bool.yy",},}, diff --git a/PixelComposer.yyp.css b/PixelComposer.yyp.css index 2f6617a34..6e34f5618 100644 --- a/PixelComposer.yyp.css +++ b/PixelComposer.yyp.css @@ -105,41 +105,41 @@ background-blend-mode: normal !important; } -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.item[data-kind="shader"], -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"], -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.dir { +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.item[data-kind="shader"], +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"], +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.dir { padding-top: 0px; margin-left: 208px; margin-top: -20px; /* width: 32px; */ } -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.item[data-kind="shader"]::before, -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"]::before, -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.dir::before { +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.item[data-kind="shader"]::before, +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"]::before, +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.dir::before { margin-right: 4px; } -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.item[data-kind="shader"] > span, -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"] > span, -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.dir > div.header > span { +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.item[data-kind="shader"] > span, +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"] > span, +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.dir > div.header > span { color: #9F9FB500; } -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.dir > div.items { +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.dir > div.items { margin-left: -208px; } -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.item[data-kind="shader"]:hover, -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"]:hover, -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.dir div.header:hover { +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.item[data-kind="shader"]:hover, +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-ident^="node_3d"] + div.item[data-ident^="d3d"]:hover, +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.dir div.header:hover { background-color: transparent !important; } -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.item[data-kind="shader"]:hover::before { +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.item[data-kind="shader"]:hover::before { background-image: url(gmedit/tree_shader_hover.png); } -.treeview .dir[data-rel-path="folders/nodes/"] div.item[data-kind="script"] + div.dir div.header:hover::before { +.treeview .dir[data-rel-path="folders/nodes/data/"] div.item[data-kind="script"] + div.dir div.header:hover::before { background-image: url(gmedit/treeview_hover.png?r4); } diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 76d4ae855..c74fa7e23 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -201,7 +201,6 @@ event_inherited(); #endregion #region build - function buildNode(_node, _param = {}) { instance_destroy(); instance_destroy(o_dialog_menubox); @@ -1180,14 +1179,18 @@ event_inherited(); if(i % 2) draw_sprite_stretched_add(THEME.node_bg, 0, pd, yy, list_width - pd * 2, list_height, c_white, 0.1); - var _minput = _hover && (MOUSE_MOVED || mouse_release(mb_any)); - if(_minput && point_in_rectangle(_m[0], _m[1], pd + ui(16 * 2), yy, list_width, yy + list_height - 1)) { + var _minput = _hover && (MOUSE_MOVED || mouse_release(mb_any)); + var _mouseOn = point_in_rectangle(_m[0], _m[1], pd + ui(16 * 2), yy, list_width, yy + list_height - 1); + + if(_mouseOn) { search_pane.hover_content = true; - node_selecting = i; - node_icon = _node.spr; node_icon_x = search_pane.x + pd + list_height / 2 + ui(32); node_icon_y = search_pane.y + yy + list_height / 2; + } + + if(_minput && _mouseOn) { + node_selecting = i; if(sFOCUS) { if(mouse_release(mb_left)) diff --git a/scripts/buttonAnchor/buttonAnchor.gml b/scripts/buttonAnchor/buttonAnchor.gml index 4120e5aba..f86ac50b5 100644 --- a/scripts/buttonAnchor/buttonAnchor.gml +++ b/scripts/buttonAnchor/buttonAnchor.gml @@ -1,13 +1,25 @@ -function buttonAnchor(_onClick) : widget() constructor { +function buttonAnchor(_input = noone, _onClick = noone) : widget() constructor { onClick = _onClick; + input = _input; index = 4; click = true; center = true; context = noone; - static drawParam = function(params) { - return draw(params.x, params.y, params.w, params.h, params.m); + static drawParam = function(params) { return draw(params.x, params.y, params.w, params.h, params.m); } + + static trigger = function(_index) { + if(input == noone) { + onClick(_index); + return; + } + + switch(_index) { + case 0 : input.setValue([ 0.0, 0.0 ]); break; case 1 : input.setValue([ 0.5, 0.0 ]); break; case 2 : input.setValue([ 1.0, 0.0 ]); break; + case 3 : input.setValue([ 0.0, 0.5 ]); break; case 4 : input.setValue([ 0.5, 0.5 ]); break; case 5 : input.setValue([ 1.0, 0.5 ]); break; + case 6 : input.setValue([ 0.0, 1.0 ]); break; case 7 : input.setValue([ 0.5, 1.0 ]); break; case 8 : input.setValue([ 1.0, 1.0 ]); break; + } } static draw = function(_x, _y, _w, _h, _m, spr = THEME.button_def, blend = c_white) { @@ -39,8 +51,7 @@ function buttonAnchor(_onClick) : widget() constructor { if(hov) { hovering = true; - if(mouse_click(mb_left, active)) - onClick(_in); + if(mouse_click(mb_left, active)) trigger(_in) } } @@ -49,9 +60,5 @@ function buttonAnchor(_onClick) : widget() constructor { return _h; } - static clone = function() { #region - var cln = new buttonAnchor(onClick); - - return cln; - } #endregion + static clone = function() /*=>*/ {return new buttonAnchor(input, onClick)} } \ No newline at end of file diff --git a/scripts/node_atlas_draw/node_atlas_draw.gml b/scripts/node_atlas_draw/node_atlas_draw.gml index 5a7bcc49a..5b0e8d015 100644 --- a/scripts/node_atlas_draw/node_atlas_draw.gml +++ b/scripts/node_atlas_draw/node_atlas_draw.gml @@ -1,30 +1,25 @@ -function Node_Atlas_Draw(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { +function Node_Atlas_Draw(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Draw Atlas"; previewable = true; newInput(0, nodeValue_Dimension(self)); - newInput(1, nodeValue_Surface("Atlas", self)) + newInput(1, nodeValue_Atlas("Atlas", self)) + .setArrayDepth(1) .setVisible(true, true); newOutput(0, nodeValue_Output("Surface", self, VALUE_TYPE.surface, noone)); attribute_interpolation(true); - static update = function(frame = CURRENT_FRAME) { - var dim = getInputData(0); - var atl = getInputData(1); - - if(atl == noone) return; - if(is_array(atl) && array_length(atl) == 0) return; + static processData = function(_outSurf, _data, _output_index, _array_index = 0) { + var dim = _data[0]; + var atl = _data[1]; + //_outSurf = surface_verify(_outSurf, dim[0], dim[1]); if(!is_array(atl)) atl = [ atl ]; - var outSurf = outputs[0].getValue(); - outSurf = surface_verify(outSurf, dim[0], dim[1]); - outputs[0].setValue(outSurf); - - surface_set_shader(outSurf,,, BLEND.alpha); + surface_set_shader(_outSurf); for( var i = 0, n = array_length(atl); i < n; i++ ) { var _a = atl[i]; if(!is_instanceof(_a, Atlas)) continue; @@ -33,5 +28,7 @@ function Node_Atlas_Draw(_x, _y, _group = noone) : Node(_x, _y, _group) construc _a.draw(); } surface_reset_shader(); + + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_atlas_get/node_atlas_get.gml b/scripts/node_atlas_get/node_atlas_get.gml index 2cf35c4ce..16ff59016 100644 --- a/scripts/node_atlas_get/node_atlas_get.gml +++ b/scripts/node_atlas_get/node_atlas_get.gml @@ -1,8 +1,10 @@ -function Node_Atlas_Get(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { +function Node_Atlas_Get(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Atlas Get"; previewable = true; + dimension_index = -1; + setDimension(96, 48); - newInput(0, nodeValue_Surface("Atlas", self)) + newInput(0, nodeValue_Atlas("Atlas", self)) .setVisible(true, true); newOutput(0, nodeValue_Output("Surface", self, VALUE_TYPE.surface, [])) @@ -25,39 +27,23 @@ function Node_Atlas_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct newOutput(5, nodeValue_Output("Alpha", self, VALUE_TYPE.float, [])) .setArrayDepth(1); - static update = function(frame = CURRENT_FRAME) { - var atl = getInputData(0); + static processData = function(_outData, _data, _output_index, _array_index = 0) { + var atl = _data[0]; - if(atl == noone) return; + if(!is(atl, Atlas)) return _outData; + + _outData[0] = atl.getSurface(); + _outData[1] = [ atl.x, atl.y ]; + _outData[2] = atl.rotation; + _outData[3] = [ atl.sx, atl.sy ]; + _outData[4] = atl.blend; + _outData[5] = atl.alpha; - if(!is_array(atl)) atl = [ atl ]; - if(array_empty(atl)) return; - - var n = array_length(atl); - var surf = array_create(n); - var posi = array_create(n); - var rota = array_create(n); - var scal = array_create(n); - var blns = array_create(n); - var alph = array_create(n); - - for( var i = 0; i < n; i++ ) { - var _at = atl[i]; - if(!is_instanceof(_at, SurfaceAtlas)) continue; - - surf[i] = _at.getSurface(); - posi[i] = [ _at.x, _at.y ]; - rota[i] = _at.rotation; - scal[i] = [ _at.sx, _at.sy ]; - blns[i] = _at.blend; - alph[i] = _at.alpha; - } - - outputs[0].setValue(surf); - outputs[1].setValue(posi); - outputs[2].setValue(rota); - outputs[3].setValue(scal); - outputs[4].setValue(blns); - outputs[5].setValue(alph); + return _outData; + } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + var bbox = drawGetBbox(xx, yy, _s); + draw_sprite_bbox_uniform(s_node_atlas_get, 0, bbox); } } \ No newline at end of file diff --git a/scripts/node_atlas_set/node_atlas_set.gml b/scripts/node_atlas_set/node_atlas_set.gml index 3d529c1c2..d9de77ba5 100644 --- a/scripts/node_atlas_set/node_atlas_set.gml +++ b/scripts/node_atlas_set/node_atlas_set.gml @@ -1,120 +1,143 @@ -function Node_Atlas_Set(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { +function Node_Atlas_Set(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Atlas Set"; previewable = true; + dimension_index = -1; + setDimension(96, 48); - newInput(0, nodeValue_Surface("Atlas", self)) + newInput(0, nodeValue_Atlas("Atlas", self)) .setVisible(true, true); - newInput(1, nodeValue_Surface("Surface", self)); + newInput(1, nodeValue_Bool("Set Surface", self, false)); + newInput(2, nodeValue_Surface("Surface", self)); - newInput(2, nodeValue_Vec2("Position", self, [ 0, 0 ])); + newInput(3, nodeValue_Bool("Set Position", self, false)); + newInput(4, nodeValue_Enum_Button("Mode", self, 0, [ "Absolute", "Relative" ])).setInternalName("Position mode"); + newInput(5, nodeValue_Vec2("Position", self, [ 0, 0 ])); - newInput(3, nodeValue_Rotation("Rotation", self, 0)); + newInput(6, nodeValue_Bool("Set Rotation", self, false)); + newInput(7, nodeValue_Enum_Button("Mode", self, 0, [ "Absolute", "Relative" ])).setInternalName("Rotation mode"); + newInput(8, nodeValue_Rotation("Rotation", self, 0)); + newInput(9, nodeValue_Bool("Recalculate Position", self, true)); - newInput(4, nodeValue_Vec2("Scale", self, [ 0, 0 ])); + newInput(10, nodeValue_Bool("Set Scale", self, false)); + newInput(11, nodeValue_Enum_Button("Mode", self, 0, [ "Absolute", "Additive", "Multiplicative" ])).setInternalName("Scale mode"); + newInput(12, nodeValue_Vec2("Scale", self, [ 1, 1 ])); - newInput(5, nodeValue_Color("Blend", self, cola(c_white))); + newInput(13, nodeValue_Bool("Set Blending", self, false)); + newInput(14, nodeValue_Enum_Button("Mode", self, 0, [ "Absolute", "Multiplicative" ])).setInternalName("Blend mode"); + newInput(15, nodeValue_Color("Blend", self, cola(c_white))); - newInput(6, nodeValue_Float("Alpha", self, 1)); - - newInput(7, nodeValue_Bool("Recalculate Position", self, true)); + newInput(16, nodeValue_Bool("Set Alpha", self, false)); + newInput(17, nodeValue_Enum_Button("Mode", self, 0, [ "Absolute", "Additive", "Multiplicative" ])).setInternalName("Alpha mode"); + newInput(18, nodeValue_Float("Alpha", self, 1)); + newInput(19, nodeValue_Vec2("Anchor", self, [ 0.5, 0.5 ])); + inputs[19].setDisplay(VALUE_DISPLAY.vector, { side_button : new buttonAnchor(inputs[19]) }); + newOutput(0, nodeValue_Output("Atlas", self, VALUE_TYPE.atlas, noone)); - input_display_list = [ - 0, 1, 2, 3, 7, 4, 5, 6, + input_display_list = [ 0, + [ "Surface", false, 1], 2, + [ "Position", false, 3], 4, 5, + [ "Rotation", false, 6], 7, 8, 9, + [ "Scale", false, 10], 11, 12, 19, + [ "Blend", false, 13], 14, 15, + [ "Alpha", false, 16], 17, 18, ]; - static update = function(frame = CURRENT_FRAME) { - var atl = getInputData(0); + static processData = function(_outData, _data, _output_index, _array_index = 0) { + var atl = _data[0]; + if(!is(atl, Atlas)) return _outData; - if(atl == noone) return; - - if(!is_array(atl)) atl = [ atl ]; - if(array_empty(atl)) return; - - var _rot = getInputData(7); - - var use = array_create(6); - var len = array_create(6); - var val = array_create(6); - - for( var i = 0; i < 7; i++ ) { - val[i] = getInputData(i); - len[i] = is_array(val[i])? array_length(val[i]) : 0; - use[i] = inputs[i].value_from != noone; - } - - var n = array_length(atl); var natl = []; - var _ind = 0; - var _at, _newAtl, _surf, _val; - for( var i = 0; i < n; i++ ) { - _at = atl[i]; - if(!is_instanceof(_at, SurfaceAtlas)) continue; + var _newAtl = atl.clone(); + var _surf = atl.surface.get(); + var _dim = surface_get_dimension(_surf); + + if(_data[1]) _newAtl.setSurface(_data[2]); + + if(_data[3]) { + var _pmode = _data[4]; + var _pos = _data[5]; - _newAtl = _at.clone(); - _surf = _at.surface.get(); - - if(use[1] && (len[1] == 0 || i < len[1])) { - _val = len[1] == 0? val[1] : val[1][i]; - - _newAtl.setSurface(_val); - } - - if(use[2] && (len[2] == 0 || i < len[2])) { - _val = len[2] == 0? val[2] : val[2][i]; - - _newAtl.x = array_safe_get_fast(_val, 0); - _newAtl.y = array_safe_get_fast(_val, 1); - } - - if(use[3] && (len[3] == 0 || i < len[3])) { - _val = len[3] == 0? val[3] : val[3][i]; - - var _or = _newAtl.rotation; - var _nr = _val; - - _newAtl.rotation = _nr; - - if(_rot) { - var _sw = surface_get_width_safe(_surf) * _newAtl.sx; - var _sh = surface_get_height_safe(_surf) * _newAtl.sy; - - var p0 = point_rotate(0, 0, _sw / 2, _sh / 2, -_or); - var p1 = point_rotate(0, 0, _sw / 2, _sh / 2, _nr); - - _newAtl.x = _newAtl.x - p0[1] + p1[0]; - _newAtl.y = _newAtl.y - p0[0] + p1[1]; - } - - } - - if(use[4] && (len[4] == 0 || i < len[4])) { - _val = len[4] == 0? val[4] : val[4][i]; - - _newAtl.sx = array_safe_get_fast(_val, 0, 1); - _newAtl.sy = array_safe_get_fast(_val, 1, 1); - } - - if(use[5] && (len[5] == 0 || i < len[5])) { - _val = len[5] == 0? val[5] : val[5][i]; - - _newAtl.blend = _val; - } - - if(use[6] && (len[6] == 0 || i < len[6])) { - _val = len[6] == 0? val[6] : val[6][i]; - - _newAtl.alpha = _val; - } - - natl[_ind] = _newAtl; - _ind++; + _newAtl.x = _pmode? _newAtl.x + _pos[0] : _pos[0]; + _newAtl.y = _pmode? _newAtl.y + _pos[1] : _pos[1]; } - array_resize(natl, _ind); - outputs[0].setValue(natl); + if(_data[6]) { + var _rmode = _data[7]; + var _or = _newAtl.rotation; + var _nr = _rmode? _or + _data[8] : _data[8]; + + _newAtl.rotation = _nr; + + if(_data[9]) { + var _sw = _dim[0] * _newAtl.sx; + var _sh = _dim[1] * _newAtl.sy; + + var p0 = point_rotate(0, 0, _sw / 2, _sh / 2, -_or); + var p1 = point_rotate(0, 0, _sw / 2, _sh / 2, _nr); + + _newAtl.x = _newAtl.x - p0[1] + p1[0]; + _newAtl.y = _newAtl.y - p0[0] + p1[1]; + } + + } + + if(_data[10]) { + var _smode = _data[11]; + var _sca = _data[12]; + var _anc = _data[19]; + + var _ox = _newAtl.sx; + var _oy = _newAtl.sy; + + switch(_smode) { + case 0 : + _newAtl.sx = _sca[0]; + _newAtl.sy = _sca[1]; + break; + + case 1 : + _newAtl.sx += _sca[0]; + _newAtl.sy += _sca[1]; + break; + + case 2 : + _newAtl.sx *= _sca[0]; + _newAtl.sy *= _sca[1]; + break; + } + + _newAtl.x -= (_newAtl.sx - _ox) * _dim[0] * _anc[0]; + _newAtl.y -= (_newAtl.sy - _oy) * _dim[1] * _anc[1]; + } + + if(_data[13]) { + var _bmode = _data[14]; + var _blend = _data[15]; + + _newAtl.blend = _bmode? colorMultiply(_newAtl.blend, _blend) : _blend; + } + + if(_data[16]) { + var _amode = _data[17]; + var _alp = _data[18]; + + switch(_amode) { + case 0 : _newAtl.alpha = _alp; break; + case 1 : _newAtl.alpha += _alp; break; + case 2 : _newAtl.alpha *= _alp; break; + } + } + + + return _newAtl; + } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + var bbox = drawGetBbox(xx, yy, _s); + draw_sprite_bbox_uniform(s_node_atlas_set, 0, bbox); } } \ No newline at end of file diff --git a/scripts/node_atlas_to_struct/node_atlas_to_struct.gml b/scripts/node_atlas_to_struct/node_atlas_to_struct.gml index d7a367795..0652d0f08 100644 --- a/scripts/node_atlas_to_struct/node_atlas_to_struct.gml +++ b/scripts/node_atlas_to_struct/node_atlas_to_struct.gml @@ -1,40 +1,32 @@ -function Node_Atlas_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { +function Node_Atlas_Struct(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Atlas to Struct"; setDimension(96, 48); - newInput(0, nodeValue_Surface("Atlas", self)) + newInput(0, nodeValue_Atlas("Atlas", self)) .setVisible(true, true); newOutput(0, nodeValue_Output("Struct", self, VALUE_TYPE.struct, [])) .setArrayDepth(1); - static update = function(frame = CURRENT_FRAME) { - var atl = getInputData(0); + static processData = function(_outData, _data, _output_index, _array_index = 0) { + var atl = _data[0]; + if(!is(atl, Atlas)) return _outData; - if(atl == noone) return; - - if(!is_array(atl)) atl = [ atl ]; - if(array_empty(atl)) return; - - var n = array_length(atl); - var str = []; - var ind = 0; - - for( var i = 0; i < n; i++ ) { - var _at = atl[i]; - if(!is_instanceof(_at, SurfaceAtlas)) continue; - - str[ind++] = { - surface: _at.surface, - size: surface_get_dimension(_at.getSurface()), - position: [ _at.x, _at.y ], - rotation: _at.rotation, - scale: [ _at.sx, _at.sy ], - blend: _at.blend, - alpha: _at.alpha, - } + var str = { + surface : atl.surface, + size : surface_get_dimension(atl.getSurface()), + position : [ atl.x, atl.y ], + rotation : atl.rotation, + scale : [ atl.sx, atl.sy ], + blend : atl.blend, + alpha : atl.alpha, } - outputs[0].setValue(str); + return str; + } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + var bbox = drawGetBbox(xx, yy, _s); + draw_sprite_bbox_uniform(s_node_atlas_struct, 0, bbox); } } \ No newline at end of file diff --git a/scripts/node_outline/node_outline.gml b/scripts/node_outline/node_outline.gml index 6a055aa97..e2192ea23 100644 --- a/scripts/node_outline/node_outline.gml +++ b/scripts/node_outline/node_outline.gml @@ -5,7 +5,7 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c attributes.filter = array_create(9, 1); filtering_vl = false; - filter_button = new buttonAnchor(function(ind) { + filter_button = new buttonAnchor(noone, function(ind) { if(mouse_press(mb_left)) filtering_vl = !attributes.filter[ind]; attributes.filter[ind] = filtering_vl; diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index d02fdca5e..a6168dc77 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -224,7 +224,6 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct static processBatchOutput = function() { var _is = array_length(inputs); var _os = array_length(outputs); - var _dep = attrDepth(); var data; var _out = array_create(_os); @@ -247,7 +246,7 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct for(var i = 0; i < _os; i++) { if(outputs[i].type != VALUE_TYPE.surface) continue; - _out[i] = surface_verify(_out[i], _dim[0], _dim[1], _dep); + _out[i] = surface_verify(_out[i], _dim[0], _dim[1], attrDepth()); } } @@ -284,15 +283,16 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct if(l == 0 || l == preview_index) current_data = _inputs; var _outa = array_create(_os); - var _dim = getDimension(l); - for(var i = 0; i < _os; i++) { - _outa[i] = array_safe_get(_out[i], l); - - if(dimension_index == -1) continue; - if(outputs[i].type != VALUE_TYPE.surface) continue; - - _outa[i] = surface_verify(_outa[i], _dim[0], _dim[1], _dep); + if(dimension_index > -1) { + var _dim = getDimension(l); + for(var i = 0; i < _os; i++) { + _outa[i] = array_safe_get(_out[i], l); + + if(outputs[i].type != VALUE_TYPE.surface) continue; + + _outa[i] = surface_verify(_outa[i], _dim[0], _dim[1], attrDepth()); + } } if(_os == 1) { diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index e1b41b94d..d6eec4cc4 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -61,11 +61,9 @@ function NodeObject(_name, _spr, _node, _tooltip = "") constructor { static setTags = function(_tags) { tags = _tags; return self; } static setSpr = function(_spr) { spr = _spr; return self; } static setTooltip = function(_tool) { tooltip = _tool; return self; } - static setBuild = function(_fn) { createFn = _fn; return self; } + static setBuild = function(_fn) { createFn = _fn; return self; } static setParam = function(_par) { createParam = _par; return self; } - // static setIO = function(t) { for(var i = 0; i < argument_count; i++) input_type_mask |= value_bit(argument[i]); return self; } - // static setIO = function(t) { for(var i = 0; i < argument_count; i++) output_type_mask |= value_bit(argument[i]); return self; } static setIO = function(t) { for(var i = 0; i < argument_count; i++) { input_type_mask |= value_bit(argument[i]); output_type_mask |= value_bit(argument[i]); } return self; } static setVersion = function(version) { diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index 516f2c430..8042ff7cc 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -106,24 +106,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c newInput(39, nodeValue_Range("Shift radial", self, [ 0, 0 ])); - newInput(40, nodeValue_Vec2("Anchor", self, [ 0.5, 0.5 ])) - .setDisplay(VALUE_DISPLAY.vector, { - side_button : new buttonAnchor(function(ind) { - switch(ind) { - case 0 : inputs[40].setValue([ 0.0, 0.0 ]); break; - case 1 : inputs[40].setValue([ 0.5, 0.0 ]); break; - case 2 : inputs[40].setValue([ 1.0, 0.0 ]); break; - - case 3 : inputs[40].setValue([ 0.0, 0.5 ]); break; - case 4 : inputs[40].setValue([ 0.5, 0.5 ]); break; - case 5 : inputs[40].setValue([ 1.0, 0.5 ]); break; - - case 6 : inputs[40].setValue([ 0.0, 1.0 ]); break; - case 7 : inputs[40].setValue([ 0.5, 1.0 ]); break; - case 8 : inputs[40].setValue([ 1.0, 1.0 ]); break; - } - }) - }); + newInput(40, nodeValue_Vec2("Anchor", self, [ 0.5, 0.5 ])); + inputs[40].setDisplay(VALUE_DISPLAY.vector, { side_button : new buttonAnchor(inputs[40]) }); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/node_seperate_shape/node_seperate_shape.gml b/scripts/node_seperate_shape/node_seperate_shape.gml index 7b8a4acd6..0b1529c96 100644 --- a/scripts/node_seperate_shape/node_seperate_shape.gml +++ b/scripts/node_seperate_shape/node_seperate_shape.gml @@ -19,7 +19,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons newInput(5, nodeValue_Enum_Button("Mode", self, 0 , [ "Greyscale", "Alpha" ] )) - newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); + newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(1, nodeValue_Output("Atlas", self, VALUE_TYPE.atlas, [])); diff --git a/scripts/node_terminal_trigger/node_terminal_trigger.gml b/scripts/node_terminal_trigger/node_terminal_trigger.gml index 7446f23b7..3fe6965b0 100644 --- a/scripts/node_terminal_trigger/node_terminal_trigger.gml +++ b/scripts/node_terminal_trigger/node_terminal_trigger.gml @@ -8,7 +8,6 @@ function Node_Terminal_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) co static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { var bbox = drawGetBbox(xx, yy, _s); - - draw_sprite_bbox(s_node_terminal_trigger, 0, bbox); + draw_sprite_bbox_uniform(s_node_terminal_trigger, 0, bbox); } } \ No newline at end of file diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index 03ddfea66..3bdee2125 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -17,16 +17,8 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) newInput(2, nodeValue_Vec2("Position", self, [ 0.5, 0.5 ])) .setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference); - newInput(3, nodeValue_Vec2("Anchor", self, [ 0.5, 0.5 ])) - .setDisplay(VALUE_DISPLAY.vector, { - side_button : new buttonAnchor(function(ind) { - switch(ind) { - case 0 : inputs[3].setValue([ 0.0, 0.0 ]); break; case 1 : inputs[3].setValue([ 0.5, 0.0 ]); break; case 2 : inputs[3].setValue([ 1.0, 0.0 ]); break; - case 3 : inputs[3].setValue([ 0.0, 0.5 ]); break; case 4 : inputs[3].setValue([ 0.5, 0.5 ]); break; case 5 : inputs[3].setValue([ 1.0, 0.5 ]); break; - case 6 : inputs[3].setValue([ 0.0, 1.0 ]); break; case 7 : inputs[3].setValue([ 0.5, 1.0 ]); break; case 8 : inputs[3].setValue([ 1.0, 1.0 ]); break; - } - }) - }); + newInput(3, nodeValue_Vec2("Anchor", self, [ 0.5, 0.5 ])); + inputs[3].setDisplay(VALUE_DISPLAY.vector, { side_button : new buttonAnchor(inputs[3]) }); newInput(4, nodeValue_Bool("Relative anchor", self, true)); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 519d4e866..2cb940519 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -19,6 +19,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru #region ---- main ---- active = true; from = noone; + name = _name; node = _node; tags = VALUE_TAG.none; @@ -30,19 +31,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru forward = true; _initName = _name; - static updateName = function(_name) { - name = _name; - internalName = string_to_var(name); - name_custom = true; - } updateName(_name); - name_custom = false; - if(struct_has(node, "inputMap")) { - if(_connect == CONNECT_TYPE.input) node.inputMap[$ internalName] = self; - else if(_connect == CONNECT_TYPE.output) node.outputMap[$ internalName] = self; - } - tooltip = _tooltip; editWidget = noone; editWidgetRaw = noone; @@ -82,6 +72,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru onSetFrom = noone; onSetTo = noone; + #endregion #region ---- animation ---- @@ -129,11 +120,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru fullUpdate = false; attributes = {}; - if(_connect == CONNECT_TYPE.input) { - node.inputs_data[index] = _value; - node.input_value_map[$ internalName] = _value; - } - __curr_get_val = [ 0, 0 ]; validator = noone; #endregion @@ -243,6 +229,30 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru con_tag = 0; #endregion + #region ---- Init Fn --- + static setInternalName = function(_iname) { + internalName = string_to_var(_iname); + + if(is(node, Node)) { + if(connect_type == CONNECT_TYPE.input) node.inputMap[$ internalName] = self; + else if(connect_type == CONNECT_TYPE.output) node.outputMap[$ internalName] = self; + } + } + static updateName = function(_name) { + name = _name; + name_custom = true; + + setInternalName(name); + } + + updateName(_name); + + if(connect_type == CONNECT_TYPE.input) { + node.inputs_data[index] = _value; + node.input_value_map[$ internalName] = _value; + } + #endregion + ////- META static setDummy = function(get_node, _dummy_undo = -1, _dummy_redo = -1) { diff --git a/scripts/node_value_atlas/node_value_atlas.gml b/scripts/node_value_atlas/node_value_atlas.gml new file mode 100644 index 000000000..d644a6179 --- /dev/null +++ b/scripts/node_value_atlas/node_value_atlas.gml @@ -0,0 +1,20 @@ +function nodeValue_Atlas(_name, _node, _value = [], _tooltip = "") { return new __NodeValue_Atlas(_name, _node, _value, _tooltip); } + +function __NodeValue_Atlas(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, CONNECT_TYPE.input, VALUE_TYPE.atlas, _value, _tooltip) constructor { + + animable = false; + + /////============== GET ============= + + static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value + getValueRecursive(self.__curr_get_val, _time); + var val = __curr_get_val[0]; + var nod = __curr_get_val[1]; if(!is(nod, NodeValue)) return val; + + return val; + } + + static __getAnimValue = function(_time = CURRENT_FRAME) { return array_empty(animator.values)? noone : animator.processValue(animator.values[0].value); } + + static arrayLength = arrayLengthSimple; +} \ No newline at end of file diff --git a/scripts/node_value_atlas/node_value_atlas.yy b/scripts/node_value_atlas/node_value_atlas.yy new file mode 100644 index 000000000..cc843b83d --- /dev/null +++ b/scripts/node_value_atlas/node_value_atlas.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"node_value_atlas", + "isCompatibility":false, + "isDnD":false, + "name":"node_value_atlas", + "parent":{ + "name":"types", + "path":"folders/nodes/values/types.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/node_value_types/node_value_types.gml b/scripts/node_value_types/node_value_types.gml index 1ca2674d3..3c186deaf 100644 --- a/scripts/node_value_types/node_value_types.gml +++ b/scripts/node_value_types/node_value_types.gml @@ -258,6 +258,7 @@ function value_bit(i) { case VALUE_TYPE.boolean : return 1 << 3 | 1 << 1; case VALUE_TYPE.color : return 1 << 4; case VALUE_TYPE.gradient : return 1 << 25; + case VALUE_TYPE.atlas : case VALUE_TYPE.dynaSurface : case VALUE_TYPE.surface : return 1 << 5 | 1 << 23; case VALUE_TYPE.path : return 1 << 10;