Pixel-Composer/scripts/testing_script/testing_script.gml

202 lines
4.8 KiB
Plaintext
Raw Normal View History

2024-09-16 09:29:37 +02:00
function __test_update_current_collections() {
2023-01-01 02:06:02 +01:00
var st = ds_stack_create();
ds_stack_push(st, PANEL_COLLECTION.context);
print("---------- COLLECTION UPDATING STARTED ----------");
var sel = PANEL_GRAPH.getFocusingNode(), outj = noone;
2024-08-08 06:57:51 +02:00
if(sel != noone) outj = sel.outputs[0];
2023-01-01 02:06:02 +01:00
while(!ds_stack_empty(st)) {
var _st = ds_stack_pop(st);
for( var i = 0; i < ds_list_size(_st.content); i++ ) {
var _node = _st.content[| i];
2023-11-25 08:54:35 +01:00
print(" > Updating " + _node.meta_path);
var _map = json_load_struct(_node.meta_path);
_map.version = SAVE_VERSION;
json_save_struct(_node.meta_path, _map);
2023-11-25 08:54:35 +01:00
var _map = json_load_struct(_node.path);
_map.version = SAVE_VERSION;
json_save_struct(_node.path, _map);
2023-01-01 02:06:02 +01:00
}
for( var i = 0; i < ds_list_size(_st.subDir); i++ )
ds_stack_push(st, _st.subDir[| i]);
}
ds_stack_destroy(st);
print("---------- COLLECTION UPDATING ENDED ----------");
2024-09-16 09:29:37 +02:00
}
2023-02-14 02:51:14 +01:00
2024-09-16 09:29:37 +02:00
function __test_update_sample_projects() {
2023-01-17 08:11:55 +01:00
print("---------- PROJECT UPDATING STARTED ----------");
for( var i = 0; i < ds_list_size(SAMPLE_PROJECTS); i++ ) {
var _proj = SAMPLE_PROJECTS[| i];
2023-11-25 08:54:35 +01:00
print(" > Updating " + _proj.meta_path);
var _map = json_load_struct(_proj.meta_path);
_map.version = SAVE_VERSION;
json_save_struct(_proj.meta_path, _map);
var _map = json_load_struct(_proj.path);
_map.version = SAVE_VERSION;
json_save_struct(_proj.path, _map);
2023-01-17 08:11:55 +01:00
}
print("---------- PROJECT UPDATING ENDED ----------");
2024-09-16 09:29:37 +02:00
}
2023-01-01 02:06:02 +01:00
2024-09-16 09:29:37 +02:00
function __test_load_current_collections() {
2023-01-01 02:06:02 +01:00
var st = ds_stack_create();
ds_stack_push(st, PANEL_COLLECTION.context);
var xx = 0;
var yy = 0;
var col = 6;
var ind = 0;
print("---------- COLLECTION TESTING STARTED ----------");
var sel = PANEL_GRAPH.getFocusingNode();
2024-08-08 06:57:51 +02:00
var outj = sel == noone? noone : sel.outputs[0];
2023-01-01 02:06:02 +01:00
while(!ds_stack_empty(st)) {
var _st = ds_stack_pop(st);
for( var i = 0; i < ds_list_size(_st.content); i++ ) {
var _node = _st.content[| i];
print(" > Building " + _node.path);
var coll = APPEND(_node.path);
if(coll == noone) continue;
if(is_struct(coll)) {
coll.x = xx;
coll.y = yy;
if(outj)
2024-08-08 06:57:51 +02:00
for( var k = 0; k < array_length(coll.inputs); k++ ) {
if(coll.inputs[k].type != VALUE_TYPE.surface) continue;
coll.inputs[k].setFrom(outj);
2023-01-01 02:06:02 +01:00
break;
}
} else {
for( var j = 0; j < array_length(coll); j++ ) {
coll[j].x = xx;
coll[j].y = yy;
2023-01-01 02:06:02 +01:00
if(outj)
2024-08-08 06:57:51 +02:00
for( var k = 0; k < array_length(coll[j].inputs); k++ ) {
if(coll[j].inputs[k].type != VALUE_TYPE.surface) continue;
coll[j].inputs[k].setFrom(outj);
2023-01-01 02:06:02 +01:00
break;
}
}
}
if(++ind > col) {
ind = 0;
xx = 0;
2023-01-09 03:14:20 +01:00
yy += 160;
2023-01-01 02:06:02 +01:00
} else
2023-01-09 03:14:20 +01:00
xx += 160;
2023-01-01 02:06:02 +01:00
}
for( var i = 0; i < ds_list_size(_st.subDir); i++ )
ds_stack_push(st, _st.subDir[| i]);
}
ds_stack_destroy(st);
print("---------- COLLECTION TESTING ENDED ----------");
2024-09-16 09:29:37 +02:00
}
2023-02-14 02:51:14 +01:00
2024-09-16 09:29:37 +02:00
function __test_load_all_nodes() {
2024-08-20 10:15:53 +02:00
var amo = ds_map_size(ALL_NODES);
var k = ds_map_find_first(ALL_NODES);
var xx = 0;
var yy = 0;
var col = 10;
var ind = 0;
var sel = PANEL_GRAPH.getFocusingNode();
2024-08-08 06:57:51 +02:00
var outj = sel == noone? noone : sel.outputs[0];
2023-02-14 02:51:14 +01:00
var index = 0;
var indst = 0; // 150 -- 175 -- 200
var inded = 1000;
LOADING = true;
repeat(amo) {
if(index > inded) break;
if(index > indst) {
2023-03-08 14:59:54 +01:00
var node = ALL_NODES[? k];
k = ds_map_find_next(ALL_NODES, k);
if(!node.testable) continue;
2023-08-04 13:12:32 +02:00
print($"==== Building {node.node} ====");
2023-03-08 14:59:54 +01:00
var b = node.build(xx, yy);
2023-02-14 02:51:14 +01:00
if(++ind > col) {
ind = 0;
xx = 0;
yy += 160;
} else
xx += 160;
if(b) {
if(outj)
2024-08-08 06:57:51 +02:00
for( var i = 0; i < array_length(b.inputs); i++ ) {
if(b.inputs[i].type != VALUE_TYPE.surface) continue;
b.inputs[i].setFrom(outj);
2023-02-14 02:51:14 +01:00
break;
}
}
}
index++;
}
LOADING = false;
2024-09-16 09:29:37 +02:00
}
2023-02-14 02:51:14 +01:00
2024-09-16 09:29:37 +02:00
function __test_metadata_current_collections() {
2023-02-14 02:51:14 +01:00
var st = ds_stack_create();
ds_stack_push(st, PANEL_COLLECTION.context);
print("---------- COLLECTION UPDATING STARTED ----------");
var sel = PANEL_GRAPH.getFocusingNode(), outj = noone;
2023-11-27 14:50:20 +01:00
var _meta = PROJECT.meta.serialize();
2024-08-08 06:57:51 +02:00
if(sel != noone) outj = sel.outputs[0];
2023-02-14 02:51:14 +01:00
while(!ds_stack_empty(st)) {
var _st = ds_stack_pop(st);
for( var i = 0; i < ds_list_size(_st.content); i++ ) {
var _node = _st.content[| i];
print(" > Updating " + _node.path);
2023-08-04 13:12:32 +02:00
json_save_struct(_node.meta_path, _meta, true);
2023-02-14 02:51:14 +01:00
}
for( var i = 0; i < ds_list_size(_st.subDir); i++ )
ds_stack_push(st, _st.subDir[| i]);
}
ds_stack_destroy(st);
print("---------- COLLECTION UPDATING ENDED ----------");
2024-09-16 09:29:37 +02:00
}
2023-11-23 13:39:35 +01:00
2024-09-16 09:29:37 +02:00
function __test_generate_theme() {
2023-11-23 13:39:35 +01:00
var _txt = "function Theme() constructor {\n";
var _spr = struct_get_names(THEME);
for( var i = 0, n = array_length(_spr); i < n; i++ )
_txt += $"\t{_spr[i]} = noone;\n";
_txt += "}";
clipboard_set_text(_txt);
2024-09-16 09:29:37 +02:00
}