mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
- Reduce the amount of data unpacking on start.
This commit is contained in:
parent
6e73ae5855
commit
2f8f36c4ae
28 changed files with 588 additions and 652 deletions
|
@ -1164,6 +1164,7 @@
|
||||||
{"name":"widget","order":25,"path":"scripts/widget/widget.yy",},
|
{"name":"widget","order":25,"path":"scripts/widget/widget.yy",},
|
||||||
{"name":"node_VFX_effect_vortex","order":6,"path":"scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy",},
|
{"name":"node_VFX_effect_vortex","order":6,"path":"scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy",},
|
||||||
{"name":"s_node_skew","order":11,"path":"sprites/s_node_skew/s_node_skew.yy",},
|
{"name":"s_node_skew","order":11,"path":"sprites/s_node_skew/s_node_skew.yy",},
|
||||||
|
{"name":"version_checker","order":11,"path":"scripts/version_checker/version_checker.yy",},
|
||||||
{"name":"s_node_feedback_input","order":10,"path":"sprites/s_node_feedback_input/s_node_feedback_input.yy",},
|
{"name":"s_node_feedback_input","order":10,"path":"sprites/s_node_feedback_input/s_node_feedback_input.yy",},
|
||||||
{"name":"s_node_path_builder","order":9,"path":"sprites/s_node_path_builder/s_node_path_builder.yy",},
|
{"name":"s_node_path_builder","order":9,"path":"sprites/s_node_path_builder/s_node_path_builder.yy",},
|
||||||
{"name":"Obj_FirebaseFirestore_Document_Listener","order":4,"path":"objects/Obj_FirebaseFirestore_Document_Listener/Obj_FirebaseFirestore_Document_Listener.yy",},
|
{"name":"Obj_FirebaseFirestore_Document_Listener","order":4,"path":"objects/Obj_FirebaseFirestore_Document_Listener/Obj_FirebaseFirestore_Document_Listener.yy",},
|
||||||
|
|
|
@ -1852,6 +1852,7 @@
|
||||||
{"id":{"name":"widget","path":"scripts/widget/widget.yy",},},
|
{"id":{"name":"widget","path":"scripts/widget/widget.yy",},},
|
||||||
{"id":{"name":"node_VFX_effect_vortex","path":"scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy",},},
|
{"id":{"name":"node_VFX_effect_vortex","path":"scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.yy",},},
|
||||||
{"id":{"name":"s_node_skew","path":"sprites/s_node_skew/s_node_skew.yy",},},
|
{"id":{"name":"s_node_skew","path":"sprites/s_node_skew/s_node_skew.yy",},},
|
||||||
|
{"id":{"name":"version_checker","path":"scripts/version_checker/version_checker.yy",},},
|
||||||
{"id":{"name":"s_node_feedback_input","path":"sprites/s_node_feedback_input/s_node_feedback_input.yy",},},
|
{"id":{"name":"s_node_feedback_input","path":"sprites/s_node_feedback_input/s_node_feedback_input.yy",},},
|
||||||
{"id":{"name":"s_node_path_builder","path":"sprites/s_node_path_builder/s_node_path_builder.yy",},},
|
{"id":{"name":"s_node_path_builder","path":"sprites/s_node_path_builder/s_node_path_builder.yy",},},
|
||||||
{"id":{"name":"Obj_FirebaseFirestore_Document_Listener","path":"objects/Obj_FirebaseFirestore_Document_Listener/Obj_FirebaseFirestore_Document_Listener.yy",},},
|
{"id":{"name":"Obj_FirebaseFirestore_Document_Listener","path":"objects/Obj_FirebaseFirestore_Document_Listener/Obj_FirebaseFirestore_Document_Listener.yy",},},
|
||||||
|
|
|
@ -61,8 +61,7 @@ event_inherited();
|
||||||
function newPresetFromNode(name) {
|
function newPresetFromNode(name) {
|
||||||
if(node == noone) return;
|
if(node == noone) return;
|
||||||
var dir = $"{DIRECTORY}Presets/{instanceof(node)}/";
|
var dir = $"{DIRECTORY}Presets/{instanceof(node)}/";
|
||||||
if(!directory_exists(dir))
|
directory_verify(dir);
|
||||||
directory_create(dir);
|
|
||||||
|
|
||||||
var pth = dir + name + ".json";
|
var pth = dir + name + ".json";
|
||||||
var map = node.serialize(true, true);
|
var map = node.serialize(true, true);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
}
|
}
|
||||||
show_debug_message("App directory: " + string(APP_DIRECTORY));
|
show_debug_message("App directory: " + string(APP_DIRECTORY));
|
||||||
|
|
||||||
if(!directory_exists(APP_DIRECTORY)) directory_create(APP_DIRECTORY);
|
directory_verify(APP_DIRECTORY);
|
||||||
|
|
||||||
var perstPath = APP_DIRECTORY + "persistPreference.json";
|
var perstPath = APP_DIRECTORY + "persistPreference.json";
|
||||||
if(file_exists(perstPath)) {
|
if(file_exists(perstPath)) {
|
||||||
|
@ -45,6 +45,8 @@
|
||||||
directory_set_current_working(DIRECTORY);
|
directory_set_current_working(DIRECTORY);
|
||||||
|
|
||||||
METADATA = __getdefaultMetaData();
|
METADATA = __getdefaultMetaData();
|
||||||
|
|
||||||
|
//print($"===================== WORKING DIRECTORIES =====================\n\t{working_directory}\n\t{DIRECTORY}");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Set up
|
#region Set up
|
||||||
|
@ -52,8 +54,7 @@
|
||||||
PREF_LOAD();
|
PREF_LOAD();
|
||||||
|
|
||||||
var dir = string(DIRECTORY) + "log";
|
var dir = string(DIRECTORY) + "log";
|
||||||
if(!directory_exists(dir))
|
directory_verify(dir);
|
||||||
directory_create(dir);
|
|
||||||
|
|
||||||
log_clear();
|
log_clear();
|
||||||
log_newline();
|
log_newline();
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
|
|
||||||
log_message("SESSION", "> init Ins Renderer"); __initInstanceRenderer();
|
log_message("SESSION", "> init Ins Renderer"); __initInstanceRenderer();
|
||||||
|
|
||||||
setPanel();
|
__initPanel();
|
||||||
loadAddon();
|
loadAddon();
|
||||||
|
|
||||||
if(file_exists("icon.png"))
|
if(file_exists("icon.png"))
|
||||||
|
|
|
@ -51,7 +51,7 @@ if(PROJECT.active && !PROJECT.safeMode) {
|
||||||
HOTKEY_BLOCK = false;
|
HOTKEY_BLOCK = false;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region coroutine
|
#region GIF builder
|
||||||
for( var i = 0; i < ds_list_size(GIF_READER); i++ ) {
|
for( var i = 0; i < ds_list_size(GIF_READER); i++ ) {
|
||||||
var _reader = GIF_READER[| i];
|
var _reader = GIF_READER[| i];
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,7 @@ _HOVERING_ELEMENT = noone;
|
||||||
if(PROJECT.modified && PREFERENCES.auto_save_time > 0 && AUTO_SAVE_TIMER > PREFERENCES.auto_save_time) {
|
if(PROJECT.modified && PREFERENCES.auto_save_time > 0 && AUTO_SAVE_TIMER > PREFERENCES.auto_save_time) {
|
||||||
AUTO_SAVE_TIMER = 0;
|
AUTO_SAVE_TIMER = 0;
|
||||||
var loc = DIRECTORY + "Autosave/";
|
var loc = DIRECTORY + "Autosave/";
|
||||||
if(!directory_exists(loc))
|
directory_verify(loc);
|
||||||
directory_create(loc);
|
|
||||||
|
|
||||||
var fname = string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), "") +
|
var fname = string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), "") +
|
||||||
"_autosave" + string(current_year) + "-" +
|
"_autosave" + string(current_year) + "-" +
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
function __addonDefault(root) {
|
function __addonDefault(root) {
|
||||||
var _l = root + "/version";
|
if(check_version($"{root}/version")) {
|
||||||
if(file_exists(_l)) {
|
log_message("THEME", "unzipping default addon to DIRECTORY.");
|
||||||
var res = json_load_struct(_l);
|
zip_unzip("data/Addons.zip", root);
|
||||||
if(res.version == BUILD_NUMBER) return;
|
|
||||||
}
|
}
|
||||||
json_save_struct(_l, { version: BUILD_NUMBER });
|
|
||||||
|
|
||||||
log_message("THEME", "unzipping default addon to DIRECTORY.");
|
|
||||||
zip_unzip("data/Addons.zip", root);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function __initAddon() {
|
function __initAddon() {
|
||||||
|
@ -16,11 +11,7 @@ function __initAddon() {
|
||||||
ADDONS = [];
|
ADDONS = [];
|
||||||
ADDONS_ON_START = [];
|
ADDONS_ON_START = [];
|
||||||
|
|
||||||
if(!directory_exists(dirPath)) {
|
directory_verify(dirPath);
|
||||||
directory_create(dirPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
__addonDefault(dirPath);
|
__addonDefault(dirPath);
|
||||||
|
|
||||||
var f = file_find_first(dirPath + "\\*", fa_directory);
|
var f = file_find_first(dirPath + "\\*", fa_directory);
|
||||||
|
|
|
@ -166,19 +166,13 @@ function Node_Custom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
||||||
|
|
||||||
function __initNodeCustom(list) { #region
|
function __initNodeCustom(list) { #region
|
||||||
var root = DIRECTORY + "Nodes";
|
var root = DIRECTORY + "Nodes";
|
||||||
if(!directory_exists(root)) directory_create(root);
|
directory_verify(root);
|
||||||
|
|
||||||
root += "/Custom";
|
root += "/Custom";
|
||||||
if(!directory_exists(root)) directory_create(root);
|
directory_verify(root);
|
||||||
|
|
||||||
var _l = root + "/version";
|
if(check_version($"{root}/version"))
|
||||||
if(file_exists(_l)) {
|
|
||||||
var res = json_load_struct(_l);
|
|
||||||
if(!is_struct(res) || !struct_has(res, "version") || res.version != BUILD_NUMBER)
|
|
||||||
zip_unzip("data/Nodes.zip", root);
|
|
||||||
} else
|
|
||||||
zip_unzip("data/Nodes.zip", root);
|
zip_unzip("data/Nodes.zip", root);
|
||||||
json_save_struct(_l, { version: BUILD_NUMBER });
|
|
||||||
|
|
||||||
var f = file_find_first(root + "/*", fa_directory);
|
var f = file_find_first(root + "/*", fa_directory);
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,9 @@
|
||||||
global.ACTIONS = [];
|
global.ACTIONS = [];
|
||||||
|
|
||||||
var root = DIRECTORY + "Actions";
|
var root = DIRECTORY + "Actions";
|
||||||
if(!directory_exists(root))
|
directory_verify(root);
|
||||||
directory_create(root);
|
|
||||||
|
|
||||||
zip_unzip("data/Actions.zip", DIRECTORY);
|
if(check_version($"{root}/version"))
|
||||||
|
|
||||||
return;
|
|
||||||
var _l = root + "/version";
|
|
||||||
if(file_exists(_l)) {
|
|
||||||
var res = json_load_struct(_l);
|
|
||||||
if(!is_struct(res) || !struct_has(res, "version") || res.version != BUILD_NUMBER)
|
|
||||||
zip_unzip("data/Actions.zip", DIRECTORY);
|
|
||||||
} else
|
|
||||||
zip_unzip("data/Actions.zip", DIRECTORY);
|
zip_unzip("data/Actions.zip", DIRECTORY);
|
||||||
json_save_struct(_l, { version: BUILD_NUMBER });
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
|
@ -6,17 +6,10 @@
|
||||||
ds_map_clear(global.ASSET_MAP);
|
ds_map_clear(global.ASSET_MAP);
|
||||||
|
|
||||||
var root = DIRECTORY + "Assets";
|
var root = DIRECTORY + "Assets";
|
||||||
if(!directory_exists(root))
|
directory_verify(root);
|
||||||
directory_create(root);
|
|
||||||
|
|
||||||
var _l = root + "/version";
|
if(check_version($"{root}/version"))
|
||||||
if(file_exists(_l)) {
|
|
||||||
var res = json_load_struct(_l);
|
|
||||||
if(!is_struct(res) || !struct_has(res, "version") || res.version != BUILD_NUMBER)
|
|
||||||
zip_unzip("data/Assets.zip", root);
|
|
||||||
} else
|
|
||||||
zip_unzip("data/Assets.zip", root);
|
zip_unzip("data/Assets.zip", root);
|
||||||
json_save_struct(_l, { version: BUILD_NUMBER });
|
|
||||||
|
|
||||||
global.ASSETS = new DirectoryObject("Assets", root);
|
global.ASSETS = new DirectoryObject("Assets", root);
|
||||||
global.ASSETS.scan([".png"]);
|
global.ASSETS.scan([".png"]);
|
||||||
|
|
|
@ -5,17 +5,10 @@ function __initCollection() {
|
||||||
COLLECTIONS = -1;
|
COLLECTIONS = -1;
|
||||||
|
|
||||||
var root = DIRECTORY + "Collections";
|
var root = DIRECTORY + "Collections";
|
||||||
if(!directory_exists(root))
|
directory_verify(root);
|
||||||
directory_create(root);
|
|
||||||
|
|
||||||
var _l = root + "/version";
|
if(check_version($"{root}/version"))
|
||||||
if(file_exists(_l)) {
|
|
||||||
var res = json_load_struct(_l);
|
|
||||||
if(!is_struct(res) || !struct_has(res, "version") || res.version != BUILD_NUMBER)
|
|
||||||
zip_unzip("data/Collections.zip", root);
|
|
||||||
} else
|
|
||||||
zip_unzip("data/Collections.zip", root);
|
zip_unzip("data/Collections.zip", root);
|
||||||
json_save_struct(_l, { version: BUILD_NUMBER });
|
|
||||||
|
|
||||||
refreshCollections();
|
refreshCollections();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
function __initFontFolder() {
|
function __initFontFolder() {
|
||||||
var root = DIRECTORY + "Fonts";
|
var root = DIRECTORY + "Fonts";
|
||||||
if(!directory_exists(root))
|
directory_verify(root);
|
||||||
directory_create(root);
|
|
||||||
}
|
}
|
|
@ -551,10 +551,10 @@ function gameframe_button_add_defaults() {
|
||||||
|
|
||||||
function gameframe_tools_rect__new(_x, _y, _w, _h) {
|
function gameframe_tools_rect__new(_x, _y, _w, _h) {
|
||||||
// gameframe_tools_rect__new(...:int)->gameframe_tools_rect
|
// gameframe_tools_rect__new(...:int)->gameframe_tools_rect
|
||||||
if (_x == undefined) _x = 0;
|
_x ??= 0;
|
||||||
if (_y == undefined) _y = 0;
|
_y ??= 0;
|
||||||
if (_w == undefined) _w = 0;
|
_w ??= 0;
|
||||||
if (_h == undefined) _h = 0;
|
_h ??= 0;
|
||||||
if (false) show_debug_message(argument[3]);
|
if (false) show_debug_message(argument[3]);
|
||||||
return [/* x: */_x, /* y: */_y, /* width: */_w, /* height: */_h];
|
return [/* x: */_x, /* y: */_y, /* width: */_w, /* height: */_h];
|
||||||
}
|
}
|
||||||
|
@ -674,7 +674,7 @@ function gameframe_restore(__force) {
|
||||||
/// gameframe_restore(_force:bool = false)
|
/// gameframe_restore(_force:bool = false)
|
||||||
/// @param {bool} [_force=false]
|
/// @param {bool} [_force=false]
|
||||||
/// @returns {void}
|
/// @returns {void}
|
||||||
if (__force == undefined) __force = false;
|
__force ??= false;
|
||||||
if (false) show_debug_message(argument[0]);
|
if (false) show_debug_message(argument[0]);
|
||||||
if (window_get_fullscreen()) {
|
if (window_get_fullscreen()) {
|
||||||
window_set_fullscreen(false);
|
window_set_fullscreen(false);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,9 +8,9 @@
|
||||||
var lfile = $"data/locale/en.zip";
|
var lfile = $"data/locale/en.zip";
|
||||||
var root = $"{DIRECTORY}Locale";
|
var root = $"{DIRECTORY}Locale";
|
||||||
|
|
||||||
if(!directory_exists(root))
|
directory_verify(root);
|
||||||
directory_create(root);
|
if(check_version($"{root}/version"))
|
||||||
zip_unzip(lfile, root);
|
zip_unzip(lfile, root);
|
||||||
|
|
||||||
loadLocale();
|
loadLocale();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,10 +100,10 @@
|
||||||
|
|
||||||
function __initNodeActions(list) {
|
function __initNodeActions(list) {
|
||||||
var root = $"{DIRECTORY}Actions";
|
var root = $"{DIRECTORY}Actions";
|
||||||
if(!directory_exists(root)) directory_create(root);
|
directory_verify(root);
|
||||||
|
|
||||||
root += "/Nodes";
|
root += "/Nodes";
|
||||||
if(!directory_exists(root)) directory_create(root);
|
directory_verify(root);
|
||||||
|
|
||||||
var f = file_find_first(root + "/*", 0);
|
var f = file_find_first(root + "/*", 0);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ function __generate_node_data() { #region
|
||||||
NODE_EXTRACT = true;
|
NODE_EXTRACT = true;
|
||||||
|
|
||||||
var dir = DIRECTORY + "Nodes/";
|
var dir = DIRECTORY + "Nodes/";
|
||||||
if(!directory_exists(dir)) directory_create(dir);
|
directory_verify(dir);
|
||||||
|
|
||||||
var data = {};
|
var data = {};
|
||||||
var junc = {};
|
var junc = {};
|
||||||
var locale = {};
|
var locale = {};
|
||||||
|
@ -122,7 +123,7 @@ function __generate_node_data() { #region
|
||||||
global.NODE_RELATION = {};
|
global.NODE_RELATION = {};
|
||||||
|
|
||||||
var _dir = DIRECTORY + "Nodes/Related";
|
var _dir = DIRECTORY + "Nodes/Related";
|
||||||
if(!directory_exists(_dir)) return;
|
directory_verify(_dir);
|
||||||
|
|
||||||
var f = file_find_first(_dir + "/*.json", fa_none);
|
var f = file_find_first(_dir + "/*.json", fa_none);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function Node_create_Image_gif(_x, _y, _group = noone) {
|
function Node_create_Image_gif(_x, _y, _group = noone) { #region
|
||||||
var path = "";
|
var path = "";
|
||||||
if(!LOADING && !APPENDING && !CLONING) {
|
if(!LOADING && !APPENDING && !CLONING) {
|
||||||
path = get_open_filename(".gif", "");
|
path = get_open_filename(".gif", "");
|
||||||
|
@ -11,9 +11,9 @@ function Node_create_Image_gif(_x, _y, _group = noone) {
|
||||||
node.doUpdate();
|
node.doUpdate();
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
function Node_create_Image_gif_path(_x, _y, path) {
|
function Node_create_Image_gif_path(_x, _y, path) { #region
|
||||||
if(!file_exists(path)) return noone;
|
if(!file_exists(path)) return noone;
|
||||||
|
|
||||||
var node = new Node_Image_gif(_x, _y, PANEL_GRAPH.getCurrentContext());
|
var node = new Node_Image_gif(_x, _y, PANEL_GRAPH.getCurrentContext());
|
||||||
|
@ -21,7 +21,7 @@ function Node_create_Image_gif_path(_x, _y, path) {
|
||||||
node.doUpdate();
|
node.doUpdate();
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Image GIF";
|
name = "Image GIF";
|
||||||
|
@ -131,6 +131,8 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
if(loading == 2 && spr_builder != noone && spr_builder.building()) {
|
if(loading == 2 && spr_builder != noone && spr_builder.building()) {
|
||||||
surfaces = [];
|
surfaces = [];
|
||||||
spr = spr_builder._spr;
|
spr = spr_builder._spr;
|
||||||
|
print($"{spr}: {sprite_get_width(spr)}, {sprite_get_height(spr)}");
|
||||||
|
|
||||||
triggerRender();
|
triggerRender();
|
||||||
loading = 0;
|
loading = 0;
|
||||||
|
|
||||||
|
@ -207,12 +209,11 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||||
if(loading) draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1);
|
if(loading) draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1);
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onDestroy = function() {
|
static onDestroy = function() { #region
|
||||||
if(sprite_exists(spr))
|
if(sprite_exists(spr)) sprite_flush(spr);
|
||||||
sprite_flush(spr);
|
} #endregion
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,96 +1,16 @@
|
||||||
function Node_PC_Balls(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
function Node_PC_Balls(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||||
name = "Pixel Cloud";
|
name = "Pixel Cloud";
|
||||||
|
|
||||||
shader = sh_pixel_cloud;
|
|
||||||
uniform_sed = shader_get_uniform(shader, "seed");
|
|
||||||
uniform_str = shader_get_uniform(shader, "strength");
|
|
||||||
uniform_dis = shader_get_uniform(shader, "dist");
|
|
||||||
|
|
||||||
uniform_map_use = shader_get_uniform(shader, "useMap");
|
|
||||||
uniform_map = shader_get_sampler_index(shader, "strengthMap");
|
|
||||||
|
|
||||||
uniform_grad_blend = shader_get_uniform(shader, "gradient_blend");
|
|
||||||
uniform_grad = shader_get_uniform(shader, "gradient_color");
|
|
||||||
uniform_grad_time = shader_get_uniform(shader, "gradient_time");
|
|
||||||
uniform_grad_key = shader_get_uniform(shader, "gradient_keys");
|
|
||||||
|
|
||||||
uniform_alpha = shader_get_uniform(shader, "alpha_curve");
|
|
||||||
uniform_alamo = shader_get_uniform(shader, "curve_amount");
|
|
||||||
uniform_rnd = shader_get_uniform(shader, "randomAmount");
|
|
||||||
|
|
||||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||||
|
|
||||||
inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(100000));
|
input_display_list = [ ];
|
||||||
|
|
||||||
inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
|
||||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01] });
|
|
||||||
|
|
||||||
inputs[| 3] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
|
||||||
|
|
||||||
inputs[| 4] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
|
|
||||||
|
|
||||||
inputs[| 5] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
|
|
||||||
|
|
||||||
inputs[| 6] = nodeValue("Alpha over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);
|
|
||||||
|
|
||||||
inputs[| 7] = nodeValue("Random blending", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
|
||||||
.setDisplay(VALUE_DISPLAY.slider);
|
|
||||||
|
|
||||||
inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
|
||||||
active_index = 8;
|
|
||||||
|
|
||||||
input_display_list = [ 8,
|
|
||||||
["Input", true], 0, 1,
|
|
||||||
["Movement", false], 5, 2, 3,
|
|
||||||
["Color", true], 4, 6, 7,
|
|
||||||
]
|
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||||
|
|
||||||
attribute_surface_depth();
|
attribute_surface_depth();
|
||||||
|
|
||||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||||
var _sed = _data[1];
|
var _sed = _data[0];
|
||||||
var _str = _data[2];
|
|
||||||
var _map = _data[3];
|
|
||||||
var _gra = _data[4];
|
|
||||||
var _dis = _data[5];
|
|
||||||
var _alp = _data[6];
|
|
||||||
var _rnd = _data[7];
|
|
||||||
|
|
||||||
var _grad = _gra.toArray();
|
|
||||||
var _grad_color = _grad[0];
|
|
||||||
var _grad_time = _grad[1];
|
|
||||||
|
|
||||||
surface_set_target(_outSurf);
|
|
||||||
DRAW_CLEAR
|
|
||||||
BLEND_OVERRIDE;
|
|
||||||
|
|
||||||
shader_set(shader);
|
|
||||||
shader_set_uniform_f(uniform_sed, _sed);
|
|
||||||
shader_set_uniform_f(uniform_str, _str);
|
|
||||||
shader_set_uniform_f(uniform_dis, _dis);
|
|
||||||
if(is_surface(_map)) {
|
|
||||||
shader_set_uniform_i(uniform_map_use, 1);
|
|
||||||
texture_set_stage(uniform_map, surface_get_texture(_map));
|
|
||||||
} else {
|
|
||||||
shader_set_uniform_i(uniform_map_use, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_set_uniform_i(uniform_grad_blend, _gra.type);
|
|
||||||
shader_set_uniform_f_array_safe(uniform_grad, _grad_color);
|
|
||||||
shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time);
|
|
||||||
shader_set_uniform_i(uniform_grad_key, array_length(_gra.keys));
|
|
||||||
|
|
||||||
shader_set_uniform_f_array_safe(uniform_alpha, _alp);
|
|
||||||
shader_set_uniform_i(uniform_alamo, array_length(_alp));
|
|
||||||
shader_set_uniform_f(uniform_rnd, _rnd);
|
|
||||||
|
|
||||||
draw_surface_safe(_data[0], 0, 0);
|
|
||||||
shader_reset();
|
|
||||||
|
|
||||||
BLEND_NORMAL;
|
|
||||||
surface_reset_target();
|
|
||||||
|
|
||||||
return _outSurf;
|
return _outSurf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1675,7 +1675,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static arrayLength = function(val = undefined) { #region
|
static arrayLength = function(val = undefined) { #region
|
||||||
if(val == undefined) val = getValue();
|
val ??= getValue();
|
||||||
|
|
||||||
if(!isArray(val))
|
if(!isArray(val))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -121,12 +121,16 @@
|
||||||
PANEL_MAIN.refresh();
|
PANEL_MAIN.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __initPanel() {
|
||||||
|
if(check_version($"{DIRECTORY}layouts/version"))
|
||||||
|
zip_unzip("data/Layouts.zip", DIRECTORY);
|
||||||
|
setPanel();
|
||||||
|
}
|
||||||
|
|
||||||
function setPanel() {
|
function setPanel() {
|
||||||
globalvar CURRENT_PANEL;
|
globalvar CURRENT_PANEL;
|
||||||
|
|
||||||
panelObjectInit();
|
panelObjectInit();
|
||||||
//if(!directory_exists(DIRECTORY + "layouts"))
|
|
||||||
zip_unzip("data/Layouts.zip", DIRECTORY);
|
|
||||||
|
|
||||||
var file = $"{DIRECTORY}layouts/{PREFERENCES.panel_layout_file}.json";
|
var file = $"{DIRECTORY}layouts/{PREFERENCES.panel_layout_file}.json";
|
||||||
if(!file_exists(file))
|
if(!file_exists(file))
|
||||||
|
|
|
@ -38,7 +38,8 @@ function Panel_Node_Data_Gen() : PanelContent() constructor {
|
||||||
NODE_EXTRACT = true;
|
NODE_EXTRACT = true;
|
||||||
|
|
||||||
dir = DIRECTORY + "Nodes/";
|
dir = DIRECTORY + "Nodes/";
|
||||||
if(!directory_exists(dir)) directory_create(dir);
|
directory_verify(dir);
|
||||||
|
|
||||||
data = {};
|
data = {};
|
||||||
junc = {};
|
junc = {};
|
||||||
locale = {};
|
locale = {};
|
||||||
|
|
|
@ -4,21 +4,11 @@
|
||||||
function __initPresets() {
|
function __initPresets() {
|
||||||
ds_map_clear(global.PRESETS_MAP);
|
ds_map_clear(global.PRESETS_MAP);
|
||||||
|
|
||||||
var root = DIRECTORY + "Presets";
|
|
||||||
if(!directory_exists(root))
|
|
||||||
directory_create(root);
|
|
||||||
|
|
||||||
var _l = root + "/version";
|
|
||||||
var _preset_path = "data/Preset.zip";
|
var _preset_path = "data/Preset.zip";
|
||||||
if(file_exists(_preset_path)) {
|
var root = DIRECTORY + "Presets";
|
||||||
if(file_exists(_l)) {
|
directory_verify(root);
|
||||||
var res = json_load_struct(_l);
|
if(check_version($"{root}/version") && file_exists(_preset_path))
|
||||||
if(!is_struct(res) || !struct_has(res, "version") || res.version != BUILD_NUMBER)
|
zip_unzip(_preset_path, root);
|
||||||
zip_unzip(_preset_path, root);
|
|
||||||
} else
|
|
||||||
zip_unzip(_preset_path, root);
|
|
||||||
}
|
|
||||||
json_save_struct(_l, { version: BUILD_NUMBER });
|
|
||||||
|
|
||||||
global.PRESETS = new DirectoryObject("Presets", root);
|
global.PRESETS = new DirectoryObject("Presets", root);
|
||||||
global.PRESETS.scan([".json"]);
|
global.PRESETS.scan([".json"]);
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
function __initTheme() {
|
function __initTheme() { #region
|
||||||
var root = DIRECTORY + "Themes";
|
var root = DIRECTORY + "Themes";
|
||||||
if(!directory_exists(root))
|
|
||||||
directory_create(root);
|
|
||||||
|
|
||||||
var _l = root + "/version";
|
directory_verify(root);
|
||||||
if(file_exists(_l))
|
if(check_version($"{root}/version")) {
|
||||||
var res = json_load_struct(_l);
|
log_message("THEME", $"unzipping default theme to {root}.");
|
||||||
json_save_struct(_l, { version: BUILD_NUMBER });
|
zip_unzip("data/themes/default.zip", root);
|
||||||
|
}
|
||||||
log_message("THEME", $"unzipping default theme to {root}.");
|
|
||||||
zip_unzip("data/themes/default.zip", root);
|
|
||||||
|
|
||||||
loadGraphic(PREFERENCES.theme);
|
loadGraphic(PREFERENCES.theme);
|
||||||
loadColor(PREFERENCES.theme);
|
loadColor(PREFERENCES.theme);
|
||||||
}
|
|
||||||
|
|
||||||
function _sprite_path(rel, theme) {
|
print($">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> OBJECT CHECK: {THEME.ui_panel_bg} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function _sprite_path(rel, theme) { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
return $"{DIRECTORY}themes/{theme}/graphics/{string_replace_all(rel, "./", "")}";
|
return $"{DIRECTORY}themes/{theme}/graphics/{string_replace_all(rel, "./", "")}";
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
function _sprite_load_from_struct(str, theme, key) {
|
function _sprite_load_from_struct(str, theme, key) { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
var path = _sprite_path(str.path, theme);
|
var path = _sprite_path(str.path, theme);
|
||||||
|
@ -42,17 +40,17 @@ function _sprite_load_from_struct(str, theme, key) {
|
||||||
else log_message("THEME", $"Load sprite {path} failed.");
|
else log_message("THEME", $"Load sprite {path} failed.");
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
function __getGraphicList() {
|
function __getGraphicList() { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
var path = _sprite_path("./graphics.json", "default");
|
var path = _sprite_path("./graphics.json", "default");
|
||||||
var s = file_read_all(path);
|
var s = file_read_all(path);
|
||||||
return json_try_parse(s);
|
return json_try_parse(s);
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
function loadGraphic(theme = "default") {
|
function loadGraphic(theme = "default") { #region
|
||||||
var sprDef = __getGraphicList();
|
var sprDef = __getGraphicList();
|
||||||
var _metaP = $"{DIRECTORY}Themes/{theme}/meta.json";
|
var _metaP = $"{DIRECTORY}Themes/{theme}/meta.json";
|
||||||
if(!file_exists(_metaP))
|
if(!file_exists(_metaP))
|
||||||
|
@ -79,9 +77,6 @@ function loadGraphic(theme = "default") {
|
||||||
for( var i = 0, n = array_length(graphics); i < n; i++ ) {
|
for( var i = 0, n = array_length(graphics); i < n; i++ ) {
|
||||||
var key = graphics[i];
|
var key = graphics[i];
|
||||||
|
|
||||||
//if(struct_has(THEME, key) && sprite_exists(THEME[$ key]))
|
|
||||||
// sprite_delete(THEME[$ key]);
|
|
||||||
|
|
||||||
if(struct_has(sprStr, key)) {
|
if(struct_has(sprStr, key)) {
|
||||||
str = sprStr[$ key];
|
str = sprStr[$ key];
|
||||||
THEME[$ key] = _sprite_load_from_struct(str, theme, key);
|
THEME[$ key] = _sprite_load_from_struct(str, theme, key);
|
||||||
|
@ -91,7 +86,5 @@ function loadGraphic(theme = "default") {
|
||||||
str = sprDef[$ key];
|
str = sprDef[$ key];
|
||||||
THEME[$ key] = _sprite_load_from_struct(str, "default", key);
|
THEME[$ key] = _sprite_load_from_struct(str, "default", key);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print($"{key}: {THEME[$ key]} [{sprite_exists(THEME[$ key])}]");
|
|
||||||
}
|
}
|
||||||
}
|
} #endregion
|
|
@ -179,7 +179,7 @@ function is_surface(s) {
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
if(is_instanceof(s, dynaSurf) || is_instanceof(s, SurfaceAtlas)) return true;
|
if(is_instanceof(s, dynaSurf) || is_instanceof(s, SurfaceAtlas)) return true;
|
||||||
if(is_real(s) && s > 0 && surface_exists(s)) return true;
|
if(is_numeric(s) && s > 0 && surface_exists(s)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ function surface_get_pixel(surface, _x, _y) {
|
||||||
var f = surface_get_format(surface);
|
var f = surface_get_format(surface);
|
||||||
var px = surface_getpixel(surface, _x, _y);
|
var px = surface_getpixel(surface, _x, _y);
|
||||||
|
|
||||||
if(is_real(px)) return px;
|
if(is_numeric(px)) return px;
|
||||||
return round(px[0] * (255 * power(256, 0))) + round(px[1] * (255 * power(256, 1))) + round(px[2] * (255 * power(256, 2)));
|
return round(px[0] * (255 * power(256, 0))) + round(px[1] * (255 * power(256, 1))) + round(px[2] * (255 * power(256, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ function surface_get_pixel_ext(surface, _x, _y) {
|
||||||
if(!is_surface(surface)) return;
|
if(!is_surface(surface)) return;
|
||||||
var px = surface_getpixel_ext(surface, _x, _y);
|
var px = surface_getpixel_ext(surface, _x, _y);
|
||||||
|
|
||||||
if(is_real(px)) return px;
|
if(is_numeric(px)) return px;
|
||||||
return round(px[0] * (255 * power(256, 0))) + round(px[1] * (255 * power(256, 1))) + round(px[2] * (255 * power(256, 2))) + round(px[3] * (255 * power(256, 3)));
|
return round(px[0] * (255 * power(256, 0))) + round(px[1] * (255 * power(256, 1))) + round(px[2] * (255 * power(256, 2))) + round(px[3] * (255 * power(256, 3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ function surface_copy_size(dest, source, format = noone) {
|
||||||
function surface_valid_size(s) {
|
function surface_valid_size(s) {
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
if(!is_real(s)) return 1;
|
if(!is_numeric(s)) return 1;
|
||||||
if(is_infinity(s)) return 1;
|
if(is_infinity(s)) return 1;
|
||||||
return clamp(s, 1, 8196);
|
return clamp(s, 1, 8196);
|
||||||
}
|
}
|
||||||
|
|
9
scripts/version_checker/version_checker.gml
Normal file
9
scripts/version_checker/version_checker.gml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
function check_version(path) {
|
||||||
|
if(!file_exists(path)) {
|
||||||
|
json_save_struct(path, { version: BUILD_NUMBER });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var res = json_load_struct(path);
|
||||||
|
return struct_try_get(res, "version") != BUILD_NUMBER;
|
||||||
|
}
|
11
scripts/version_checker/version_checker.yy
Normal file
11
scripts/version_checker/version_checker.yy
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"resourceType": "GMScript",
|
||||||
|
"resourceVersion": "1.0",
|
||||||
|
"name": "version_checker",
|
||||||
|
"isCompatibility": false,
|
||||||
|
"isDnD": false,
|
||||||
|
"parent": {
|
||||||
|
"name": "files",
|
||||||
|
"path": "folders/functions/files.yy",
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in a new issue