From 8d3f2848ace557874793673feef06f97b10a8157 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Mon, 12 Aug 2024 11:02:26 +0700 Subject: [PATCH] - [Collection Panel] Fix loading project from project tab not recognize steam status. --- PixelComposer.resource_order | 1 + PixelComposer.yyp | 1 + objects/o_dialog_add_image/Create_0.gml | 17 ++++ objects/o_dialog_add_image/Draw_64.gml | 52 ++++++++++++ .../o_dialog_add_image/o_dialog_add_image.yy | 39 +++++++++ .../o_dialog_add_multiple_images/Create_0.gml | 20 ++--- .../o_dialog_add_multiple_images/Draw_64.gml | 14 +-- .../o_dialog_add_multiple_images.yy | 4 +- .../o_dialog_file_name_collection/Draw_64.gml | 2 + .../o_dialog_file_name_collection.yy | 4 +- objects/o_dialog_splash/Create_0.gml | 5 +- scripts/load_function/load_function.gml | 2 + scripts/meta_data/meta_data.gml | 10 +-- scripts/node_canvas/node_canvas.gml | 8 +- scripts/panel_collection/panel_collection.gml | 85 +++++++++---------- scripts/panel_graph/panel_graph.gml | 12 +-- scripts/panel_inspector/panel_inspector.gml | 30 ++++--- 17 files changed, 210 insertions(+), 96 deletions(-) create mode 100644 objects/o_dialog_add_image/Create_0.gml create mode 100644 objects/o_dialog_add_image/Draw_64.gml create mode 100644 objects/o_dialog_add_image/o_dialog_add_image.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 20b14a28a..6c5b5bee7 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -265,6 +265,7 @@ {"name":"_p_dialog_undo_block","order":1,"path":"objects/_p_dialog_undo_block/_p_dialog_undo_block.yy",}, {"name":"addon","order":1,"path":"objects/addon/addon.yy",}, {"name":"FLIP_Domain","order":4,"path":"objects/FLIP_Domain/FLIP_Domain.yy",}, + {"name":"o_dialog_add_image","order":3,"path":"objects/o_dialog_add_image/o_dialog_add_image.yy",}, {"name":"o_dialog_add_node","order":1,"path":"objects/o_dialog_add_node/o_dialog_add_node.yy",}, {"name":"o_dialog_assetbox","order":4,"path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",}, {"name":"o_dialog_color_picker","order":6,"path":"objects/o_dialog_color_picker/o_dialog_color_picker.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index e13cf1e2d..e199af594 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -730,6 +730,7 @@ {"id":{"name":"FLIP_Domain","path":"objects/FLIP_Domain/FLIP_Domain.yy",},}, {"id":{"name":"fx_particle_spawner","path":"objects/fx_particle_spawner/fx_particle_spawner.yy",},}, {"id":{"name":"o_dialog_about","path":"objects/o_dialog_about/o_dialog_about.yy",},}, + {"id":{"name":"o_dialog_add_image","path":"objects/o_dialog_add_image/o_dialog_add_image.yy",},}, {"id":{"name":"o_dialog_add_multiple_images","path":"objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy",},}, {"id":{"name":"o_dialog_add_node","path":"objects/o_dialog_add_node/o_dialog_add_node.yy",},}, {"id":{"name":"o_dialog_arrayBox","path":"objects/o_dialog_arrayBox/o_dialog_arrayBox.yy",},}, diff --git a/objects/o_dialog_add_image/Create_0.gml b/objects/o_dialog_add_image/Create_0.gml new file mode 100644 index 000000000..c71f0f144 --- /dev/null +++ b/objects/o_dialog_add_image/Create_0.gml @@ -0,0 +1,17 @@ +/// @description init +event_inherited(); + +#region data + nodes = [ + ALL_NODES[? "Node_Image"], + ALL_NODES[? "Node_Image_Sequence"], + ALL_NODES[? "Node_Canvas"], + ]; + + destroy_on_click_out = true; + dialog_w = ui(50 + 80 * array_length(nodes)); + dialog_h = ui(176); + + path = ""; + function setPath(_path) { path = _path; } +#endregion \ No newline at end of file diff --git a/objects/o_dialog_add_image/Draw_64.gml b/objects/o_dialog_add_image/Draw_64.gml new file mode 100644 index 000000000..96fa3cef7 --- /dev/null +++ b/objects/o_dialog_add_image/Draw_64.gml @@ -0,0 +1,52 @@ +/// @description init +if !ready exit; + +#region base UI + DIALOG_DRAW_BG + if(sFOCUS) + DIALOG_DRAW_FOCUS + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_text(dialog_x + ui(24), dialog_y + ui(16), __txtx("add_images_title_single", "Import image as")); +#endregion + +#region nodes + draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(12), dialog_y + ui(44), dialog_w - ui(24), ui(120)); + var grid_size = ui(64); + var grid_space = ui(16); + var grid_width = grid_size + grid_space; + + for(var i = 0; i < array_length(nodes); i++) { + var _node = nodes[i]; + var xx = dialog_x + ui(32) + i * grid_width; + var yy = dialog_y + ui(60); + + PANEL_GRAPH.stepBegin(); + + var nx = PANEL_GRAPH.graph_cx; + var ny = PANEL_GRAPH.graph_cy; + + draw_sprite_stretched(THEME.node_bg, 0, xx, yy, grid_size, grid_size); + if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, xx, yy, xx + grid_width, yy + grid_size)) { + draw_sprite_stretched_ext(THEME.node_bg, 1, xx, yy, grid_size, grid_size, COLORS._main_accent, 1); + if(mouse_press(mb_left, sFOCUS)) { + + switch(_node.node) { + case "Node_Image" : Node_create_Image_path(nx, ny, path).skipDefault(); break; + case "Node_Image_Sequence" : Node_create_Image_Sequence_path(nx, ny, [ path ]).skipDefault(); break; + + case "Node_Canvas" : + var _canvas = nodeBuild("Node_Canvas", nx, ny).skipDefault(); + _canvas.loadImagePath(path); + break; + } + instance_destroy(); + } + } + + draw_sprite_ui_uniform(_node.spr, 0, xx + grid_size / 2, yy + grid_size / 2, 0.5); + + draw_set_text(f_p3, fa_center, fa_top, COLORS._main_text); + draw_text_ext(xx + grid_size / 2, yy + grid_size + 4, _node.name, -1, grid_size + grid_space / 2); + } +#endregion \ No newline at end of file diff --git a/objects/o_dialog_add_image/o_dialog_add_image.yy b/objects/o_dialog_add_image/o_dialog_add_image.yy new file mode 100644 index 000000000..e81b7ffc8 --- /dev/null +++ b/objects/o_dialog_add_image/o_dialog_add_image.yy @@ -0,0 +1,39 @@ +{ + "$GMObject":"", + "%Name":"o_dialog_add_image", + "eventList":[ + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + ], + "managed":true, + "name":"o_dialog_add_image", + "overriddenProperties":[], + "parent":{ + "name":"graph", + "path":"folders/dialog/graph.yy", + }, + "parentObjectId":{ + "name":"_p_dialog", + "path":"objects/_p_dialog/_p_dialog.yy", + }, + "persistent":false, + "physicsAngularDamping":0.1, + "physicsDensity":0.5, + "physicsFriction":0.2, + "physicsGroup":1, + "physicsKinematic":false, + "physicsLinearDamping":0.1, + "physicsObject":false, + "physicsRestitution":0.1, + "physicsSensor":false, + "physicsShape":1, + "physicsShapePoints":[], + "physicsStartAwake":true, + "properties":[], + "resourceType":"GMObject", + "resourceVersion":"2.0", + "solid":false, + "spriteId":null, + "spriteMaskId":null, + "visible":true, +} \ No newline at end of file diff --git a/objects/o_dialog_add_multiple_images/Create_0.gml b/objects/o_dialog_add_multiple_images/Create_0.gml index a10abfb0b..f4c4bfa46 100644 --- a/objects/o_dialog_add_multiple_images/Create_0.gml +++ b/objects/o_dialog_add_multiple_images/Create_0.gml @@ -2,9 +2,16 @@ event_inherited(); #region data + nodes = [ + ALL_NODES[? "Node_Image"], + ALL_NODES[? "Node_Image_Sequence"], + ALL_NODES[? "Node_Image_Animated"], + ALL_NODES[? "Node_Canvas"], + ]; + destroy_on_click_out = true; - dialog_w = ui(370); - dialog_h = ui(180); + dialog_w = ui(50 + 80 * array_length(nodes)); + dialog_h = ui(176); paths = ""; is_dir = false; @@ -25,13 +32,4 @@ event_inherited(); cb_recursive = new checkBox(function(val) { dir_recursive = !dir_recursive; }); tb_filter = new textBox(TEXTBOX_INPUT.text, function(str) { dir_filter = str; }) -#endregion - -#region nodes - nodes = [ - ALL_NODES[? "Node_Image"], - ALL_NODES[? "Node_Image_Sequence"], - ALL_NODES[? "Node_Image_Animated"], - ALL_NODES[? "Node_Canvas"], - ]; #endregion \ No newline at end of file diff --git a/objects/o_dialog_add_multiple_images/Draw_64.gml b/objects/o_dialog_add_multiple_images/Draw_64.gml index fcbf53496..535063f24 100644 --- a/objects/o_dialog_add_multiple_images/Draw_64.gml +++ b/objects/o_dialog_add_multiple_images/Draw_64.gml @@ -7,11 +7,11 @@ if !ready exit; DIALOG_DRAW_FOCUS draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); - draw_text(dialog_x + ui(24), dialog_y + ui(16), __txtx("add_images_title_images", "Import multiple images")); + draw_text(dialog_x + ui(24), dialog_y + ui(16), __txtx("add_images_title_images", "Import multiple images as")); #endregion #region nodes - draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(16), dialog_y + ui(44), dialog_w - ui(32), ui(120)); + draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(12), dialog_y + ui(44), dialog_w - ui(24), ui(120)); var grid_size = ui(64); var grid_space = ui(16); var grid_width = grid_size + grid_space; @@ -36,7 +36,7 @@ if !ready exit; case "Node_Image" : for( var i = 0, n = array_length(path_arr); i < n; i++ ) { var path = path_arr[i]; - Node_create_Image_path(nx, ny, path); + Node_create_Image_path(nx, ny, path).skipDefault(); ny += 160; } break; @@ -44,15 +44,15 @@ if !ready exit; case "Node_Canvas" : for( var i = 0, n = array_length(path_arr); i < n; i++ ) { var path = path_arr[i]; - var _canvas = nodeBuild("Node_Canvas", nx, ny); + var _canvas = nodeBuild("Node_Canvas", nx, ny).skipDefault(); _canvas.loadImagePath(path); ny += 160; } break; - case "Node_Image_Sequence" : Node_create_Image_Sequence_path(nx, ny, path_arr); break; - case "Node_Image_Animated" : Node_create_Image_Animated_path(nx, ny, path_arr); break; - case "Node_Directory_Search" : Node_create_Directory_path(nx, ny, paths[0]); break; + case "Node_Image_Sequence" : Node_create_Image_Sequence_path(nx, ny, path_arr).skipDefault(); break; + case "Node_Image_Animated" : Node_create_Image_Animated_path(nx, ny, path_arr).skipDefault(); break; + case "Node_Directory_Search" : Node_create_Directory_path(nx, ny, paths[0]).skipDefault(); break; } instance_destroy(); } diff --git a/objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy b/objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy index b52452b4c..3c181eb22 100644 --- a/objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy +++ b/objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_add_multiple_images", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_add_multiple_images", diff --git a/objects/o_dialog_file_name_collection/Draw_64.gml b/objects/o_dialog_file_name_collection/Draw_64.gml index dc80b5799..671746684 100644 --- a/objects/o_dialog_file_name_collection/Draw_64.gml +++ b/objects/o_dialog_file_name_collection/Draw_64.gml @@ -35,6 +35,7 @@ txt = __txtx("panel_inspector_workshop_upload", "Upload to Steam Workshop"); icon = THEME.workshop_upload; clr = c_white; + } else if(ugc == 2) { txt = __txtx("panel_inspector_workshop_update", "Update Steam Workshop"); icon = THEME.workshop_update; @@ -48,6 +49,7 @@ draw_sprite_ui(THEME.loading_s, 0, bx + ui(16), by + ui(16),,, current_time / 5, COLORS._main_icon); if(STEAM_UGC_ITEM_UPLOADING == false) instance_destroy(); + } else { if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, txt, icon, 0, clr) == 2) { if(meta.author_steam_id == 0) diff --git a/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy b/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy index 31c520f09..aef57b01a 100644 --- a/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy +++ b/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_file_name_collection", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_file_name_collection", diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index ae35f3171..470da97ce 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -244,10 +244,7 @@ event_inherited(); LOAD_PATH(_project.path, true); PROJECT.thumbnail = array_safe_get_fast(_project.spr_path, 0); - if(txt == "Workshop") { - PROJECT.meta.file_id = _meta.file_id; - PROJECT.meta.steam = FILE_STEAM_TYPE.steamOpen; - } + if(PROJECT.meta.file_id) PROJECT.meta.steam = FILE_STEAM_TYPE.steamOpen; instance_destroy(); } } diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index b7540423a..599941114 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -71,6 +71,8 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { PROJECT.safeMode = safe_mode; if(!IS_CMD) setFocus(PANEL_GRAPH.panel); + if(PROJECT.meta.file_id) PROJECT.meta.steam = FILE_STEAM_TYPE.steamOpen; + return PROJECT; } diff --git a/scripts/meta_data/meta_data.gml b/scripts/meta_data/meta_data.gml index f68846f3a..276e0750a 100644 --- a/scripts/meta_data/meta_data.gml +++ b/scripts/meta_data/meta_data.gml @@ -29,11 +29,11 @@ function MetaDataManager() constructor { steam = FILE_STEAM_TYPE.local; static displays = [ - [ "Description", function(meta) { return meta.description; } , line_get_height() * 5], - [ "Author", function(meta) { return meta.author; } , line_get_height() ], - [ "Contact info", function(meta) { return meta.contact; } , line_get_height() ], - [ "Alias", function(meta) { return meta.alias; } , line_get_height() ], - [ "Tags", function(meta) { return meta.tags; } , line_get_height() ], + [ "Description", function(meta) { return meta.description; } , 5], + [ "Author", function(meta) { return meta.author; } , 1], + [ "Contact info", function(meta) { return meta.contact; } , 1], + [ "Alias", function(meta) { return meta.alias; } , 1], + [ "Tags", function(meta) { return meta.tags; } , 1], ]; static serialize = function() { diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 771763dc4..cfe9f7f81 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -1150,7 +1150,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor return true; } - static loadImagePath = function(path) { + static loadImagePath = function(path, live = false) { if(!file_exists_empty(path)) return noone; var _spr = sprite_add(path, 0, 0, 0, 0, 0); @@ -1171,8 +1171,10 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor setCanvasSurface(_s); surface_store_buffer(); - live_edit = true; - live_target = path; + if(live) { + live_edit = true; + live_target = path; + } return self; } diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 5dfd28f77..b27c7fdad 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -3,10 +3,10 @@ registerFunction("Collection", "Replace", "", MOD_KEY.none, panel_collection_replace ).setMenu("collection_replace") registerFunction("Collection", "Edit Meta", "", MOD_KEY.none, panel_collection_edit_meta ).setMenu("collection_edit_meta") registerFunction("Collection", "Update Thumbnail", "", MOD_KEY.none, panel_collection_update_thumbnail ).setMenu("collection_update_thumbnail") - registerFunction("Collection", "Delete Collection", "", MOD_KEY.none, panel_collection_delete_collection ).setMenu("collection_delete_collection") + registerFunction("Collection", "Delete Collection", "", MOD_KEY.none, panel_collection_delete_collection ).setMenu("collection_delete_collection", THEME.cross) - registerFunction("Collection", "Upload To Steam", "", MOD_KEY.none, panel_collection_steam_file_upload ).setMenu("collection_upload_to_steam") - registerFunction("Collection", "Update Steam", "", MOD_KEY.none, panel_collection_steam_file_update ).setMenu("collection_update_steam") + registerFunction("Collection", "Upload To Steam", "", MOD_KEY.none, panel_collection_steam_file_upload ).setMenu("collection_upload_to_steam", THEME.workshop_upload) + registerFunction("Collection", "Update Steam", "", MOD_KEY.none, panel_collection_steam_file_update ).setMenu("collection_update_steam", THEME.workshop_update) registerFunction("Collection", "Unsubscribe", "", MOD_KEY.none, panel_collection_steam_unsubscribe ).setMenu("collection_unsubscribe") } @@ -24,10 +24,10 @@ function Panel_Collection() : PanelContent() constructor { title = __txt("Collections"); expandable = false; - group_w = ui(180); + group_w = ui(180); group_w_dragging = false; - group_w_sx = false; - group_w_mx = false; + group_w_sx = false; + group_w_mx = false; static initSize = function() { content_w = w - ui(8) - group_w; @@ -41,20 +41,18 @@ function Panel_Collection() : PanelContent() constructor { roots = [ ["Collections", COLLECTIONS] , ["Assets", global.ASSETS] ]; if(STEAM_ENABLED) array_push(roots, ["Projects", STEAM_PROJECTS]); - mode = 0; - root = roots[mode][1]; + page = 0; + root = roots[page][1]; context = root; - search_list = ds_list_create(); + search_list = ds_list_create(); file_dragging = noone; _menu_node = noone; - - updated_path = noone; - updated_prog = 0; - data_path = ""; - - view_tooltip = new tooltipSelector("View", [ "Grid", "List" ]) + updated_path = noone; + updated_prog = 0; + data_path = ""; + view_tooltip = new tooltipSelector("View", [ "Grid", "List" ]) PANEL_COLLECTION = self; @@ -187,7 +185,7 @@ function Panel_Collection() : PanelContent() constructor { initMenu(); search_string = ""; - tb_search = new textBox(TEXTBOX_INPUT.text, function(str) { + tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchCollection(search_list, search_string); }); @@ -203,24 +201,23 @@ function Panel_Collection() : PanelContent() constructor { var content; var steamNode = []; - if(mode == 0) { - if(!COLLECTIONS.scanned) - COLLECTIONS.scan([".json", ".pxcc"]); - - if(context == root) content = STEAM_COLLECTION; - else content = context.content; - - for( var i = 0; i < ds_list_size(STEAM_COLLECTION); i++ ) { - var meta = STEAM_COLLECTION[| i].meta; - if(array_exists(meta.tags, context.name)) - array_push(steamNode, STEAM_COLLECTION[| i]); - } - - } else if(mode == 1) { - content = context.content; - - } else if(mode == 2) { - content = context; + switch(page) { + case 0 : + if(!COLLECTIONS.scanned) + COLLECTIONS.scan([".json", ".pxcc"]); + + if(context == root) content = STEAM_COLLECTION; + else content = context.content; + + for( var i = 0; i < ds_list_size(STEAM_COLLECTION); i++ ) { + var meta = STEAM_COLLECTION[| i].meta; + if(array_exists(meta.tags, context.name)) + array_push(steamNode, STEAM_COLLECTION[| i]); + } + break; + + case 1 : content = context.content; break; + case 2 : content = context; break; } if(search_string != "") content = search_list; @@ -230,9 +227,9 @@ function Panel_Collection() : PanelContent() constructor { var frame = PREFERENCES.collection_animated? current_time * PREFERENCES.collection_preview_speed / 3000 : 0; var _cw = contentPane.surface_w; var _hover = pHOVER && contentPane.hover; - var hh = 0; - updated_prog = lerp_linear(updated_prog, 0, 0.01); + updated_prog = lerp_linear(updated_prog, 0, 0.01); + var hh = 0; if(contentView == 0) { var grid_width = round(grid_size * 1.25); @@ -319,7 +316,7 @@ function Panel_Collection() : PanelContent() constructor { } else draw_sprite_ui_uniform(THEME.group, 0, _boxx + grid_size / 2, yy + grid_size / 2, 1, c_white); - if(meta != noone && mode == 0) { + if(meta != noone && page == 0) { if(struct_try_get(meta, "steam")) { draw_sprite_ui_uniform(THEME.steam, 0, _boxx + ui(12), yy + ui(12), 1, COLORS._main_icon_dark, 1); if(meta.author_steam_id == STEAM_USER_ID) @@ -447,7 +444,7 @@ function Panel_Collection() : PanelContent() constructor { folderPane.resize(group_w - ui(8), content_h); - if(mode == 2) contentPane.resize(w - ui(16), content_h); + if(page == 2) contentPane.resize(w - ui(16), content_h); else contentPane.resize(content_w - ui(6), content_h); } @@ -458,8 +455,8 @@ function Panel_Collection() : PanelContent() constructor { } function refreshContext() { - if(mode == 0) context.scan([ ".json", ".pxcc" ]); - else if(mode == 1) context.scan([ ".png", ".jpg", ".gif" ]); + if(page == 0) context.scan([ ".json", ".pxcc" ]); + else if(page == 1) context.scan([ ".png", ".jpg", ".gif" ]); if(STEAM_ENABLED) steamUCGload(); } @@ -469,7 +466,7 @@ function Panel_Collection() : PanelContent() constructor { var content_y = ui(48); - if(mode == 2) { + if(page == 2) { var pad = ui(8); draw_sprite_stretched(THEME.ui_panel_bg, 1, pad, content_y, w - pad * 2, content_h); @@ -519,13 +516,13 @@ function Panel_Collection() : PanelContent() constructor { var _bw = string_width(r[0]) + ui(20); if(buttonInstant(THEME.button_hide_fill, _bx, _by, _bw, bh, [ mx, my ], pFOCUS, pHOVER) == 2) { - mode = i; + page = i; root = r[1]; context = root; onResize(); } - draw_set_text(f_p0b, fa_left, fa_center, i == mode? COLORS._main_text : COLORS._main_text_sub); + draw_set_text(f_p0b, fa_left, fa_center, i == page? COLORS._main_text : COLORS._main_text_sub); draw_text(_x, _y, __txt(r[0])); _x += string_width(r[0]) + ui(24); @@ -545,7 +542,7 @@ function Panel_Collection() : PanelContent() constructor { } bx -= ui(36); - if(mode == 0 && !DEMO) { + if(page == 0 && !DEMO) { if(bx > rootx) { if(context != root) { var txt = __txtx("panel_collection_add_node", "Add selecting node as collection"); diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 119430183..28718e078 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -3193,8 +3193,7 @@ function load_file_path(path, _x = undefined, _y = undefined) { var is_multi = type == "image" && (array_length(path) > 1 || directory_exists(path[0])); if(is_multi) { - with(dialogCall(o_dialog_add_multiple_images, WIN_W / 2, WIN_H / 2)) - setPath(path); + with(dialogCall(o_dialog_add_multiple_images)) setPath(path); } else { if(!IS_CMD) PANEL_GRAPH.onStepBegin(); @@ -3211,9 +3210,12 @@ function load_file_path(path, _x = undefined, _y = undefined) { case "ase" : case "aseprite" : node = Node_create_ASE_File_Read_path(_x, _y, p); break; - case "png" : - case "jpg" : - case "jpeg" : node = Node_create_Image_path(_x, _y, p); break; + case "png" : + case "jpg" : + case "jpeg" : + if(keyboard_check_direct(vk_shift)) with(dialogCall(o_dialog_add_image)) setPath(p); + else node = Node_create_Image_path(_x, _y, p); + break; case "gif" : node = Node_create_Image_gif_path(_x, _y, p); break; case "obj" : node = Node_create_3D_Obj_path(_x, _y, p); break; diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 8fcac5f9b..b9b04355f 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -278,9 +278,9 @@ function Panel_Inspector() : PanelContent() constructor { } static drawMeta = function(_y, _m) { - var con_w = contentPane.surface_w - ui(4); - var _hover = pHOVER && contentPane.hover; + var con_w = contentPane.surface_w - ui(4); + var _hover = pHOVER && contentPane.hover; var context = PANEL_GRAPH.getCurrentContext(); var meta = context == noone? PROJECT.meta : context.metadata; if(meta == noone) return 0; @@ -393,12 +393,15 @@ function Panel_Inspector() : PanelContent() constructor { break; case 1 : - var _wdx = viewMode == INSP_VIEW_MODE.spacious? ui(16) : ui(140); - var _wdw = w - ui(48) - _wdx; + var _wdx = viewMode == INSP_VIEW_MODE.spacious? ui(16) : ui(140); + var _wdw = w - ui(48) - _wdx; + var _whh = line_get_height(_font); + var _edt = !PROJECT.meta.file_id || PROJECT.meta.author_steam_id == STEAM_USER_ID; for( var j = 0; j < array_length(meta.displays); j++ ) { var display = meta.displays[j]; - + var _wdgt = meta_tb[j]; + draw_set_text(_font, fa_left, fa_top, COLORS._main_text_inner); draw_text_over(ui(16), viewMode == INSP_VIEW_MODE.spacious? yy : yy + ui(3), __txt(display[0])); @@ -411,23 +414,24 @@ function Panel_Inspector() : PanelContent() constructor { _lh = line_get_height() + ui(6); } - meta_tb[j].setFocusHover(pFOCUS, _hover); - if(pFOCUS) meta_tb[j].register(contentPane); + _wdgt.setFocusHover(pFOCUS, _hover); + _wdgt.setInteract(_edt); + if(pFOCUS) _wdgt.register(contentPane); var _dataFunc = display[1]; var _data = _dataFunc(meta); var _wdy = yy; - var _wdh = display[2]; + var _wdh = _whh * display[2]; var _param = new widgetParam(_wdx, _wdy, _wdw, _wdh, _data, {}, _m, rx, ry); _param.font = _font; - switch(instanceof(meta_tb[j])) { - case "textArrayBox" : meta_tb[j].arraySet = current_meta.tags; break; + switch(instanceof(_wdgt)) { + case "textArrayBox" : _wdgt.arraySet = current_meta.tags; break; } - wh = meta_tb[j].drawParam(_param); - if(meta_tb[j].inBBOX(_m)) contentPane.hover_content = true; + wh = _wdgt.drawParam(_param); + if(_wdgt.inBBOX(_m)) contentPane.hover_content = true; if(viewMode == INSP_VIEW_MODE.spacious) { yy += wh + ui(8); @@ -439,7 +443,7 @@ function Panel_Inspector() : PanelContent() constructor { } } - if(STEAM_ENABLED) { + if(STEAM_ENABLED && _edt) { meta_steam_avatar.setFocusHover(pFOCUS, _hover); if(pFOCUS) meta_steam_avatar.register(contentPane);