I'd like the flow of my script to match what is happening on the timeline from left to right. So now I got to a point where I needed a new track layer below one that already exists (something happening behind a text).
I tried: project.Tracks.Insert(videoTrack2.Index, newTrack);
But strangely the insert is not supported.....??? So I set out to take a deep dive into the track idexes and how they are ordered. Found a video about it from @jetdv https://www.jetdv.com/2021/08/23/add-new-tracks-to-the-timeline-in-vegas-pro/
But I was still not sure on the order from that. So I setup my own test code:
VideoTrack videotrack0 = new VideoTrack(0, "0"); myVegas.Project.Tracks.Add(videotrack0); videotrack0.Name = "V0-" + videotrack0.Index.ToString(); // Set name to assigned track # - Gotten track # AudioTrack audiotrack0 = new AudioTrack(0, "0"); myVegas.Project.Tracks.Add(audiotrack0); audiotrack0.Name = "A0-" + audiotrack0.Index.ToString(); VideoTrack videotrack1 = new VideoTrack(1, "1"); myVegas.Project.Tracks.Add(videotrack1); videotrack1.Name = "V1-" + videotrack1.Index.ToString(); VideoTrack videotrack99 = new VideoTrack(99, "99"); myVegas.Project.Tracks.Add(videotrack99); videotrack99.Name = "V99-" + videotrack99.Index.ToString(); VideoTrack videotrack5 = new VideoTrack(5, "5"); myVegas.Project.Tracks.Add(videotrack5); videotrack5.Name = "V5-" + videotrack5.Index.ToString(); AudioTrack audiotrack1 = new AudioTrack(1, "1"); myVegas.Project.Tracks.Add(audiotrack1); audiotrack1.Name = "A1-" + audiotrack1.Index.ToString(); AudioTrack audiotrack99 = new AudioTrack(99, "99"); myVegas.Project.Tracks.Add(audiotrack99); audiotrack99.Name = "A99-" + audiotrack99.Index.ToString(); AudioTrack audiotrack5 = new AudioTrack(5, "5"); myVegas.Project.Tracks.Add(audiotrack5); audiotrack5.Name = "A5-" + audiotrack5.Index.ToString();
And the result is: A0-0, A1-1, V1-1, V0-0, V99-3, A5-5, V5-4, A99-6
So first things noteworthy is that the index that I am assigning is not what is actually given to the track! And to me the order does not make any sense...
So if anyone can shine a light on this, please do!