From 83ca8a6cf9f6598a7dc88e8b2c8ee684c5f19907 Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+StopMotionEGames@users.noreply.github.com> Date: Fri, 27 Mar 2026 01:57:36 -0300 Subject: [PATCH 01/11] starting working on it --- Minecraft Note Block Studio.yyp | 1 + scripts/selection_flip/selection_flip.gml | 2 ++ scripts/selection_flip/selection_flip.yy | 11 +++++++++++ 3 files changed, 14 insertions(+) create mode 100644 scripts/selection_flip/selection_flip.gml create mode 100644 scripts/selection_flip/selection_flip.yy diff --git a/Minecraft Note Block Studio.yyp b/Minecraft Note Block Studio.yyp index 2d91c96a..6e8185d8 100644 --- a/Minecraft Note Block Studio.yyp +++ b/Minecraft Note Block Studio.yyp @@ -7430,4 +7430,5 @@ "MetaData": { "IDEVersion": "2022.0.3.85", }, + {"id":{"name":"selection_flip","path":"scripts/selection_flip/selection_flip.yy",},"order":39,}, } \ No newline at end of file diff --git a/scripts/selection_flip/selection_flip.gml b/scripts/selection_flip/selection_flip.gml new file mode 100644 index 00000000..b7334a05 --- /dev/null +++ b/scripts/selection_flip/selection_flip.gml @@ -0,0 +1,2 @@ +function selection_flip(flipVertically){ +} \ No newline at end of file diff --git a/scripts/selection_flip/selection_flip.yy b/scripts/selection_flip/selection_flip.yy new file mode 100644 index 00000000..19e5fe02 --- /dev/null +++ b/scripts/selection_flip/selection_flip.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "selection_flip", + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "Selection", + "path": "folders/Scripts/Note Blocks/Selection.yy", + }, +} \ No newline at end of file From 8e635388204a917f3a179b9d33528a620eb3323a Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+StopMotionEGames@users.noreply.github.com> Date: Fri, 27 Mar 2026 01:59:04 -0300 Subject: [PATCH 02/11] add keyboard shortcuts for testing --- scripts/control_draw/control_draw.gml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index b22193b1..e9b93fba 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -637,6 +637,13 @@ function control_draw() { window_scale = get_default_window_scale() set_msg(condstr(language = 1, "窗口缩放", "Window scale") + " => " + string(window_scale * 100) + "%") } + + // ASK FOR CHANGES BEFORE FLIGHT! + if (keyboard_check_pressed(ord("J"))) + selection_flip(true) + if (keyboard_check_pressed(ord("H"))) + selection_flip(false) + if ((os_type != os_macosx && keyboard_check_pressed(187)) || (os_type = os_macosx && keyboard_check_pressed(24)) || (mouse_wheel_up_dynamic())) { if (window_scale >= 0.5 && window_scale < 0.67) {window_scale = 0.67} else if (window_scale < 0.75) {window_scale = 0.75} From 714b8b1835223b3367205116fcacc299ff1bbe9b Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+RaviScriptDev@users.noreply.github.com> Date: Fri, 3 Apr 2026 12:44:24 -0300 Subject: [PATCH 03/11] selection flipping script done also, I can probably make it cleaner --- scripts/selection_flip/selection_flip.gml | 119 ++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/scripts/selection_flip/selection_flip.gml b/scripts/selection_flip/selection_flip.gml index b7334a05..0b44f7d2 100644 --- a/scripts/selection_flip/selection_flip.gml +++ b/scripts/selection_flip/selection_flip.gml @@ -1,2 +1,121 @@ function selection_flip(flipVertically){ + //if flipVertical is true, well, it'll flip the selection vertically. Otherwise, horizontally. + + var row, column, current_song, str; + + var old_ins, old_key, old_vel, old_pan, old_pit, old_exists; + + current_song = songs[song]; + + str = current_song.selection_code; + + var target_height = current_song.selection_h; + for (var i = 0; i < current_song.selection_l; i++) { + + for (var j = current_song.selection_colfirst[i]; j < target_height; j++) { + if (j < 0 || current_song.selection_exists[i, j]) continue; + + current_song.selection_colfirst[i] = -1 + current_song.selection_collast[i] = -1 + current_song.selection_exists[i, j] = 0 + current_song.selection_ins[i, j] = 0 + current_song.selection_key[i, j] = 0 + current_song.selection_vel[i, j] = 0 + current_song.selection_pan[i, j] = 0 + current_song.selection_pit[i, j] = 0 + current_song.selection_played[i, j] = 0 + } + } + + + + // vertical flip + if (flipVertically) { + + for (column = 0; column < current_song.selection_l; column++) { + for (row = 0; row < current_song.selection_h / 2; row++) { + var target_row = current_song.selection_h - row - 1; + + old_ins = current_song.selection_ins[column, row]; + old_key = current_song.selection_key[column, row]; + old_vel = current_song.selection_vel[column, row]; + old_pan = current_song.selection_pan[column, row]; + old_pit = current_song.selection_pit[column, row]; + old_exists = current_song.selection_exists[column,row]; + + current_song.selection_ins[column, row] = current_song.selection_ins[column, target_row]; + current_song.selection_ins[column, target_row] = old_ins; + + current_song.selection_key[column, row] = current_song.selection_key[column, target_row]; + current_song.selection_key[column, target_row] = old_key; + + current_song.selection_vel[column, row] = current_song.selection_vel[column, target_row]; + current_song.selection_vel[column, target_row] = old_vel; + + current_song.selection_pan[column, row] = current_song.selection_pan[column, target_row]; + current_song.selection_pan[column, target_row] = old_pan; + + current_song.selection_pit[column, row] = current_song.selection_pit[column, target_row]; + current_song.selection_pit[column, target_row] = old_pit; + + current_song.selection_exists[column, row] = current_song.selection_exists[column, target_row]; + current_song.selection_exists[column, target_row] = old_exists; + } + } + } + else { + for (column = 0; column < current_song.selection_l / 2; column++) { + for (row = 0; row < current_song.selection_h; row++) { + var target_column = current_song.selection_l - column - 1; + + old_ins = current_song.selection_ins[column, row]; + old_key = current_song.selection_key[column, row]; + old_vel = current_song.selection_vel[column, row]; + old_pan = current_song.selection_pan[column, row]; + old_pit = current_song.selection_pit[column, row]; + old_exists = current_song.selection_exists[column, row]; + + current_song.selection_ins[column, row] = current_song.selection_ins[target_column, row]; + current_song.selection_ins[target_column, row] = old_ins; + + current_song.selection_key[column, row] = current_song.selection_key[target_column, row]; + current_song.selection_key[target_column, row] = old_key; + + current_song.selection_vel[column, row] = current_song.selection_vel[target_column, row]; + current_song.selection_vel[target_column, row] = old_vel; + + current_song.selection_pan[column, row] = current_song.selection_pan[target_column, row]; + current_song.selection_pan[target_column, row] = old_pan; + + current_song.selection_pit[column, row] = current_song.selection_pit[target_column, row]; + current_song.selection_pit[target_column, row] = old_pit; + + current_song.selection_exists[column, row] = current_song.selection_exists[target_column, row]; + current_song.selection_exists[target_column, row] = old_exists; + } + } + } + + for (var i = 0; i < current_song.selection_l; i++) { + for (var j = 0; j < current_song.selection_h; j++) { + if (current_song.selection_exists[i,j]) { + current_song.selection_colfirst[i] = j; + break; + } + } + } + + for (var i = current_song.selection_l; i >= 0; i--) { + for (var j = current_song.selection_h; j >= 0; j--) { + if (current_song.selection_exists[i,j]) { + current_song.selection_collast[i] = j; + break; + } + } + } + + selection_trim(); + + selection_code_update(); + history_set(h_selectchange, current_song.selection_x, current_song.selection_y, current_song.selection_code, current_song.selection_x, current_song.selection_y, str); } \ No newline at end of file From 9483808fd8bf2533b24f90e4f2add52546d2fee5 Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+RaviScriptDev@users.noreply.github.com> Date: Fri, 3 Apr 2026 13:28:18 -0300 Subject: [PATCH 04/11] add some documentation in selection_flip.gml --- scripts/selection_flip/selection_flip.gml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/selection_flip/selection_flip.gml b/scripts/selection_flip/selection_flip.gml index 0b44f7d2..0d1ba8ca 100644 --- a/scripts/selection_flip/selection_flip.gml +++ b/scripts/selection_flip/selection_flip.gml @@ -9,10 +9,10 @@ function selection_flip(flipVertically){ str = current_song.selection_code; - var target_height = current_song.selection_h; + // expand all the column properites before flipping for (var i = 0; i < current_song.selection_l; i++) { - for (var j = current_song.selection_colfirst[i]; j < target_height; j++) { + for (var j = current_song.selection_colfirst[i]; j < current_song.selection_h; j++) { if (j < 0 || current_song.selection_exists[i, j]) continue; current_song.selection_colfirst[i] = -1 @@ -23,15 +23,13 @@ function selection_flip(flipVertically){ current_song.selection_vel[i, j] = 0 current_song.selection_pan[i, j] = 0 current_song.selection_pit[i, j] = 0 - current_song.selection_played[i, j] = 0 } } + if (flipVertically) // vertical flip - if (flipVertically) { - for (column = 0; column < current_song.selection_l; column++) { for (row = 0; row < current_song.selection_h / 2; row++) { var target_row = current_song.selection_h - row - 1; @@ -62,8 +60,8 @@ function selection_flip(flipVertically){ current_song.selection_exists[column, target_row] = old_exists; } } - } - else { + else + // horizontal flip for (column = 0; column < current_song.selection_l / 2; column++) { for (row = 0; row < current_song.selection_h; row++) { var target_column = current_song.selection_l - column - 1; @@ -94,8 +92,8 @@ function selection_flip(flipVertically){ current_song.selection_exists[target_column, row] = old_exists; } } - } - + + // find the fist row number in the columns for (var i = 0; i < current_song.selection_l; i++) { for (var j = 0; j < current_song.selection_h; j++) { if (current_song.selection_exists[i,j]) { @@ -104,7 +102,8 @@ function selection_flip(flipVertically){ } } } - + + // find the last row number in the columns for (var i = current_song.selection_l; i >= 0; i--) { for (var j = current_song.selection_h; j >= 0; j--) { if (current_song.selection_exists[i,j]) { From a1b8e0db4a74490cc3105830e835693334557f2f Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+RaviScriptDev@users.noreply.github.com> Date: Fri, 3 Apr 2026 16:19:34 -0300 Subject: [PATCH 05/11] add flip selection options to show_menu_ext calls and menu_macos --- scripts/control_draw/control_draw.gml | 4 ++++ scripts/menu_macos_init/menu_macos_init.gml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index e9b93fba..f90d2fad 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -533,6 +533,8 @@ function control_draw() { inactive(current_song.selected = 0 && current_song.totalblocks = 0) + get_hotkey("invert_selection") + "$Invert selection|-|"+ inactive(current_song.totalblocks = 0 || selbx >= current_song.enda) + "Select all to the right ->|"+ inactive(current_song.totalblocks = 0 || selbx <= 0) + "Select all to the left <-|-|"+ + inactive(current_song.selection_l < 2) + "Flip selection horizontally|"+ + inactive(current_song.selection_h < 2) + "Flip selection vertically|-|"+ inactive(current_song.instrument.num_blocks = 0) + "Select all " + clean(current_song.instrument.name) + "|"+ inactive(current_song.instrument.num_blocks = current_song.totalblocks) + "Select all but " + clean(current_song.instrument.name) + "|-|"+ inactive(current_song.selected = 0) + get_hotkey("action_1") + "$" + get_mode_actions(1) + "|"+ @@ -1754,6 +1756,8 @@ function control_draw() { inactive(current_song.totalblocks = 0) + get_hotkey("select_all") + "$Select all|"+ inactive(current_song.selected = 0) + "Deselect all|"+ inactive(current_song.selected = 0 && current_song.totalblocks = 0) + get_hotkey("invert_selection") + "$Invert selection|-|"+ + inactive(current_song.selection_l < 2) + "Flip selection horizontally|"+ + inactive(current_song.selection_h < 2) + "Flip selection vertically|-|"+ inactive(current_song.instrument.num_blocks = 0) + "Select all " + clean(current_song.instrument.name) + "|"+ inactive(current_song.instrument.num_blocks = current_song.totalblocks) + "Select all but " + clean(current_song.instrument.name) + "|-|"+ inactive(current_song.selected = 0) + get_hotkey("action_1") + "$" + get_mode_actions(1) + "|"+ diff --git a/scripts/menu_macos_init/menu_macos_init.gml b/scripts/menu_macos_init/menu_macos_init.gml index c6be208b..75f41472 100644 --- a/scripts/menu_macos_init/menu_macos_init.gml +++ b/scripts/menu_macos_init/menu_macos_init.gml @@ -54,6 +54,8 @@ function menu_macos_init(){ inactive(current_song.totalblocks = 0) + get_hotkey_menubar("select_all") + "$Select all|"+ inactive(current_song.selected = 0) + "Deselect all|"+ inactive(current_song.selected = 0 && current_song.totalblocks = 0) + get_hotkey_menubar("invert_selection") + "$Invert selection|-|"+ + inactive(current_song.selection_l < 2) + "Flip selection horizontally|"+ + inactive(current_song.selection_h < 2) + "Flip selection vertically|-|"+ inactive(current_song.instrument.num_blocks = 0) + "Select all " + clean(current_song.instrument.name) + "|"+ inactive(current_song.instrument.num_blocks = current_song.totalblocks) + "Select all but " + clean(current_song.instrument.name) + "|-|"+ inactive(current_song.selected = 0) + get_hotkey_menubar("action_1") + "$" + get_mode_actions(1) + "|"+ From dd8d2bcb98f464accd6730426775ee88b16c4f1d Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+RaviScriptDev@users.noreply.github.com> Date: Fri, 3 Apr 2026 16:20:34 -0300 Subject: [PATCH 06/11] make flip selection options clickable --- scripts/menu_click/menu_click.gml | 120 +++++++++++++++--------------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/scripts/menu_click/menu_click.gml b/scripts/menu_click/menu_click.gml index 665fd61e..9354fdfe 100644 --- a/scripts/menu_click/menu_click.gml +++ b/scripts/menu_click/menu_click.gml @@ -68,11 +68,11 @@ function menu_click(argument0) { break } case "edit": { - if ((editmode = m_key) && (sel >= 15)) { + if ((editmode = m_key) && (sel >= 17)) { sel += 2 } var insoffset = ds_list_size(songs[song].instrument_list) + insmenu - 1 - var ins = sel - 18 + var ins = sel - 20 ins -= floor(ins / 26) // subtract the "More..." entries to get the instrument number if (sel = 0) action_undo() if (sel = 1) action_redo() @@ -98,44 +98,46 @@ function menu_click(argument0) { if (sel = 6) select_all(-1, 0) if (sel = 7) selection_place(0) if (sel = 8) selection_invert() - if (sel = 9) select_all(songs[song].instrument, 0) - if (sel = 10) select_all(songs[song].instrument, 1) - if (sel = 11) mode_action(1) - if (sel = 12) mode_action(2) - if (sel = 13) mode_action(3) - if (sel = 14) mode_action(4) - if (sel = 15 && editmode != m_key) mode_action(5) - if (sel = 16 && editmode != m_key) mode_action(6) - if (sel > 17 && sel < 18 + insoffset) selection_changeins(songs[song].instrument_list[| ins]) - if (sel = 18 + insoffset) selection_expand() - if (sel = 19 + insoffset) selection_compress() - if (sel = 21 + insoffset) window = w_tremolo - if (sel = 22 + insoffset) window = w_stereo - if (sel = 23 + insoffset) window = w_arpeggio - if (sel = 24 + insoffset) window = w_portamento - if (sel = 25 + insoffset) macro_vibrato() - if (sel = 26 + insoffset) window = w_stagger - if (sel = 27 + insoffset) macro_chorus() - if (sel = 28 + insoffset) macro_velocitylfo() - if (sel = 29 + insoffset) macro_fadein() - if (sel = 30 + insoffset) macro_fadeout() - if (sel = 31 + insoffset) macro_replacekey() - if (sel = 32 + insoffset) window = w_setvelocity - if (sel = 33 + insoffset) window = w_setpanning - if (sel = 34 + insoffset) window = w_setpitch - if (sel = 35 + insoffset) macro_reset() - if (sel = 36 + insoffset) { + if (sel = 9) selection_flip(0) + if (sel = 10) selection_flip(1) + if (sel = 11) select_all(songs[song].instrument, 0) + if (sel = 12) select_all(songs[song].instrument, 1) + if (sel = 13) mode_action(1) + if (sel = 14) mode_action(2) + if (sel = 15) mode_action(3) + if (sel = 16) mode_action(4) + if (sel = 17 && editmode != m_key) mode_action(5) + if (sel = 18 && editmode != m_key) mode_action(6) + if (sel > 19 && sel < 20 + insoffset) selection_changeins(songs[song].instrument_list[| ins]) + if (sel = 20 + insoffset) selection_expand() + if (sel = 21 + insoffset) selection_compress() + if (sel = 23 + insoffset) window = w_tremolo + if (sel = 24 + insoffset) window = w_stereo + if (sel = 25 + insoffset) window = w_arpeggio + if (sel = 26 + insoffset) window = w_portamento + if (sel = 27 + insoffset) macro_vibrato() + if (sel = 28 + insoffset) window = w_stagger + if (sel = 29 + insoffset) macro_chorus() + if (sel = 30 + insoffset) macro_velocitylfo() + if (sel = 31 + insoffset) macro_fadein() + if (sel = 32 + insoffset) macro_fadeout() + if (sel = 33 + insoffset) macro_replacekey() + if (sel = 34 + insoffset) window = w_setvelocity + if (sel = 35 + insoffset) window = w_setpanning + if (sel = 36 + insoffset) window = w_setpitch + if (sel = 37 + insoffset) macro_reset() + if (sel = 38 + insoffset) { if (language != 1) {if (question("Transpose selected notes so that they fall within Minecraft's 2 octaves?", "Transpose notes")) selection_transpose()} else {if (question("转换音符使其在 Minecraft 的 2 八度以内吗?", "转换音符")) selection_transpose()} } break } case "editext": { - if ((editmode = m_key) && (sel >= 15)) { + if ((editmode = m_key) && (sel >= 17)) { sel += 2 } var insoffset = ds_list_size(songs[song].instrument_list) + insmenu - 1 - var ins = sel - 18 + var ins = sel - 20 ins -= floor((ins) / 26) // subtract the "More..." entries to get the instrument number if (sel = 0) action_copy() if (sel = 1) action_cut() @@ -152,33 +154,35 @@ function menu_click(argument0) { selection_place(0) selection_add(0, 0, obj_menu.menuc, songs[song].endb, 0, 0) } - if (sel = 9) select_all(songs[song].instrument, 0) - if (sel = 10) select_all(songs[song].instrument, 1) - if (sel = 11) mode_action(1) - if (sel = 12) mode_action(2) - if (sel = 13) mode_action(3) - if (sel = 14) mode_action(4) - if (sel = 15 && editmode != m_key) mode_action(5) - if (sel = 16 && editmode != m_key) mode_action(6) - if (sel > 17 && sel < 18 + insoffset) selection_changeins(songs[song].instrument_list[| ins]) - if (sel = 18 + insoffset) selection_expand() - if (sel = 19 + insoffset) selection_compress() - if (sel = 21 + insoffset) window = w_tremolo - if (sel = 22 + insoffset) window = w_stereo - if (sel = 23 + insoffset) window = w_arpeggio - if (sel = 24 + insoffset) window = w_portamento - if (sel = 25 + insoffset) macro_vibrato() - if (sel = 26 + insoffset) window = w_stagger - if (sel = 27 + insoffset) macro_chorus() - if (sel = 28 + insoffset) macro_velocitylfo() - if (sel = 29 + insoffset) macro_fadein() - if (sel = 30 + insoffset) macro_fadeout() - if (sel = 31 + insoffset) macro_replacekey() - if (sel = 32 + insoffset) window = w_setvelocity - if (sel = 33 + insoffset) window = w_setpanning - if (sel = 34 + insoffset) window = w_setpitch - if (sel = 35 + insoffset) macro_reset() - if (sel = 36 + insoffset) { + if (sel = 9) selection_flip(0) + if (sel = 10) selection_flip(1) + if (sel = 11) select_all(songs[song].instrument, 0) + if (sel = 12) select_all(songs[song].instrument, 1) + if (sel = 13) mode_action(1) + if (sel = 14) mode_action(2) + if (sel = 15) mode_action(3) + if (sel = 16) mode_action(4) + if (sel = 17 && editmode != m_key) mode_action(5) + if (sel = 18 && editmode != m_key) mode_action(6) + if (sel > 19 && sel < 20 + insoffset) selection_changeins(songs[song].instrument_list[| ins]) + if (sel = 20 + insoffset) selection_expand() + if (sel = 21 + insoffset) selection_compress() + if (sel = 23 + insoffset) window = w_tremolo + if (sel = 24 + insoffset) window = w_stereo + if (sel = 25 + insoffset) window = w_arpeggio + if (sel = 26 + insoffset) window = w_portamento + if (sel = 27 + insoffset) macro_vibrato() + if (sel = 28 + insoffset) window = w_stagger + if (sel = 29 + insoffset) macro_chorus() + if (sel = 30 + insoffset) macro_velocitylfo() + if (sel = 31 + insoffset) macro_fadein() + if (sel = 32 + insoffset) macro_fadeout() + if (sel = 33 + insoffset) macro_replacekey() + if (sel = 34 + insoffset) window = w_setvelocity + if (sel = 35 + insoffset) window = w_setpanning + if (sel = 36 + insoffset) window = w_setpitch + if (sel = 37 + insoffset) macro_reset() + if (sel = 38 + insoffset) { if (language != 1) {if (question("Transpose selected notes so that they fall within Minecraft's 2 octaves?", "Transpose notes")) selection_transpose()} else {if (question("转换音符使其在 Minecraft 的 2 八度以内吗?", "转换音符")) selection_transpose()} } From 59d0211c9936a33f9d8bd840e3e89d739617edaa Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+RaviScriptDev@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:02:48 -0300 Subject: [PATCH 07/11] add entries for selection flipping in menus on the Chinese side --- scripts/control_draw/control_draw.gml | 4 ++++ scripts/menu_macos_init/menu_macos_init.gml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index f90d2fad..f146a9fc 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -571,6 +571,8 @@ function control_draw() { inactive(current_song.totalblocks = 0) + get_hotkey("select_all") + "$全选|"+ inactive(current_song.selected = 0) + "全不选|"+ inactive(current_song.selected = 0 && current_song.totalblocks = 0) + get_hotkey("invert_selection") + "$选择反转|-|"+ + inactive(current_song.selection_l < 2) + "Flip selection horizontally (TRANSLATION_NEEDED)|"+ + inactive(current_song.selection_h < 2) + "Flip selection vertically (TRANSLATION_NEEDED)|-|"+ inactive(current_song.totalblocks = 0 || selbx >= current_song.enda) + "选择右侧所有 ->|"+ inactive(current_song.totalblocks = 0 || selbx <= 0) + "选择左侧所有 <-|-|"+ inactive(current_song.instrument.num_blocks = 0) + "选择所有 " + clean(current_song.instrument.name) + "|"+ @@ -1853,6 +1855,8 @@ function control_draw() { inactive(current_song.totalblocks = 0) + get_hotkey("select_all") + "$全选|"+ inactive(current_song.selected = 0) + "全不选|"+ inactive(current_song.selected = 0 && current_song.totalblocks = 0) + get_hotkey("invert_selection") + "$选择反转|-|"+ + inactive(current_song.selection_l < 2) + "Flip selection horizontally (TRANSLATION_NEEDED)|"+ + inactive(current_song.selection_h < 2) + "Flip selection vertically (TRANSLATION_NEEDED)|-|"+ inactive(current_song.instrument.num_blocks = 0) + "选择所有 " + clean(current_song.instrument.name) + "|"+ inactive(current_song.instrument.num_blocks = current_song.totalblocks) + "选择所有除了 " + clean(current_song.instrument.name) + "|-|"+ inactive(current_song.selected = 0) + get_hotkey("action_1") + "$" + get_mode_actions(1) + "|"+ diff --git a/scripts/menu_macos_init/menu_macos_init.gml b/scripts/menu_macos_init/menu_macos_init.gml index 75f41472..ec1f7e39 100644 --- a/scripts/menu_macos_init/menu_macos_init.gml +++ b/scripts/menu_macos_init/menu_macos_init.gml @@ -160,6 +160,8 @@ function menu_macos_init(){ inactive(current_song.totalblocks = 0) + get_hotkey_menubar("select_all") + "$全选|"+ inactive(current_song.selected = 0) + "全不选|"+ inactive(current_song.selected = 0 && current_song.totalblocks = 0) + get_hotkey_menubar("invert_selection") + "$选择反转|-|"+ + inactive(current_song.selection_l < 2) + "Flip selection horizontally (TRANSLATION_NEEDED)|"+ + inactive(current_song.selection_h < 2) + "Flip selection vertically (TRANSLATION_NEEDED)|-|"+ inactive(current_song.instrument.num_blocks = 0) + "选择所有 " + clean(current_song.instrument.name) + "|"+ inactive(current_song.instrument.num_blocks = current_song.totalblocks) + "选择所有除了 " + clean(current_song.instrument.name) + "|-|"+ inactive(current_song.selected = 0) + get_hotkey_menubar("action_1") + "$" + get_mode_actions(1) + "|"+ From 92dc1b18ce7083f5bbe59998871b3abebf3a81e8 Mon Sep 17 00:00:00 2001 From: StopMotionEGames <163608714+RaviScriptDev@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:10:01 -0300 Subject: [PATCH 08/11] move the flipping options below the "select all to the..." options --- scripts/control_draw/control_draw.gml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index f146a9fc..57fac985 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -571,10 +571,10 @@ function control_draw() { inactive(current_song.totalblocks = 0) + get_hotkey("select_all") + "$全选|"+ inactive(current_song.selected = 0) + "全不选|"+ inactive(current_song.selected = 0 && current_song.totalblocks = 0) + get_hotkey("invert_selection") + "$选择反转|-|"+ - inactive(current_song.selection_l < 2) + "Flip selection horizontally (TRANSLATION_NEEDED)|"+ - inactive(current_song.selection_h < 2) + "Flip selection vertically (TRANSLATION_NEEDED)|-|"+ inactive(current_song.totalblocks = 0 || selbx >= current_song.enda) + "选择右侧所有 ->|"+ inactive(current_song.totalblocks = 0 || selbx <= 0) + "选择左侧所有 <-|-|"+ + inactive(current_song.selection_l < 2) + "Flip selection horizontally (TRANSLATION_NEEDED)|"+ + inactive(current_song.selection_h < 2) + "Flip selection vertically (TRANSLATION_NEEDED)|-|"+ inactive(current_song.instrument.num_blocks = 0) + "选择所有 " + clean(current_song.instrument.name) + "|"+ inactive(current_song.instrument.num_blocks = current_song.totalblocks) + "选择所有除了 " + clean(current_song.instrument.name) + "|-|"+ inactive(current_song.selected = 0) + get_hotkey("action_1") + "$" + get_mode_actions(1) + "|"+ From a647a9916d4fabadd7af0d60d649d30fd9406891 Mon Sep 17 00:00:00 2001 From: Ravi Widnef <163608714+RaviScriptDev@users.noreply.github.com> Date: Sat, 16 May 2026 13:22:25 -0300 Subject: [PATCH 09/11] remove keyboard shortcut for selection flip --- scripts/control_draw/control_draw.gml | 6 ------ 1 file changed, 6 deletions(-) mode change 100644 => 100755 scripts/control_draw/control_draw.gml diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml old mode 100644 new mode 100755 index 57fac985..f1bf242c --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -642,12 +642,6 @@ function control_draw() { set_msg(condstr(language = 1, "窗口缩放", "Window scale") + " => " + string(window_scale * 100) + "%") } - // ASK FOR CHANGES BEFORE FLIGHT! - if (keyboard_check_pressed(ord("J"))) - selection_flip(true) - if (keyboard_check_pressed(ord("H"))) - selection_flip(false) - if ((os_type != os_macosx && keyboard_check_pressed(187)) || (os_type = os_macosx && keyboard_check_pressed(24)) || (mouse_wheel_up_dynamic())) { if (window_scale >= 0.5 && window_scale < 0.67) {window_scale = 0.67} else if (window_scale < 0.75) {window_scale = 0.75} From 9e4ad7ebbd6671acb971b8e4d755cd371c44a4e4 Mon Sep 17 00:00:00 2001 From: Ravi Widnef <163608714+RaviScriptDev@users.noreply.github.com> Date: Thu, 13 Aug 2026 21:01:16 -0300 Subject: [PATCH 10/11] fix possible crash --- scripts/selection_flip/selection_flip.gml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/selection_flip/selection_flip.gml b/scripts/selection_flip/selection_flip.gml index 0d1ba8ca..442e4224 100644 --- a/scripts/selection_flip/selection_flip.gml +++ b/scripts/selection_flip/selection_flip.gml @@ -93,7 +93,7 @@ function selection_flip(flipVertically){ } } - // find the fist row number in the columns + // find the first row number in the columns for (var i = 0; i < current_song.selection_l; i++) { for (var j = 0; j < current_song.selection_h; j++) { if (current_song.selection_exists[i,j]) { @@ -104,8 +104,8 @@ function selection_flip(flipVertically){ } // find the last row number in the columns - for (var i = current_song.selection_l; i >= 0; i--) { - for (var j = current_song.selection_h; j >= 0; j--) { + for (var i = current_song.selection_l - 1; i >= 0; i--) { + for (var j = current_song.selection_h - 1; j >= 0; j--) { if (current_song.selection_exists[i,j]) { current_song.selection_collast[i] = j; break; From 9740ce51acd75f8edf2a33f95db00559a64aacbc Mon Sep 17 00:00:00 2001 From: Ravi Widnef <163608714+RaviScriptDev@users.noreply.github.com> Date: Fri, 14 Aug 2026 21:03:56 -0300 Subject: [PATCH 11/11] remove code duplication by merging the horizontal flip for-loop with the vertical flip for-loop. To remove the code duplication, I merged these two for-loops. To select what mode (vertical or horizontal) the flip will use, before the loop, I defined and calculated two variables: `outerloop_count` and `innerloop_count` These two variables basically, one the two is set to current_song.selection_(l or h) divided by 2. The other is set to `row` or `column`. The same thing is done for the target_row and target_column: one of these two has the value calculated, the other is just `row` or `column` --- scripts/selection_flip/selection_flip.gml | 102 +++++++++------------- 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/scripts/selection_flip/selection_flip.gml b/scripts/selection_flip/selection_flip.gml index 442e4224..072f96ca 100644 --- a/scripts/selection_flip/selection_flip.gml +++ b/scripts/selection_flip/selection_flip.gml @@ -1,7 +1,7 @@ function selection_flip(flipVertically){ //if flipVertical is true, well, it'll flip the selection vertically. Otherwise, horizontally. - var row, column, current_song, str; + var row, column, current_song, str, target_column, target_row, outerloop_count, innerloop_count; var old_ins, old_key, old_vel, old_pan, old_pit, old_exists; @@ -15,24 +15,39 @@ function selection_flip(flipVertically){ for (var j = current_song.selection_colfirst[i]; j < current_song.selection_h; j++) { if (j < 0 || current_song.selection_exists[i, j]) continue; - current_song.selection_colfirst[i] = -1 - current_song.selection_collast[i] = -1 - current_song.selection_exists[i, j] = 0 - current_song.selection_ins[i, j] = 0 - current_song.selection_key[i, j] = 0 - current_song.selection_vel[i, j] = 0 - current_song.selection_pan[i, j] = 0 - current_song.selection_pit[i, j] = 0 + current_song.selection_colfirst[i] = -1; + current_song.selection_collast[i] = -1; + current_song.selection_exists[i, j] = 0; + current_song.selection_ins[i, j] = 0; + current_song.selection_key[i, j] = 0; + current_song.selection_vel[i, j] = 0; + current_song.selection_pan[i, j] = 0; + current_song.selection_pit[i, j] = 0; } } - - if (flipVertically) - // vertical flip - for (column = 0; column < current_song.selection_l; column++) { - for (row = 0; row < current_song.selection_h / 2; row++) { - var target_row = current_song.selection_h - row - 1; + // if flipVertically, set the loop count values to do a vertical flip + if (flipVertically) { + outerloop_count = current_song.selection_l; + innerloop_count = current_song.selection_h / 2; + } else { + // otherwise, set the loop count values to do a horizontal flip + outerloop_count = current_song.selection_l / 2; + innerloop_count = current_song.selection_h; + } + + for (column = 0; column < outerloop_count; column++) { + for (row = 0; row < innerloop_count; row++) { + + // same logic, but for the target row and column you want to move the value + if (flipVertically) { + target_row = current_song.selection_h - row - 1; + target_column = column; + } else { + target_row = row; + target_column = current_song.selection_l - column - 1; + } old_ins = current_song.selection_ins[column, row]; old_key = current_song.selection_key[column, row]; @@ -41,55 +56,23 @@ function selection_flip(flipVertically){ old_pit = current_song.selection_pit[column, row]; old_exists = current_song.selection_exists[column,row]; - current_song.selection_ins[column, row] = current_song.selection_ins[column, target_row]; - current_song.selection_ins[column, target_row] = old_ins; + current_song.selection_ins[column, row] = current_song.selection_ins[target_column, target_row]; + current_song.selection_ins[target_column, target_row] = old_ins; - current_song.selection_key[column, row] = current_song.selection_key[column, target_row]; - current_song.selection_key[column, target_row] = old_key; + current_song.selection_key[column, row] = current_song.selection_key[target_column, target_row]; + current_song.selection_key[target_column, target_row] = old_key; - current_song.selection_vel[column, row] = current_song.selection_vel[column, target_row]; - current_song.selection_vel[column, target_row] = old_vel; + current_song.selection_vel[column, row] = current_song.selection_vel[target_column, target_row]; + current_song.selection_vel[target_column, target_row] = old_vel; - current_song.selection_pan[column, row] = current_song.selection_pan[column, target_row]; - current_song.selection_pan[column, target_row] = old_pan; + current_song.selection_pan[column, row] = current_song.selection_pan[target_column, target_row]; + current_song.selection_pan[target_column, target_row] = old_pan; - current_song.selection_pit[column, row] = current_song.selection_pit[column, target_row]; - current_song.selection_pit[column, target_row] = old_pit; + current_song.selection_pit[column, row] = current_song.selection_pit[target_column, target_row]; + current_song.selection_pit[target_column, target_row] = old_pit; - current_song.selection_exists[column, row] = current_song.selection_exists[column, target_row]; - current_song.selection_exists[column, target_row] = old_exists; - } - } - else - // horizontal flip - for (column = 0; column < current_song.selection_l / 2; column++) { - for (row = 0; row < current_song.selection_h; row++) { - var target_column = current_song.selection_l - column - 1; - - old_ins = current_song.selection_ins[column, row]; - old_key = current_song.selection_key[column, row]; - old_vel = current_song.selection_vel[column, row]; - old_pan = current_song.selection_pan[column, row]; - old_pit = current_song.selection_pit[column, row]; - old_exists = current_song.selection_exists[column, row]; - - current_song.selection_ins[column, row] = current_song.selection_ins[target_column, row]; - current_song.selection_ins[target_column, row] = old_ins; - - current_song.selection_key[column, row] = current_song.selection_key[target_column, row]; - current_song.selection_key[target_column, row] = old_key; - - current_song.selection_vel[column, row] = current_song.selection_vel[target_column, row]; - current_song.selection_vel[target_column, row] = old_vel; - - current_song.selection_pan[column, row] = current_song.selection_pan[target_column, row]; - current_song.selection_pan[target_column, row] = old_pan; - - current_song.selection_pit[column, row] = current_song.selection_pit[target_column, row]; - current_song.selection_pit[target_column, row] = old_pit; - - current_song.selection_exists[column, row] = current_song.selection_exists[target_column, row]; - current_song.selection_exists[target_column, row] = old_exists; + current_song.selection_exists[column, row] = current_song.selection_exists[target_column, target_row]; + current_song.selection_exists[target_column, target_row] = old_exists; } } @@ -114,7 +97,6 @@ function selection_flip(flipVertically){ } selection_trim(); - selection_code_update(); history_set(h_selectchange, current_song.selection_x, current_song.selection_y, current_song.selection_code, current_song.selection_x, current_song.selection_y, str); } \ No newline at end of file