Pref

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

Pref

This list object allows read-write access to the preferences listed on the Preferences panel. (Note that there are additional preferences that are not listed there; see ColorPref and FolderPref in addition to the discussion here.)

The Pref object is a list with indexed or associative access, ie Pref[2] or Pref["first1"]—clearly the latter form is generally preferred. You can also access the values directly, such as Pref.fontsize.

There are also some arrays of textual data in the preferences. These can be manipulated via a number of special member functions. The only allowable index1 values are as follows:

8: Most-recently-used SynthEyes .sni files

15: Folder preferences. Use FolderPref instead. Do not clear this. 33: Most-recently-used export scripts.

85: Room configuration data, as set by right-clicking in the room area and selecting Save as prefs. Do not clear this array, use ResetRoomPrefsFromFactory().

113: Multiple-export configuration data, ie the listed exporters plus encoded folder prefix and file suffix information.

319: Most-recently-used tool scripts.

331: Window placement and setting preference information, as set from the File Open section of the preferences. These are very long encoded strings; the information is undocumented and the contents are subject to change and should not be relied upon.

Changes to room and window data will not be effective until restart or a new scene.

The following member functions are defined for Pref:

.ClearArray(index1) Clear this preference array of strings, removing them all. See the discussion above.

.GetCountFromArray(index1) Get the number of strings in this preference

array.

.GetStringFromArray(index1, index2) Get the index2'th string (from 1) of array

index1.

.Reload() Reload some values that are cached internally for speed from the preferences so that the rest of the program sees them; call after changing preferences.

.ResetRoomPrefsFromFactory() Resets the room preferences to the factory

settings. Needed because you can't just ClearArray them.

.Save() Saves changed preferences immediately (instead of at successful program close or preference panel open/close).

.SetStringFromArray(index1, index2, str) Set the index2'th (from 1) string of array

index1 to the string str.

Use the Plain Text/Preferences Listing (prefslist.szl) and Save Preferences (savepref.szl) exporters as a code reference and source of the preference variable and attribute names.

Each preference has the following read-only attributes. Only the value is writable. After changing a value, call the function Pref.Reload() to make the change(s) effective; some changes may not take effect until some user action, such as reopening the Perspective view. Important: there is no Undo for Preferences changes: they take effect immediately, and are outside the scope of the normal undo system.

.attr The attribute name, to be used to locate the desired preference, ie by Pref["first1"].

.config Kind-specific machine-readable configuration string. for this preference, for example the range of a spinner, the options for a dropdown.

.default Default value for this preference. Always a string.

.description The full pop-up tooltip text from the Preferences panel.

.group The group name that this preference resides in.

.kind A numeric code for the type of preference, ie spinners, checkboxes, dropdowns, etc.

.name The user-visible name on the Preferences panel

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