ChoiceParam
Inherits : AnimatedParam
Synopsis
A choice parameter holds an integer value which corresponds to a choice. See detailed description below.
Functions
def
addOption
(option, help)def
get
()def
get
(frame)def
getDefaultValue
()def
getOption
(index)def
getNumOptions
()def
getOptions
()def
getValue
()def
getValueAtTime
(time)def
restoreDefaultValue
()def
set
(x)def
set
(x, frame)def
set
(label)def
setDefaultValue
(value)def
setDefaultValue
(label)def
setOptions
(options)def
setValue
(value)def
setValueAtTime
(value, time)
Detailed Description
A choice is represented as a drop-down (combobox) in the user interface:

You can add options to the menu using the addOption(option, help)
function.
You can also set them all at once using the setOptions(options)
function.
The value held internally is a 0-based index corresponding to an entry of the menu. the choice parameter behaves much like an IntParam.
Member functions description
- NatronEngine.ChoiceParam.addOption(option, help)
- Parameters:
option –
str
help –
str
Adds a new option to the menu. If help is not empty, it will be displayed when the user hovers the entry with the mouse.
- NatronEngine.ChoiceParam.get(frame)
- Parameters:
frame –
float
- Return type:
int
Get the value of the parameter at the given frame.
- NatronEngine.ChoiceParam.get()
- Return type:
int
Get the value of the parameter at the current timeline’s time.
- NatronEngine.ChoiceParam.getDefaultValue()
- Return type:
int
Get the default value for this parameter.
- NatronEngine.ChoiceParam.getOption(index)
- Parameters:
index –
int
- Return type:
str
Get the menu entry at the given index.
- NatronEngine.ChoiceParam.getNumOptions()
- Return type:
int
Returns the number of menu entries.
- NatronEngine.ChoiceParam.getOptions()
- Return type:
sequence
Returns a sequence of string with all menu entries from top to bottom.
- NatronEngine.ChoiceParam.getValue()
- Return type:
int
Same as get()
- NatronEngine.ChoiceParam.getValueAtTime(time)
- Parameters:
time –
float
- Return type:
float
Same as get(frame)
- NatronEngine.ChoiceParam.restoreDefaultValue()
Removes all animation and expression set on this parameter and set the value to be the default value.
- NatronEngine.ChoiceParam.set(x)
- Parameters:
x –
int
Set the value of this parameter to be x. If this parameter is animated (see getIsAnimated(dimension)
then this function will automatically add a keyframe at the timeline’s current time.
- NatronEngine.ChoiceParam.set(x, frame)
- Parameters:
x –
int
frame –
float
Set a new keyframe on the parameter with the value x at the given frame.
- NatronEngine.ChoiceParam.set(label)
- Parameters:
label –
str
Set the value of this parameter given a label. The label must match an existing option. Strings will be compared without case sensitivity. If not found, nothing happens.
- NatronEngine.ChoiceParam.setDefaultValue(value)
- Parameters:
value –
int
Set the default value for this parameter.
- NatronEngine.ChoiceParam.setDefaultValue(label)
- Parameters:
label –
str
Set the default value from the label for this parameter. The label must match an existing option. Strings will be compared without case sensitivity. If not found, nothing happens.
- NatronEngine.ChoiceParam.setOptions(options)
- Parameters:
options – class::sequence
Clears all existing entries in the menu and add all entries contained in options to the menu.
- NatronEngine.ChoiceParam.setValue(value)
- Parameters:
value –
int
Same as set
- NatronEngine.ChoiceParam.setValueAtTime(value, time)
- Parameters:
value –
int
time –
int
Same as set(time)<NatronEngine.ChoiceParam.set()