.. module:: NatronEngine .. _ChoiceParam: ChoiceParam *********** **Inherits** : :doc:`AnimatedParam` Synopsis -------- A choice parameter holds an integer value which corresponds to a choice. See :ref:`detailed description` below. Functions ^^^^^^^^^ - def :meth:`addOption` (option, help) - def :meth:`get` () - def :meth:`get` (frame) - def :meth:`getDefaultValue` () - def :meth:`getOption` (index) - def :meth:`getNumOptions` () - def :meth:`getOptions` () - def :meth:`getValue` () - def :meth:`getValueAtTime` (time) - def :meth:`restoreDefaultValue` () - def :meth:`set` (x) - def :meth:`set` (x, frame) - def :meth:`set` (label) - def :meth:`setDefaultValue` (value) - def :meth:`setDefaultValue` (label) - def :meth:`setOptions` (options) - def :meth:`setValue` (value) - def :meth:`setValueAtTime` (value, time) .. _choice.details: Detailed Description -------------------- A choice is represented as a drop-down (combobox) in the user interface: .. figure:: choiceParam.png You can add options to the menu using the :func:`addOption(option, help)` function. You can also set them all at once using the :func:`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 :doc:`IntParam`. Member functions description ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. method:: NatronEngine.ChoiceParam.addOption(option, help) :param option: :class:`str` :param help: :class:`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. .. method:: NatronEngine.ChoiceParam.get(frame) :param frame: :class:`float` :rtype: :class:`int` Get the value of the parameter at the given *frame*. .. method:: NatronEngine.ChoiceParam.get() :rtype: :class:`int` Get the value of the parameter at the current timeline's time. .. method:: NatronEngine.ChoiceParam.getDefaultValue() :rtype: :class:`int` Get the default value for this parameter. .. method:: NatronEngine.ChoiceParam.getOption(index) :param index: :class:`int` :rtype: :class:`str` Get the menu entry at the given *index*. .. method:: NatronEngine.ChoiceParam.getNumOptions() :rtype: :class:`int` Returns the number of menu entries. .. method:: NatronEngine.ChoiceParam.getOptions() :rtype: :class:`sequence` Returns a sequence of string with all menu entries from top to bottom. .. method:: NatronEngine.ChoiceParam.getValue() :rtype: :class:`int` Same as :func:`get()` .. method:: NatronEngine.ChoiceParam.getValueAtTime(time) :param time: :class:`float` :rtype: :class:`float` Same as :func:`get(frame)` .. method:: NatronEngine.ChoiceParam.restoreDefaultValue() Removes all animation and expression set on this parameter and set the value to be the default value. .. method:: NatronEngine.ChoiceParam.set(x) :param x: :class:`int` Set the value of this parameter to be *x*. If this parameter is animated (see :func:`getIsAnimated(dimension)` then this function will automatically add a keyframe at the timeline's current time. .. method:: NatronEngine.ChoiceParam.set(x, frame) :param x: :class:`int` :param frame: :class:`float` Set a new keyframe on the parameter with the value *x* at the given *frame*. .. method:: NatronEngine.ChoiceParam.set(label) :param label: :class:`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. .. method:: NatronEngine.ChoiceParam.setDefaultValue(value) :param value: :class:`int` Set the default *value* for this parameter. .. method:: NatronEngine.ChoiceParam.setDefaultValue(label) :param label: :class:`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. .. method:: NatronEngine.ChoiceParam.setOptions(options) :param options: class::`sequence` Clears all existing entries in the menu and add all entries contained in *options* to the menu. .. method:: NatronEngine.ChoiceParam.setValue(value) :param value: :class:`int` Same as :func:`set` .. method:: NatronEngine.ChoiceParam.setValueAtTime(value, time) :param value: :class:`int` :param time: :class:`int` Same as :func:`set(time)