Zelgerath

Placing 3 images (worked fine)

Feb 11th, 2024
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using ScriptPortal.Vegas;
  4. using System.Windows.Forms;
  5.  
  6. namespace AddingmediatoVegas
  7. {
  8. public class EntryPoint
  9. {
  10. public void FromVegas(Vegas myVegas)
  11. {
  12. try
  13. {
  14. Timecode cursorPosition = myVegas.Transport.CursorPosition;
  15. var gap = 10;
  16. string videoPath = "D:\\Home Videos\\green.png";
  17. VideoEvent V1event = (VideoEvent)AddMedia(myVegas.Project, videoPath, 0, Timecode.FromSeconds(0), Timecode.FromSeconds(gap));
  18. string videoPath2 = "D:\\Home Videos\\red.png";
  19. VideoEvent V2event = (VideoEvent)AddMedia(myVegas.Project, videoPath2, 0, Timecode.FromSeconds(0+gap), Timecode.FromSeconds(gap));
  20. string videoPath3 = "D:\\Home Videos\\green.png";
  21. VideoEvent V3event = (VideoEvent)AddMedia(myVegas.Project, videoPath3, 0, Timecode.FromSeconds(0+2*gap), Timecode.FromSeconds(gap));
  22. }
  23. catch (Exception ex)
  24. {
  25. MessageBox.Show(ex.Message);
  26. }
  27. }
  28. TrackEvent AddMedia(Project project, string mediaPath, int trackIndex, Timecode start, Timecode length)
  29. {
  30. Media media = Media.CreateInstance(project, mediaPath);
  31. Track track = project.Tracks[trackIndex];
  32.  
  33. if (track.MediaType == MediaType.Video)
  34. {
  35. VideoTrack videoTrack = (VideoTrack)track;
  36. VideoEvent videoEvent = videoTrack.AddVideoEvent(start, length);
  37. Take take = videoEvent.AddTake(media.GetVideoStreamByIndex(0));
  38. return videoEvent;
  39. }
  40. else if (track.MediaType == MediaType.Audio)
  41. {
  42. AudioTrack audioTrack = (AudioTrack)track;
  43. AudioEvent audioEvent = audioTrack.AddAudioEvent(start, length);
  44. Take take = audioEvent.AddTake(media.GetAudioStreamByIndex(0));
  45. return audioEvent;
  46. }
  47. return null;
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment