mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
Action nodes: Location tag
This commit is contained in:
parent
80b02f7eab
commit
14fab463f7
11 changed files with 76 additions and 16 deletions
Binary file not shown.
|
@ -2,6 +2,7 @@
|
||||||
"name": "Armature Build",
|
"name": "Armature Build",
|
||||||
"tags": ["bone", "rigging"],
|
"tags": ["bone", "rigging"],
|
||||||
"tooltip": "",
|
"tooltip": "",
|
||||||
|
"location": ["Compose", "Armature"],
|
||||||
"sprPath": "./Armature Build.png",
|
"sprPath": "./Armature Build.png",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{ "node": "Node_Armature" },
|
{ "node": "Node_Armature" },
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"name": "Follow Path",
|
"name": "Follow Path",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"tooltip": "",
|
"tooltip": "",
|
||||||
|
"location": ["Transform", "Transformations"],
|
||||||
"sprPath": "./Follow Path.png",
|
"sprPath": "./Follow Path.png",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{ "node": "Node_Path", "y": 64 },
|
{ "node": "Node_Path", "y": 64 },
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"name": "Line from Path",
|
"name": "Line from Path",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"tooltip": "",
|
"tooltip": "",
|
||||||
|
"location": ["Generate", "Drawer"],
|
||||||
"sprPath": "./Line from Path.png",
|
"sprPath": "./Line from Path.png",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{ "node": "Node_Path" },
|
{ "node": "Node_Path" },
|
||||||
|
|
|
@ -120,6 +120,7 @@ event_inherited();
|
||||||
function buildNode(_node, _param = "") {
|
function buildNode(_node, _param = "") {
|
||||||
if(!_node) {
|
if(!_node) {
|
||||||
instance_destroy();
|
instance_destroy();
|
||||||
|
instance_destroy(o_dialog_menubox);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +131,7 @@ event_inherited();
|
||||||
_new_node = _node.build(node_target_x, node_target_y,, _param);
|
_new_node = _node.build(node_target_x, node_target_y,, _param);
|
||||||
if(!_new_node) {
|
if(!_new_node) {
|
||||||
instance_destroy();
|
instance_destroy();
|
||||||
|
instance_destroy(o_dialog_menubox);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +228,7 @@ event_inherited();
|
||||||
}
|
}
|
||||||
|
|
||||||
instance_destroy();
|
instance_destroy();
|
||||||
|
instance_destroy(o_dialog_menubox);
|
||||||
}
|
}
|
||||||
|
|
||||||
catagory_pane = new scrollPane(category_width, dialog_h - ui(66), function(_y, _m) {
|
catagory_pane = new scrollPane(category_width, dialog_h - ui(66), function(_y, _m) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/// @description
|
/// @description
|
||||||
event_inherited();
|
event_inherited();
|
||||||
|
|
||||||
WIDGET_CURRENT = noone;
|
WIDGET_CURRENT = noone;
|
||||||
instance_destroy(o_dialog_menubox);
|
|
|
@ -104,7 +104,7 @@
|
||||||
VERSION = 11484;
|
VERSION = 11484;
|
||||||
SAVE_VERSION = 11482;
|
SAVE_VERSION = 11482;
|
||||||
VERSION_STRING = "1.15rc4";
|
VERSION_STRING = "1.15rc4";
|
||||||
BUILD_NUMBER = 11484;
|
BUILD_NUMBER = 11485;
|
||||||
|
|
||||||
globalvar APPEND_MAP;
|
globalvar APPEND_MAP;
|
||||||
APPEND_MAP = ds_map_create();
|
APPEND_MAP = ds_map_create();
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
inputNode = noone;
|
inputNode = noone;
|
||||||
outputNode = noone;
|
outputNode = noone;
|
||||||
|
|
||||||
|
location = noone;
|
||||||
|
|
||||||
static getName = function() { return name; /*__txt_node_name(node, name); */ }
|
static getName = function() { return name; /*__txt_node_name(node, name); */ }
|
||||||
static getTooltip = function() { return tooltip; /*__txt_node_tooltip(node, tooltip); */ }
|
static getTooltip = function() { return tooltip; /*__txt_node_tooltip(node, tooltip); */ }
|
||||||
|
@ -67,6 +69,8 @@
|
||||||
inputNode = struct_try_get(map, "inputNode", noone);
|
inputNode = struct_try_get(map, "inputNode", noone);
|
||||||
outputNode = struct_try_get(map, "outputNode", noone);
|
outputNode = struct_try_get(map, "outputNode", noone);
|
||||||
|
|
||||||
|
location = struct_try_get(map, "location", noone);
|
||||||
|
|
||||||
if(struct_has(map, "sprPath")) {
|
if(struct_has(map, "sprPath")) {
|
||||||
var _path = string_replace(map.sprPath, "./", filename_dir(path) + "/");
|
var _path = string_replace(map.sprPath, "./", filename_dir(path) + "/");
|
||||||
|
|
||||||
|
@ -93,6 +97,23 @@
|
||||||
if(filename_ext(f) == ".json") {
|
if(filename_ext(f) == ".json") {
|
||||||
var _c = new NodeAction().deserialize($"{root}/{f}");
|
var _c = new NodeAction().deserialize($"{root}/{f}");
|
||||||
ds_list_add(list, _c);
|
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();
|
f = file_find_next();
|
||||||
|
|
|
@ -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[| 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[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||||
|
|
||||||
outputs[| 1] = nodeValue("Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, self);
|
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 = [
|
input_display_list = [
|
||||||
["File", true], 0,
|
["File", true], 0,
|
||||||
["Layers", false], 1, layer_renderer,
|
["Layers", false], 1, 3, layer_renderer,
|
||||||
["Tags", false], 2, tag_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 nh = (array_length(layers) - 1) / 2 * _nh;
|
||||||
var ny = y - nh;
|
var ny = y - nh;
|
||||||
|
|
||||||
|
var use_cel = inputs[| 3].getValue();
|
||||||
|
|
||||||
var lvs = [];
|
var lvs = [];
|
||||||
for( var i = 0, n = array_length(layers); i < n; i++ ) {
|
for( var i = 0, n = array_length(layers); i < n; i++ ) {
|
||||||
var _layer = layers[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)
|
if(_node == noone)
|
||||||
_node = nodeBuild("Node_ASE_layer", nx, ny + i * _nh);
|
_node = nodeBuild("Node_ASE_layer", nx, ny + i * _nh);
|
||||||
|
|
||||||
lvs[i] = _node;
|
lvs[i] = _node;
|
||||||
lvs[i].inputs[| 0].setFrom(outputs[| 1]);
|
lvs[i].inputs[| 0].setFrom(outputs[| 1]);
|
||||||
|
lvs[i].inputs[| 1].setValue(use_cel);
|
||||||
lvs[i].setDisplayName(_name);
|
lvs[i].setDisplayName(_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,18 +9,45 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
.setVisible(true, true);
|
.setVisible(true, true);
|
||||||
|
|
||||||
inputs[| 1] = nodeValue("Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
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();
|
.rejectArray();
|
||||||
|
|
||||||
inputs[| 2] = nodeValue("Reverse", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
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, [])
|
outputs[| 0] = nodeValue("Sorted palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [])
|
||||||
.setDisplay(VALUE_DISPLAY.palette);
|
.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) {
|
static update = function(frame = PROJECT.animator.current_frame) {
|
||||||
var _arr = inputs[| 0].getValue();
|
var _arr = inputs[| 0].getValue();
|
||||||
var _ord = inputs[| 1].getValue();
|
var _ord = inputs[| 1].getValue();
|
||||||
var _rev = inputs[| 2].getValue();
|
var _rev = inputs[| 2].getValue();
|
||||||
|
sort_string = inputs[| 3].getValue();
|
||||||
if(!is_array(_arr)) return;
|
if(!is_array(_arr)) return;
|
||||||
|
|
||||||
var _pal = array_clone(_arr);
|
var _pal = array_clone(_arr);
|
||||||
|
@ -28,13 +55,15 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
switch(_ord) {
|
switch(_ord) {
|
||||||
case 0 : array_sort(_pal, __sortBright); break;
|
case 0 : array_sort(_pal, __sortBright); break;
|
||||||
|
|
||||||
case 1 : array_sort(_pal, __sortHue); break;
|
case 2 : array_sort(_pal, __sortHue); break;
|
||||||
case 2 : array_sort(_pal, __sortSat); break;
|
case 3 : array_sort(_pal, __sortSat); break;
|
||||||
case 3 : array_sort(_pal, __sortVal); break;
|
case 4 : array_sort(_pal, __sortVal); break;
|
||||||
|
|
||||||
case 4 : array_sort(_pal, __sortRed); break;
|
case 6 : array_sort(_pal, __sortRed); break;
|
||||||
case 5 : array_sort(_pal, __sortGreen); break;
|
case 7 : array_sort(_pal, __sortGreen); break;
|
||||||
case 6 : array_sort(_pal, __sortBlue); 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);
|
if(_rev) _pal = array_reverse(_pal);
|
||||||
|
|
|
@ -732,7 +732,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
);
|
);
|
||||||
|
|
||||||
callAddDialog();
|
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");
|
setFocus(o_dialog_add_node.id, "Dialog");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1083,18 +1083,18 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
SAVE_NODE(_node, nodeArray[i],,,, getCurrentContext());
|
SAVE_NODE(_node, nodeArray[i],,,, getCurrentContext());
|
||||||
_map.nodes = _node;
|
_map.nodes = _node;
|
||||||
|
|
||||||
clipboard_set_text(json_encode_minify(_map));
|
clipboard_set_text(json_stringify_minify(_map));
|
||||||
}
|
}
|
||||||
|
|
||||||
function doPaste() {
|
function doPaste() {
|
||||||
var txt = clipboard_get_text();
|
var txt = clipboard_get_text();
|
||||||
var _map = json_try_parse(txt, noone);
|
var _map = json_try_parse(txt, noone);
|
||||||
|
|
||||||
if(_map != noone) {
|
if(_map != noone) {
|
||||||
ds_map_clear(APPEND_MAP);
|
ds_map_clear(APPEND_MAP);
|
||||||
APPENDING = true;
|
APPENDING = true;
|
||||||
CLONING = true;
|
CLONING = true;
|
||||||
var _app = __APPEND_MAP(_map);
|
var _app = __APPEND_MAP(_map);
|
||||||
APPENDING = false;
|
APPENDING = false;
|
||||||
CLONING = false;
|
CLONING = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue