Pixel-Composer/scripts/node_registry/node_registry.gml

560 lines
15 KiB
Text
Raw Normal View History

2025-01-03 11:53:34 +01:00
#region globalvar
globalvar ALL_NODES, NODE_CATEGORY, NODE_PB_CATEGORY, NODE_PCX_CATEGORY;
globalvar SUPPORTER_NODES, NEW_NODES;
globalvar NODE_PAGE_DEFAULT;
2025-01-09 08:28:19 +01:00
globalvar NODE_ACTION_LIST;
2025-01-03 11:53:34 +01:00
2025-01-09 08:28:19 +01:00
ALL_NODES = {};
2025-01-03 11:53:34 +01:00
NODE_CATEGORY = ds_list_create();
NODE_PB_CATEGORY = ds_list_create();
NODE_PCX_CATEGORY = ds_list_create();
SUPPORTER_NODES = ds_list_create();
NEW_NODES = ds_list_create();
global.__currPage = "";
global.__currNewPage = "";
#macro NODE_ADD_CAT if(!IS_CMD) addNodeCatagory
2025-01-09 05:28:30 +01:00
global.PATREON_NODES = [
Node_Brush_Linear,
Node_Ambient_Occlusion,
Node_RM_Cloud,
Node_Perlin_Extra,
Node_Voronoi_Extra,
Node_Gabor_Noise,
Node_Shard_Noise,
Node_Wavelet_Noise,
Node_Caustic,
Node_Noise_Bubble,
Node_Flow_Noise,
Node_Noise_Cristal,
Node_Honeycomb_Noise,
Node_Grid_Pentagonal,
Node_Pytagorean_Tile,
Node_Herringbone_Tile,
Node_Random_Tile,
Node_MK_Fracture,
Node_MK_Sparkle,
];
2025-01-03 11:53:34 +01:00
#endregion
2025-01-03 06:41:04 +01:00
function NodeObject(_name, _spr, _node, _tooltip = "") constructor {
2022-01-13 05:24:03 +01:00
name = _name;
spr = _spr;
2022-12-16 09:18:09 +01:00
node = _node;
2024-02-12 10:25:23 +01:00
icon = noone;
2025-01-03 06:41:04 +01:00
nodeName = script_get_name(node);
createFn = noone;
createParam = noone;
2022-01-13 05:24:03 +01:00
2025-01-03 06:41:04 +01:00
tags = [];
tooltip = _tooltip;
2024-02-12 13:59:43 +01:00
2025-01-09 08:28:19 +01:00
pxc_version = 0;
2024-09-10 11:48:51 +02:00
new_node = false;
tooltip_spr = noone;
deprecated = false;
2022-12-27 04:00:50 +01:00
show_in_recent = true;
2023-12-18 13:54:33 +01:00
show_in_global = true;
2025-01-09 05:28:30 +01:00
patreon = array_exists(global.PATREON_NODES, node);
if(patreon) ds_list_add(SUPPORTER_NODES, self);
testable = true;
2025-01-09 05:28:30 +01:00
ioArray = [];
2025-01-05 01:48:23 +01:00
input_type_mask = 0b0;
output_type_mask = 0b0;
2025-01-09 05:28:30 +01:00
static init = function() {
_fn = registerFunctionLite("New node", name, function(n) /*=>*/ { PANEL_GRAPH.createNodeHotkey(n); }, [ nodeName ]);
_fn.spr = spr;
if(!IS_CMD) {
var pth = DIRECTORY + $"Nodes/Tooltip/{node}.png";
if(file_exists_empty(pth)) tooltip_spr = sprite_add(pth, 0, false, false, 0, 0);
if(struct_has(global.NODE_GUIDE, node)) {
var _n = global.NODE_GUIDE[$ node];
name = _n.name;
if(_n.tooltip != "")
tooltip = _n.tooltip;
}
2024-02-12 13:59:43 +01:00
}
2025-01-09 05:28:30 +01:00
} init();
2025-01-03 06:41:04 +01:00
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; }
2025-01-03 06:41:04 +01:00
static setParam = function(_par) { createParam = _par; return self; }
2025-01-09 05:28:30 +01:00
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]);
array_push(ioArray, value_type_to_string(argument[i]));
}
return self;
}
2025-01-05 01:48:23 +01:00
2024-07-08 04:37:36 +02:00
static setVersion = function(version) {
INLINE
2024-02-15 14:23:26 +01:00
if(IS_CMD) return self;
2024-02-12 13:59:43 +01:00
2025-01-09 08:28:19 +01:00
pxc_version = version;
new_node = version >= LATEST_VERSION;
2023-11-20 13:21:50 +01:00
if(new_node) {
if(global.__currPage != global.__currNewPage) {
ds_list_add(NEW_NODES, global.__currPage);
global.__currNewPage = global.__currPage;
}
ds_list_add(NEW_NODES, self);
}
2022-12-27 04:00:50 +01:00
return self;
2024-07-08 04:37:36 +02:00
}
2022-12-27 04:00:50 +01:00
2024-09-09 03:04:54 +02:00
static setIcon = function(_icon) {
2024-02-12 10:25:23 +01:00
INLINE
2024-02-15 14:23:26 +01:00
if(IS_CMD) return self;
2024-02-12 13:59:43 +01:00
2024-09-09 03:04:54 +02:00
icon = _icon;
2024-02-12 10:25:23 +01:00
return self;
2024-07-08 04:37:36 +02:00
}
2024-02-12 10:25:23 +01:00
2024-07-08 04:37:36 +02:00
static isDeprecated = function() {
INLINE
2024-02-15 14:23:26 +01:00
if(IS_CMD) return self;
2024-02-12 13:59:43 +01:00
deprecated = true;
return self;
2024-07-08 04:37:36 +02:00
}
2024-07-08 04:37:36 +02:00
static hideRecent = function() {
INLINE
2024-02-15 14:23:26 +01:00
if(IS_CMD) return self;
2024-02-12 13:59:43 +01:00
show_in_recent = false;
testable = false;
2024-09-14 05:36:18 +02:00
variable_struct_remove(FUNCTIONS, _fn.fnName);
return self;
2024-07-08 04:37:36 +02:00
}
static notTest = function() { testable = false; return self; }
2024-07-08 04:37:36 +02:00
static hideGlobal = function() {
2023-12-18 13:54:33 +01:00
INLINE
2024-02-15 14:23:26 +01:00
if(IS_CMD) return self;
2024-02-12 13:59:43 +01:00
2023-12-18 13:54:33 +01:00
show_in_global = false;
return self;
2024-07-08 04:37:36 +02:00
}
2023-12-18 13:54:33 +01:00
static getName = function() { return __txt_node_name(node, name); }
static getTooltip = function() { return __txt_node_tooltip(node, tooltip); }
2023-06-05 18:27:53 +02:00
2024-07-08 04:37:36 +02:00
static build = function(_x = 0, _y = 0, _group = PANEL_GRAPH.getCurrentContext(), _param = {}) {
2024-03-31 05:36:11 +02:00
INLINE
2025-01-03 06:41:04 +01:00
if(createParam != noone) struct_append(_param, createParam);
var _node = createFn == noone? new node(_x, _y, _group, _param) : createFn(_x, _y, _group, _param);
2022-01-13 05:24:03 +01:00
return _node;
2024-07-08 04:37:36 +02:00
}
2024-07-08 04:37:36 +02:00
static drawGrid = function(_x, _y, _mx, _my, grid_size, _param = {}) {
var spr_x = _x + grid_size / 2;
var spr_y = _y + grid_size / 2;
2023-12-01 05:49:44 +01:00
var _spw = sprite_get_width(spr);
var _sph = sprite_get_height(spr);
2024-12-29 10:12:24 +01:00
var _ss = grid_size / max(_spw, _sph) * 0.75;
2023-12-01 05:49:44 +01:00
gpu_set_tex_filter(true);
draw_sprite_uniform(spr, 0, spr_x, spr_y, _ss);
2023-12-01 05:49:44 +01:00
gpu_set_tex_filter(false);
if(new_node) {
draw_sprite_ui_uniform(THEME.node_new_badge, 0, _x + grid_size - ui(12), _y + ui(6),, COLORS._main_accent);
draw_sprite_ui_uniform(THEME.node_new_badge, 1, _x + grid_size - ui(12), _y + ui(6));
}
if(deprecated) {
draw_sprite_ui_uniform(THEME.node_deprecated_badge, 0, _x + grid_size - ui(12), _y + ui(6),, COLORS._main_value_negative);
draw_sprite_ui_uniform(THEME.node_deprecated_badge, 1, _x + grid_size - ui(12), _y + ui(6));
}
2025-01-06 05:32:21 +01:00
var fav = struct_exists(global.FAV_NODES, nodeName);
if(fav) {
gpu_set_tex_filter(true);
draw_sprite_ui_uniform(THEME.star, 0, _x + grid_size - ui(10), _y + grid_size - ui(10), .8, COLORS._main_accent, 1.);
gpu_set_tex_filter(false);
}
2024-05-22 04:46:29 +02:00
2024-02-12 10:25:23 +01:00
var spr_x = _x + grid_size - 4;
var spr_y = _y + 4;
2025-01-05 01:48:23 +01:00
if(IS_PATREON && patreon) {
BLEND_SUBTRACT
gpu_set_colorwriteenable(0, 0, 0, 1);
draw_sprite_ext(THEME.patreon_supporter, 0, spr_x, spr_y, 1, 1, 0, c_white, 1);
gpu_set_colorwriteenable(1, 1, 1, 1);
BLEND_NORMAL
draw_sprite_ext(THEME.patreon_supporter, 1, spr_x, spr_y, 1, 1, 0, COLORS._main_accent, 1);
if(point_in_circle(_mx, _my, spr_x, spr_y, 10)) TOOLTIP = __txt("Supporter exclusive");
}
2024-02-12 10:25:23 +01:00
if(icon) draw_sprite_ext(icon, 0, spr_x, spr_y, 1, 1, 0, c_white, 1);
2024-07-08 04:37:36 +02:00
}
static drawList = function(_x, _y, _mx, _my, _h, _w, _param = {}) {
2025-01-06 05:32:21 +01:00
var fav = struct_exists(global.FAV_NODES, nodeName);
if(fav) {
gpu_set_tex_filter(true);
draw_sprite_ui_uniform(THEME.star, 0, _x + ui(16), _y + _h / 2, .8, COLORS._main_accent, 1.);
gpu_set_tex_filter(false);
}
var spr_x = _x + ui(32) + _h / 2;
var spr_y = _y + _h / 2;
var ss = (_h - ui(8)) / max(sprite_get_width(spr), sprite_get_height(spr));
2023-12-01 05:49:44 +01:00
gpu_set_tex_filter(true);
draw_sprite_ext(spr, 0, spr_x, spr_y, ss, ss, 0, c_white, 1);
2023-12-01 05:49:44 +01:00
gpu_set_tex_filter(false);
var tx = spr_x + _h / 2 + ui(4);
var ty = _y + _h / 2;
if(new_node) {
var _nx = _w - ui(6 + 18);
draw_sprite_ui_uniform(THEME.node_new_badge, 0, _nx, _y + _h / 2,, COLORS._main_accent);
draw_sprite_ui_uniform(THEME.node_new_badge, 1, _nx, _y + _h / 2);
}
if(deprecated) {
var _nx = _w - ui(6 + 18);
draw_sprite_ui_uniform(THEME.node_deprecated_badge, 0, _nx, _y + _h / 2,, COLORS._main_value_negative);
draw_sprite_ui_uniform(THEME.node_deprecated_badge, 1, _nx, _y + _h / 2);
}
var _txt = getName();
var _query = struct_try_get(_param, "query", "");
var _range = struct_try_get(_param, "range", 0);
if(_query != "") {
2024-02-16 07:44:36 +01:00
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text_sub);
draw_text_add(tx, ty, _txt);
tx += string_width(_txt);
draw_sprite_ext(THEME.arrow, 0, tx + ui(12), ty, 1, 1, 0, COLORS._main_icon, 1);
tx += ui(24);
2024-02-16 07:44:36 +01:00
_query = string_title(_query);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
if(_range == 0) draw_text_add(tx, ty, _query);
else draw_text_match_range(tx, ty, _query, _range);
2024-02-16 07:44:36 +01:00
tx += string_width(_query);
} else {
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
if(_range == 0) draw_text_add(tx, ty, _txt);
else draw_text_match_range(tx, ty, _txt, _range);
2024-02-16 07:44:36 +01:00
tx += string_width(_txt);
}
2025-01-05 01:48:23 +01:00
if(IS_PATREON && patreon) {
var spr_x = tx + ui(4);
var spr_y = _y + _h / 2 - ui(6);
gpu_set_colorwriteenable(0, 0, 0, 1); BLEND_SUBTRACT
draw_sprite_ext(THEME.patreon_supporter, 0, spr_x, spr_y, 1, 1, 0, c_white, 1);
gpu_set_colorwriteenable(1, 1, 1, 1); BLEND_NORMAL
draw_sprite_ext(THEME.patreon_supporter, 1, spr_x, spr_y, 1, 1, 0, COLORS._main_accent, 1);
if(point_in_circle(_mx, _my, spr_x, spr_y, ui(10))) TOOLTIP = __txt("Supporter exclusive");
2024-12-29 10:12:24 +01:00
2024-12-30 11:05:35 +01:00
tx += ui(12);
}
return tx;
2024-07-08 04:37:36 +02:00
}
2025-01-09 05:28:30 +01:00
static serialize = function() {
var _str = {
name,
2025-01-09 08:28:19 +01:00
spr: sprite_get_name(spr),
2025-01-09 05:28:30 +01:00
baseNode: nodeName,
io: ioArray,
}
2025-01-09 08:28:19 +01:00
if(tooltip != "") _str.tooltip = tooltip;
if(createFn != noone) _str.build = script_get_name(createFn);
if(deprecated) _str.deprecated = true;
if(pxc_version) _str.pxc_version = pxc_version;
if(!show_in_recent) _str.show_in_recent = show_in_recent;
if(!array_empty(tags)) _str.alias = tags;
2025-01-09 05:28:30 +01:00
return _str;
}
static deserialize = function(_data) {
2025-01-09 08:28:19 +01:00
if(struct_has(_data, "tooltip")) setTooltip(_data.tooltip);
2025-01-09 05:28:30 +01:00
if(struct_has(_data, "io")) {
var _io = _data.io;
for( var i = 0, n = array_length(_io); i < n; i++ )
2025-01-09 08:28:19 +01:00
setIO(value_type_from_string(_io[i]));
2025-01-09 05:28:30 +01:00
}
if(struct_has(_data, "build")) {
var _bfn = asset_get_index(_data.build);
2025-01-09 08:28:19 +01:00
if(_bfn != -1) setBuild(_bfn);
2025-01-09 05:28:30 +01:00
}
if(struct_has(_data, "deprecated"))
isDeprecated();
if(struct_has(_data, "alias"))
setTags(_data.alias);
2025-01-09 08:28:19 +01:00
if(struct_has(_data, "show_in_recent"))
show_in_recent = _data.show_in_recent;
if(struct_has(_data, "pxc_version"))
setVersion(_data.pxc_version);
2025-01-09 05:28:30 +01:00
return self;
}
2024-07-08 04:37:36 +02:00
}
2022-01-13 05:24:03 +01:00
function nodeBuild(_name, _x, _y, _group = PANEL_GRAPH.getCurrentContext()) {
2024-03-31 05:36:11 +02:00
INLINE
2025-01-09 08:28:19 +01:00
if(!struct_has(ALL_NODES, _name)) {
2023-12-05 09:51:24 +01:00
log_warning("LOAD", $"Node type {_name} not found");
return noone;
}
2025-01-09 08:28:19 +01:00
var _node = ALL_NODES[$ _name];
var _bnode = _node.build(_x, _y, _group);
2022-01-13 05:24:03 +01:00
return _bnode;
}
2025-01-09 05:28:30 +01:00
function addNodeCatagory( name, list, filter = [], color = noone) { ds_list_add(NODE_CATEGORY, { name, list, filter, color }); global.__currPage = name; }
function addNodePBCatagory( name, list, filter = []) { ds_list_add(NODE_PB_CATEGORY, { name, list, filter }); }
function addNodePCXCatagory( name, list, filter = []) { ds_list_add(NODE_PCX_CATEGORY, { name, list, filter }); }
2024-01-16 14:08:57 +01:00
////- Nodes
2025-01-09 05:28:30 +01:00
function __read_node_directory(dir) {
if(!directory_exists(dir)) return;
__read_node_folder(dir);
var _dirs = [];
2025-01-09 08:28:19 +01:00
var _f = file_find_first(dir + "/*", fa_directory);
2025-01-09 05:28:30 +01:00
var f, p;
while(_f != "") {
f = _f;
2025-01-09 08:28:19 +01:00
p = dir + "/" + f;
2025-01-09 05:28:30 +01:00
_f = file_find_next();
if(!directory_exists(p)) continue;
array_push(_dirs, p);
}
file_find_close();
array_foreach(_dirs, function(d) /*=>*/ {return __read_node_directory(d)});
}
function __read_node_folder(dir) {
var _info = dir + "/info.json";
2025-01-09 05:28:30 +01:00
if(!file_exists(_info)) return;
var _data = json_load_struct(_info);
var _name = _data[$ "name"];
2025-01-09 05:28:30 +01:00
var _base = _data[$ "baseNode"];
var _inme = _data[$ "iname"] ?? _base;
2025-01-09 08:28:19 +01:00
var _spr = _data[$ "spr"];
2025-01-09 05:28:30 +01:00
if(is_undefined(_base)) {
print($"NODE ERROR: baseNode not found in {_info}.");
return;
}
2025-01-09 08:28:19 +01:00
if(struct_has(ALL_NODES, _inme))
2025-01-09 08:55:34 +01:00
print($"NODE WARNING: Duplicate node iname {_inme} | {dir}.");
2025-01-09 05:28:30 +01:00
if(is_undefined(_spr))
2025-01-09 08:28:19 +01:00
_spr = $"s_{string_lower(_inme)}";
_spr = asset_get_index(_spr);
2025-01-09 05:28:30 +01:00
if(!sprite_exists(_spr))
_spr = s_node_icon;
var _node = asset_get_index(_base);
var _n = new NodeObject(_name, _spr, _node);
_n.deserialize(_data);
2025-01-09 08:28:19 +01:00
ALL_NODES[$ _inme] = _n;
2025-01-09 05:28:30 +01:00
return _n;
}
2025-01-09 08:28:19 +01:00
function __read_node_display(_list, _addCat) {
for( var i = 0, n = array_length(_list); i < n; i++ ) {
var _dl = _list[i];
var _name = _dl.name;
var _filter = _dl[$ "context"] ?? [];
var _color = noone;
if(struct_has(_dl, "color")) _color = COLORS[$ _dl.color];
var _l = ds_list_create();
_addCat(_name, _l, _filter, _color);
var _nodes = _dl.nodes;
for( var j = 0, m = array_length(_nodes); j < m; j++ ) {
var _n = _nodes[j];
if(is_string(_n)) {
if(struct_has(ALL_NODES, _n))
ds_list_add(_l, ALL_NODES[$ _n]);
continue;
}
if(is_struct(_n)) {
if(struct_has(_n, "label"))
ds_list_add(_l, _n.label);
}
}
}
}
2024-12-10 09:15:49 +01:00
function __initNodes() {
2024-07-15 10:43:30 +02:00
global.__currPage = "";
global.__startPage = 0;
global.FAV_NODES = {};
2023-12-05 09:51:24 +01:00
2024-02-12 10:25:23 +01:00
if(!IS_CMD) {
var favPath = DIRECTORY + "Nodes/fav.json";
if(file_exists_empty(favPath)) {
var favs = json_load_struct(favPath);
for (var i = 0, n = array_length(favs); i < n; i++)
global.FAV_NODES[$ favs[i]] = 1;
}
2024-03-24 04:58:08 +01:00
2024-02-12 10:25:23 +01:00
var recPath = DIRECTORY + "Nodes/recent.json";
global.RECENT_NODES = file_exists_empty(recPath)? json_load_struct(recPath) : [];
if(!is_array(global.RECENT_NODES)) global.RECENT_NODES = [];
}
2023-12-20 14:02:49 +01:00
2023-12-05 09:51:24 +01:00
NODE_PAGE_DEFAULT = ds_list_size(NODE_CATEGORY);
ADD_NODE_PAGE = NODE_PAGE_DEFAULT;
2025-01-09 08:28:19 +01:00
////- DATA
2025-01-09 08:28:19 +01:00
var dir = $"{DIRECTORY}Nodes/Data/";
directory_verify(dir);
if(check_version($"{dir}version"))
zip_unzip("data/Nodes/Internal.zip", $"{DIRECTORY}Nodes/Data/");
2025-01-09 08:28:19 +01:00
var dir = $"{DIRECTORY}Nodes/Data/Internal";
__read_node_directory(dir);
2023-12-20 14:02:49 +01:00
2025-01-09 08:28:19 +01:00
////- DISPLAY
2023-12-05 13:49:18 +01:00
2025-01-09 08:28:19 +01:00
var _relFrom = $"data/Nodes/display_data.json";
var _relTo = $"{DIRECTORY}Nodes/Data/display_data.json";
file_copy_override(_relFrom, _relTo);
2023-12-19 14:30:34 +01:00
2025-01-09 08:28:19 +01:00
var _data = json_load_struct(_relTo);
2023-12-05 13:49:18 +01:00
2025-01-09 08:28:19 +01:00
__read_node_display(_data.list, addNodeCatagory);
2023-12-20 14:02:49 +01:00
2025-01-09 08:28:19 +01:00
NODE_ACTION_LIST = ds_list_create();
addNodeCatagory("Action", NODE_ACTION_LIST);
__initNodeActions();
2023-12-05 09:51:24 +01:00
2025-01-09 08:28:19 +01:00
if(IS_PATREON) addNodeCatagory("Extra", SUPPORTER_NODES);
2023-12-05 09:51:24 +01:00
2025-01-09 08:28:19 +01:00
__read_node_display(_data.pb, addNodePBCatagory);
__read_node_display(_data.pcx, addNodePCXCatagory);
}
function __generateNodeData() {
var _dir = "D:/Project/MakhamDev/LTS-PixelComposer/PixelComposer/datafiles/data/Nodes/Internal"
2023-12-05 09:51:24 +01:00
2025-01-09 08:28:19 +01:00
for( var i = 0, n = ds_list_size(NODE_CATEGORY); i < n; i++ ) {
var _cat = NODE_CATEGORY[| i];
2024-12-29 10:12:24 +01:00
2025-01-09 08:28:19 +01:00
var _lnme = _cat.name;
var _list = _cat.list;
directory_verify($"{_dir}/{_lnme}");
2024-06-17 13:12:33 +02:00
2025-01-09 08:28:19 +01:00
for( var j = 0, m = ds_list_size(_list); j < m; j++ ) {
var _node = _list[| j];
if(!is(_node, NodeObject)) continue;
2023-12-05 09:51:24 +01:00
2025-01-09 08:28:19 +01:00
var _nme = _node.nodeName;
var _vnme = filename_name_validate(_nme);
2023-12-05 09:51:24 +01:00
2025-01-09 08:28:19 +01:00
var _str = _node.serialize();
directory_verify($"{_dir}/{_lnme}/{_vnme}");
json_save_struct($"{_dir}/{_lnme}/{_vnme}/info.json", _str, true);
2023-03-05 07:16:44 +01:00
}
2025-01-09 08:28:19 +01:00
}
2022-01-13 05:24:03 +01:00
2025-01-09 08:28:19 +01:00
for( var i = 0, n = ds_list_size(NODE_PB_CATEGORY); i < n; i++ ) {
var _cat = NODE_PB_CATEGORY[| i];
2023-12-09 09:00:35 +01:00
2025-01-09 08:28:19 +01:00
var _lnme = _cat.name;
var _list = _cat.list;
directory_verify($"{_dir}/{_lnme}");
2024-01-22 10:26:25 +01:00
2025-01-09 08:28:19 +01:00
for( var j = 0, m = ds_list_size(_list); j < m; j++ ) {
var _node = _list[| j];
if(!is(_node, NodeObject)) continue;
2023-12-05 09:51:24 +01:00
2025-01-09 08:28:19 +01:00
var _nme = _node.nodeName;
var _vnme = filename_name_validate(_nme);
2023-12-05 09:51:24 +01:00
2025-01-09 08:28:19 +01:00
var _str = _node.serialize();
directory_verify($"{_dir}/pb_{_lnme}/{_vnme}");
json_save_struct($"{_dir}/pb_{_lnme}/{_vnme}/info.json", _str, true);
}
2025-01-09 08:28:19 +01:00
}
2025-01-09 05:28:30 +01:00
2025-01-09 08:28:19 +01:00
for( var i = 0, n = ds_list_size(NODE_PCX_CATEGORY); i < n; i++ ) {
var _cat = NODE_PCX_CATEGORY[| i];
2025-01-09 05:28:30 +01:00
var _lnme = _cat.name;
var _list = _cat.list;
directory_verify($"{_dir}/{_lnme}");
for( var j = 0, m = ds_list_size(_list); j < m; j++ ) {
var _node = _list[| j];
if(!is(_node, NodeObject)) continue;
2025-01-09 08:28:19 +01:00
var _nme = _node.nodeName;
2025-01-09 05:28:30 +01:00
var _vnme = filename_name_validate(_nme);
var _str = _node.serialize();
2025-01-09 08:28:19 +01:00
directory_verify($"{_dir}/pcx_{_lnme}/{_vnme}");
json_save_struct($"{_dir}/pcx_{_lnme}/{_vnme}/info.json", _str, true);
2025-01-09 05:28:30 +01:00
}
}
}