-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFreeze Frame on Cursor (14+).cs
51 lines (42 loc) · 2.34 KB
/
Freeze Frame on Cursor (14+).cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ScriptPortal.Vegas;
public class EntryPoint {
Vegas myVegas;
TransportControl cursor;
public void FromVegas(Vegas vegas) {
myVegas = vegas;
Timecode cursorPosition = vegas.Transport.CursorPosition;
foreach (Track tr in vegas.Project.Tracks){
if (tr.IsVideo()){
foreach (TrackEvent trackEvent in tr.Events){
VideoEvent videoEvent = (VideoEvent) trackEvent;
if (videoEvent.Selected){
Envelope startEnvelope = new Envelope(EnvelopeType.Velocity);
if(trackEvent.Start <= cursorPosition && (trackEvent.End > cursorPosition)){
if (!videoEvent.Envelopes.HasEnvelope(EnvelopeType.Velocity)){
videoEvent.Envelopes.Add(startEnvelope);
} else{
videoEvent.Envelopes.FindByType(EnvelopeType.Velocity).Points.Clear();
}
EnvelopePoint freezeEnvelope = new EnvelopePoint(cursorPosition - trackEvent.Start, 0, CurveType.None);
videoEvent.Envelopes.FindByType(EnvelopeType.Velocity).Points.Add(freezeEnvelope);
videoEvent.Envelopes.FindByType(EnvelopeType.Velocity).Points[0].Curve = CurveType.None;
videoEvent.Envelopes.FindByType(EnvelopeType.Velocity).Points[0].Y = 1;
} else {
if (!videoEvent.Envelopes.HasEnvelope(EnvelopeType.Velocity)){
Envelope envelope = new Envelope(EnvelopeType.Velocity);
videoEvent.Envelopes.Add(envelope);
videoEvent.Envelopes.FindByType(EnvelopeType.Velocity).Points[0].Y = 0;
} else{
videoEvent.Envelopes.FindByType(EnvelopeType.Velocity).Points.Clear();
videoEvent.Envelopes.FindByType(EnvelopeType.Velocity).Points[0].Y = 0;
}
}
}
}
}
}
}
}