Lua update, array processor

This commit is contained in:
Tanasart 2023-11-23 08:32:26 +07:00
parent 9235a9f9fe
commit f9e5e3ea9c
12 changed files with 172 additions and 144 deletions

View file

@ -1,4 +1,4 @@
function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) {
function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) { #region
if(_path == "") return noone;
var _map = json_load_struct(_path);
@ -12,9 +12,9 @@ function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) {
log_message("FILE", "append file " + _path, THEME.noti_icon_file_load);
return node_create;
}
} #endregion
function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) {
function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { #region
static log = false;
UNDO_HOLDING = true;
@ -149,13 +149,13 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) {
}
return node_create;
}
} #endregion
function GetAppendID(old_id) {
function GetAppendID(old_id) { #region
if(old_id == noone) return noone;
if(ds_map_exists(APPEND_MAP, old_id))
return APPEND_MAP[? old_id];
print("Get append ID error: " + string(old_id));
return noone;
}
} #endregion

View file

@ -1,4 +1,4 @@
function LOAD(safe = false) {
function LOAD(safe = false) { #region
if(DEMO) return false;
var path = get_open_filename("Pixel Composer PROJECT (.pxc)|*.pxc", "");
@ -8,9 +8,9 @@ function LOAD(safe = false) {
gc_collect();
var proj = LOAD_PATH(path, false, safe);
}
} #endregion
function TEST_PATH(path) {
function TEST_PATH(path) { #region
TESTING = true;
TEST_ERROR = true;
@ -19,9 +19,9 @@ function TEST_PATH(path) {
PANEL_GRAPH.setProject(PROJECT);
__LOAD_PATH(path);
}
} #endregion
function LOAD_PATH(path, readonly = false, safe_mode = false) {
function LOAD_PATH(path, readonly = false, safe_mode = false) { #region
for( var i = 0, n = array_length(PROJECTS); i < n; i++ )
if(PROJECTS[i].path == path) return;
@ -47,9 +47,9 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) {
setFocus(PANEL_GRAPH.panel);
return PROJECT;
}
} #endregion
function __LOAD_PATH(path, readonly = false, override = false) {
function __LOAD_PATH(path, readonly = false, override = false) { #region
if(DEMO) return false;
if(!file_exists(path)) {
@ -250,4 +250,24 @@ function __LOAD_PATH(path, readonly = false, override = false) {
PANEL_GRAPH.toCenterNode();
return true;
}
} #endregion
function __IMPORT_ZIP() { #region
var path = get_open_filename("Pixel Composer portable project (.zip)|*.zip", "");
var _fname = filename_name_only(path);
var _fext = filename_ext(path);
if(_fext != ".zip") return false;
directory_verify(TEMPDIR + "proj/");
var _dir = TEMPDIR + "proj/" + _fname;
directory_create(_dir);
zip_unzip(path, _dir);
var _f = file_find_first(_dir + "/*.pxc", fa_none);
var _proj = $"{_dir}/{_f}";
print(_proj);
if(!file_exists(_proj)) return false;
LOAD_PATH(_proj, true);
} #endregion

View file

@ -42,10 +42,10 @@ function Node_3D_Depth(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var right_y = sin(x_rad) * sin(y_rad) * cos(z_rad) - cos(x_rad) * sin(z_rad);
var right_z = cos(x_rad) * sin(y_rad) * cos(z_rad) + sin(x_rad) * sin(z_rad);
print($"POS: {_cx}, {_cy}, {_cz}");
print($"UP: {up_x}, {up_y}, {up_z}");
print($"RIGHT: {right_x}, {right_y}, {right_z}");
print("");
//print($"POS: {_cx}, {_cy}, {_cz}");
//print($"UP: {up_x}, {up_y}, {up_z}");
//print($"RIGHT: {right_x}, {right_y}, {right_z}");
//print("");
surface_set_shader(_outSurf, sh_3d_depth);
DRAW_CLEAR

View file

@ -119,13 +119,13 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
use_display_list = true;
if(obj_raw == noone) return;
var txt = $"========== OBJ import ==========\n";
txt += $"Vertex counts: {obj_raw.vertex_count}\n";
txt += $"Object counts: {obj_raw.object_counts}\n";
txt += $"Material counts: {array_length(obj_raw.materials)}\n";
txt += $"Model BBOX: {obj_raw.model_size}\n";
txt += $"Load completed in {(get_timer() - obj_read_time) / 1000} ms\n";
print(txt);
//var txt = $"========== OBJ import ==========\n";
//txt += $"Vertex counts: {obj_raw.vertex_count}\n";
//txt += $"Object counts: {obj_raw.object_counts}\n";
//txt += $"Material counts: {array_length(obj_raw.materials)}\n";
//txt += $"Model BBOX: {obj_raw.model_size}\n";
//txt += $"Load completed in {(get_timer() - obj_read_time) / 1000} ms\n";
//print(txt);
var span = max(abs(obj_raw.model_size.x), abs(obj_raw.model_size.y), abs(obj_raw.model_size.z));
if(span > 10) noti_warning($"The model is tool large to display properly ({span}u). Scale the model down to preview.");

View file

@ -551,6 +551,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static getGraphPreviewSurface = function() { #region
var _output_junc = outputs[| preview_channel];
for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) {
if(!nodes[| i].active) continue;
if(is_instanceof(nodes[| i], Node_Group_Thumbnail))

View file

@ -6,6 +6,9 @@ function Node_Group_Thumbnail(_x, _y, _group = noone) : Node(_x, _y, _group) con
inputs[| 0] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
.setVisible(true, true);
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
.setVisible(false, false);
static getGraphPreviewSurface = function() { #region
return getInputData(0);
} #endregion

View file

@ -15,19 +15,6 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 4] = nodeValue("Execute on frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)
static createNewInput = function() {
var index = ds_list_size(inputs);
inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, { data: [ "Number", "String", "Surface", "Struct" ], update_hover: false });
inputs[| index + 1].editWidget.interactable = false;
inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setVisible(true, true);
inputs[| index + 2].editWidget.interactable = false;
}
outputs[| 0] = nodeValue("Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone );
outputs[| 1] = nodeValue("Return value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, 0);
@ -51,9 +38,20 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
error_notification = noone;
compiled = false;
if(!LOADING && !APPENDING) createNewInput();
static createNewInput = function() { #region
var index = ds_list_size(inputs);
inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
static stepBegin = function() {
inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, { data: [ "Number", "String", "Surface", "Struct" ], update_hover: false });
inputs[| index + 1].editWidget.interactable = false;
inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setVisible(true, true);
inputs[| index + 2].editWidget.interactable = false;
} if(!LOADING && !APPENDING) createNewInput(); #endregion
static stepBegin = function() { #region
if(PROJECT.animator.frame_progress)
setRenderStatus(false);
@ -77,15 +75,15 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
case 1 : outputs[| 1].setType(VALUE_TYPE.text); break;
case 2 : outputs[| 1].setType(VALUE_TYPE.struct); break;
}
}
} #endregion
static getState = function() {
static getState = function() { #region
if(inputs[| 3].isLeaf())
return lua_state;
return inputs[| 3].value_from.node.getState();
}
} #endregion
static refreshDynamicInput = function() {
static refreshDynamicInput = function() { #region
var _in = ds_list_create();
for( var i = 0; i < input_fix_len; i++ )
@ -127,13 +125,13 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs = _in;
createNewInput();
}
} #endregion
static onValueFromUpdate = function(index) {
static onValueFromUpdate = function(index) { #region
if(index == 0 || index == 2) compiled = false;
}
} #endregion
static onValueUpdate = function(index = 0) {
static onValueUpdate = function(index = 0) { #region
if(index == 0 || index == 2) compiled = false;
if(index == 3) {
@ -149,16 +147,16 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
compiled = false;
refreshDynamicInput();
}
} #endregion
static step = function() {
static step = function() { #region
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
var name = getInputData(i + 0);
inputs[| i + 2].name = name;
}
}
} #endregion
static update = function(frame = CURRENT_FRAME) {
static update = function(frame = CURRENT_FRAME) { #region
if(!compiled) return;
//if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return;
@ -172,12 +170,6 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length )
array_push(argument_val, getInputData(i + 2));
//if(CURRENT_FRAME == 0) { //refresh state on the first frame
// lua_state_destroy(lua_state);
// lua_state = lua_create();
// addCode();
//}
lua_projectData(getState());
var res = 0;
@ -188,9 +180,9 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
outputs[| 1].setValue(res);
}
} #endregion
static addCode = function() {
static addCode = function() { #region
var _func = getInputData(0);
var _code = getInputData(2);
argument_name = [];
@ -207,15 +199,14 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
lua_code += ")\n";
lua_code += _code;
lua_code += "\nend";
//print(lua_code);
lua_add_code(getState(), lua_code);
}
} #endregion
insp1UpdateTooltip = __txt("Compile");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() { //compile
static onInspector1Update = function() { #region
var thrd = inputs[| 3].value_from;
if(thrd == noone) {
doCompile();
@ -223,9 +214,9 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
thrd.node.onInspector1Update();
}
} #endregion
static doCompile = function() {
static doCompile = function() { #region
compiled = true;
addCode();
@ -236,9 +227,9 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
doUpdate();
}
} #endregion
static doApplyDeserialize = function() {
static doApplyDeserialize = function() { #region
refreshDynamicInput();
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
@ -256,11 +247,13 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default);
}
}
static onDestroy = function() {
doCompile();
} #endregion
static onDestroy = function() { #region
lua_state_destroy(lua_state);
if(error_notification != noone)
noti_remove(error_notification);
}
} #endregion
}

View file

@ -24,7 +24,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
error_notification = noone;
compiled = false;
static stepBegin = function() {
static stepBegin = function() { #region
var _type = getInputData(1);
if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress && (CURRENT_FRAME == 0 || _type == 1))
@ -43,22 +43,22 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
noti_remove(error_notification);
error_notification = noone;
}
}
} #endregion
static getState = function() {
static getState = function() { #region
if(inputs[| 2].isLeaf()) return lua_state;
return inputs[| 2].value_from.node.getState();
}
} #endregion
static onValueFromUpdate = function(index) {
static onValueFromUpdate = function(index) { #region
if(index == 0 || index == 2) compiled = false;
}
} #endregion
static onValueUpdate = function(index = 0) {
static onValueUpdate = function(index = 0) { #region
if(index == 0 || index == 2) compiled = false;
}
} #endregion
static update = function(frame = CURRENT_FRAME) {
static update = function(frame = CURRENT_FRAME) { #region
if(!compiled) return;
//if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return;
@ -77,9 +77,9 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
try { lua_add_code(getState(), _code); }
catch(e) { noti_warning(exception_print(e),, self); }
}
}
} #endregion
static onInspector1Update = function() { //compile
static onInspector1Update = function() { #region
var thrd = inputs[| 2].value_from;
if(thrd == noone) {
doCompile();
@ -87,9 +87,9 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
}
thrd.node.onInspector1Update();
}
} #endregion
static doCompile = function() {
static doCompile = function() { #region
compiled = true;
for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) {
@ -99,11 +99,13 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
}
doUpdate();
}
} #endregion
static onDestroy = function() {
static doApplyDeserialize = function() { doCompile(); }
static onDestroy = function() { #region
lua_state_destroy(lua_state);
if(error_notification != noone)
noti_remove(error_notification);
}
} #endregion
}

View file

@ -15,19 +15,6 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 4] = nodeValue("Execute on frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)
static createNewInput = function() {
var index = ds_list_size(inputs);
inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, { data: [ "Number", "String", "Surface", "Struct" ], update_hover: false });
inputs[| index + 1].editWidget.interactable = false;
inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setVisible(true, true);
inputs[| index + 2].editWidget.interactable = false;
}
outputs[| 0] = nodeValue("Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone );
outputs[| 1] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -52,9 +39,20 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
error_notification = noone;
compiled = false;
if(!LOADING && !APPENDING) createNewInput();
static createNewInput = function() { #region
var index = ds_list_size(inputs);
inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
static stepBegin = function() {
inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, { data: [ "Number", "String", "Surface", "Struct" ], update_hover: false });
inputs[| index + 1].editWidget.interactable = false;
inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setVisible(true, true);
inputs[| index + 2].editWidget.interactable = false;
} if(!LOADING && !APPENDING) createNewInput(); #endregion
static stepBegin = function() { #region
if(PROJECT.animator.frame_progress)
setRenderStatus(false);
@ -71,15 +69,15 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
noti_remove(error_notification);
error_notification = noone;
}
}
} #endregion
static getState = function() {
static getState = function() { #region
if(inputs[| 3].isLeaf())
return lua_state;
return inputs[| 3].value_from.node.getState();
}
} #endregion
static refreshDynamicInput = function() {
static refreshDynamicInput = function() { #region
var _in = ds_list_create();
for( var i = 0; i < input_fix_len; i++ )
@ -121,13 +119,13 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs = _in;
createNewInput();
}
} #endregion
static onValueFromUpdate = function(index) {
static onValueFromUpdate = function(index) { #region
if(index == 0 || index == 2) compiled = false;
}
} #endregion
static onValueUpdate = function(index = 0) {
static onValueUpdate = function(index = 0) { #region
if(index == 0 || index == 2) compiled = false;
if(index == 3) {
@ -143,16 +141,16 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
compiled = false;
refreshDynamicInput();
}
} #endregion
static step = function() {
static step = function() { #region
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
var name = getInputData(i + 0);
inputs[| i + 2].name = name;
}
}
} #endregion
static update = function(frame = CURRENT_FRAME) {
static update = function(frame = CURRENT_FRAME) { #region
if(!compiled) return;
//if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return;
@ -184,9 +182,9 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
surface_reset_target();
outputs[| 1].setValue(_outSurf);
}
} #endregion
static addCode = function() {
static addCode = function() { #region
var _func = getInputData(0);
var _code = getInputData(2);
argument_name = [];
@ -205,12 +203,12 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
lua_code += "\nend";
lua_add_code(getState(), lua_code);
}
} #endregion
insp1UpdateTooltip = __txt("Compile");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() { //compile
static onInspector1Update = function() { #region
var thrd = inputs[| 3].value_from;
if(thrd == noone) {
doCompile();
@ -218,9 +216,9 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
thrd.node.onInspector1Update();
}
} #endregion
static doCompile = function() {
static doCompile = function() { #region
addCode();
compiled = true;
@ -231,9 +229,9 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
doUpdate();
}
} #endregion
static doApplyDeserialize = function() {
static doApplyDeserialize = function() { #region
refreshDynamicInput();
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
@ -251,11 +249,13 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default);
}
}
static onDestroy = function() {
doCompile();
} #endregion
static onDestroy = function() { #region
lua_state_destroy(lua_state);
if(error_notification != noone)
noti_remove(error_notification);
}
} #endregion
}

View file

@ -49,6 +49,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
if(!_n.isArray()) return _in;
var _aIndex = _arr;
if(!is_array(_arr)) return 0;
switch(attributes.array_process) {
case ARRAY_PROCESS.loop : _aIndex = safe_mod(_arr, array_length(_in)); break;
case ARRAY_PROCESS.hold : _aIndex = min(_arr, array_length(_in) - 1); break;

View file

@ -32,6 +32,13 @@ function Panel_Menu() : PanelContent() constructor {
return submenuCall(_dat, arr);
}).setIsShelf(),
menuItem(__txtx("panel_menu_auto_save_folder", "Open autosave folder"), function() { shellOpenExplorer(DIRECTORY + "autosave"); }, THEME.save_auto),
menuItem(__txt("Import"), function(_dat) {
var arr = [
menuItem(__txt("Portable project (.zip)") + "...", function() { __IMPORT_ZIP(); }),
];
return submenuCall(_dat, arr);
}).setIsShelf(),
menuItem(__txt("Export"), function(_dat) {
var arr = [
menuItem(__txt("Portable project (.zip)") + "...", function() { exportPortable(PROJECT); }),

View file

@ -1,16 +1,16 @@
globalvar SAVING;
SAVING = false;
function NEW() {
function NEW() { #region
PROJECT = new Project();
array_push(PROJECTS, PROJECT);
var graph = new Panel_Graph(PROJECT);
PANEL_GRAPH.panel.setContent(graph, true);
PANEL_GRAPH = graph;
}
} #endregion
function save_serialize(project = PROJECT, _outMap = false) {
function save_serialize(project = PROJECT, _outMap = false) { #region
var _map = {};
_map.version = SAVE_VERSION;
@ -57,9 +57,9 @@ function save_serialize(project = PROJECT, _outMap = false) {
if(_outMap) return _map;
return PREFERENCES.save_file_minify? json_stringify_minify(_map) : json_stringify(_map, true);
}
} #endregion
function SET_PATH(project, path) {
function SET_PATH(project, path) { #region
if(path == "") {
project.readonly = false;
} else if(!project.readonly) {
@ -73,22 +73,22 @@ function SET_PATH(project, path) {
}
project.path = path;
}
} #endregion
function SAVE_ALL() {
function SAVE_ALL() { #region
for( var i = 0, n = array_length(PROJECTS); i < n; i++ )
SAVE(PROJECTS[i]);
}
} #endregion
function SAVE(project = PROJECT) {
function SAVE(project = PROJECT) { #region
if(DEMO) return false;
if(project.path == "" || project.readonly)
return SAVE_AS(project);
return SAVE_AT(project, project.path);
}
} #endregion
function SAVE_AS(project = PROJECT) {
function SAVE_AS(project = PROJECT) { #region
if(DEMO) return false;
var path = get_save_filename("Pixel Composer project (.pxc)|*.pxc", "");
@ -104,9 +104,9 @@ function SAVE_AS(project = PROJECT) {
SET_PATH(project, path);
return true;
}
} #endregion
function SAVE_AT(project = PROJECT, path = "", log = "save at ") {
function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region
if(DEMO) return false;
SAVING = true;
@ -125,11 +125,11 @@ function SAVE_AT(project = PROJECT, path = "", log = "save at ") {
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
return true;
}
} #endregion
/////////////////////////////////////////////////////// COLLECTION ///////////////////////////////////////////////////////
function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) {
function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { #region
var _content = {};
_content.version = SAVE_VERSION;
@ -171,9 +171,9 @@ function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, c
log_message("COLLECTION", "save collection at " + _path, THEME.noti_icon_file_save);
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
}
} #endregion
function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) {
function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { #region
if(save_surface) {
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
if(is_surface(preview_surface)) {
@ -206,9 +206,9 @@ function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, co
log_message("COLLECTION", "save collection at " + _path, THEME.noti_icon_file_save);
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
}
} #endregion
function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_GRAPH.getCurrentContext()) {
function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_GRAPH.getCurrentContext()) { #region
if(struct_has(_node, "nodes")) {
for(var i = 0; i < ds_list_size(_node.nodes); i++)
SAVE_NODE(_arr, _node.nodes[| i], dx, dy, scale, context);
@ -222,4 +222,4 @@ function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_G
if(m.group == c) m.group = noone;
array_push(_arr, m);
}
} #endregion