|
|
|
08-17-2022, 04:33 PM
|
#1
|
Human being with feelings
Join Date: Mar 2012
Posts: 375
|
Select and move a single marker?
Hey everyone--title says it all. I have a marker action that I want moved to the end of a time selection whenever I am reamping. But I'm not seeing anything in Reaper or online.
Any ideas?
|
|
|
08-17-2022, 06:44 PM
|
#2
|
Human being with feelings
Join Date: May 2017
Posts: 3,201
|
Left click it and drag.
|
|
|
08-18-2022, 05:36 AM
|
#3
|
Human being with feelings
Join Date: Mar 2012
Posts: 375
|
Sorry--I meant as part of a custom action, so moving it manually with the mouse is not what I'm referring to.
|
|
|
08-18-2022, 06:01 AM
|
#4
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
AFAIK the ReaScript API doesn't yet have a function to select project markers. You can find a marker by name and change its position pretty easily with a Lua script. For example, move first marker named "reamp" to end of the time selection...
Code:
-- Move project marker 'reamp' to end of time selection.lua
-- get time selection
local start_time, end_time = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
if start_time == end_time then return end -- abort if no time selection
-- move marker
reaper.Undo_BeginBlock()
for idx = 0, reaper.CountProjectMarkers(0)-1 do
local retval, isrgn, pos, rgnend, name, markrgnindexnumber = reaper.EnumProjectMarkers(idx)
if not isrgn and name == "reamp" then
reaper.SetProjectMarker(markrgnindexnumber, isrgn, end_time, rgnend, name)
break
end
end
reaper.Undo_EndBlock("Move project marker 'reamp' to end of time selection", -1)
|
|
|
08-18-2022, 06:25 AM
|
#5
|
Human being with feelings
Join Date: Mar 2012
Posts: 375
|
Quote:
Originally Posted by Edgemeal
AFAIK the ReaScript API doesn't yet have a function to select project markers. You can find a marker by name and change its position pretty easily with a Lua script. For example, move first marker named "reamp" to end of the time selection...
Code:
-- Move project marker 'reamp' to end of time selection.lua
-- get time selection
local start_time, end_time = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
if start_time == end_time then return end -- abort if no time selection
-- move marker
reaper.Undo_BeginBlock()
for idx = 0, reaper.CountProjectMarkers(0)-1 do
local retval, isrgn, pos, rgnend, name, markrgnindexnumber = reaper.EnumProjectMarkers(idx)
if not isrgn and name == "reamp" then
reaper.SetProjectMarker(markrgnindexnumber, isrgn, end_time, rgnend, name)
break
end
end
reaper.Undo_EndBlock("Move project marker 'reamp' to end of time selection", -1)
|
Thanks for this. Two q's:
1. Since my marker is actually a marker action, it starts with "!_" followed my the command ID for the action. Where in this script would I substitute in this marker ID?
2. As well, could this script be modified to encode a second action that moves the marker action back to its original spot (or at least somewhere else, away from the time selection to which the first action moved it?)
|
|
|
08-18-2022, 08:07 AM
|
#6
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by Miscreant
Thanks for this. Two q's:
1. Since my marker is actually a marker action, it starts with "!_" followed my the command ID for the action. Where in this script would I substitute in this marker ID?
2. As well, could this script be modified to encode a second action that moves the marker action back to its original spot (or at least somewhere else, away from the time selection to which the first action moved it?)
|
I think this will work,..
EDIT Uses marker_name to save/restore marker position so script can be used for more then a single marker.
Code:
local marker_name = "!1016" --< Set name of marker here!
function MoveMarker(mark_name, new_pos, save)
reaper.Undo_BeginBlock()
for idx = 0, reaper.CountProjectMarkers(0)-1 do
local retval, isrgn, pos, rgnend, name, markrgnindexnumber = reaper.EnumProjectMarkers(idx)
if not isrgn and name == mark_name then
if save then reaper.SetExtState("Move_"..mark_name, "Position",tostring(pos), false) end
reaper.SetProjectMarker(markrgnindexnumber, isrgn, new_pos, rgnend, name)
break
end
end
reaper.Undo_EndBlock("Move project marker "..mark_name, -1)
end
local val = reaper.GetExtState("Move_"..marker_name,"Position")
if val ~= "" then -- restore previous pos.
reaper.DeleteExtState("Move_"..marker_name, "Position", false)
MoveMarker(marker_name, tonumber(val), false)
else -- move marker to end of time selection, save current pos.
local start_time, end_time = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
if start_time == end_time then return end
MoveMarker(marker_name, end_time, true)
end
Last edited by Edgemeal; 08-19-2022 at 05:55 AM.
|
|
|
08-19-2022, 06:50 AM
|
#7
|
Human being with feelings
Join Date: Mar 2012
Posts: 375
|
Quote:
Originally Posted by Edgemeal
I think this will work,..
EDIT Uses marker_name to save/restore marker position so script can be used for more then a single marker.
Code:
local marker_name = "!1016" --< Set name of marker here!
function MoveMarker(mark_name, new_pos, save)
reaper.Undo_BeginBlock()
for idx = 0, reaper.CountProjectMarkers(0)-1 do
local retval, isrgn, pos, rgnend, name, markrgnindexnumber = reaper.EnumProjectMarkers(idx)
if not isrgn and name == mark_name then
if save then reaper.SetExtState("Move_"..mark_name, "Position",tostring(pos), false) end
reaper.SetProjectMarker(markrgnindexnumber, isrgn, new_pos, rgnend, name)
break
end
end
reaper.Undo_EndBlock("Move project marker "..mark_name, -1)
end
local val = reaper.GetExtState("Move_"..marker_name,"Position")
if val ~= "" then -- restore previous pos.
reaper.DeleteExtState("Move_"..marker_name, "Position", false)
MoveMarker(marker_name, tonumber(val), false)
else -- move marker to end of time selection, save current pos.
local start_time, end_time = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
if start_time == end_time then return end
MoveMarker(marker_name, end_time, true)
end
|
Works perfectly. Thanks for being a random internet hero. Much appreciated!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 10:23 AM.
|