AddEffect fails in extension but not script

CuriousKea wrote on 12/14/2009, 12:26 PM
When trying to call AddEffect in an extension, I get the following exception (but have no problem when the same code is used within a script):

System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at Sony.Vegas.IEffectCOM.AddEffect(IPlugInNodeCOM com, Int32& index, UInt32& sessionID)
at Sony.Vegas.Effect.AddSelf(IEffectOwner owner, Int32 index)
at Sony.Vegas.Effects.BaseAdd(Effect item)
at Sony.Vegas.Effects.AddEffect(PlugInNode plugIn)
at MyExtension.MyExtClass.HandleInvoked(Object sender, EventArgs args)

Similarly I get the same exception for adding a keyframe from within an extension.

Any help appreciated.

Comments

Rosebud wrote on 12/14/2009, 12:42 PM
You have to add an Undo Block:

See this post.
CuriousKea wrote on 12/14/2009, 12:53 PM
Great! Thanks for the very quick response! This problem had me really stalled for a while.

I had wrongly assumed that the "What's new" sticky post had the same info as in the scripting API HTML docs. I obviously need to take a closer look at that.