Old 11-08-2019, 06:16 AM   #1
Human being with feelings
Travesty's Avatar
Join Date: Nov 2014
Posts: 514
Default Region overlaps incorrectly detected

I've noticed that when adding regions to adjacent sections they often act as if they are overlapping, and you get one on a lower row to the adjacent one in the ruler. This will often be corrected if you shift the edge of the region back and forth manually.

This became an issue in a script I wrote which was for flagging region overlaps, but not adjacent regions.

I had to put this subtraction in to correct it:

if pos < prevend-0.0000000001 then

function CheckRegionOverlapsWithinTime(startpos,endpos)
  local prevend=-1
  local regionsdetected = false
  for i=0, reaper.CountProjectMarkers(0) -1 do
    local retval, isrgn, pos, rgnend, name, markrgnindexnumber = reaper.EnumProjectMarkers(i)
    if pos >= startpos and pos <= endpos then
      regionsdetected = true
      if pos < prevend-0.0000000001 then
        error("Overlapping regions detected. Regions must have gaps between them.") 
        return false
        prevend = rgnend
  if not regionsdetected then
    error( "No regions detected around items.") 
  return regionsdetected
Travesty is offline   Reply With Quote

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 04:10 AM.

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