Skip to content

sonolus.script.options

options(cls)

Decorator to define options.

Usage
@options
class Options:
    slider_option: float = slider_option(
        name='Slider Option',
        standard=True,
        advanced=False,
        default=0.5,
        min=0,
        max=1,
        step=0.1,
        unit='unit',
        scope='scope',
    )
    toggle_option: bool = toggle_option(
        name='Toggle Option',
        standard=True,
        advanced=False,
        default=True,
        scope='scope',
    )
    select_option: int = select_option(
        name='Select Option',
        standard=True,
        advanced=False,
        default='value',
        values=['value'],
        scope='scope',
    )

select_option(*, name=None, description=None, standard=False, advanced=False, default, values, scope=None)

Define a select option.

Parameters:

Name Type Description Default
name str | None

The name of the option.

None
description str | None

The description of the option.

None
standard bool

Whether the option is standard.

False
advanced bool

Whether the option is advanced.

False
default str | int

The default value of the option.

required
values list[str]

The values of the option.

required
scope str | None

The scope of the option.

None

slider_option(*, name=None, description=None, standard=False, advanced=False, default, min, max, step, unit=None, scope=None)

Define a slider option.

Parameters:

Name Type Description Default
name str | None

The name of the option.

None
description str | None

The description of the option.

None
standard bool

Whether the option is standard.

False
advanced bool

Whether the option is advanced.

False
default float

The default value of the option.

required
min float

The minimum value of the option.

required
max float

The maximum value of the option.

required
step float

The step value of the option.

required
unit str | None

The unit of the option.

None
scope str | None

The scope of the option.

None

toggle_option(*, name=None, description=None, standard=False, advanced=False, default, scope=None)

Define a toggle option.

Parameters:

Name Type Description Default
name str | None

The name of the option.

None
description str | None

The description of the option.

None
standard bool

Whether the option is standard.

False
advanced bool

Whether the option is advanced.

False
default bool

The default value of the option.

required
scope str | None

The scope of the option.

None