www.jetdv.com Forum Index Edward Troxel
Vegas Scripting and Newsletters
Home of Excalibur and Montage Magic
 
 FAQ   Search   Memberlist   Usergroups   Register   Profile 
 Log in to check your private messagesLog in to check your private messages   Log inLog in 

Groups

 
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Scripting FAQ
View previous topic :: View next topic  
Author Message
Freddie



Joined: 10 Mar 2006
Posts: 100

PostPosted: Sun May 11, 2008 6:26 pm    Post subject: Groups Reply with quote

Using C#, how do you add Track events to a group? In the code below I get all the selected Track Events and store them in Array. Now I want to add all the selected events to a Group.

From the API, I see there is a TrackEventGroup Class but I'm not really sure if that is what I need and how to use it.

Code:


       // Get the Selected Tracks
       FoundTrackEvents = FindSelectedEvents(vegas.Project);

       // .... removed a lot of code....

        TrackEvent[] FindSelectedEvents(Project project)
        {
            List<TrackEvent> selectedEvents = new List<TrackEvent>();
            foreach (Track track in project.Tracks)
            {
                foreach (TrackEvent trackEvent in track.Events)
                {
                    if (trackEvent.Selected)
                    {
                        selectedEvents.Add(trackEvent);
                    }
                }
            }
            return selectedEvents.ToArray();
        }
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Sun May 11, 2008 7:05 pm    Post subject: Reply with quote

Here's a way to create a NEW grouping consisting of two events:

Code:
TrackEventGroup grp = new TrackEventGroup();
Vegas.Project.Groups.Add(grp);
grp.Add(myVidEvent);
grp.Add(myAudEvent);


Here's some JScript code that adds a new event to an existing grouping:

Code:
var grp : TrackEventGroup = evnt.Group;
grp.Add(mynewEvent);
Back to top
View user's profile Send private message Send e-mail
Freddie



Joined: 10 Mar 2006
Posts: 100

PostPosted: Sun May 11, 2008 8:16 pm    Post subject: Reply with quote

Thanks Ed, This worked perfect.

I was missing this line:
Code:

Vegas.Project.Groups.Add(grp);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Scripting FAQ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.11 © 2001, 2002 phpBB Group