Old 04-30-2017, 02:21 AM   #1
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default REQ: De-select last selected item

Hey guys, is it possible to write a script that de-selects the last selected item within an item selection across tracks, ignoring grouping?

Example, I'm editing multitrack drums. They are grouped (vertically) and occasionally I want to edit the position of just the first 1 or 2 items (kick drum mics).


A script that deselected the last selected item (shrinks selection) could be used in multiple instances in a custom action.

Alternatively, I'd be happy with a script that changes the selection of items to only the first 2 (or 1) items.


Any thoughts?
Cheers for reading!

All the best,
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]

Last edited by daxliniere; 04-30-2017 at 02:54 AM.
daxliniere is offline   Reply With Quote
Old 04-30-2017, 02:25 AM   #2
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

I suppose this could also be achieved through an adaption of SWS: Select Next Item (across tracks). That action selects the next item on the same track, rather than the next item on the track below.
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 04-30-2017, 02:30 AM   #3
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

Haha, it could also be done with an adaptation of the native action Item navigation: Select and move to item in next track without changing track selection

That action successfully selects the item below, but deselects the first selected item.
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 04-30-2017, 02:35 AM   #4
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

Okay, I think I've got it with a fairly convoluted custom action, but a dedicated script could be quite handy for other things.
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 09-11-2017, 05:19 PM   #5
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Script: FnA_Unselect First Selected Item.lua
Script: FnA_Unselect Last Selected Item.lua

are now in ReaPack. Thanks X-Raym and cfillion for help!

Also:
Script: FnA_Ensure toggle ON (item grouping).lua
Script: FnA_Ensure toggle OFF (item grouping).lua
FnA is offline   Reply With Quote
Old 09-12-2017, 02:12 AM   #6
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

Woowoo!
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 12-02-2017, 11:23 AM   #7
teniente powell
Human being with feelings
 
teniente powell's Avatar
 
Join Date: Oct 2016
Location: Spain
Posts: 324
Default

Hello FnA. I'm trying to use your "Ensure toggle" scripts in midi editor, but I can't get them to do what I want.

View: toggle show velocity handles on notes (ID 40040)
View: toggle show velocity numbers on notes (ID 40632)

I want a Custom action that hide velocity handles and show velocity numbers. What I have done is:

I paste "40040" in your Ensure toggle off script, and rename it.
I paste "40632" in your Ensure toggle on script, and rename it.

I make a custom action with those two actions. The custom action does not work. And neither the new "ensure toggle" scripts individually.

Why?
teniente powell is offline   Reply With Quote
Old 12-02-2017, 02:16 PM   #8
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Hm, that's a bit of a problem isn't it. That action was only meant for use in the Main Section of the Action List. Well, until I figure out what, if anything, to do for ReaPack, I'll make 2 examples here for use in the regular MIDI Editor. I don't see any toggle "state" being reported for any actions in the Inline MIDI Editor Action List, and I don't know how to trigger a Media Explorer action. So, regular MIDI editor only.

It requires a somewhat obscure integer to point to the other sections of the list. I had to be told about them by Jeffos, lol. And different functions too.

Code:
-- Description: Ensure toggle ON - MIDI Editor (velocity numbers on notes)

-- User Variables ---------------------------------
local Command_ID = "40632" -- Paste Command ID from Action List between quotes SWS example:"_BR_ME_TOGGLE_HIDE_ALL_NO_LAST_CLICKED"
local islistviewcommand = false -- true for Event List, false for Piano Roll
-- End of User Variables --------------------------

local section_id = 32060 --0/100=main/main alt, 32063=media explorer, 32060=midi editor, 32061=midi event list editor, 32062=midi inline editor)
local r = reaper
local x = tonumber(Command_ID)
if x then -- REAPER factory actions
  if r.GetToggleCommandStateEx(section_id, x) == 0 then
    r.MIDIEditor_LastFocused_OnCommand(x, islistviewcommand)
  end
else -- SWS actions
  local x = r.NamedCommandLookup(Command_ID)
  if r.GetToggleCommandStateEx(section_id, x) == 0 then
    r.MIDIEditor_LastFocused_OnCommand(x, islistviewcommand)
  end
end

function noundo() end
r.defer(noundo)
Code:
-- Description: Ensure toggle OFF - MIDI Editor (velocity handles on notes)

-- User Variables ---------------------------------
local Command_ID = "40040" -- Paste Command ID from Action List between quotes SWS example:"_BR_ME_TOGGLE_HIDE_ALL_NO_LAST_CLICKED"
local islistviewcommand = false -- true for Event List, false for Piano Roll
-- End of User Variables --------------------------

local section_id = 32060 --0/100=main/main alt, 32063=media explorer, 32060=midi editor, 32061=midi event list editor, 32062=midi inline editor)
local r = reaper
local x = tonumber(Command_ID)
if x then -- REAPER factory actions
  if r.GetToggleCommandStateEx(section_id, x) == 1 then
    r.MIDIEditor_LastFocused_OnCommand(x, islistviewcommand)
  end
else -- SWS actions
  local x = r.NamedCommandLookup(Command_ID)
  if r.GetToggleCommandStateEx(section_id, x) == 1 then
    r.MIDIEditor_LastFocused_OnCommand(x, islistviewcommand)
  end
end

function noundo() end
r.defer(noundo)

Last edited by FnA; 12-02-2017 at 09:39 PM.
FnA is offline   Reply With Quote
Old 12-02-2017, 06:21 PM   #9
teniente powell
Human being with feelings
 
teniente powell's Avatar
 
Join Date: Oct 2016
Location: Spain
Posts: 324
Default

Fine, it works. I only need to operate in midi editor. Thanks a lot.
teniente powell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.