-
Project change works in a script but not in an extension (?)
Posted by Frederic Baumann on October 29, 2010 at 6:16 pmHi,
I have written a script which modifies a few things in the TrackEvent’s of a project, and it works fine.
It is under Vegas Pro 10.
I have then embedded the same code in a Vegas Extension. The extension executes correctly, except when I try to change the ‘Start’ field of a TrackEvent. Also, calling the Project.AddAudioTrack method throws an exception.
It looks like any change to the project causes an exception (System.Runtime.InteropServices.COMException).
Would you have any idea to fix this?
I have tried to build the extension with Framework 2.0, 3.0 and 3.5. Always same problem.
Thanks,
Frédéric—
Want to learn on Sony Vegas Event Pan/Crop tool? Watch my video tutorial:
https://library.creativecow.net/baumann_frederic/Sony-Vegas_event-pan-crop-tool/1Or about Keyframes? https://library.creativecow.net/articles/baumann_frederic/Animating-with-Keyframes-in-Sony-Vegas.php
French version: https://geo.creativecow.net/fr/a/12999
John Rofrano replied 15 years, 6 months ago 2 Members · 9 Replies -
9 Replies
-
Frederic Baumann
October 29, 2010 at 7:30 pmHere are more details on what I have experienced:
– compiling an extension in .net 4 makes it not recognized by Vegas Pro 10. If I recompile it in .net 3.5 or below, then it is loaded at Vegas startup, and it appears in the Extensions menu.
– so it means that the extension needs to be built in .net 3.5 or below, and in my case, for the x64 target (and not x86), since I use Vegas 64 bits on Windows 7 64 bits.
– BUT, it looks like the .net framework 3.5 64 bits cannot be installed on Windows 7. When I try, the installer complains with a message which is not clear to me.
– AND when I compile my extension, I have a warning saying that the mscorlib.dll targets a different processor (I don’t have this warning when I am compiling with .Net 4 — only with .Net 3.5). This leads me to think that I don’t have a .net 3.5 framework in 64 bits.
– so, I wonder if it is possible to build extensions working on Vegas 64 bits under Windows 7 64 bits.
– however, what is strange is that my extension (.net 3.5) seems to work until I try to access to the Vegas project to modify it (reading data is find, but modifying them seems to be the problem).
Well, thank you if you have read me up to this point. Any feedback will be welcome. Especially if one managed to make an extension work on Windows 7 with Vegas 10 64bits, and if this extension modifies the Vegas project…
Thanks!
Frédéric 🙂—
Want to learn on Sony Vegas Event Pan/Crop tool? Watch my video tutorial:
https://library.creativecow.net/baumann_frederic/Sony-Vegas_event-pan-crop-tool/1Or about Keyframes? https://library.creativecow.net/articles/baumann_frederic/Animating-with-Keyframes-in-Sony-Vegas.php
French version: https://geo.creativecow.net/fr/a/12999
-
John Rofrano
October 29, 2010 at 7:38 pm[Frederic Baumann] “Would you have any idea to fix this?”
Yes, with Command Extensions you have to manage the undo buffer youself. You can read about it in the SDK. For now, just use the following code block around any part of your command extension that changes the Vegas project in any way:
using (UndoBlock undo = new UndoBlock("Changed foo..."))
{
// make your changes to the project here.}
The text that you use in the UndoBlock() will show up under the Undo menu in Vegas (so be careful what you say) 😉~jr
http://www.johnrofrano.com
http://www.vasst.com -
John Rofrano
October 29, 2010 at 7:43 pmYou do not have to compile Command Extensions as 64-bit to use them in Vegas Pro 64-bit. Just make a 32-bit DLL and Vegas Pro 64-bit will load it just fine. That’s the “magic” of the .Net Framework… it’s all interpreted as Command Language Runtime (CLR) inside.
Use the .Net Framework 3.5 for Vegas Pro 10. This will also work in Vegas Pro 9.0 but not 8.0 and earlier.
~jr
http://www.johnrofrano.com
http://www.vasst.com -
Frederic Baumann
October 29, 2010 at 8:06 pmYou are so great John !!!! 🙂
I have made the change and it works.
I was getting crazy about this strange behaviour. I don’t know how I could have got out of this without your help.
Many thanks,
Frédéric—
Want to learn on Sony Vegas Event Pan/Crop tool? Watch my video tutorial:
https://library.creativecow.net/baumann_frederic/Sony-Vegas_event-pan-crop-tool/1Or about Keyframes? https://library.creativecow.net/articles/baumann_frederic/Animating-with-Keyframes-in-Sony-Vegas.php
French version: https://geo.creativecow.net/fr/a/12999
-
John Rofrano
October 29, 2010 at 8:13 pmYou’re welcome… Do you have the Script SDK? It’s really valuable for understanding all of this.
~jr
http://www.johnrofrano.com
http://www.vasst.com -
Frederic Baumann
October 29, 2010 at 8:35 pmYes I think so. Do you mean the zip file with 18 files including the API documentation and a FAQ list?
I have intensively browsed the API doc and the FAQ, but I must admit that I did not pay attention to other files (.cs, .js, .vb, and also a big XML file with API description). Should I?
If there is something else you would recommend?
Thanks again,
Frédéric—
Want to learn on Sony Vegas Event Pan/Crop tool? Watch my video tutorial:
https://library.creativecow.net/baumann_frederic/Sony-Vegas_event-pan-crop-tool/1Or about Keyframes? https://library.creativecow.net/articles/baumann_frederic/Animating-with-Keyframes-in-Sony-Vegas.php
French version: https://geo.creativecow.net/fr/a/12999
-
John Rofrano
October 30, 2010 at 2:34 pm[Frederic Baumann] “Yes I think so. Do you mean the zip file with 18 files including the API documentation and a FAQ list?”
Yes, that’s the one.
[Frederic Baumann] “I have intensively browsed the API doc and the FAQ, but I must admit that I did not pay attention to other files (.cs, .js, .vb, and also a big XML file with API description). Should I?”
Yes, I would definitely read the sample code. It will show you how the API should be used and give you insight into how to it works.
~jr
http://www.johnrofrano.com
http://www.vasst.com -
Frederic Baumann
October 30, 2010 at 3:41 pmDid it yesterday thanks to your question 🙂 – that’s right there were some interesting things that I did not see through the API & FAQ docs.
—
Want to learn on Sony Vegas Event Pan/Crop tool? Watch my video tutorial:
https://library.creativecow.net/baumann_frederic/Sony-Vegas_event-pan-crop-tool/1Or about Keyframes? https://library.creativecow.net/articles/baumann_frederic/Animating-with-Keyframes-in-Sony-Vegas.php
French version: https://geo.creativecow.net/fr/a/12999
-
John Rofrano
October 30, 2010 at 4:20 pm[Frederic Baumann] ” that’s right there were some interesting things that I did not see through the API & FAQ docs.”
Yea, whenever you get code samples, they will always reveal what the documentation alone cannot. Glad that helped.
~jr
http://www.johnrofrano.com
http://www.vasst.com
Reply to this Discussion! Login or Sign Up