|
| 1 | +-- @description Move selected items to a FIPM lane |
| 2 | +-- @version 1.0 |
| 3 | +-- @author cfillion |
| 4 | +-- @website |
| 5 | +-- cfillion.ca https://cfillion.ca |
| 6 | +-- Request Thread https://forum.cockos.com/showthread.php?t=200756 |
| 7 | +-- @donate https://www.paypal.com/cgi-bin/webscr?business=T3DEWBQJAV7WL&cmd=_donations¤cy_code=CAD&item_name=FIPM+-+Move+selected+items+to+a+given+lane |
| 8 | +-- @about |
| 9 | +-- This script provides a set of two actions for moving the selected media |
| 10 | +-- items to the top or bottom FIPM lane of the track. Each lane is half of the |
| 11 | +-- track's height. |
| 12 | +-- |
| 13 | +-- FIPM (Free Item Positioning Mode) is enabled on the tracks as required. |
| 14 | +-- @provides |
| 15 | +-- [main] . > cfillion_Move selected items to top FIPM lane (half track height).lua |
| 16 | +-- [main] . > cfillion_Move selected items to bottom FIPM lane (half track height).lua |
| 17 | + |
| 18 | +local script_name = ({reaper.get_action_context()})[2]:match('([^/\\_]+).lua$') |
| 19 | + |
| 20 | +reaper.Undo_BeginBlock() |
| 21 | + |
| 22 | +for ii=0,reaper.CountSelectedMediaItems(0)-1 do |
| 23 | + local item = reaper.GetSelectedMediaItem(0, ii) |
| 24 | + local track = reaper.GetMediaItemTrack(item) |
| 25 | + |
| 26 | + if reaper.GetMediaTrackInfo_Value(track, 'B_FREEMODE') ~= 1 then |
| 27 | + reaper.SetMediaTrackInfo_Value(track, 'B_FREEMODE', 1) |
| 28 | + end |
| 29 | + |
| 30 | + local y, h = 0, 0.5 |
| 31 | + if script_name:match('bottom') then |
| 32 | + y = 0.5 |
| 33 | + end |
| 34 | + |
| 35 | + reaper.SetMediaItemInfo_Value(item, 'F_FREEMODE_Y', y) |
| 36 | + reaper.SetMediaItemInfo_Value(item, 'F_FREEMODE_H', h) |
| 37 | +end |
| 38 | + |
| 39 | +reaper.UpdateTimeline() |
| 40 | +reaper.Undo_EndBlock(script_name, -1) |
0 commit comments