feat: use range instead of location/arrangement markers
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
		
							parent
							
								
									8a14996bb1
								
							
						
					
					
						commit
						65506891f6
					
				@ -3,10 +3,10 @@ ardour {
 | 
			
		||||
    name        = "Rename regions from markers",
 | 
			
		||||
    license     = "MIT",
 | 
			
		||||
    author      = "Christopher Arndt",
 | 
			
		||||
    description = [[Rename selected regions using track name and label of location marker at region start]]
 | 
			
		||||
    description = [[Rename selected regions using track name and label of range marker at region start]]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function factory ()
 | 
			
		||||
function factory()
 | 
			
		||||
    -- there is currently no direct way to find the track
 | 
			
		||||
    -- corresponding to a [selected] region
 | 
			
		||||
    function find_track_for_region(region_id)
 | 
			
		||||
@ -20,11 +20,10 @@ function factory ()
 | 
			
		||||
        assert (0) -- can't happen, region must be in a playlist
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    return function ()
 | 
			
		||||
    return function()
 | 
			
		||||
        local sel = Editor:get_selection () -- get current selection
 | 
			
		||||
        local loc = Session:locations()     -- get locations
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        -- prepare undo operation
 | 
			
		||||
        Session:begin_reversible_command ("Rename regions from markers")
 | 
			
		||||
 | 
			
		||||
@ -32,17 +31,17 @@ function factory ()
 | 
			
		||||
        for region in sel.regions:regionlist():iter () do
 | 
			
		||||
            -- test if it's an audio region
 | 
			
		||||
            local ar = region:to_audioregion ()
 | 
			
		||||
            if ar:isnil () then
 | 
			
		||||
            if ar:isnil() then
 | 
			
		||||
                goto next
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            --~ print("Region:", region:name())
 | 
			
		||||
            local rid = region:to_stateful():id()
 | 
			
		||||
            --~ print("ID:", id:to_s())
 | 
			
		||||
            --~ print("ID:", rid:to_s())
 | 
			
		||||
 | 
			
		||||
            -- get marker at region start position
 | 
			
		||||
            -- get range marker at region start position
 | 
			
		||||
            local pos = region:position()
 | 
			
		||||
            local mloc = loc:first_mark_at(pos, Temporal.timecnt_t(0))
 | 
			
		||||
            local mloc = loc:range_starts_at(pos, Temporal.timecnt_t(0), true)
 | 
			
		||||
            if not mloc then
 | 
			
		||||
                goto next
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user