Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 05-23-2018, 06:12 AM   #1
mccrabney
Human being with feelings
 
mccrabney's Avatar
 
Join Date: Aug 2015
Posts: 3,669
Default different mouse modifiers for different media item types

i wrote a cool "open midi item" action that you run from the Main screen. it runs a script that runs actions from the Midi Editor (zooming to content, hiding unused note rows).

i replaced the default "open in editor" action with this, and it's awesome for midi items

however, double clicking audio items attempts to open it in the midi editor, of course.

so, FR - different mouse modifiers for different media item types!
__________________
mccrabney scripts: MIDI edits from the Arrange screen ala jjos/MPC sequencer
|sis - - - anacru| isn't what we performed: pls no extra noteons in loop recording
| - - - - - anacru|sis <==this is what we actually performed.
mccrabney is offline   Reply With Quote
Old 05-23-2018, 06:45 AM   #2
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Can you maybe please share your script ?
I am very interested
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 05-23-2018, 08:32 AM   #3
mccrabney
Human being with feelings
 
mccrabney's Avatar
 
Join Date: Aug 2015
Posts: 3,669
Default

sure, here it is. keep in mind some things are changing for 5.9 in regards to zooming, selection in midi editor.

the whole "create item if none exists" (script1) isn't necessary but it's useful if you're entering "midi tracks" from hardware

Quote:
custom action:

sws: show selected track in TCP
script 1: create midi item under edit cursor if none exists
xenakios/sws: select item under edit cursor on selected tracks
script 2: open midi editor and run midi editor action
item: select all items in track (to make all midi data on track editable in midi editor)
script 1:

Code:
discussion: http://forum.cockos.com/showthread.p...=1#post1520818

function is_edit_cursor_on_item() 
  reaper.Undo_BeginBlock() --Begining of the undo block.
  selected_tracks_count = reaper.CountSelectedTracks(0)
  cursor_pos = reaper.GetCursorPosition() --edit cursor position
  no_edit_cursor = 0 --number of tracks that DON'T contain the edit cursor

  for i = 0, selected_tracks_count-1  do  -- LOOP THROUGH SELECTED TRACKS
    track_sel = reaper.GetSelectedTrack(0, i)
    item_num = reaper.CountTrackMediaItems(track_sel)

    for j = 0, item_num-1 do -- LOOP THROUGH MEDIA ITEMS
      item = reaper.GetTrackMediaItem(track_sel, j)
      start_pos = reaper.GetMediaItemInfo_Value(item, "D_POSITION");
      end_pos = start_pos + reaper.GetMediaItemInfo_Value(item, "D_LENGTH");
          
           --now, count how many items don't contain edit cursor:
        if cursor_pos >= start_pos and cursor_pos <= end_pos 
          then --do nothing. consider editing to DELETE item if no midi events counted.     
          else no_edit_cursor = no_edit_cursor + 1
        end --end item count
    end -- ENDLOOP through selected items
  end -- ENDLOOP through selected tracks
  
  if no_edit_cursor == item_num   --- check to see if # of items w/out edit cursor == total
    then reaper.CreateNewMIDIItemInProj(track_sel, cursor_pos, cursor_pos+1)

    reaper.Main_OnCommandEx(reaper.NamedCommandLookup( "_ecc87463a4710b46a8843a0dbe767187"), 0, 0)    
    
  end
  
  reaper.Undo_EndBlock("create midi item under mouse cursor if none exists", 0) 
end

is_edit_cursor_on_item() -- Execute your main function
reaper.UpdateArrange() -- Update the arrangement (often needed)

------------

script 2. NOTE: i left in extra midi editor actions in the below script, comment out or delete the ones you don't need.

Code:
function do_actions_from_main_and_midi_sections()
(
   Main_OnCommand(40153, 0); // MAIN section action 40153: "open selected item in MIDI editor"
   active_MIDI_editor = MIDIEditor_GetActive(); // Now the MIDI editor is opened -> get MIDI editor ID
   
  MIDIEditor_OnCommand(active_MIDI_editor, 40799); // other midi on track (doesn't work in script)
  //MIDIEditor_OnCommand(active_MIDI_editor, 40452); // show all note rowss40466
  MIDIEditor_OnCommand(active_MIDI_editor, 40453); // hide unused note row
  MIDIEditor_OnCommand(active_MIDI_editor, 40006); // select all events
  MIDIEditor_OnCommand(active_MIDI_editor, 40725); // zoom to selected notes
  MIDIEditor_OnCommand(active_MIDI_editor, 40214); // deselect all
  MIDIEditor_OnCommand(active_MIDI_editor, 40466); // zoom to content    
);

do_actions_from_main_and_midi_sections();
__________________
mccrabney scripts: MIDI edits from the Arrange screen ala jjos/MPC sequencer
|sis - - - anacru| isn't what we performed: pls no extra noteons in loop recording
| - - - - - anacru|sis <==this is what we actually performed.

Last edited by mccrabney; 05-23-2018 at 11:52 AM.
mccrabney is offline   Reply With Quote
Old 05-23-2018, 11:26 AM   #4
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Thanks for the effort !

I only wanna script 2 to open midi editor for 1 selected item and then zoom to the item's contents of that 1 item in midi editor.
Therefore, I tried to leave out some lines in script 2, but then i get an error when running the script:

3: ')' expected (to close '(' at line 2) near ';'

I am a total Script noob so i dunno what i am doing wrong ..lol.
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 05-23-2018, 11:52 AM   #5
mccrabney
Human being with feelings
 
mccrabney's Avatar
 
Join Date: Aug 2015
Posts: 3,669
Default

it's now edited in post above, i might have screwed it up while copying/pasting

use the example // to comment out actions you don't need
__________________
mccrabney scripts: MIDI edits from the Arrange screen ala jjos/MPC sequencer
|sis - - - anacru| isn't what we performed: pls no extra noteons in loop recording
| - - - - - anacru|sis <==this is what we actually performed.
mccrabney is offline   Reply With Quote
Old 05-23-2018, 01:19 PM   #6
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

I copied the whole script 2, did not any alteration in it.
I select a MIDI Item in Arrange and then run the script in Arrange.
I then get:
lua:3: ')' expected (to close '(' at line 2) near ';'
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 05-23-2018, 01:48 PM   #7
mccrabney
Human being with feelings
 
mccrabney's Avatar
 
Join Date: Aug 2015
Posts: 3,669
Default

sorry, i don't know what to tell you, i don't see any uncommented parenthesis that would be causing that issue. maybe remove the commented out "(does not work in script)" bit
__________________
mccrabney scripts: MIDI edits from the Arrange screen ala jjos/MPC sequencer
|sis - - - anacru| isn't what we performed: pls no extra noteons in loop recording
| - - - - - anacru|sis <==this is what we actually performed.
mccrabney is offline   Reply With Quote
Old 05-23-2018, 02:45 PM   #8
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Script two is .eel
FnA 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 09:59 PM.


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