-
- All Implemented Interfaces:
-
app.rive.runtime.kotlin.core.RefCount
public final class ViewModelInstance extends NativeObject
Represents an instantiated set of properties on a ViewModel. With this class you have access to the individual properties to get and set values from bindings.
Before the property modifications have any effect, you need to assign the instance to an artboard with Artboard.viewModelInstance.
Instances can be created from one File and applied to another. See transfer for more information.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classViewModelInstance.TransferWrapper type for transferring a view model instance between Files.
Exists to encode reference counting operations at the type-level.
-
Field Summary
Fields Modifier and Type Field Description private final Stringnameprivate final BooleanhasCppObjectprivate AtomicIntegerrefsprivate LongcppPointerprivate final <ERROR CLASS>dependenciesprivate final IntegerrefCount
-
Method Summary
-
-
Method Detail
-
getHasCppObject
final Boolean getHasCppObject()
-
getRefs
final AtomicInteger getRefs()
-
setRefs
final Unit setRefs(AtomicInteger refs)
-
getCppPointer
final Long getCppPointer()
-
setCppPointer
final Unit setCppPointer(Long cppPointer)
-
getDependencies
final <ERROR CLASS> getDependencies()
-
getRefCount
Integer getRefCount()
-
getNumberProperty
final ViewModelNumberProperty getNumberProperty(String path)
Get a named number property.
- Parameters:
path- The path to the property.
-
getStringProperty
final ViewModelStringProperty getStringProperty(String path)
Get a named string property.
-
getBooleanProperty
final ViewModelBooleanProperty getBooleanProperty(String path)
Get a named boolean property.
-
getColorProperty
final ViewModelColorProperty getColorProperty(String path)
Get a named color property.
Numbers are represented as integers in 0xAARRGGBB format.
-
getEnumProperty
final ViewModelEnumProperty getEnumProperty(String path)
Get a named enum property.
Enums are represented as strings.
-
getTriggerProperty
final ViewModelTriggerProperty getTriggerProperty(String path)
Get a named trigger property.
-
getImageProperty
final ViewModelImageProperty getImageProperty(String path)
Get a named image property.
-
getListProperty
final ViewModelListProperty getListProperty(String path)
Get a named list property.
-
getArtboardProperty
final ViewModelArtboardProperty getArtboardProperty(String path)
-
getInstanceProperty
final ViewModelInstance getInstanceProperty(String path)
Get a nested, named ViewModelInstance.
Note that unlike other properties, instances aren't changed with a
valuemember. However they can be reassigned with setInstanceProperty.
-
setInstanceProperty
final Unit setInstanceProperty(String path, ViewModelInstance instance)
Set a nested, named ViewModelInstance.
- Parameters:
path- The path to the property.instance- The new instance to set.
-
transfer
final ViewModelInstance.Transfer transfer()
Start a transfer of this ViewModelInstance to another File. This is necessary because normally the C++ lifetime of the instance is managed by the File it belongs to. When transferring, the instance needs to survive the possible deletion of its owning File.
You can omit this if you're certain that the originating File will not be deleted before this instance is assigned.
Important: once created, you must call Transfer.end or assign the instance to a StateMachineInstance or Artboard, otherwise the internal C++ reference count will leak.
-
-
-
-