Add-to-Group ("G") ?

fausseplanete wrote on 10/25/2008, 11:33 AM
"Add to Group" would be nice (and dead simple).

At present vid & aud for a given clip are implicitly grouped. If you select the vid of one clip and the vid of another clip and hit the "G" key then the two vid events become grouped but at the same time any other events they were each already grouped with (e.g. their audio events) become no longer grouped.

Comments

kairosmatt wrote on 10/25/2008, 11:46 AM
I could really use that.
johnmeyer wrote on 10/25/2008, 3:12 PM
It would also be nice to have some key you could press, and then when you clicked on an event, it would highlight all events that are grouped with that event.
farss wrote on 10/25/2008, 3:20 PM
All of the above gets my vote. I'd prefer it if the A/V pairs had their own locking / unlocking mechanism that was different to the grouping.

Bob.
Chienworks wrote on 10/25/2008, 3:52 PM
Multi-level grouping would be my dream.
tcbetka wrote on 10/25/2008, 5:42 PM
Right. The ability to have more than one group would be great; as of course, would be a way to tell which group an event belonged to.

TB
JohnnyRoy wrote on 10/26/2008, 9:05 AM
> "Add to Group" would be nice (and dead simple).

For your editing pleasure: (this will add any selected event and all of the events in their respective groups to a new group that contains all of the events)


//**************************************************************
//* Program: AddToGroup.cs
//* Author: John Rofrano
//* Description: Adds events to a group maintaining the original grouping
//* Last Updated: October 26, 2008
//* Copyright: (c) 2008 VASST, All Rights Reserved
//**************************************************************
using System;
using System.Collections;
using System.Windows.Forms;
using Sony.Vegas;

class EntryPoint
{
public void FromVegas(Vegas vegas)
{
try
{
// get the selected events
ArrayList selectedEvents = FindSelectedEvents(vegas.Project.Tracks);

// if we found more than one selected event, process them
if (selectedEvents.Count > 1)
{
TrackEventGroup group = new TrackEventGroup();
vegas.Project.Groups.Add(group);

foreach (TrackEvent trackEvent in selectedEvents)
{
if (trackEvent.IsGrouped)
{
ArrayList oldGroup = new ArrayList(trackEvent.Group);
foreach (TrackEvent groupedEvent in oldGroup)
{
groupedEvent.Group.Remove(groupedEvent);
group.Add(groupedEvent);
}
}
else
{
group.Add(trackEvent);
}
}
}
}
catch (Exception e)
{
MessageBox.Show(e.Message, "VASST Add To Group", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

/// <summary>
/// Finds events that are selected in the track collection
/// </summary>
/// <param name="trackList">A list of tracks to serahc for selected events</param>
/// <returns>an ArrayList of selected events. If no events found the collection will be empty</returns>
private ArrayList FindSelectedEvents(Tracks trackList)
{
ArrayList selectedEvents = new ArrayList();

foreach (Track track in trackList)
{
foreach (TrackEvent trackEvent in track.Events)
{
if (trackEvent.Selected)
{
selectedEvents.Add(trackEvent);
}
}
}

return selectedEvents;
}
}


~jr
JohnnyRoy wrote on 10/26/2008, 9:14 AM
> It would also be nice to have some key you could press, and then when you clicked on an event, it would highlight all events that are grouped with that event.

This code will select all of the events in a group just by selecting one of them. (note: you can select multiple events and it will select all of the events in all of the groups)


//**************************************************************
//* Program: HighlightGroupedEvents.cs
//* Author: John Rofrano
//* Description: Selects all events that are in the same group
//* Last Updated: October 26, 2008
//* Copyright: (c) 2008 VASST, All Rights Reserved
//**************************************************************
using System;
using System.Collections;
using System.Windows.Forms;
using Sony.Vegas;

class EntryPoint
{
public void FromVegas(Vegas vegas)
{
try
{
// get the selected events
ArrayList selectedEvents = FindSelectedEvents(vegas.Project.Tracks);

// if we found at least one selected event, process them
if (selectedEvents.Count > 0)
{
foreach (TrackEvent trackEvent in selectedEvents)
{
if (trackEvent.IsGrouped)
{
foreach (TrackEvent groupedEvent in trackEvent.Group)
{
groupedEvent.Selected = true;
}
}
}
}
}
catch (Exception e)
{
MessageBox.Show(e.Message, "VASST Highlight Grouped Events", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

/// <summary>
/// Finds events that are selected in the track collection
/// </summary>
/// <param name="trackList">A list of tracks to serahc for selected events</param>
/// <returns>an ArrayList of selected events. If no events found the collection will be empty</returns>
private ArrayList FindSelectedEvents(Tracks trackList)
{
ArrayList selectedEvents = new ArrayList();

foreach (Track track in trackList)
{
foreach (TrackEvent trackEvent in track.Events)
{
if (trackEvent.Selected)
{
selectedEvents.Add(trackEvent);
}
}
}

return selectedEvents;
}
}


~jr
tcbetka wrote on 10/26/2008, 9:22 AM
Whoa...strong work JR. I can follow the code alright, but now just need to get smart enough to figure out what to do with it. Sweet though.

JR for President!

TB
megabit wrote on 10/26/2008, 9:28 AM
Thanks Johnny!

BTW, when I click an event being member of a group, all other members of this group are framed by a light-blue box; isn't your second script sort of reduntant to this Vegas behaviour?

AMD TR 2990WX CPU | MSI X399 CARBON AC | 64GB RAM@XMP2933  | 2x RTX 2080Ti GPU | 4x 3TB WD Black RAID0 media drive | 3x 1TB NVMe RAID0 cache drive | SSD SATA system drive | AX1600i PSU | Decklink 12G Extreme | Samsung UHD reference monitor (calibrated)

johnmeyer wrote on 10/26/2008, 10:13 AM
Very nice, JR. Thanks!!
fausseplanete wrote on 10/26/2008, 11:00 AM
I'm stunned...Thank you very much !
kairosmatt wrote on 10/26/2008, 1:42 PM
I also need a little help as to what to do with this code...is it a script?

thanks
kairosmatt
johnmeyer wrote on 10/26/2008, 2:49 PM
Yes, it's a script. Copy it from the post, paste it into Notepad, and then save with the extension ".js" instead of ".txt". Then, either put this file into the Vegas scripts folder or else navigate to it from the Vegas Scripts menu option and execute it from there.
kairosmatt wrote on 10/26/2008, 3:06 PM
Thanks John!
John_Cline wrote on 10/26/2008, 5:17 PM
Once again, these two scripts, along with hundreds of others, demonstrate why Vegas is perhaps the most powerful NLE available. It's certainly the most configurable.
tcbetka wrote on 10/26/2008, 5:47 PM
OK I renamed the scripts with a .js extension, but then saw JRs .cs extension, and used that instead. But for some reason, I cannot get Windows to recognize then as anything other than text files. I'm not sure if this is an issue or not, but I never see them as possible scripts like the other .cs files--they don't even appear in the same folder.

What am I doing wrong here?

Thanks.

TB
John_Cline wrote on 10/26/2008, 5:54 PM
When you save a file from Notepad, it automatically adds ".TXT" as the extension. In order to save them with a specific filename and extension from Notepad, you must enclose the entire filename in quotes.
tcbetka wrote on 10/26/2008, 5:55 PM
Exactly, lol...just figured that out now. Gotta love Windows...

BTW--they work now.

Thanks.

TB
JohnnyRoy wrote on 10/27/2008, 5:53 AM
> BTW, when I click an event being member of a group, all other members of this group are framed by a light-blue box; isn't your second script sort of reduntant to this Vegas behaviour?

No, because they are still not selected. If you wanted to run another script that worked on selected events and you just selected one event from a group you would only affect that one event. If you run HighlightGroupedEvents first, then the next script would affect all of the events in the group. So it's more than just a visual queue, it's actually selecting the events as if you performed a Ctrl+click.

~jr
JohnnyRoy wrote on 10/27/2008, 5:58 AM
> Exactly, lol...just figured that out now. Gotta love Windows...

Yea, I try and put the script name in the comments so that you know if it's a .cs (C#) or ,js (JavaScript). You still have to look out for notepad adding the .txt on you though (you gotta love tools that think they are smarter than you). I usually don't write any JavaScript anymore because I have a script project set up in Visual Studio that allows me to write these quickly in C#.

I'm glad you got it working and that you find them useful. As John Meyer said, this is where the real power of Vegas comes shining through. End-users can add new functionality and not have to wait for the next release. It's very empowering for an editor.

~jr
tcbetka wrote on 10/27/2008, 6:43 AM
JR, thanks again for these scripts. I haven't played with them much, but did get both of them working--which is way more than I knew how to do two days ago. So your efforts are much-appreciated. There's no question of your mastery of the Vegas workflow...

Thanks again.

TB