|
|
|
08-09-2018, 05:46 PM
|
#1
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
|
2 New Scripts: Smart Vertical selection w/ previous selection aware
Hi guys, (are there any women in this forum?)
Here are 2 new scripts I wrote to suit some of my editing needs... especially since Arming Action Icons with Key Commands will be officially supported soon. These basically turn your mouse into a smart selection tool. There are similar scripts out there but when using Snap there can be issues in selecting the correct items and they are problematic for multi selecting (Clicking new items etc). Snap should not inhibit this script and neither should previously selected items be affected.
Script #1: Select_All_Items_Under_Cursor_All_Tracks- Click on any item and all items crossing cursor vertically above and below will be selected.
- Previous selection will be retained allowing multiple vertical selections -- even from previously marqueed selections.
Script #1: Select_Items_Under_Cursor_on Selected Tracks- Click on any item and ONLY items on selected tracks crossing cursor vertically above and below will be selected.
- Previous selection will be retained allowing multiple vertical selections -- even from previously marqueed selections.
With both of these scripts, I bound them to a Toolbar Icon that will be Key Command-able very soon. But the functionality
Hope you find it useful. Let me know if you find any odd behaviors.
Script #1: Select_All_Items_Under_Cursor_All_Tracks
Script #1: Select_Items_Under_Cursor_On_Selected_Tracks
Select All Items Under Cursor on ALL Tracks
Code:
-- written by Thonex aka Andrew K
function Select_All_Items_Under_Cursor_All_Tracks ()
reaper.PreventUIRefresh(1)
reaper.ClearConsole()
reaper.Undo_BeginBlock()
Cur_Pos = reaper.BR_PositionAtMouseCursor( true )
Num_Sel_1 = reaper.CountSelectedMediaItems(0 )
t_Prev_Sel_ID = {}
for i=0, Num_Sel_1 -1 do -- scans already selected PLUS the clicked item (clicked item will be first ID)
t_Prev_Sel_ID[i] = reaper.GetSelectedMediaItem(0,i)
end
local L_Start, R_End = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false) -- Get TimeSelection from orig position
local _, __ = reaper.GetSet_LoopTimeRange(true, false, Cur_Pos-.001, Cur_Pos+.001, false) -- Set TimeSelection 1 ms to right and left of mouse click
reaper.Main_OnCommand( 40717, 0) -- Item: Select all items in current time selection
for i=0, Num_Sel_1 -1 do
reaper.SetMediaItemSelected( t_Prev_Sel_ID[i], 1 )
end
local _, __ = reaper.GetSet_LoopTimeRange(true, false, L_Start, R_End, false) -- Set TimeSelection
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
reaper.Undo_EndBlock("Select all items under cursor",-1)
end
Select_All_Items_Under_Cursor_All_Tracks ()
Select All Items Under Cursor On Selected Tracks
Code:
-- written by Thonex aka Andrew K
function itemUnderMouse()
reaper.BR_GetMouseCursorContext()
return reaper.BR_GetMouseCursorContext_Item()
end
function Select_All_Items_Under_Cursor_On_Selected_Tracks()
reaper.PreventUIRefresh(1)
reaper.ClearConsole()
reaper.Undo_BeginBlock()
local Clicked_Item = itemUnderMouse()
if Clicked_Item ~= nil then
reaper.SetMediaItemSelected(Clicked_Item, 0 )
end
Cur_Pos = reaper.BR_PositionAtMouseCursor( true )
Num_Sel_1 = reaper.CountSelectedMediaItems(0 )
t_Prev_Sel_ID = {}
for i=0, Num_Sel_1 -1 do -- scans already selected items
t_Prev_Sel_ID[i] = reaper.GetSelectedMediaItem(0,i)
end
local L_Start, R_End = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false) -- Get Time Selection initial pos
local _, __ = reaper.GetSet_LoopTimeRange(true, false, Cur_Pos-.001, Cur_Pos+.001, false) -- Set TimeSelection 1 ms to right and left of mouse click
reaper.Main_OnCommand( 40718, 0) -- Item: Select all items on selected tracks in current time selection
for i=0, Num_Sel_1 -1 do -- reselct all previous items
reaper.SetMediaItemSelected( t_Prev_Sel_ID[i], 1 )
end
local _, __ = reaper.GetSet_LoopTimeRange(true, false, L_Start, R_End, false) -- Set Time Selection to initial pos
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
reaper.Undo_EndBlock("Select all items under cursor",-1)
end
Select_All_Items_Under_Cursor_On_Selected_Tracks()
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Last edited by Thonex; 08-12-2018 at 11:38 AM.
Reason: removed an unnecessary line of code
|
|
|
08-10-2018, 05:32 AM
|
#2
|
Human being with feelings
Join Date: Feb 2017
Posts: 305
|
Thank you for sharing
Are you seeking girlfrend?
|
|
|
08-10-2018, 06:39 AM
|
#3
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Wow, awesome man! Checking them out
|
|
|
08-10-2018, 09:35 AM
|
#4
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Just tried the scripts and there's a tiny little typo in the last line of the first script.
It points to the wrong function. It needs to be changed to:
Select_All_Items_Under_Cursor_All_Tracks ()
|
|
|
08-10-2018, 10:13 AM
|
#5
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
|
Quote:
Originally Posted by _Stevie_
Just tried the scripts and there's a tiny little typo in the last line of the first script.
It points to the wrong function. It needs to be changed to:
Select_All_Items_Under_Cursor_All_Tracks ()
|
That's what happens when I copy from Sublime instead of the Reascript API. All fixed. Thanks man.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Last edited by Thonex; 08-10-2018 at 10:22 AM.
|
|
|
08-10-2018, 10:24 AM
|
#6
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
|
Quote:
Originally Posted by Ivannn Bennnettt
Thank you for sharing
Are you seeking girlfrend?
|
LOL.... no, I'm relatively new here... and I don't remember seeing any women in this forum. So was just curious after I wrote... "Hey Guys"
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
08-11-2018, 02:21 AM
|
#7
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Thonex, awesome scripts !
Any chance of adding these to ReaPack plz ?
|
|
|
08-11-2018, 03:54 AM
|
#8
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
|
Quote:
Originally Posted by vanhaze
Thonex, awesome scripts !
Any chance of adding these to ReaPack plz ?
|
Yeah... I think so. I just want to make sure I use them some more to check for edge-case errors. So far all has been good.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
08-11-2018, 12:23 PM
|
#9
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Superb !
|
|
|
08-15-2018, 07:45 AM
|
#10
|
Human being with feelings
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
|
Really nice... many thanks... please keep writing!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:51 PM.
|