< Previous | Contents | Manuals Home | Boris FX | Next >
Detached Panels
You can use dlg.Detach() to create a persistent modeless free-floating tool user interface from within a tool. Use buttons to activate functions within the script on user command. Each floating tool dialog carries its own environment, they do not share ordinary variables—use persistent global variables to communicate if necessary.
IMPORTANT : do not maintain references to SynthEyes objects such as trackers or cameras from one button push to the next. If necessary, keep the name of the tracker/etc instead, or its uniqueID.
In detached panels, a Sizzle function named ReloadPanel() will be called immediately before the panel is redrawn, if it exists. (Note: it is not called during spinner or viewport drags where an undo object is being built.) The function can reload user interface elements if needed. Since the function is called during redraw, it must be very fast, making any minimal changes to the detached dialog only if required, and it must not change the SynthEyes scene. Changing the scene will cause an assertion failure, ie intentional crash. For example, the Perspective Projection Screen Adjust script contains this:
function ReloadPanel()
if (Scene.activeObj.cam.nm != dlg.camera)
FetchFromCam(); // active camera changed end
end
It quickly checks to see if it is already displaying the parameters for the active camera, and as long as it is, quickly exits. If not, it reloads the panel with still-speedy statements to reload the panel, such as
dlg.camera = Scene.activeObj.cam.nm
©2023 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.