This problem has been hinted at in earlier posts. If I use this code:
HOWEVER, if I split the event on the timeline and then run the code on the event immediately after the split, the offset function doesn't work. Upon further inspection, it is clear that the copy function is copying the original unsplit event. Thus, the first frame of video is the first frame of video from the unsplit event, and NOT the first frame of video from the "new" event that is created by the split.
I still haven't figured out a workaround.
[Edit] Perhaps the problem is that I am not adding a take to this new event. However, since it is part of existing media, I am not sure how to get the media class for this object in order to add the take. I think I need to use code something like this:
var patch_frame : VideoEvent = VideoEvent(evnt.Copy(VideoTrack(track),Vegas.Cursor));to create a copy of an existing event, I can then use this line:
for (var i=patch_frame.Takes.Count - 1; i >= 0; i--) {to change the frame that displays at the event start.
patch_frame.Takes[i].Offset = Vegas.Cursor - one_frame - evnt.Start;
}
HOWEVER, if I split the event on the timeline and then run the code on the event immediately after the split, the offset function doesn't work. Upon further inspection, it is clear that the copy function is copying the original unsplit event. Thus, the first frame of video is the first frame of video from the unsplit event, and NOT the first frame of video from the "new" event that is created by the split.
I still haven't figured out a workaround.
[Edit] Perhaps the problem is that I am not adding a take to this new event. However, since it is part of existing media, I am not sure how to get the media class for this object in order to add the take. I think I need to use code something like this:
var stream = media.Streams[0];but I don't know how to get "media" for the events that already exist.
var videoTake = new Take(videostream);
patch_frame.Takes.Add(videoTake);