From ea58e07865d246d8a98be6e3c453e467034c397a Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:12:32 +0200 Subject: [PATCH] Bug fix or something. --- PixelComposer.yyp | 2 +- objects/o_main/Create_0.gml | 3 + objects/o_main/Other_60.gml | 5 ++ objects/o_main/o_main.yy | 1 + .../_node_VFX_spawner/_node_VFX_spawner.gml | 2 +- scripts/append_function/append_function.gml | 16 ++--- scripts/directory_object/directory_object.gml | 69 ++++++++++++------- scripts/globals/globals.gml | 2 +- scripts/meta_data/meta_data.gml | 18 ++--- scripts/node_channels/node_channels.gml | 9 ++- scripts/node_registry/node_registry.gml | 34 ++++----- scripts/panel_animation/panel_animation.gml | 4 +- scripts/panel_collection/panel_collection.gml | 9 ++- scripts/save_function/save_function.gml | 30 +++++--- .../steam_ugc_collection.gml | 3 + scripts/testing_script/testing_script.gml | 13 ++-- shaders/sh_channel_A/sh_channel_A.fsh | 2 + .../sh_channel_A_grey/sh_channel_A_grey.fsh | 2 + shaders/sh_channel_B/sh_channel_B.fsh | 4 +- .../sh_channel_B_grey/sh_channel_B_grey.fsh | 4 +- shaders/sh_channel_G/sh_channel_G.fsh | 4 +- .../sh_channel_G_grey/sh_channel_G_grey.fsh | 4 +- shaders/sh_channel_R/sh_channel_R.fsh | 4 +- .../sh_channel_R_grey/sh_channel_R_grey.fsh | 4 +- 24 files changed, 158 insertions(+), 90 deletions(-) create mode 100644 objects/o_main/Other_60.gml diff --git a/PixelComposer.yyp b/PixelComposer.yyp index adb505905..13dbdc9f1 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -249,8 +249,8 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"NotoSans-Bold.ttf","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale/fonts",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"NotoSans-Medium.ttf","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale/fonts",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"NotoSans-SemiBold.ttf","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale/fonts",}, - {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"HOW TO LOCALE.txt","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"UI.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"words.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data",}, diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index 57dd90a28..41230132f 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -244,12 +244,15 @@ #region async globalvar PORT_MAP, NETWORK_SERVERS, NETWORK_CLIENTS; + globalvar IMAGE_FETCH_MAP; global.FILE_LOAD_ASYNC = ds_map_create(); PORT_MAP = ds_map_create(); NETWORK_SERVERS = ds_map_create(); NETWORK_CLIENTS = ds_map_create(); + IMAGE_FETCH_MAP = ds_map_create(); + asyncInit(); #endregion diff --git a/objects/o_main/Other_60.gml b/objects/o_main/Other_60.gml new file mode 100644 index 000000000..bedf8ebe6 --- /dev/null +++ b/objects/o_main/Other_60.gml @@ -0,0 +1,5 @@ +/// @description +if(!ds_map_exists(IMAGE_FETCH_MAP, async_load[? "id"])) exit; + +var _callback = IMAGE_FETCH_MAP[? async_load[? "id"]]; +_callback(async_load); \ No newline at end of file diff --git a/objects/o_main/o_main.yy b/objects/o_main/o_main.yy index 79e9a228d..1246aeee8 100644 --- a/objects/o_main/o_main.yy +++ b/objects/o_main/o_main.yy @@ -22,6 +22,7 @@ {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":1,"eventType":9,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,}, ], "managed": true, "overriddenProperties": [], diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index f0c2ffe05..169655d8a 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -434,7 +434,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co static onPartDestroy = function(part) {} static postDeserialize = function() { - if(PROJECT.version < SAVE_VERSION) { + if(PROJECT.version < 11480) { for( var i = 37; i <= 39; i++ ) array_insert(load_map.inputs, i, noone); } diff --git a/scripts/append_function/append_function.gml b/scripts/append_function/append_function.gml index 64bab753b..7fe25a390 100644 --- a/scripts/append_function/append_function.gml +++ b/scripts/append_function/append_function.gml @@ -3,7 +3,7 @@ function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) { var _map = json_load_struct(_path); if(_map == -1) { - printlog("Decode error"); + printIf(log, "Decode error"); return noone; } @@ -42,7 +42,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { var _node = nodeLoad(_node_list[i], true, context); if(_node) ds_list_add(appended_list, _node); } - printlog("Load time: " + string(current_time - t)); t = current_time; + printIf(log, "Load time: " + string(current_time - t)); t = current_time; try { for(var i = 0; i < ds_list_size(appended_list); i++) { @@ -55,7 +55,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { } catch(e) { log_warning("APPEND, node", exception_print(e)); } - printlog("Load group time: " + string(current_time - t)); t = current_time; + printIf(log, "Load group time: " + string(current_time - t)); t = current_time; try { for(var i = 0; i < ds_list_size(appended_list); i++) @@ -63,7 +63,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { } catch(e) { log_warning("APPEND, deserialize", exception_print(e)); } - printlog("Deserialize time: " + string(current_time - t)); t = current_time; + printIf(log, "Deserialize time: " + string(current_time - t)); t = current_time; try { for(var i = 0; i < ds_list_size(appended_list); i++) @@ -71,7 +71,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { } catch(e) { log_warning("LOAD, apply deserialize", exception_print(e)); } - printlog("Apply deserialize time: " + string(current_time - t)); t = current_time; + printIf(log, "Apply deserialize time: " + string(current_time - t)); t = current_time; try { for(var i = 0; i < ds_list_size(appended_list); i++) @@ -81,7 +81,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { } catch(e) { log_warning("APPEND, connect", exception_print(e)); } - printlog("Connect time: " + string(current_time - t)); t = current_time; + printIf(log, "Connect time: " + string(current_time - t)); t = current_time; try { for(var i = 0; i < ds_list_size(appended_list); i++) @@ -89,7 +89,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { } catch(e) { log_warning("APPEND, update", exception_print(e)); } - printlog("Update time: " + string(current_time - t)); t = current_time; + printIf(log, "Update time: " + string(current_time - t)); t = current_time; Render(true); @@ -115,7 +115,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { log_warning("APPEND, Conflict solver error : ", exception_print(e)); } } - printlog("Conflict time: " + string(current_time - t)); t = current_time; + printIf(log, "Conflict time: " + string(current_time - t)); t = current_time; try { for(var i = 0; i < ds_list_size(appended_list); i++) diff --git a/scripts/directory_object/directory_object.gml b/scripts/directory_object/directory_object.gml index 95e15ec07..a82d418b9 100644 --- a/scripts/directory_object/directory_object.gml +++ b/scripts/directory_object/directory_object.gml @@ -2,11 +2,17 @@ function FileObject(_name, _path) constructor { name = _name; path = _path; spr_path = []; - spr = -1; - content = -1; - surface = noone; - meta = noone; - type = FILE_TYPE.collection; + spr = -1; + sprFetchID = noone; + + content = -1; + surface = noone; + + var _mdir = filename_dir(path); + var _mname = filename_name_only(path); + meta_path = $"{_mdir}/{_mname}.meta"; + meta = noone; + type = FILE_TYPE.collection; switch(string_lower(filename_ext(path))) { case ".png" : @@ -33,7 +39,7 @@ function FileObject(_name, _path) constructor { return surface; } - static getThumbnail = function() { + static getThumbnail = function() { if(size > 100000) return noone; if(!retrive_data) getMetadata(); @@ -44,40 +50,55 @@ function FileObject(_name, _path) constructor { } static getSpr = function() { - if(sprite_exists(spr)) return spr; + if(sprite_exists(spr)) return spr; + if(sprFetchID != noone) return -1; + if(array_length(spr_path) == 0) { - spr = sprite_add(self.path, 0, false, false, 0, 0); - sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2); + sprFetchID = sprite_add_ext(self.path, 0, 0, 0, false); + IMAGE_FETCH_MAP[? sprFetchID] = function(load_result) { + spr = load_result[? "id"]; + sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2); + }; return spr; } var path = array_safe_get(spr_path, 0); var amo = array_safe_get(spr_path, 1); - var cent = array_safe_get(spr_path, 2); if(path == 0) return -1; - spr = sprite_add(path, amo, false, false, 0, 0); - if(cent) - sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2); + + sprFetchID = sprite_add_ext(path, amo, 0, 0, false); + IMAGE_FETCH_MAP[? sprFetchID] = function(load_result) { + spr = load_result[? "id"]; + if(array_safe_get(spr_path, 2)) + sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2); + }; + return spr; } - static getMetadata = function() { + static getMetadata = function() { retrive_data = true; - if(!file_exists(path)) return noone; - if(meta != noone) return meta; - if(meta == undefined) return noone; - var _f = file_text_read_all(path); - var m = json_decode(_f); + if(!file_exists(path)) return noone; + if(meta != noone) return meta; + if(meta == undefined) return noone; meta = new MetaDataManager(); - if(ds_map_exists(m, "metadata")) - meta.deserialize(m[? "metadata"]); - if(ds_map_exists(m, "preview")) - thumbnail_data = json_try_parse(m[? "preview"], -1); - meta.version = m[? "version"]; + if(file_exists(meta_path)) { + var m = json_load(meta_path); + meta.deserialize(m); + } else { + var m = json_load(path); + + if(ds_map_exists(m, "metadata")) + meta.deserialize(m[? "metadata"]); + if(ds_map_exists(m, "preview")) + thumbnail_data = json_try_parse(m[? "preview"], -1); + meta.version = m[? "version"]; + } + meta.name = name; switch(filename_ext(path)) { diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 6ab8250e1..afacec5a3 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -18,7 +18,7 @@ active = true; path = ""; - version = 0; + version = SAVE_VERSION; seed = irandom_range(100000, 999999); modified = false; diff --git a/scripts/meta_data/meta_data.gml b/scripts/meta_data/meta_data.gml index 547cb981c..f7ef13760 100644 --- a/scripts/meta_data/meta_data.gml +++ b/scripts/meta_data/meta_data.gml @@ -19,7 +19,7 @@ function MetaDataManager() constructor { author_steam_id = 0; file_id = 0; tags = []; - version = 0; + version = SAVE_VERSION; steam = false; static displays = [ @@ -32,13 +32,14 @@ function MetaDataManager() constructor { static serialize = function() { var m = {}; - m.description = description; - m.author = author; - m.contact = contact; - m.alias = alias; - m.aut_id = author_steam_id; - m.file_id = file_id; - m.tags = tags; + m.description = description; + m.author = author; + m.contact = contact; + m.alias = alias; + m.aut_id = author_steam_id; + m.file_id = file_id; + m.tags = tags; + m.version = version; return m; } @@ -51,6 +52,7 @@ function MetaDataManager() constructor { author_steam_id = struct_try_get(m, "aut_id", author_steam_id); file_id = struct_try_get(m, "file_id", file_id); tags = struct_try_get(m, "tags", tags); + version = struct_try_get(m, "version", version); return self; } diff --git a/scripts/node_channels/node_channels.gml b/scripts/node_channels/node_channels.gml index c319c3568..587fdcfb9 100644 --- a/scripts/node_channels/node_channels.gml +++ b/scripts/node_channels/node_channels.gml @@ -1,10 +1,12 @@ function Node_RGB_Channel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "RGBA Extract"; - 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("Output type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Output Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Channel value", "Greyscale"]); + + inputs[| 2] = nodeValue("Keep Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); outputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -15,6 +17,7 @@ function Node_RGB_Channel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou static process_data = function(_outSurf, _data, output_index) { var _out = _data[1]; + var _alp = _data[2]; surface_set_target(_outSurf); DRAW_CLEAR @@ -25,6 +28,8 @@ function Node_RGB_Channel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou case 2 : shader_set(_out? sh_channel_B_grey : sh_channel_B); break; case 3 : shader_set(_out? sh_channel_A_grey : sh_channel_A); break; } + shader_set_i("keepAlpha", _alp); + draw_surface_safe(_data[0], 0, 0); shader_reset(); BLEND_NORMAL; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index d8236aa2c..7b7b300a1 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -93,7 +93,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(group, "Groups"); addNodeObject(group, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(group, "Output", s_node_group_output,"Node_Group_Output", [1, Node_Group_Output]); - + var iter = ds_list_create(); addNodeCatagory("Loop", iter, ["Node_Iterate"]); ds_list_add(iter, "Groups"); @@ -103,33 +103,33 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(iter, "Loops"); addNodeObject(iter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]); addNodeObject(iter, "Loop amount", s_node_iterator_amount, "Node_Iterator_Length", [1, Node_Iterator_Length]); - + var itere = ds_list_create(); addNodeCatagory("Loop", itere, ["Node_Iterate_Each"]); ds_list_add(itere, "Groups"); addNodeObject(itere, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(itere, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); - + ds_list_add(itere, "Loops"); addNodeObject(itere, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]); addNodeObject(itere, "Array Length", s_node_iterator_length, "Node_Iterator_Each_Length", [1, Node_Iterator_Each_Length]); - + var filter = ds_list_create(); addNodeCatagory("Filter", filter, ["Node_Iterate_Filter"]); ds_list_add(filter, "Groups"); addNodeObject(filter, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(filter, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); - + ds_list_add(filter, "Loops"); addNodeObject(filter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]); addNodeObject(filter, "Array Length", s_node_iterator_length, "Node_Iterator_Each_Length", [1, Node_Iterator_Each_Length]); - + var feed = ds_list_create(); addNodeCatagory("Feedback", feed, ["Node_Feedback"]); ds_list_add(feed, "Groups"); addNodeObject(feed, "Input", s_node_feedback_input, "Node_Feedback_Input", [1, Node_Feedback_Input]); addNodeObject(feed, "Output", s_node_feedback_output, "Node_Feedback_Output", [1, Node_Feedback_Output]); - + var vfx = ds_list_create(); addNodeCatagory("VFX", vfx, ["Node_VFX_Group"]); ds_list_add(vfx, "Groups"); @@ -152,36 +152,36 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(vfx, "Instance control"); addNodeObject(vfx, "VFX Variable", s_node_vfx_variable, "Node_VFX_Variable", [1, Node_VFX_Variable]).setVersion(1120); addNodeObject(vfx, "VFX Override", s_node_vfx_override, "Node_VFX_Override", [1, Node_VFX_Override]).setVersion(1120); - + var rigidSim = ds_list_create(); addNodeCatagory("RigidSim", rigidSim, ["Node_Rigid_Group"]); ds_list_add(rigidSim, "Group"); addNodeObject(rigidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(rigidSim, "Output", s_node_group_output,"Node_Group_Output", [1, Node_Group_Output]); - + ds_list_add(rigidSim, "RigidSim"); addNodeObject(rigidSim, "Object", s_node_rigidSim_object, "Node_Rigid_Object", [1, Node_Rigid_Object]).setVersion(1110); addNodeObject(rigidSim, "Object Spawner", s_node_rigidSim_object_spawner, "Node_Rigid_Object_Spawner", [1, Node_Rigid_Object_Spawner]).setVersion(1110); addNodeObject(rigidSim, "Render", s_node_rigidSim_renderer, "Node_Rigid_Render", [1, Node_Rigid_Render]).setVersion(1110); addNodeObject(rigidSim, "Apply Force", s_node_rigidSim_force, "Node_Rigid_Force_Apply", [1, Node_Rigid_Force_Apply]).setVersion(1110); - + ds_list_add(rigidSim, "Instance control"); addNodeObject(rigidSim, "Activate Physics", s_node_rigidSim_activate, "Node_Rigid_Activate", [1, Node_Rigid_Activate]).setVersion(1110); addNodeObject(rigidSim, "Rigidbody Variable", s_node_rigid_variable, "Node_Rigid_Variable", [1, Node_Rigid_Variable]).setVersion(1120); addNodeObject(rigidSim, "Rigidbody Override", s_node_rigid_override, "Node_Rigid_Override", [1, Node_Rigid_Override]).setVersion(1120); - + var fluidSim = ds_list_create(); addNodeCatagory("FluidSim", fluidSim, ["Node_Fluid_Group"]); ds_list_add(fluidSim, "Group"); addNodeObject(fluidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(fluidSim, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); - + ds_list_add(fluidSim, "Domain"); addNodeObject(fluidSim, "Fluid Domain", s_node_fluidSim_domain, "Node_Fluid_Domain", [1, Node_Fluid_Domain]).setVersion(1120); addNodeObject(fluidSim, "Update Domain", s_node_fluidSim_update, "Node_Fluid_Update", [1, Node_Fluid_Update]).setVersion(1120); addNodeObject(fluidSim, "Render Domain", s_node_fluidSim_render, "Node_Fluid_Render", [1, Node_Fluid_Render]).setVersion(1120); addNodeObject(fluidSim, "Queue Domain", s_node_fluidSim_domain_queue, "Node_Fluid_Domain_Queue", [1, Node_Fluid_Domain_Queue]).setVersion(1120); - + ds_list_add(fluidSim, "Fluid"); addNodeObject(fluidSim, "Add Fluid", s_node_fluidSim_add_fluid, "Node_Fluid_Add", [1, Node_Fluid_Add]).setVersion(1120); addNodeObject(fluidSim, "Apply Velocity", s_node_fluidSim_apply_velocity, "Node_Fluid_Apply_Velocity", [1, Node_Fluid_Apply_Velocity]).setVersion(1120); @@ -189,7 +189,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(fluidSim, "Vortex", s_node_fluidSim_vortex, "Node_Fluid_Vortex", [1, Node_Fluid_Vortex]).setVersion(1120); addNodeObject(fluidSim, "Repulse", s_node_fluidSim_repulse, "Node_Fluid_Repulse", [1, Node_Fluid_Repulse]).setVersion(1120); addNodeObject(fluidSim, "Turbulence", s_node_fluidSim_turbulence, "Node_Fluid_Turbulence", [1, Node_Fluid_Turbulence]).setVersion(1120); - + var strandSim = ds_list_create(); addNodeCatagory("StrandSim", strandSim, ["Node_Strand_Group"]); ds_list_add(strandSim, "Group"); @@ -208,13 +208,13 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(strandSim, "Strand Break", s_node_strandSim_break, "Node_Strand_Break", [1, Node_Strand_Break]).setVersion(1140); addNodeObject(strandSim, "Strand Length Adjust", s_node_strandSim_length, "Node_Strand_Length_Adjust", [1, Node_Strand_Length_Adjust]).setVersion(1140); addNodeObject(strandSim, "Strand Collision", s_node_strandSim_collide, "Node_Strand_Collision", [1, Node_Strand_Collision]).setVersion(1140); - + NODE_PAGE_DEFAULT = ds_list_size(NODE_CATEGORY); ADD_NODE_PAGE = NODE_PAGE_DEFAULT; - + var fav = ds_list_create(); addNodeCatagory("Favourites", fav); - + var input = ds_list_create(); addNodeCatagory("IO", input); ds_list_add(input, "Images"); diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index 58f376a8f..e1831d977 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -1461,8 +1461,8 @@ function Panel_Animation() : PanelContent() constructor { var ot = 0, ov = true; var x0 = 0, x1 = 0; - for( var i = 0; i < ds_list_size(active_inp.animator.values); i++ ) { - var k = active_inp.animator.values[| i]; + for( var j = 0; j < ds_list_size(active_inp.animator.values); j++ ) { + var k = active_inp.animator.values[| j]; var t = k.time; var v = k.value; diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 0b3371c8d..62e64216f 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -39,17 +39,20 @@ function Panel_Collection() : PanelContent() constructor { if(meta == noone || !meta.steam) { contentMenu = [ menuItem(__txtx("panel_collection_replace", "Replace with selected"), function() { - saveCollection(PANEL_INSPECTOR.inspecting, _menu_node.data_path, _menu_node.path, false, _menu_node.meta); + var _path = filename_dir(_menu_node.path); + var _name = filename_name(_menu_node.path); + + saveCollection(PANEL_INSPECTOR.inspecting, _path, _name, false, _menu_node.meta); }), menuItem(__txtx("panel_collection_edit_meta", "Edit metadata") + "...", function() { - var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320)); + var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320)); var meta = _menu_node.getMetadata(); if(meta != noone && meta != undefined) dia.meta = meta; dia.node = PANEL_INSPECTOR.inspecting; dia.data_path = data_path; - dia.updating = _menu_node; + dia.updating = _menu_node; dia.doExpand(); }), -1, diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index af86732aa..7cf5022f6 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -122,6 +122,8 @@ function SAVE_AT(project = PROJECT, path = "", log = "save at ") { return true; } +/////////////////////////////////////////////////////// COLLECTION /////////////////////////////////////////////////////// + function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { var _content = {}; _content.version = SAVE_VERSION; @@ -148,12 +150,16 @@ function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, c SAVE_NODE(_nodes, _list[| i], cx, cy, true, context); _content.nodes = _nodes; - if(metadata != noone) - _content.metadata = metadata.serialize(); + json_save_struct(_path, _content, !PREF_MAP[? "save_file_minify"]); - var file = file_text_open_write(_path); - file_text_write_string(file, PREF_MAP[? "save_file_minify"]? json_stringify_minify(_content) : json_stringify(_content, true)); - file_text_close(file); + if(metadata != noone) { + var _meta = metadata.serialize(); + var _dir = filename_dir(_path); + var _name = filename_name_only(_path); + var _mpath = $"{_dir}/{_name}.meta"; + + json_save_struct(_mpath, _meta, true); + } var pane = findPanel("Panel_Collection"); if(pane) pane.refreshContext(); @@ -178,12 +184,16 @@ function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, co SAVE_NODE(_nodes, _node, _node.x, _node.y, true, context); _content.nodes = _nodes; - if(metadata != noone) - _content.metadata = metadata.serialize(); + json_save_struct(_path, _content, !PREF_MAP[? "save_file_minify"]); - var file = file_text_open_write(_path); - file_text_write_string(file, PREF_MAP[? "save_file_minify"]? json_stringify_minify(_content) : json_stringify(_content, true)); - file_text_close(file); + if(metadata != noone) { + var _meta = metadata.serialize(); + var _dir = filename_dir(_path); + var _name = filename_name_only(_path); + var _mpath = $"{_dir}/{_name}.meta"; + + json_save_struct(_mpath, _meta, true); + } var pane = findPanel("Panel_Collection"); if(pane) pane.refreshContext(); diff --git a/scripts/steam_ugc_collection/steam_ugc_collection.gml b/scripts/steam_ugc_collection/steam_ugc_collection.gml index 2205a7f23..01413a0b6 100644 --- a/scripts/steam_ugc_collection/steam_ugc_collection.gml +++ b/scripts/steam_ugc_collection/steam_ugc_collection.gml @@ -9,6 +9,8 @@ function steam_ugc_create_collection(file) { directory_destroy(DIRECTORY + "steamUGC"); directory_create(DIRECTORY + "steamUGC"); file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path)); + file_copy(file.meta_path, DIRECTORY + "steamUGC/" + filename_name(file.meta_path)); + if(array_safe_get(file.spr_path, 0, 0) != 0) file_copy(file.spr_path[0], DIRECTORY + "steamUGC/" + filename_name(file.spr_path[0])); steam_ugc_collection_generate(file); @@ -27,6 +29,7 @@ function steam_ugc_update_collection(file, update_preview = false) { directory_destroy(DIRECTORY + "steamUGC"); directory_create(DIRECTORY + "steamUGC"); file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path)); + file_copy(file.meta_path, DIRECTORY + "steamUGC/" + filename_name(file.meta_path)); if(array_safe_get(file.spr_path, 0, 0) != 0) file_copy(file.spr_path[0], DIRECTORY + "steamUGC/" + filename_name(file.spr_path[0])); diff --git a/scripts/testing_script/testing_script.gml b/scripts/testing_script/testing_script.gml index 4a02fc61a..c29786188 100644 --- a/scripts/testing_script/testing_script.gml +++ b/scripts/testing_script/testing_script.gml @@ -15,7 +15,7 @@ function __test_update_current_collections() { print(" > Updating " + _node.path); var _map = json_load(_node.path); _map[? "version"] = SAVE_VERSION; - json_save(_node.path, _map); + json_save(_node.meta_path, _map); } for( var i = 0; i < ds_list_size(_st.subDir); i++ ) @@ -36,7 +36,7 @@ function __test_update_sample_projects() { print(" > Updating " + _proj.path); var _map = json_load(_proj.path); _map[? "version"] = SAVE_VERSION; - json_save(_proj.path, _map); + json_save(_proj.meta_path, _map); } print("---------- PROJECT UPDATING ENDED ----------"); @@ -125,7 +125,7 @@ function __test_load_all_nodes() { if(index > inded) break; if(index > indst) { var node = ALL_NODES[? k]; - print("==== Building " + node.node); + print($"==== Building {node.node} ===="); var b = node.build(xx, yy); if(++ind > col) { @@ -156,7 +156,8 @@ function __test_metadata_current_collections() { print("---------- COLLECTION UPDATING STARTED ----------"); - var sel = PANEL_GRAPH.node_focus, outj = noone; + var sel = PANEL_GRAPH.node_focus, outj = noone; + var _meta = METADATA.serialize(); if(sel != noone) outj = sel.outputs[| 0]; while(!ds_stack_empty(st)) { @@ -165,9 +166,7 @@ function __test_metadata_current_collections() { var _node = _st.content[| i]; print(" > Updating " + _node.path); - var _map = json_load(_node.path); - ds_map_add_map(_map, "metadata", METADATA.serialize()); - json_save(_node.path, _map); + json_save_struct(_node.meta_path, _meta, true); } for( var i = 0; i < ds_list_size(_st.subDir); i++ ) diff --git a/shaders/sh_channel_A/sh_channel_A.fsh b/shaders/sh_channel_A/sh_channel_A.fsh index b9ee0bdcc..b308e3816 100644 --- a/shaders/sh_channel_A/sh_channel_A.fsh +++ b/shaders/sh_channel_A/sh_channel_A.fsh @@ -4,6 +4,8 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); gl_FragColor = vec4(vec3(1.), col.a); diff --git a/shaders/sh_channel_A_grey/sh_channel_A_grey.fsh b/shaders/sh_channel_A_grey/sh_channel_A_grey.fsh index 64c3a4707..006909eb8 100644 --- a/shaders/sh_channel_A_grey/sh_channel_A_grey.fsh +++ b/shaders/sh_channel_A_grey/sh_channel_A_grey.fsh @@ -4,6 +4,8 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); gl_FragColor = vec4(col.a, col.a, col.a, 1.); diff --git a/shaders/sh_channel_B/sh_channel_B.fsh b/shaders/sh_channel_B/sh_channel_B.fsh index d80384ab4..00d41f3f1 100644 --- a/shaders/sh_channel_B/sh_channel_B.fsh +++ b/shaders/sh_channel_B/sh_channel_B.fsh @@ -4,7 +4,9 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); - gl_FragColor = vec4(0., 0., col.b, 1.); + gl_FragColor = vec4(0., 0., col.b, keepAlpha == 1? col.a : 1.); } diff --git a/shaders/sh_channel_B_grey/sh_channel_B_grey.fsh b/shaders/sh_channel_B_grey/sh_channel_B_grey.fsh index 2138f4069..7828c00ea 100644 --- a/shaders/sh_channel_B_grey/sh_channel_B_grey.fsh +++ b/shaders/sh_channel_B_grey/sh_channel_B_grey.fsh @@ -4,7 +4,9 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); - gl_FragColor = vec4(col.b, col.b, col.b, 1.); + gl_FragColor = vec4(col.b, col.b, col.b, keepAlpha == 1? col.a : 1.); } diff --git a/shaders/sh_channel_G/sh_channel_G.fsh b/shaders/sh_channel_G/sh_channel_G.fsh index f2e612e0f..98a0b560f 100644 --- a/shaders/sh_channel_G/sh_channel_G.fsh +++ b/shaders/sh_channel_G/sh_channel_G.fsh @@ -4,7 +4,9 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); - gl_FragColor = vec4(0., col.g, 0., 1.); + gl_FragColor = vec4(0., col.g, 0., keepAlpha == 1? col.a : 1.); } diff --git a/shaders/sh_channel_G_grey/sh_channel_G_grey.fsh b/shaders/sh_channel_G_grey/sh_channel_G_grey.fsh index ca6676458..1824e55f3 100644 --- a/shaders/sh_channel_G_grey/sh_channel_G_grey.fsh +++ b/shaders/sh_channel_G_grey/sh_channel_G_grey.fsh @@ -4,7 +4,9 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); - gl_FragColor = vec4(col.g, col.g, col.g, 1.); + gl_FragColor = vec4(col.g, col.g, col.g, keepAlpha == 1? col.a : 1.); } diff --git a/shaders/sh_channel_R/sh_channel_R.fsh b/shaders/sh_channel_R/sh_channel_R.fsh index df0e8a87e..1ac6f1d5c 100644 --- a/shaders/sh_channel_R/sh_channel_R.fsh +++ b/shaders/sh_channel_R/sh_channel_R.fsh @@ -4,7 +4,9 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); - gl_FragColor = vec4(col.r, 0., 0., 1.); + gl_FragColor = vec4(col.r, 0., 0., keepAlpha == 1? col.a : 1.); } diff --git a/shaders/sh_channel_R_grey/sh_channel_R_grey.fsh b/shaders/sh_channel_R_grey/sh_channel_R_grey.fsh index c0f85922e..e1716d7fa 100644 --- a/shaders/sh_channel_R_grey/sh_channel_R_grey.fsh +++ b/shaders/sh_channel_R_grey/sh_channel_R_grey.fsh @@ -4,7 +4,9 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +uniform int keepAlpha; + void main() { vec4 col = texture2D( gm_BaseTexture, v_vTexcoord); - gl_FragColor = vec4(col.r, col.r, col.r, 1.); + gl_FragColor = vec4(col.r, col.r, col.r, keepAlpha == 1? col.a : 1.); }