Could someone help me? I have this script that removes areas within the regions inserted in the project. However, when running the script, it deletes the parts normally but leaves the events grouped. Would it be possible to change something in this script so that each remaining area/event is in a separate group from the original? This way, I could move each one without affecting the others?
using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;
namespace Test_Script
{
public class Class1
{
public Vegas myVegas;
public void Main(Vegas vegas)
{
myVegas = vegas;
removeEventsInsideRegions();
}
private void removeEventsInsideRegions()
{
foreach (ScriptPortal.Vegas.Region myRegion in myVegas.Project.Regions)
{
Timecode regStart = myRegion.Position;
Timecode regEnd = regStart + myRegion.Length;
foreach (Track myTrack in myVegas.Project.Tracks)
{
foreach (TrackEvent evnt in myTrack.Events)
{
Timecode eventStart = evnt.Start;
Timecode eventEnd = evnt.End;
TrackEvent delEvent = null;
TrackEvent newEvent = null;
// Verifica se o evento está dentro da região
if ((eventStart >= regStart && eventStart < regEnd) ||
(eventEnd > regStart && eventEnd <= regEnd) ||
(eventStart <= regStart && eventEnd >= regEnd))
{
delEvent = evnt;
// Remove apenas a parte dentro da região
if (eventStart < regStart)
{
newEvent = evnt.Split(regStart - eventStart);
delEvent = newEvent;
}
if (eventEnd > regEnd)
{
if (newEvent != null)
{
TrackEvent rightEvent = newEvent.Split(regEnd - newEvent.Start);
delEvent = newEvent;
}
else
{
TrackEvent rightEvent = evnt.Split(regEnd - eventStart);
delEvent = evnt;
}
}
// Adiciona o evento à lista para remoção posterior
if (delEvent != null)
{
myTrack.Events.Remove(delEvent);
}
}
}
}
}
}
}
}
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
Test_Script.Class1 test = new Test_Script.Class1();
test.Main(vegas);
}
}
Could someone help me? I have this script that removes areas within the regions inserted in the project. However, when running the script, it deletes the parts normally but leaves the events grouped. Would it be possible to change something in this script so that each remaining area/event is in a separate group from the original? This way, I could move each one without affecting the others?
like in this exemple: