ChoiceParam

Inherits : AnimatedParam

Synopsis

A choice parameter holds an integer value which corresponds to a choice. See detailed description below.

Functions

Detailed Description

A choice is represented as a drop-down (combobox) in the user interface:

../../../_images/choiceParam.png

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(optionID, optionLabel, optionHelp)
Parameters:
  • optionIDstr
  • optionLabelstr
  • optionHelpstr

Adds a new option to the menu. The optionID is a unique identifier for the option and is not displayed to the user. The optionLabel is the label visible in the drop-down menu for the user. If empty, the optionLabel will be automatically set to be the same as the optionID If optionHelp is not empty, it will be displayed when the user hovers the entry with the mouse.

NatronEngine.ChoiceParam.get(frame[, view="Main"])
Parameters:
  • framefloat
  • viewstr
Return type:

int

Get the value of the parameter at the given frame and view.

NatronEngine.ChoiceParam.get([view="Main"])
param view:str
Return type:int

Get the value of the parameter at the current timeline’s time for the given view.

NatronEngine.ChoiceParam.getDefaultValue()
Return type:int

Get the default value for this parameter.

NatronEngine.ChoiceParam.getActiveOption([view="Main"])
Parameters:viewstr
Return type:PyTuple

Get the active menu entry for the given view. Note that the active entry may not be present in the options returned by the getOptions() function if the menu was changed. In this case the option will be displayed in italic in the user interface. The tuple is composed of 3 strings: the optionID, optionLabel and optionHint. The optionID is what uniquely identifies the entry in the drop-down menu. The optionLabel is what is visible in the user interface. The optionHint is the help for the entry visible in the tooltip.

NatronEngine.ChoiceParam.getOption(index)
Parameters:indexint
Return type:PyTuple

Get the menu entry at the given index. The tuple is composed of 3 strings: the optionID, optionLabel and optionHint. The optionID is what uniquely identifies the entry in the drop-down menu. The optionLabel is what is visible in the user interface. The optionHint is the help for the entry visible in the tooltip.

NatronEngine.ChoiceParam.getNumOptions()
Return type:int

Returns the number of menu entries.

NatronEngine.ChoiceParam.getOptions()
Return type:sequence

Returns a sequence of tuple with all menu entries from top to bottom. Each tuple is composed of 3 strings: the optionID, optionLabel and optionHint. The optionID is what uniquely identifies the entry in the drop-down menu. The optionLabel is what is visible in the user interface. The optionHint is the help for the entry visible in the tooltip.

NatronEngine.ChoiceParam.getValue()
Return type:int

Same as get()

NatronEngine.ChoiceParam.getValueAtTime(time[, view="Main"])
Parameters:
  • timefloat
  • viewstr
Return type:

float

Same as get(frame,view)

NatronEngine.ChoiceParam.restoreDefaultValue([view="All"])
Parameters:viewstr

Removes all animation and expression set on this parameter for the given view and set the value to be the default value.

NatronEngine.ChoiceParam.set(x[, view="All"])
Parameters:
  • xint
  • viewstr
Set the value of this parameter to be x for the given view.
If this parameter is animated (see getIsAnimated(dimension, view)

then this function will automatically add a keyframe at the timeline’s current time.

NatronEngine.ChoiceParam.set(x, frame[, view="All"])
Parameters:
  • xint
  • framefloat
  • viewstr

Set a new keyframe on the parameter with the value x at the given frame and view.

NatronEngine.ChoiceParam.set(label[, view="All"])
Parameters:
  • labelstr
  • viewstr

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:valueint

Set the default value for this parameter.

NatronEngine.ChoiceParam.setDefaultValue(ID)
Parameters:labelstr

Set the default value from the ID for this parameter. The ID must match an existing optionID. 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. The options is a list of tuples. Each tuple is composed of 3 strings: the optionID, optionLabel and optionHint. The optionID is what uniquely identifies the entry in the drop-down menu. The optionLabel is what is visible in the user interface. The optionHint is the help for the entry visible in the tooltip.

NatronEngine.ChoiceParam.setValue(value[, view="All"])
Parameters:
  • valueint
  • viewstr

Same as set

NatronEngine.ChoiceParam.setValueAtTime(value, time[, view="All"])
Parameters:
  • valueint
  • timeint

Same as set(time)<NatronEngine.ChoiceParam.set()