diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 26ee23899..45c505514 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1102,6 +1102,7 @@ {"name":"safe_operation","order":6,"path":"scripts/safe_operation/safe_operation.yy",}, {"name":"sample_projects","order":6,"path":"scripts/sample_projects/sample_projects.yy",}, {"name":"save_function","order":1,"path":"scripts/save_function/save_function.yy",}, + {"name":"tooltip_hotkey","order":2,"path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",}, {"name":"scrollBox","order":2,"path":"scripts/scrollBox/scrollBox.yy",}, {"name":"scrollPane","order":3,"path":"scripts/scrollPane/scrollPane.yy",}, {"name":"shell_functions","order":20,"path":"scripts/shell_functions/shell_functions.yy",}, @@ -1313,7 +1314,6 @@ {"name":"sh_grid_tri","order":3,"path":"shaders/sh_grid_tri/sh_grid_tri.yy",}, {"name":"sh_herringbone_tile","order":5,"path":"shaders/sh_herringbone_tile/sh_herringbone_tile.yy",}, {"name":"sh_image_trace","order":34,"path":"shaders/sh_image_trace/sh_image_trace.yy",}, - {"name":"sh_mask_invert","order":20,"path":"shaders/sh_mask_invert/sh_mask_invert.yy",}, {"name":"sh_invert","order":17,"path":"shaders/sh_invert/sh_invert.yy",}, {"name":"sh_kuwahara_ani","order":37,"path":"shaders/sh_kuwahara_ani/sh_kuwahara_ani.yy",}, {"name":"sh_kuwahara","order":36,"path":"shaders/sh_kuwahara/sh_kuwahara.yy",}, @@ -1323,6 +1323,7 @@ {"name":"sh_lovify","order":2,"path":"shaders/sh_lovify/sh_lovify.yy",}, {"name":"sh_lum2alpha","order":16,"path":"shaders/sh_lum2alpha/sh_lum2alpha.yy",}, {"name":"sh_mask_expand","order":31,"path":"shaders/sh_mask_expand/sh_mask_expand.yy",}, + {"name":"sh_mask_invert","order":20,"path":"shaders/sh_mask_invert/sh_mask_invert.yy",}, {"name":"sh_mask_modify","order":2,"path":"shaders/sh_mask_modify/sh_mask_modify.yy",}, {"name":"sh_mesh_generation","order":3,"path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",}, {"name":"sh_mirror_mask","order":8,"path":"shaders/sh_mirror_mask/sh_mirror_mask.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 36497c3d0..04acc18ab 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1579,6 +1579,7 @@ {"id":{"name":"safe_operation","path":"scripts/safe_operation/safe_operation.yy",},}, {"id":{"name":"sample_projects","path":"scripts/sample_projects/sample_projects.yy",},}, {"id":{"name":"save_function","path":"scripts/save_function/save_function.yy",},}, + {"id":{"name":"tooltip_hotkey","path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",},}, {"id":{"name":"scrollBox","path":"scripts/scrollBox/scrollBox.yy",},}, {"id":{"name":"scrollPane","path":"scripts/scrollPane/scrollPane.yy",},}, {"id":{"name":"shader_functions","path":"scripts/shader_functions/shader_functions.yy",},}, @@ -1828,7 +1829,6 @@ {"id":{"name":"sh_herringbone_tile","path":"shaders/sh_herringbone_tile/sh_herringbone_tile.yy",},}, {"id":{"name":"sh_image_trace","path":"shaders/sh_image_trace/sh_image_trace.yy",},}, {"id":{"name":"sh_interpret_number","path":"shaders/sh_interpret_number/sh_interpret_number.yy",},}, - {"id":{"name":"sh_mask_invert","path":"shaders/sh_mask_invert/sh_mask_invert.yy",},}, {"id":{"name":"sh_invert","path":"shaders/sh_invert/sh_invert.yy",},}, {"id":{"name":"sh_kuwahara_ani","path":"shaders/sh_kuwahara_ani/sh_kuwahara_ani.yy",},}, {"id":{"name":"sh_kuwahara","path":"shaders/sh_kuwahara/sh_kuwahara.yy",},}, @@ -1838,6 +1838,7 @@ {"id":{"name":"sh_lovify","path":"shaders/sh_lovify/sh_lovify.yy",},}, {"id":{"name":"sh_lum2alpha","path":"shaders/sh_lum2alpha/sh_lum2alpha.yy",},}, {"id":{"name":"sh_mask_expand","path":"shaders/sh_mask_expand/sh_mask_expand.yy",},}, + {"id":{"name":"sh_mask_invert","path":"shaders/sh_mask_invert/sh_mask_invert.yy",},}, {"id":{"name":"sh_mask_modify","path":"shaders/sh_mask_modify/sh_mask_modify.yy",},}, {"id":{"name":"sh_mask","path":"shaders/sh_mask/sh_mask.yy",},}, {"id":{"name":"sh_mesh_generation","path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",},}, diff --git a/scripts/draw_tooltip/draw_tooltip.gml b/scripts/draw_tooltip/draw_tooltip.gml index 587a90061..a378f95fc 100644 --- a/scripts/draw_tooltip/draw_tooltip.gml +++ b/scripts/draw_tooltip/draw_tooltip.gml @@ -1,4 +1,4 @@ -function draw_tooltip_text(txt) { +function draw_tooltip_text(txt) { #region if(string_length(txt) > 1024) txt = string_copy(txt, 1, 1024) + "..."; @@ -13,9 +13,9 @@ function draw_tooltip_text(txt) { draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16)); draw_text_line(mx + ui(8), my + ui(8), txt, -1, tw); -} +} #endregion -function draw_tooltip_color(clr) { +function draw_tooltip_color(clr) { #region if(is_array(clr)) { draw_tooltip_palette(clr); return; @@ -32,9 +32,9 @@ function draw_tooltip_color(clr) { draw_set_color(clr); draw_rectangle(mx + ui(8), my + ui(8), mx + ui(ww + 8), my + ui(hh + 8), false); -} +} #endregion -function draw_tooltip_palette(clr) { +function draw_tooltip_palette(clr) { #region if(array_empty(clr)) return; var ph = ui(32); @@ -58,9 +58,9 @@ function draw_tooltip_palette(clr) { drawPalette(clr[i], mx + ui(8), _y, ui(ww), ph); _y += ph; } -} +} #endregion -function draw_tooltip_gradient(clr) { +function draw_tooltip_gradient(clr) { #region var gh = ui(32); if(!is_array(clr)) clr = [ clr ]; @@ -78,9 +78,9 @@ function draw_tooltip_gradient(clr) { clr[i].draw(mx + ui(8), _y, ui(ww), gh); _y += gh; } -} +} #endregion -function draw_tooltip_surface_array(surf) { +function draw_tooltip_surface_array(surf) { #region if(!is_array(surf) || array_empty(surf)) return; if(is_instanceof(surf[0], SurfaceAtlas)) { @@ -121,9 +121,9 @@ function draw_tooltip_surface_array(surf) { draw_set_color(COLORS._main_icon); draw_rectangle(cx - sw * ss / 2, cy - sh * ss / 2, cx + sw * ss / 2 - 1, cy + sh * ss / 2 - 1, true); } -} +} #endregion -function draw_tooltip_surface(surf) { +function draw_tooltip_surface(surf) { #region if(is_array(surf)) { draw_tooltip_surface_array(array_spread(surf)) return; @@ -151,9 +151,9 @@ function draw_tooltip_surface(surf) { draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_surface_ext_safe(surf, mx + ui(8), my + ui(8), ss, ss); -} +} #endregion -function draw_tooltip_sprite(spr) { +function draw_tooltip_sprite(spr) { #region if(!sprite_exists(spr)) return; var sw = sprite_get_width(spr); @@ -176,9 +176,9 @@ function draw_tooltip_sprite(spr) { for( var i = 0; i < sn; i++ ) draw_sprite_ext(spr, i, sx + i * (sw * ss + 2), sy, ss, ss, 0, c_white, 1); -} +} #endregion -function draw_tooltip_atlas(atlas) { +function draw_tooltip_atlas(atlas) { #region if(!is_array(atlas)) atlas = [ atlas ]; var amo = array_length(atlas); @@ -223,9 +223,9 @@ function draw_tooltip_atlas(atlas) { draw_text_add(sx + ui(160), _y + ui(16), atl.rotation); draw_text_add(sx + ui(160), _y + ui(32), $"{atl.sx}, {atl.sy}"); } -} +} #endregion -function draw_tooltip_buffer(buff) { +function draw_tooltip_buffer(buff) { #region var txt = buffer_get_string(buff, false, 400); var len = string_length(txt); @@ -249,4 +249,4 @@ function draw_tooltip_buffer(buff) { draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text_sub); draw_text(mx + ui(8), my + th + ui(8), $"...({buffer_get_size(buff)} bytes)"); } -} \ No newline at end of file +} #endregion \ No newline at end of file diff --git a/scripts/hotkey_data/hotkey_data.gml b/scripts/hotkey_data/hotkey_data.gml index d1dbc6c54..a2df2bb34 100644 --- a/scripts/hotkey_data/hotkey_data.gml +++ b/scripts/hotkey_data/hotkey_data.gml @@ -54,6 +54,16 @@ "Move Target": new hotkeySimple("T"), }, }; + + function getToolHotkey(_group, _key, _def = "") { + INLINE + + if(!struct_has(HOTKEYS_CUSTOM, _group)) return _def; + + var _grp = HOTKEYS_CUSTOM[$ _group]; + if(!struct_has(_grp, _key)) return _def; + return _grp[$ _key].key; + } #endregion #region hotkeys @@ -110,16 +120,15 @@ if(_context == "") ds_list_insert(HOTKEYS[? _context], 0, key); else ds_list_add(HOTKEYS[? _context], key); } -#endregion - -#region functions - function getHotkey(_group, _key, _def = "") { - INLINE + + function getHotkey(context, name) { + if(!ds_map_exists(HOTKEYS, context)) return noone; - if(!struct_has(HOTKEYS_CUSTOM, _group)) return _def; + for(var i = 0; i < ds_list_size(HOTKEYS[? context]); i++) { + var hotkey = HOTKEYS[? _context][| i]; + if(hotkey.name == name) return hotkey; + } - var _grp = HOTKEYS_CUSTOM[$ _group]; - if(!struct_has(_grp, _key)) return _def; - return _grp[$ _key].key; + return noone; } #endregion \ No newline at end of file diff --git a/scripts/node_tool/node_tool.gml b/scripts/node_tool/node_tool.gml index d72ed2bd8..2bcb1fc43 100644 --- a/scripts/node_tool/node_tool.gml +++ b/scripts/node_tool/node_tool.gml @@ -11,7 +11,7 @@ function NodeTool(name, spr, context = instanceof(other)) constructor { static checkHotkey = function() { INLINE - return getHotkey(ctx, name); + return getToolHotkey(ctx, name); } static getName = function(index = 0) { diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index 64a45e17a..23ca09eb2 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -174,7 +174,7 @@ function Panel_Animation() : PanelContent() constructor { function() { PROJECT.animator.stop(); } ], [ - function() { return PROJECT.animator.is_playing? __txt("Pause") : __txt("Play"); }, + function() { return PROJECT.animator.is_playing? __txt("Pause") : __txt("Play from current (Shift + Space)"); }, function() { return !PROJECT.animator.is_playing; }, function() { return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; }, function() { if(PROJECT.animator.is_playing) PROJECT.animator.pause(); else PROJECT.animator.resume(); } diff --git a/scripts/tooltip_hotkey/tooltip_hotkey.gml b/scripts/tooltip_hotkey/tooltip_hotkey.gml new file mode 100644 index 000000000..0a6cb3f5f --- /dev/null +++ b/scripts/tooltip_hotkey/tooltip_hotkey.gml @@ -0,0 +1,8 @@ +function tooltipHotkey(text, context, name) constructor { + self.text = text; + self.hotkey = getHotkey(context, name); + + static drawTooltip = function() { + + } +} \ No newline at end of file diff --git a/scripts/tooltip_hotkey/tooltip_hotkey.yy b/scripts/tooltip_hotkey/tooltip_hotkey.yy new file mode 100644 index 000000000..fed5b9e24 --- /dev/null +++ b/scripts/tooltip_hotkey/tooltip_hotkey.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"", + "%Name":"tooltip_hotkey", + "isCompatibility":false, + "isDnD":false, + "name":"tooltip_hotkey", + "parent":{ + "name":"tooltip", + "path":"folders/functions/tooltip.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file