From d2b992f1f0d8e016f2a30b652408228a22f2828e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludwig=20Fr=C3=BChsch=C3=BCtz?= Date: Fri, 31 Jan 2020 22:08:08 +0100 Subject: [PATCH] Now also works if project contains regions - closes #1 --- 4PointCutting/4Pcut_execute.lua | 4 +++- 4PointCutting/4Pcut_reset_markers.lua | 4 +++- 4PointCutting/4Pcut_set_DST-IN.lua | 4 +++- 4PointCutting/4Pcut_set_DST-OUT.lua | 4 +++- 4PointCutting/4Pcut_set_SRC-IN.lua | 4 +++- 4PointCutting/4Pcut_set_SRC-OUT.lua | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/4PointCutting/4Pcut_execute.lua b/4PointCutting/4Pcut_execute.lua index 0999793..f4b3c1d 100644 --- a/4PointCutting/4Pcut_execute.lua +++ b/4PointCutting/4Pcut_execute.lua @@ -77,7 +77,9 @@ end -- START HERE vvvvvvvvvvvvvvvvvvvvvvvvvv -- run through all markers and get position of the 4 points local nof_markers = 0 -_, nof_markers, _ = reaper.CountProjectMarkers(0) +local nof_regions = 0 +_, nof_markers, nof_regions = reaper.CountProjectMarkers(0) +nof_markers = nof_markers + nof_regions -- adapt count of 'CountProjectMarkers()' to 'EnumProjectMarkers()' for i = 0, nof_markers - 1 do local name = '' local pos = 0 diff --git a/4PointCutting/4Pcut_reset_markers.lua b/4PointCutting/4Pcut_reset_markers.lua index bc52211..2a02467 100644 --- a/4PointCutting/4Pcut_reset_markers.lua +++ b/4PointCutting/4Pcut_reset_markers.lua @@ -8,13 +8,15 @@ -- Requires: This script goes with several other scripts that work closely together. local nof_markers = 0 +local nof_regions = 0 local id = -1 local name = '' local isregion = false local ids = {} -- check if markers exist -_, nof_markers, _ = reaper.CountProjectMarkers(0) +_, nof_markers, nof_regions = reaper.CountProjectMarkers(0) +nof_markers = nof_markers + nof_regions -- adapt count of 'CountProjectMarkers()' to 'EnumProjectMarkers()' for i = 0, nof_markers - 1 do _, isregion, _, _, name, id = reaper.EnumProjectMarkers(i) if not isregion and diff --git a/4PointCutting/4Pcut_set_DST-IN.lua b/4PointCutting/4Pcut_set_DST-IN.lua index 0fdbb55..54940ea 100644 --- a/4PointCutting/4Pcut_set_DST-IN.lua +++ b/4PointCutting/4Pcut_set_DST-IN.lua @@ -7,10 +7,12 @@ -- Requires: This script goes with several other scripts that work closely together. local nof_markers = 0 +local nof_regions = 0 local id = -1 -- check if marker already exists -_, nof_markers, _ = reaper.CountProjectMarkers(0) +_, nof_markers, nof_regions = reaper.CountProjectMarkers(0) +nof_markers = nof_markers + nof_regions -- adapt count of 'CountProjectMarkers()' to 'EnumProjectMarkers()' for i = 0, nof_markers - 1 do local name_tmp = '' local isregion_tmp = false diff --git a/4PointCutting/4Pcut_set_DST-OUT.lua b/4PointCutting/4Pcut_set_DST-OUT.lua index 00f3b27..1f9a3a4 100644 --- a/4PointCutting/4Pcut_set_DST-OUT.lua +++ b/4PointCutting/4Pcut_set_DST-OUT.lua @@ -7,10 +7,12 @@ -- Requires: This script goes with several other scripts that work closely together. local nof_markers = 0 +local nof_regions = 0 local id = -1 -- check if marker already exists -_, nof_markers, _ = reaper.CountProjectMarkers(0) +_, nof_markers, nof_regions = reaper.CountProjectMarkers(0) +nof_markers = nof_markers + nof_regions -- adapt count of 'CountProjectMarkers()' to 'EnumProjectMarkers()' for i = 0, nof_markers - 1 do local name_tmp = '' local isregion_tmp = false diff --git a/4PointCutting/4Pcut_set_SRC-IN.lua b/4PointCutting/4Pcut_set_SRC-IN.lua index ca7e335..e6d253e 100644 --- a/4PointCutting/4Pcut_set_SRC-IN.lua +++ b/4PointCutting/4Pcut_set_SRC-IN.lua @@ -7,10 +7,12 @@ -- Requires: This script goes with several other scripts that work closely together. local nof_markers = 0 +local nof_regions = 0 local id = -1 -- check if marker already exists -_, nof_markers, _ = reaper.CountProjectMarkers(0) +_, nof_markers, nof_regions = reaper.CountProjectMarkers(0) +nof_markers = nof_markers + nof_regions -- adapt count of 'CountProjectMarkers()' to 'EnumProjectMarkers()' for i = 0, nof_markers - 1 do local name_tmp = '' local isregion_tmp = false diff --git a/4PointCutting/4Pcut_set_SRC-OUT.lua b/4PointCutting/4Pcut_set_SRC-OUT.lua index 8a54876..20bb028 100644 --- a/4PointCutting/4Pcut_set_SRC-OUT.lua +++ b/4PointCutting/4Pcut_set_SRC-OUT.lua @@ -7,10 +7,12 @@ -- Requires: This script goes with several other scripts that work closely together. local nof_markers = 0 +local nof_regions = 0 local id = -1 -- check if marker already exists -_, nof_markers, _ = reaper.CountProjectMarkers(0) +_, nof_markers, nof_regions = reaper.CountProjectMarkers(0) +nof_markers = nof_markers + nof_regions -- adapt count of 'CountProjectMarkers()' to 'EnumProjectMarkers()' for i = 0, nof_markers - 1 do local name_tmp = '' local isregion_tmp = false