Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Convert empty items with notes to dedicated video processor item named after the notes v1.00 #1358

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
-- @description Convert empty items with notes to dedicated video processor item named after the notes
-- @author amagalma
-- @version 1.00
-- @donation https://www.paypal.me/amagalma


local item_cnt = reaper.CountSelectedMediaItems( 0 )
if item_cnt == 0 then
return reaper.defer(function() end)
end

local function ConvertEmptyItem( item )
if reaper.GetActiveTake( item ) then return end
local ok, notes = reaper.GetSetMediaItemInfo_String( item, "P_NOTES", "", false )
if ok and notes ~= "" then
local ok2, chunk = reaper.GetItemStateChunk( item, "", false )
if ok2 then
chunk = chunk:match("(.+)<NOTES.+") .. 'NAME "' .. notes ..
[["
FADEFLAG 1
VOLPAN 1 0 1 -1
SOFFS 0
PLAYRATE 1 1 0 -1 0 0.0025
CHANMODE 0
GUID ]] .. reaper.genGuid() .. [[

<SOURCE VIDEOEFFECT
<CODE
>
CODEPARM 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>
>]]
reaper.SetItemStateChunk( item, chunk, false )
end
end
end

----------

reaper.PreventUIRefresh( 1 )

for i = 0, item_cnt-1 do
local item = reaper.GetSelectedMediaItem( 0 , i )
ConvertEmptyItem( item )
end

reaper.PreventUIRefresh( -1 )
reaper.Undo_OnStateChangeEx( "Convert empty items", 4, -1 )
Loading