From 14fab463f76da04144caa6ed04ed9581b7cb7341 Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Wed, 9 Aug 2023 11:52:57 +0200 Subject: [PATCH] Action nodes: Location tag --- datafiles/data/Actions.zip | Bin 1167763 -> 1167824 bytes .../data/Actions/Nodes/Armature Build.json | 1 + datafiles/data/Actions/Nodes/Follow Path.json | 1 + .../data/Actions/Nodes/Line from Path.json | 1 + objects/o_dialog_add_node/Create_0.gml | 3 ++ objects/o_dialog_add_node/Destroy_0.gml | 3 +- scripts/globals/globals.gml | 2 +- .../node_action_object/node_action_object.gml | 21 +++++++++ .../node_ase_file_read/node_ase_file_read.gml | 9 +++- .../node_palette_sort/node_palette_sort.gml | 43 +++++++++++++++--- scripts/panel_graph/panel_graph.gml | 8 ++-- 11 files changed, 76 insertions(+), 16 deletions(-) diff --git a/datafiles/data/Actions.zip b/datafiles/data/Actions.zip index f9ee670a15294c2dcc55047fbcc0bbae1ce33335..6a9460e1abe26b606f9bff9a3de4465afcfe5fbe 100644 GIT binary patch delta 868 zcmbQd*!{v{_l6e67N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J)5-vv&!)gmZ>p zt6KH*7y|>tZAJzL#pw%o3o6uS73b&m_SApndVsw%G`{M7*y3LNTvMyt_6{s?qb@Lj>q^+wSnan#j?c}lE^4_RU~LY_WL%OUWG- zzFS?VFL4&Sr7bT!zwYsOZadz4i+umH1$Z;FOlQ0xD7AgbZov<%yiO6E;c}8E9Bu%8 zyk`2sgM#Yy2eS?v@a$#(#P9U{!q&t$7x*RK1XXG5?J@FsmB!}Iwb9Ai>tAiroyzFr zB^$royL|ccRvicKlOW7tdY4Ec1HSg&pDBFMii;W&IQIJ*`+tGXO|{xLc26=N_#I50 zdTaXZ$~moDBhQ`{kNN+x>`MP8&zIq;hP6!FI}Qozu?hPEJ-mROVe3kuhXX)S%)l_6 z_oARueX0Lhu0sYq`}n`{sXjOQs!}25BJfd9D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8 diff --git a/datafiles/data/Actions/Nodes/Armature Build.json b/datafiles/data/Actions/Nodes/Armature Build.json index e992f282c..243e55066 100644 --- a/datafiles/data/Actions/Nodes/Armature Build.json +++ b/datafiles/data/Actions/Nodes/Armature Build.json @@ -2,6 +2,7 @@ "name": "Armature Build", "tags": ["bone", "rigging"], "tooltip": "", + "location": ["Compose", "Armature"], "sprPath": "./Armature Build.png", "nodes": [ { "node": "Node_Armature" }, diff --git a/datafiles/data/Actions/Nodes/Follow Path.json b/datafiles/data/Actions/Nodes/Follow Path.json index 154eb4687..2d525f57d 100644 --- a/datafiles/data/Actions/Nodes/Follow Path.json +++ b/datafiles/data/Actions/Nodes/Follow Path.json @@ -2,6 +2,7 @@ "name": "Follow Path", "tags": [], "tooltip": "", + "location": ["Transform", "Transformations"], "sprPath": "./Follow Path.png", "nodes": [ { "node": "Node_Path", "y": 64 }, diff --git a/datafiles/data/Actions/Nodes/Line from Path.json b/datafiles/data/Actions/Nodes/Line from Path.json index a8483bec1..ad1fe6b03 100644 --- a/datafiles/data/Actions/Nodes/Line from Path.json +++ b/datafiles/data/Actions/Nodes/Line from Path.json @@ -2,6 +2,7 @@ "name": "Line from Path", "tags": [], "tooltip": "", + "location": ["Generate", "Drawer"], "sprPath": "./Line from Path.png", "nodes": [ { "node": "Node_Path" }, diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 3ce12f3d3..7d37cfacb 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -120,6 +120,7 @@ event_inherited(); function buildNode(_node, _param = "") { if(!_node) { instance_destroy(); + instance_destroy(o_dialog_menubox); return; } @@ -130,6 +131,7 @@ event_inherited(); _new_node = _node.build(node_target_x, node_target_y,, _param); if(!_new_node) { instance_destroy(); + instance_destroy(o_dialog_menubox); return; } @@ -226,6 +228,7 @@ event_inherited(); } instance_destroy(); + instance_destroy(o_dialog_menubox); } catagory_pane = new scrollPane(category_width, dialog_h - ui(66), function(_y, _m) { diff --git a/objects/o_dialog_add_node/Destroy_0.gml b/objects/o_dialog_add_node/Destroy_0.gml index 42c539a8e..57c5dc646 100644 --- a/objects/o_dialog_add_node/Destroy_0.gml +++ b/objects/o_dialog_add_node/Destroy_0.gml @@ -1,5 +1,4 @@ /// @description event_inherited(); -WIDGET_CURRENT = noone; -instance_destroy(o_dialog_menubox); \ No newline at end of file +WIDGET_CURRENT = noone; \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 67d512617..5ef60969a 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -104,7 +104,7 @@ VERSION = 11484; SAVE_VERSION = 11482; VERSION_STRING = "1.15rc4"; - BUILD_NUMBER = 11484; + BUILD_NUMBER = 11485; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/node_action_object/node_action_object.gml b/scripts/node_action_object/node_action_object.gml index 1ab9879cd..48c6bc02e 100644 --- a/scripts/node_action_object/node_action_object.gml +++ b/scripts/node_action_object/node_action_object.gml @@ -14,6 +14,8 @@ inputNode = noone; outputNode = noone; + + location = noone; static getName = function() { return name; /*__txt_node_name(node, name); */ } static getTooltip = function() { return tooltip; /*__txt_node_tooltip(node, tooltip); */ } @@ -67,6 +69,8 @@ inputNode = struct_try_get(map, "inputNode", noone); outputNode = struct_try_get(map, "outputNode", noone); + location = struct_try_get(map, "location", noone); + if(struct_has(map, "sprPath")) { var _path = string_replace(map.sprPath, "./", filename_dir(path) + "/"); @@ -93,6 +97,23 @@ if(filename_ext(f) == ".json") { var _c = new NodeAction().deserialize($"{root}/{f}"); ds_list_add(list, _c); + + if(_c.location != noone) { + var _cat = _c.location[0]; + var _grp = _c.location[1]; + + for( var i = 0, n = ds_list_size(NODE_CATEGORY); i < n; i++ ) { + if(NODE_CATEGORY[| i].name != _cat) continue; + var _list = NODE_CATEGORY[| i].list; + var j = 0; + + for( var m = ds_list_size(_list); j < m; j++ ) + if(_list[| j] == _grp) break; + + ds_list_insert(_list, j + 1, _c); + break; + } + } } f = file_find_next(); diff --git a/scripts/node_ase_file_read/node_ase_file_read.gml b/scripts/node_ase_file_read/node_ase_file_read.gml index fd1e6555e..75473269f 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -37,6 +37,8 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const inputs[| 2] = nodeValue("Current tag", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + inputs[| 3] = nodeValue("Use cel dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, self); @@ -155,7 +157,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const input_display_list = [ ["File", true], 0, - ["Layers", false], 1, layer_renderer, + ["Layers", false], 1, 3, layer_renderer, ["Tags", false], 2, tag_renderer, ]; @@ -183,6 +185,8 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const var nh = (array_length(layers) - 1) / 2 * _nh; var ny = y - nh; + var use_cel = inputs[| 3].getValue(); + var lvs = []; for( var i = 0, n = array_length(layers); i < n; i++ ) { var _layer = layers[i]; @@ -201,9 +205,10 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const if(_node == noone) _node = nodeBuild("Node_ASE_layer", nx, ny + i * _nh); - + lvs[i] = _node; lvs[i].inputs[| 0].setFrom(outputs[| 1]); + lvs[i].inputs[| 1].setValue(use_cel); lvs[i].setDisplayName(_name); } } diff --git a/scripts/node_palette_sort/node_palette_sort.gml b/scripts/node_palette_sort/node_palette_sort.gml index 966bb5d16..e2d9f216d 100644 --- a/scripts/node_palette_sort/node_palette_sort.gml +++ b/scripts/node_palette_sort/node_palette_sort.gml @@ -9,18 +9,45 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr .setVisible(true, true); inputs[| 1] = nodeValue("Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Brightness", -1, "Hue (HSV)", "Saturation (SHV)", "Value (VHS)", -1, "Red (RGB)", "Green (GBR)", "Blue (BRG)" ]) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Brightness", -1, "Hue (HSV)", "Saturation (SHV)", "Value (VHS)", -1, "Red (RGB)", "Green (GBR)", "Blue (BRG)", -1, "Custom" ]) .rejectArray(); inputs[| 2] = nodeValue("Reverse", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 3] = nodeValue("Sort Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "RGB"); + outputs[| 0] = nodeValue("Sorted palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []) .setDisplay(VALUE_DISPLAY.palette); + static step = function() { + var _typ = inputs[| 1].getValue(); + + inputs[| 3].setVisible(_typ == 10); + } + + sort_string = ""; + static customSort = function(c) { + var len = string_length(sort_string); + var val = power(256, len); + + for( var i = 1; i <= len; i++ ) { + var ch = string_lower(string_char_at(sort_string, i)); + + switch(ch) { + case "r" : return + } + + val /= 256; + } + + return c; + } + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); var _ord = inputs[| 1].getValue(); var _rev = inputs[| 2].getValue(); + sort_string = inputs[| 3].getValue(); if(!is_array(_arr)) return; var _pal = array_clone(_arr); @@ -28,13 +55,15 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr switch(_ord) { case 0 : array_sort(_pal, __sortBright); break; - case 1 : array_sort(_pal, __sortHue); break; - case 2 : array_sort(_pal, __sortSat); break; - case 3 : array_sort(_pal, __sortVal); break; + case 2 : array_sort(_pal, __sortHue); break; + case 3 : array_sort(_pal, __sortSat); break; + case 4 : array_sort(_pal, __sortVal); break; - case 4 : array_sort(_pal, __sortRed); break; - case 5 : array_sort(_pal, __sortGreen); break; - case 6 : array_sort(_pal, __sortBlue); break; + case 6 : array_sort(_pal, __sortRed); break; + case 7 : array_sort(_pal, __sortGreen); break; + case 8 : array_sort(_pal, __sortBlue); break; + + case 10 : array_sort(_pal, function(c1, c2) { return customSort(c1) - customSort(c2); }); break; } if(_rev) _pal = array_reverse(_pal); diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index b122e1d25..8d074f937 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -732,7 +732,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { ); callAddDialog(); - menuCall("graph_node_selected_menu",o_dialog_add_node.dialog_x - ui(8), o_dialog_add_node.dialog_y + ui(4), menu, fa_right ); + menuCall("graph_node_selected_menu", o_dialog_add_node.dialog_x - ui(8), o_dialog_add_node.dialog_y + ui(4), menu, fa_right ); setFocus(o_dialog_add_node.id, "Dialog"); } } @@ -1083,18 +1083,18 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { SAVE_NODE(_node, nodeArray[i],,,, getCurrentContext()); _map.nodes = _node; - clipboard_set_text(json_encode_minify(_map)); + clipboard_set_text(json_stringify_minify(_map)); } function doPaste() { - var txt = clipboard_get_text(); + var txt = clipboard_get_text(); var _map = json_try_parse(txt, noone); if(_map != noone) { ds_map_clear(APPEND_MAP); APPENDING = true; CLONING = true; - var _app = __APPEND_MAP(_map); + var _app = __APPEND_MAP(_map); APPENDING = false; CLONING = false;