Old 09-11-2019, 03:57 AM   #1
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 752
Default New Script: Inline Midi Editor toggle per track

Hi gang,

UPDATED 2019-09-11: Made it for all selected tracks and added undo code blocks.

I find it tedious to select items I want to inline edit... or just see in a piano roll format on the main arrange screen. So I wrote a script that toggles the entire selected track (first selected) to Inline Edit mode. Much less fiddly than current implementations.

Here it is in action. You can also apply the script to multiple tracks by selecting different tracks as you go... and copy/paste MIDI between them by using the cursor and track selection. If you think it would be more valuable to do inline edit for ALL selected tracks at once, I can update it. Let me know.



Here is the code:

Code:
--[[
Script: AK Track Inline Edit toggle (maintain selected items).lua
Written by Thonex
v1.1

updated to apply to all selected tracksand added undo code blocks
--]]

function TOGGLE_TRACK_INLINE_EDIT ()
  reaper.PreventUIRefresh(1)
  reaper.Undo_BeginBlock()

----- log originally selected items ------

  orig_sel_item = {}
  orig_sel_tracks = {}
  trk_item = {}

  num_selected_items =  reaper.CountSelectedMediaItems( 0 )
  num_selected_tracks =  reaper.CountSelectedTracks( 0 )

  for i=0, num_selected_items-1 do
      orig_sel_item [i] =  reaper.GetSelectedMediaItem( 0, i )
  end
  reaper.SelectAllMediaItems(0, 0 ) -- deselect all items on project now that all orig selected items are logged
   
----- select all item on selected tracks  ------  

  for ii = 0, num_selected_tracks-1 do

      track = reaper.GetSelectedTrack( 0, ii )
      num_item_trk = reaper.CountTrackMediaItems( track )

      for i=0, num_item_trk-1 do
          trk_item [i] =  reaper.GetTrackMediaItem( track, i )
          reaper.SetMediaItemSelected( trk_item [i], 1 )
      end
  end
 toggle_inline = reaper.NamedCommandLookup( "_RS8990ef30b1d78ba18e5e3423352dc632f43aa723"  )-- Script: me2beats_Toggle open items inline editors.lua
 reaper.Main_OnCommand(toggle_inline,0) -- Script: me2beats_Toggle open items inline editors.lua 
  
----- reset selection state to initial state ------ 

  reaper.SelectAllMediaItems(0, 0 )
  
  for i=0, num_selected_items-1 do
      orig_sel_item [i] =  reaper.SetMediaItemSelected( orig_sel_item [i], 1 )
  end

  reaper.PreventUIRefresh(-1) 
  reaper.Undo_EndBlock("Toggle tracks inline editor state",-1)

end

TOGGLE_TRACK_INLINE_EDIT ()
__________________
Cheers,
Andrew K
v5.982/64 Mac 10.12.+, i7 Quad 2.9GHz, 24GB

Last edited by Thonex; 09-13-2019 at 02:20 PM.
Thonex is offline   Reply With Quote
Old 09-11-2019, 07:32 AM   #2
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

Hi, thanks for this script... and YES ... I do think it makes more sense to have it work on all selected tracks

I hope you will update to that or give us the code to add...

that way if we only have one track selected it still works fine but with a few selected it would catch them all and let us Inline Edit between them
more easily...

thanks again!
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is online now   Reply With Quote
Old 09-11-2019, 08:11 AM   #3
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 752
Default

Quote:
Originally Posted by hopi View Post
Hi, thanks for this script... and YES ... I do think it makes more sense to have it work on all selected tracks

I hope you will update to that or give us the code to add...

that way if we only have one track selected it still works fine but with a few selected it would catch them all and let us Inline Edit between them
more easily...

thanks again!
Sure.

Ok...will add later today and will bump the post and update the OP.
__________________
Cheers,
Andrew K
v5.982/64 Mac 10.12.+, i7 Quad 2.9GHz, 24GB
Thonex is offline   Reply With Quote
Old 09-11-2019, 10:26 AM   #4
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 752
Default

UPDATED 2019-09-11: Made it for all selected tracks and added undo code blocks.
__________________
Cheers,
Andrew K
v5.982/64 Mac 10.12.+, i7 Quad 2.9GHz, 24GB
Thonex is offline   Reply With Quote
Old 09-12-2019, 09:25 PM   #5
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 559
Default

This needs to be be added to a ReaPack.
Ozman is offline   Reply With Quote
Old 09-13-2019, 12:04 PM   #6
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

Thanks much update works great and makes perfect sense to me...

i.e., IF we only want to work on one track we just select only that track
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is online now   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 04:25 PM.


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