< Previous | Contents | Next >

Event Suites

Event suites are installed as callbacks to certain events in Fusion. Install them like a regular scriptlib. Inside the scriptlib, add the following variable:

ev = AddEventSuite(“Composition”)


This variable has now access to events that occur when certain events are triggered.


image


Possible events are:

> OnOpen() -- Triggers every time a file is opened

> OnSave() -- Triggers every time a comp is saved

> OnSaveAs() -- Whenever save as is called

> OnStartRender() -- Whenever a render starts

> OnEndRender() -- Whenever a render ends

> OnFrameRendered() -- Whenever a frame is rendered

> OnTimeChange() -- Whenever the time changes

> OnActivateTool() -- Whenever a tool is made active

image

globals.ev = AddEventSuite(“Composition”)

function ev:OnStartRender(event)

For example: Create a file called PrintSaverPathsOnRender.scriptlib in the Scripts:/Comp folder. Enter the following content:



image

Note

Always use self:Default(event) to call the base implementation of the event. This will allow you to create multiple events with different scriptlibs.

end

self:Default(event)

end

print(tool:GetInput(“Clip”))

for i, tool in pairs(toollist) do

local toollist=comp:GetToolList(“Saver”)

Now start a render with a composition that has at least one Saver with a valid path defined. The console will print all the paths of the Savers. Although this sample does not add much value, it could easily be modified to check and manipulate the paths.



image


Removing an event suite is accomplished by running the RemoveEventSuite(suite) function. In the example scenario, the syntax would be:

RemoveEventSuite(ev)