Product Documentation
Virtuoso Layout Suite SKILL Reference
Product Version IC23.1, November 2023

gpeRegisterPresetGen

gpeRegisterPresetGen(
t_displayName 
t_functionName 
t_checkFunctionName
[ g_noStacks ]
)
=> t / nil

Description

Registers the specified function as a preset generator.

Arguments

t_displayName

Display name of the preset generator. This name is displayed in the Preset drop-down list of the Grid Pattern Editor.

t_functionName

The generator function name.

t_checkFunctionName

A custom function used to pre-process the selected target, which is the Modgen sandbox. The function returns values t or nil, which can be used to specify whether the preset is to be displayed in the Preset drop-down.

To ensure that the preset is always displayed in the drop-down, set checkFunctionName to “”. Alternatively, you can use procedure(test_preset_check(args) t), but this method is not recommended as it adversely impacts the tool performance.

g_noStacks

Specifies whether the sandbox must be in the unstacked format. If this argument is set to nil or is omitted, the sandbox that is provided to the preset callback is in the stacked format.

Value Returned

t

The specified function has been registered.

nil

The command was unsuccessful.

Example

A preset function is defined and custom checks are performed to determine when the preset function has to be displayed. The preset function is then registered.

procedure(test_preset(sbox @optional selection) print("Hello world"))
=> test_preset
gpeUnregisterPresetGen("test_preset")
=> t if registered; nil if not registered
gpeRegisterPresetGen("gen1" "test_preset" "")
=> t

Return to top
 ⠀
X