Comments

jetdv wrote on 1/24/2008, 7:35 PM
Yes, that can be done.
ChrisAtSilentOrb wrote on 1/25/2008, 3:21 PM
And exactly how can it be done?
jetdv wrote on 1/25/2008, 7:35 PM
You would need to go through the list of bins to find the source and destination bins (or create a destination bin). Then go through each item in the source bin and add it to the destination bin. If needed, you could also remove them from the source bin. If you look at the "Add effect to all media" and "Remove effect from all media" scripts that ship with Vegas, they should give you an idea how to go through the Project Media items.
ChrisAtSilentOrb wrote on 1/26/2008, 5:42 PM
Thank you, I understand the general procedure; what I need to know is exactly how I can do what you said here:

"Then go through each item in the source bin and add it to the destination bin"

How exactly do I add media to a bin? I can't find any method to call, nor any list I can alter.

From what I can tell, the scripts you mentioned don't touch bins and instead simply work with the global MediaPool list.

I've been experimenting with the list of bins through vegas.Project.MediaPool.RootMediaBin[x] and the list of media items through vegas.Project.MediaPool but I can't find any properties in any of the items in either one of these lists that reference items in the other list. In other words, along with the question of how to move a media item to a different bin, I can't figure out how to determine what media items are in what bins.

I see MediaPool has an AddMedia method, but that looks like it is based on the current selection and I don't see any commands for controlling what bins are selected, and even if it did work I hope there would be a more gainly means of moving media then changing the user's current selection.

Thank you for your time,
Chris Johnson
jetdv wrote on 1/26/2008, 6:29 PM
MediaBin bin = Vegas.Project.MediaPool.RootMediaBin;
Media mymedia = new Media(FullFileName);
bin.Add(mymedia);


Here's how you can look through ALL bins

foreach (MediaBin bin in Vegas.Project.MediaPool.RootMediaBin)
{
}


Check the name of a bin:

if (bin.Name == "MyBin")



Add a new bin:

MediaBin newBin = new MediaBin(binName);
Vegas.Project.MediaPool.RootMediaBin.Add(newBin);
ChrisAtSilentOrb wrote on 1/26/2008, 8:13 PM
Thank you. That solved it for me.

For future reference for anyone interested, the main problem I ran into was that the list returned by a MediaBin object can contain items of more than one object type and until those items are explicitly converted to their respective object types, only their IMediaBinNode properties will be visible from the VS debugger.