-
Align events to cursor shortcut?
Posted by Simas Chomentauskas on August 27, 2016 at 11:02 pmI can’t believe Vegas could be missing something THAT simple: basically moving selected events to cursor (with a shortcut).
Or am I missing something here?
Basically, I have events on 10 tracks. Beginnings of theirs are slightly misaligned. I select all of them, place the cursor in an empty space before them and would like all of them to jump to the cursor (and therefore align themselves).
Image with the situation: https://snag.gy/TNESxq.jpg
Wayne Waag replied 10 years ago 4 Members · 10 Replies -
10 Replies
-
John Rofrano
August 28, 2016 at 3:33 pm[Simas Chomentauskas] “I can’t believe Vegas could be missing something THAT simple: basically moving selected events to cursor (with a shortcut).”
Yup. It doesn’t exist. 🙁
Luckily, you can add this capability with a script. Here is one that I just wrote for you that will work in Sony Vegas Pro 13 and earlier:
//****************************************************************************
//* Program: SnapToCursor.cs
//* Author: John Rofrano
//* Description: This script will snap all selected events to the cursor position
//* Created: August 28, 2016
//*
//* Copyright: (c) 2016 John Rofrano. All Rights Reserved
//****************************************************************************
using System;
using System.Windows.Forms;
using Sony.Vegas;class EntryPoint
{
public void FromVegas(Vegas vegas)
{
try
{
foreach (Track track in vegas.Project.Tracks)
{
foreach (TrackEvent trackEvent in track.Events)
{
if (trackEvent.Selected)
{
trackEvent.Start = vegas.Transport.CursorPosition;
}
}
}
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
}
Just copy the contents into a file called:SnapToCursor.cs
and place it in a folder called:
.\Documents\Vegas Script Menu
and then restart Vegas Pro and use the menu item Tools | Scripting | SnapToCursor to invoke it. You can even add it as an icon on your toolbar so that it’s only one click away.
Enjoy! 😉
~jr
http://www.johnrofrano.com
http://www.vasstsoftware.com -
Wayne Waag
August 28, 2016 at 3:37 pmYou just beat me to it.
using System;
using System.Windows.Forms;
using Sony.Vegas;class EntryPoint
{
public void FromVegas(Vegas vegas)
{
try
{
var cursorPos = vegas.Cursor;foreach (var track in vegas.Project.Tracks)
{
foreach (var ve in track.Events)
{
if (ve.Selected)
{
ve.Start = cursorPos;
}
}
}
vegas.UpdateUI();
}catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
}Just save as a text file with a .cs extension and place in your script folder.
wwaag
-
Graham Bernard
August 28, 2016 at 4:55 pmYou guys are amazing. Thanks!
* Grazie
Video Content Creator and Potter
PC 7 64-bit 16gb * Intel® Core™i7-2600k Quad Core 3.40GHz * 2GB NVIDIA GEFORCE GTX 560 Ti
Cameras: Canon XF300 + PowerShot SX50HS Bridge -
Simas Chomentauskas
August 28, 2016 at 4:58 pmWow guys, you’re amazing!
I owe you both a beer, just tell when and where :]
-
Simas Chomentauskas
August 28, 2016 at 5:08 pmOK, you’ve got my appetite :]
John, Wayne – I’d like to ask you to extend this script a bit further. As I’ll be using it in production, I’m ready to pay for the work. I can’t find a PM button around (I’m new to this forum, sorry), so I’ll ask here if someone of you would be interest.
I don’t believe it will be anything even close to hard for you, maybe even a few minutes,- but as you’ve already shared something for free I don’t think it’s fair to ask for more that way.
I would need:
1) Before aligning, to select all the events underneath cursor (vertically). I’m aware that such way the events will jump rightwards in timeline, but that’s what I want, actually.
2) Right after aligning – put a marker in that position and keep it’s…eeee text entering box active so I could enter the text right away. -
Wayne Waag
August 28, 2016 at 5:51 pmTry this. Once the script runs, just hit M and the marker with text box will appear.
using System;
using System.Windows.Forms;
using Sony.Vegas;class EntryPoint
{
public void FromVegas(Vegas vegas)
{try
{
var cursorPos = vegas.Cursor;foreach (var track in vegas.Project.Tracks)
{
foreach (var ve in track.Events)
{
if (ve.Start <= vegas.Transport.CursorPosition && ve.End >= vegas.Transport.CursorPosition)
{
ve.Selected = true;
}
else
{
ve.Selected = false;
}
if (ve.Selected)
{
ve.Start = cursorPos;
}
}
}
vegas.UpdateUI();
}catch (Exception e)
{
MessageBox.Show(e.Message);
}
}}
wwaag
-
Simas Chomentauskas
August 28, 2016 at 7:45 pmRuns. Godlike.
Can’t thank you enough already…
…but to really complete this pipeline task I would need one more script :] As I said, I’m ready to pay for it. Or just keep me in debt and once you need some help in 2d/3d graphics – feel free to ping.1) One that goes through all the timeline’s markers (or/and regions), gets their positions (in absolute frames) and related texts entered. Does that till the end of timeline.
2) Combines gathered info into some formated string, that is copied to clipboard (ideally) or saved into txt file in project folder.
3) The markers will always come in groups of 3, so the resulting string could look like “1000,s01/1500,in/1700,out/2000,s02/2200,in/2500,out”.I will then be able to take the string into Nuke and parse it with Python.
Visual (I included both markers-only and marker+region concept, if the later is too complicated, the first one will do the job too): https://snag.gy/LBjKH4.jpg
-
Wayne Waag
August 28, 2016 at 7:56 pmBefore thinking that you need a special script, first go to the Edit Details window (Alt-6). Then select markers or regions. There you will find pretty much everything you want. Just make sure that you set your time format to Absolute Frames. The edit details window can be copied and the results pasted into Excel if you want to manipulate these entries in some specific way. As an aside you can also paste data into these windows thus allowing you to create markers at regions at specific times, lengths, etc. The edit details window can be extremely useful and is well worth your time to learn its many uses.
At this point, you’re up to 3 beers! LOL.
wwaag
-
Wayne Waag
August 29, 2016 at 2:28 amGlad I could help. BTW–the easiest 6-pack I ever earned.
wwaag
Reply to this Discussion! Login or Sign Up