< Previous | Contents | Manuals Home | Boris FX | Next >

Undo

Any python-created operations must interact correctly with the SynthEyes undo subsystem. The programmer should always consider the possibility that the user will hit Undo to any script or workflow operation done via python.

When you simulate user-interface operations using SyWin or the menu calls in SyLevel, undo control is already built into the user interface, because you are simply taking advantage of existing operations.

When you perform operations using direct python access to SynthEyes objects, you need to put such changes inside (SyLevel) Begin/Accept calls, so that the operation can be undone or redone if the user desires. Operations can also be cancelled, causing them to be unrolled, which can be advantageous to make temporary "prospective" changes.

Operations that affect the presentation of data in the SynthEyes user interface generally do not create or require an undo block. For example, changing the current time slider or the flags controlling the appearance of the trackers do not create an undo. You can verify whether an undo is required by trying the operation in SynthEyes, then looking at Edit/Undo to see if an undo block has been created.

Some dialogs are very complex, and may maintain an open Undo block for their entire operation (if they have created and cached extensive amounts of information). In that case, you will be limited to user-interface simulation while the dialog is open as Begin() will be unable to acquire the lock.

Note that SyPy contains some code to monitor your Begin/Accept operations, to attempt to identify problems (and raise an exception) before they cause a crash. If you get an assertion

from SynthEyes about "holding" or "!holding," that means that you either have an Accept without a Begin, or a Begin without an Accept, respectively.


©2023 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.