unreal.MetaSoundLiteralViewModel_Float¶
- class unreal.MetaSoundLiteralViewModel_Float(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
MVVMViewModelBaseViewmodel for converting a float-type MetaSound Literal between Source, Normalized, and Display values.
Source values refer to the units or range expected by the MetaSound Literal. Display values refer to a configurable conversion of the Source value. For instance, a “Volume” input might expect a linear gain value in the MetaSound, but users may wish to display the value as decibels.
The Normalized value is to be used for UI elements such as sliders and knobs.
The Literal variable belonging to this viewmodel is expected to be bound to the Literal variable of a MetaSoundInputViewModel using a two-way binding for bidirectional updates. Doing so will ensure all updates to the input in the MetaSound Editor are reflected in your widget and vice versa.
This viewmodel should most likely use the Create Instance setting, along with the Expose Instance in Editor option. This allows designers to easily configure units and range settings in the Details panel of instances of the owning widget. see: UTechAudioToolsFloatMapping for unit conversion and range mapping logic.
C++ Source:
Plugin: TechAudioTools
Module: TechAudioToolsMetaSound
File: MetaSoundLiteralViewModel.h
Editor Properties: (see get_editor_property/set_editor_property)
display_value(float): [Read-Write] The user-facing display value (e.g. dB, Hz, semitones). Can be modified and is automatically converted to the expected SourceRange.literal(MetasoundFrontendLiteral): [Read-Write] The bound MetaSound Literal value. Should be bound using a two-way binding with the Literal variable of a MetaSoundInputViewModel.normalized_value(float): [Read-Write] The normalized (0-1) representation of the value currently surfaced to the UI. If bShowDisplayValues is true, this is DisplayValue mapped into 0-1 space. Otherwise, it’s SourceValue mapped into 0-1 space. Used by knobs/sliders purely for visual feedback.range_values(TechAudioToolsFloatMapping): [Read-Write] Mapping pair used to convert between float literal, normalized, and display values.show_display_values(bool): [Read-Write] If true, the NormalizedValue will be mapped to the DisplayRange, else mapped to the SourceRange.source_value(float): [Read-Write] The value of the bound Literal as a float.
- property display_value: float¶
[Read-Write] The user-facing display value (e.g. dB, Hz, semitones). Can be modified and is automatically converted to the expected SourceRange.
- Type:
(float)
- get_display_units() TechAudioToolsFloatUnit¶
Returns the units associated with the DisplayValue.
- Return type:
- get_source_units() TechAudioToolsFloatUnit¶
Returns the units associated with the SourceValue.
- Return type:
- property literal: MetasoundFrontendLiteral¶
[Read-Write] The bound MetaSound Literal value. Should be bound using a two-way binding with the Literal variable of a MetaSoundInputViewModel.
- Type:
- property normalized_value: float¶
[Read-Write] The normalized (0-1) representation of the value currently surfaced to the UI. If bShowDisplayValues is true, this is DisplayValue mapped into 0-1 space. Otherwise, it’s SourceValue mapped into 0-1 space. Used by knobs/sliders purely for visual feedback.
- Type:
(float)