mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-23 15:29:20 +08:00
Support for nested inputs.
This commit is contained in:
@ -17,6 +17,7 @@ export 'package:rive/src/core/importers/keyed_object_importer.dart';
|
|||||||
export 'package:rive/src/core/importers/keyed_property_importer.dart';
|
export 'package:rive/src/core/importers/keyed_property_importer.dart';
|
||||||
export 'package:rive/src/core/importers/layer_state_importer.dart';
|
export 'package:rive/src/core/importers/layer_state_importer.dart';
|
||||||
export 'package:rive/src/core/importers/linear_animation_importer.dart';
|
export 'package:rive/src/core/importers/linear_animation_importer.dart';
|
||||||
|
export 'package:rive/src/core/importers/nested_state_machine_importer.dart';
|
||||||
export 'package:rive/src/core/importers/state_machine_importer.dart';
|
export 'package:rive/src/core/importers/state_machine_importer.dart';
|
||||||
export 'package:rive/src/core/importers/state_machine_layer_importer.dart';
|
export 'package:rive/src/core/importers/state_machine_layer_importer.dart';
|
||||||
export 'package:rive/src/core/importers/state_machine_listener_importer.dart';
|
export 'package:rive/src/core/importers/state_machine_listener_importer.dart';
|
||||||
|
21
lib/src/core/importers/nested_state_machine_importer.dart
Normal file
21
lib/src/core/importers/nested_state_machine_importer.dart
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:rive/src/core/importers/artboard_import_stack_object.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_input.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_state_machine.dart';
|
||||||
|
|
||||||
|
class NestedStateMachineImporter extends ArtboardImportStackObject {
|
||||||
|
final NestedStateMachine stateMachine;
|
||||||
|
NestedStateMachineImporter(this.stateMachine);
|
||||||
|
|
||||||
|
final List<NestedInput> _inputs = [];
|
||||||
|
void addNestedInput(NestedInput nestedInput) {
|
||||||
|
_inputs.add(nestedInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool resolve() {
|
||||||
|
for (final input in _inputs) {
|
||||||
|
input.parent = stateMachine;
|
||||||
|
}
|
||||||
|
return super.resolve();
|
||||||
|
}
|
||||||
|
}
|
44
lib/src/generated/animation/nested_bool_base.dart
Normal file
44
lib/src/generated/animation/nested_bool_base.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/// Core automatically generated
|
||||||
|
/// lib/src/generated/animation/nested_bool_base.dart.
|
||||||
|
/// Do not modify manually.
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_input.dart';
|
||||||
|
|
||||||
|
abstract class NestedBoolBase extends NestedInput {
|
||||||
|
static const int typeKey = 123;
|
||||||
|
@override
|
||||||
|
int get coreType => NestedBoolBase.typeKey;
|
||||||
|
@override
|
||||||
|
Set<int> get coreTypes =>
|
||||||
|
{NestedBoolBase.typeKey, NestedInputBase.typeKey, ComponentBase.typeKey};
|
||||||
|
|
||||||
|
/// --------------------------------------------------------------------------
|
||||||
|
/// NestedValue field with key 238.
|
||||||
|
static const bool nestedValueInitialValue = false;
|
||||||
|
bool _nestedValue = nestedValueInitialValue;
|
||||||
|
static const int nestedValuePropertyKey = 238;
|
||||||
|
bool get nestedValue => _nestedValue;
|
||||||
|
|
||||||
|
/// Change the [_nestedValue] field value.
|
||||||
|
/// [nestedValueChanged] will be invoked only if the field's value has
|
||||||
|
/// changed.
|
||||||
|
set nestedValue(bool value) {
|
||||||
|
if (_nestedValue == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool from = _nestedValue;
|
||||||
|
_nestedValue = value;
|
||||||
|
if (hasValidated) {
|
||||||
|
nestedValueChanged(from, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nestedValueChanged(bool from, bool to);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void copy(covariant NestedBoolBase source) {
|
||||||
|
super.copy(source);
|
||||||
|
_nestedValue = source._nestedValue;
|
||||||
|
}
|
||||||
|
}
|
43
lib/src/generated/animation/nested_input_base.dart
Normal file
43
lib/src/generated/animation/nested_input_base.dart
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/// Core automatically generated
|
||||||
|
/// lib/src/generated/animation/nested_input_base.dart.
|
||||||
|
/// Do not modify manually.
|
||||||
|
|
||||||
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
|
|
||||||
|
abstract class NestedInputBase extends Component {
|
||||||
|
static const int typeKey = 121;
|
||||||
|
@override
|
||||||
|
int get coreType => NestedInputBase.typeKey;
|
||||||
|
@override
|
||||||
|
Set<int> get coreTypes => {NestedInputBase.typeKey, ComponentBase.typeKey};
|
||||||
|
|
||||||
|
/// --------------------------------------------------------------------------
|
||||||
|
/// InputId field with key 237.
|
||||||
|
static const int inputIdInitialValue = -1;
|
||||||
|
int _inputId = inputIdInitialValue;
|
||||||
|
static const int inputIdPropertyKey = 237;
|
||||||
|
|
||||||
|
/// Identifier used to track the actual backing state machine input.
|
||||||
|
int get inputId => _inputId;
|
||||||
|
|
||||||
|
/// Change the [_inputId] field value.
|
||||||
|
/// [inputIdChanged] will be invoked only if the field's value has changed.
|
||||||
|
set inputId(int value) {
|
||||||
|
if (_inputId == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int from = _inputId;
|
||||||
|
_inputId = value;
|
||||||
|
if (hasValidated) {
|
||||||
|
inputIdChanged(from, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void inputIdChanged(int from, int to);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void copy(covariant NestedInputBase source) {
|
||||||
|
super.copy(source);
|
||||||
|
_inputId = source._inputId;
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
/// Do not modify manually.
|
/// Do not modify manually.
|
||||||
|
|
||||||
import 'package:rive/src/generated/component_base.dart';
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/container_component_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||||
import 'package:rive/src/rive_core/nested_animation.dart';
|
import 'package:rive/src/rive_core/nested_animation.dart';
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ abstract class NestedLinearAnimationBase
|
|||||||
Set<int> get coreTypes => {
|
Set<int> get coreTypes => {
|
||||||
NestedLinearAnimationBase.typeKey,
|
NestedLinearAnimationBase.typeKey,
|
||||||
NestedAnimationBase.typeKey,
|
NestedAnimationBase.typeKey,
|
||||||
|
ContainerComponentBase.typeKey,
|
||||||
ComponentBase.typeKey
|
ComponentBase.typeKey
|
||||||
};
|
};
|
||||||
|
|
||||||
|
47
lib/src/generated/animation/nested_number_base.dart
Normal file
47
lib/src/generated/animation/nested_number_base.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/// Core automatically generated
|
||||||
|
/// lib/src/generated/animation/nested_number_base.dart.
|
||||||
|
/// Do not modify manually.
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_input.dart';
|
||||||
|
|
||||||
|
abstract class NestedNumberBase extends NestedInput {
|
||||||
|
static const int typeKey = 124;
|
||||||
|
@override
|
||||||
|
int get coreType => NestedNumberBase.typeKey;
|
||||||
|
@override
|
||||||
|
Set<int> get coreTypes => {
|
||||||
|
NestedNumberBase.typeKey,
|
||||||
|
NestedInputBase.typeKey,
|
||||||
|
ComponentBase.typeKey
|
||||||
|
};
|
||||||
|
|
||||||
|
/// --------------------------------------------------------------------------
|
||||||
|
/// NestedValue field with key 239.
|
||||||
|
static const double nestedValueInitialValue = 0;
|
||||||
|
double _nestedValue = nestedValueInitialValue;
|
||||||
|
static const int nestedValuePropertyKey = 239;
|
||||||
|
double get nestedValue => _nestedValue;
|
||||||
|
|
||||||
|
/// Change the [_nestedValue] field value.
|
||||||
|
/// [nestedValueChanged] will be invoked only if the field's value has
|
||||||
|
/// changed.
|
||||||
|
set nestedValue(double value) {
|
||||||
|
if (_nestedValue == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double from = _nestedValue;
|
||||||
|
_nestedValue = value;
|
||||||
|
if (hasValidated) {
|
||||||
|
nestedValueChanged(from, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nestedValueChanged(double from, double to);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void copy(covariant NestedNumberBase source) {
|
||||||
|
super.copy(source);
|
||||||
|
_nestedValue = source._nestedValue;
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
/// Do not modify manually.
|
/// Do not modify manually.
|
||||||
|
|
||||||
import 'package:rive/src/generated/component_base.dart';
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/container_component_base.dart';
|
||||||
import 'package:rive/src/generated/nested_animation_base.dart';
|
import 'package:rive/src/generated/nested_animation_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/nested_linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/nested_linear_animation.dart';
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ abstract class NestedRemapAnimationBase extends NestedLinearAnimation {
|
|||||||
NestedRemapAnimationBase.typeKey,
|
NestedRemapAnimationBase.typeKey,
|
||||||
NestedLinearAnimationBase.typeKey,
|
NestedLinearAnimationBase.typeKey,
|
||||||
NestedAnimationBase.typeKey,
|
NestedAnimationBase.typeKey,
|
||||||
|
ContainerComponentBase.typeKey,
|
||||||
ComponentBase.typeKey
|
ComponentBase.typeKey
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
/// Do not modify manually.
|
/// Do not modify manually.
|
||||||
|
|
||||||
import 'package:rive/src/generated/component_base.dart';
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/container_component_base.dart';
|
||||||
import 'package:rive/src/generated/nested_animation_base.dart';
|
import 'package:rive/src/generated/nested_animation_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/nested_linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/nested_linear_animation.dart';
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ abstract class NestedSimpleAnimationBase extends NestedLinearAnimation {
|
|||||||
NestedSimpleAnimationBase.typeKey,
|
NestedSimpleAnimationBase.typeKey,
|
||||||
NestedLinearAnimationBase.typeKey,
|
NestedLinearAnimationBase.typeKey,
|
||||||
NestedAnimationBase.typeKey,
|
NestedAnimationBase.typeKey,
|
||||||
|
ContainerComponentBase.typeKey,
|
||||||
ComponentBase.typeKey
|
ComponentBase.typeKey
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
/// Do not modify manually.
|
/// Do not modify manually.
|
||||||
|
|
||||||
import 'package:rive/src/generated/component_base.dart';
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/container_component_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/nested_animation.dart';
|
import 'package:rive/src/rive_core/nested_animation.dart';
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ abstract class NestedStateMachineBase extends NestedAnimation<StateMachine> {
|
|||||||
Set<int> get coreTypes => {
|
Set<int> get coreTypes => {
|
||||||
NestedStateMachineBase.typeKey,
|
NestedStateMachineBase.typeKey,
|
||||||
NestedAnimationBase.typeKey,
|
NestedAnimationBase.typeKey,
|
||||||
|
ContainerComponentBase.typeKey,
|
||||||
ComponentBase.typeKey
|
ComponentBase.typeKey
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
18
lib/src/generated/animation/nested_trigger_base.dart
Normal file
18
lib/src/generated/animation/nested_trigger_base.dart
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/// Core automatically generated
|
||||||
|
/// lib/src/generated/animation/nested_trigger_base.dart.
|
||||||
|
/// Do not modify manually.
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_input.dart';
|
||||||
|
|
||||||
|
abstract class NestedTriggerBase extends NestedInput {
|
||||||
|
static const int typeKey = 122;
|
||||||
|
@override
|
||||||
|
int get coreType => NestedTriggerBase.typeKey;
|
||||||
|
@override
|
||||||
|
Set<int> get coreTypes => {
|
||||||
|
NestedTriggerBase.typeKey,
|
||||||
|
NestedInputBase.typeKey,
|
||||||
|
ComponentBase.typeKey
|
||||||
|
};
|
||||||
|
}
|
@ -1,15 +1,20 @@
|
|||||||
/// Core automatically generated lib/src/generated/nested_animation_base.dart.
|
/// Core automatically generated lib/src/generated/nested_animation_base.dart.
|
||||||
/// Do not modify manually.
|
/// Do not modify manually.
|
||||||
|
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/container_component_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/container_component.dart';
|
||||||
|
|
||||||
abstract class NestedAnimationBase extends Component {
|
abstract class NestedAnimationBase extends ContainerComponent {
|
||||||
static const int typeKey = 93;
|
static const int typeKey = 93;
|
||||||
@override
|
@override
|
||||||
int get coreType => NestedAnimationBase.typeKey;
|
int get coreType => NestedAnimationBase.typeKey;
|
||||||
@override
|
@override
|
||||||
Set<int> get coreTypes =>
|
Set<int> get coreTypes => {
|
||||||
{NestedAnimationBase.typeKey, ComponentBase.typeKey};
|
NestedAnimationBase.typeKey,
|
||||||
|
ContainerComponentBase.typeKey,
|
||||||
|
ComponentBase.typeKey
|
||||||
|
};
|
||||||
|
|
||||||
/// --------------------------------------------------------------------------
|
/// --------------------------------------------------------------------------
|
||||||
/// AnimationId field with key 198.
|
/// AnimationId field with key 198.
|
||||||
|
@ -10,6 +10,7 @@ import 'package:rive/src/generated/animation/blend_animation_base.dart';
|
|||||||
import 'package:rive/src/generated/animation/cubic_interpolator_base.dart';
|
import 'package:rive/src/generated/animation/cubic_interpolator_base.dart';
|
||||||
import 'package:rive/src/generated/animation/keyframe_base.dart';
|
import 'package:rive/src/generated/animation/keyframe_base.dart';
|
||||||
import 'package:rive/src/generated/animation/listener_input_change_base.dart';
|
import 'package:rive/src/generated/animation/listener_input_change_base.dart';
|
||||||
|
import 'package:rive/src/generated/animation/nested_input_base.dart';
|
||||||
import 'package:rive/src/generated/animation/nested_linear_animation_base.dart';
|
import 'package:rive/src/generated/animation/nested_linear_animation_base.dart';
|
||||||
import 'package:rive/src/generated/animation/state_machine_component_base.dart';
|
import 'package:rive/src/generated/animation/state_machine_component_base.dart';
|
||||||
import 'package:rive/src/generated/animation/transition_condition_base.dart';
|
import 'package:rive/src/generated/animation/transition_condition_base.dart';
|
||||||
@ -52,9 +53,12 @@ import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
|||||||
import 'package:rive/src/rive_core/animation/listener_bool_change.dart';
|
import 'package:rive/src/rive_core/animation/listener_bool_change.dart';
|
||||||
import 'package:rive/src/rive_core/animation/listener_number_change.dart';
|
import 'package:rive/src/rive_core/animation/listener_number_change.dart';
|
||||||
import 'package:rive/src/rive_core/animation/listener_trigger_change.dart';
|
import 'package:rive/src/rive_core/animation/listener_trigger_change.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_bool.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_number.dart';
|
||||||
import 'package:rive/src/rive_core/animation/nested_remap_animation.dart';
|
import 'package:rive/src/rive_core/animation/nested_remap_animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/nested_simple_animation.dart';
|
import 'package:rive/src/rive_core/animation/nested_simple_animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/nested_state_machine.dart';
|
import 'package:rive/src/rive_core/animation/nested_state_machine.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_trigger.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_bool.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_bool.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
||||||
@ -140,6 +144,8 @@ class RiveCoreContext {
|
|||||||
return NestedSimpleAnimation();
|
return NestedSimpleAnimation();
|
||||||
case AnimationStateBase.typeKey:
|
case AnimationStateBase.typeKey:
|
||||||
return AnimationState();
|
return AnimationState();
|
||||||
|
case NestedTriggerBase.typeKey:
|
||||||
|
return NestedTrigger();
|
||||||
case KeyedObjectBase.typeKey:
|
case KeyedObjectBase.typeKey:
|
||||||
return KeyedObject();
|
return KeyedObject();
|
||||||
case BlendAnimationDirectBase.typeKey:
|
case BlendAnimationDirectBase.typeKey:
|
||||||
@ -170,6 +176,8 @@ class RiveCoreContext {
|
|||||||
return CubicInterpolator();
|
return CubicInterpolator();
|
||||||
case StateTransitionBase.typeKey:
|
case StateTransitionBase.typeKey:
|
||||||
return StateTransition();
|
return StateTransition();
|
||||||
|
case NestedBoolBase.typeKey:
|
||||||
|
return NestedBool();
|
||||||
case KeyFrameDoubleBase.typeKey:
|
case KeyFrameDoubleBase.typeKey:
|
||||||
return KeyFrameDouble();
|
return KeyFrameDouble();
|
||||||
case KeyFrameColorBase.typeKey:
|
case KeyFrameColorBase.typeKey:
|
||||||
@ -188,6 +196,8 @@ class RiveCoreContext {
|
|||||||
return NestedStateMachine();
|
return NestedStateMachine();
|
||||||
case ExitStateBase.typeKey:
|
case ExitStateBase.typeKey:
|
||||||
return ExitState();
|
return ExitState();
|
||||||
|
case NestedNumberBase.typeKey:
|
||||||
|
return NestedNumber();
|
||||||
case BlendAnimation1DBase.typeKey:
|
case BlendAnimation1DBase.typeKey:
|
||||||
return BlendAnimation1D();
|
return BlendAnimation1D();
|
||||||
case BlendState1DBase.typeKey:
|
case BlendState1DBase.typeKey:
|
||||||
@ -522,6 +532,11 @@ class RiveCoreContext {
|
|||||||
object.animationId = value;
|
object.animationId = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NestedInputBase.inputIdPropertyKey:
|
||||||
|
if (object is NestedInputBase && value is int) {
|
||||||
|
object.inputId = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KeyedObjectBase.objectIdPropertyKey:
|
case KeyedObjectBase.objectIdPropertyKey:
|
||||||
if (object is KeyedObjectBase && value is int) {
|
if (object is KeyedObjectBase && value is int) {
|
||||||
object.objectId = value;
|
object.objectId = value;
|
||||||
@ -652,6 +667,11 @@ class RiveCoreContext {
|
|||||||
object.exitTime = value;
|
object.exitTime = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NestedBoolBase.nestedValuePropertyKey:
|
||||||
|
if (object is NestedBoolBase && value is bool) {
|
||||||
|
object.nestedValue = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KeyFrameDoubleBase.valuePropertyKey:
|
case KeyFrameDoubleBase.valuePropertyKey:
|
||||||
if (object is KeyFrameDoubleBase && value is double) {
|
if (object is KeyFrameDoubleBase && value is double) {
|
||||||
object.value = value;
|
object.value = value;
|
||||||
@ -662,6 +682,11 @@ class RiveCoreContext {
|
|||||||
object.value = value;
|
object.value = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NestedNumberBase.nestedValuePropertyKey:
|
||||||
|
if (object is NestedNumberBase && value is double) {
|
||||||
|
object.nestedValue = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BlendAnimation1DBase.valuePropertyKey:
|
case BlendAnimation1DBase.valuePropertyKey:
|
||||||
if (object is BlendAnimation1DBase && value is double) {
|
if (object is BlendAnimation1DBase && value is double) {
|
||||||
object.value = value;
|
object.value = value;
|
||||||
@ -1158,6 +1183,7 @@ class RiveCoreContext {
|
|||||||
case LinearAnimationBase.workEndPropertyKey:
|
case LinearAnimationBase.workEndPropertyKey:
|
||||||
case ListenerInputChangeBase.inputIdPropertyKey:
|
case ListenerInputChangeBase.inputIdPropertyKey:
|
||||||
case AnimationStateBase.animationIdPropertyKey:
|
case AnimationStateBase.animationIdPropertyKey:
|
||||||
|
case NestedInputBase.inputIdPropertyKey:
|
||||||
case KeyedObjectBase.objectIdPropertyKey:
|
case KeyedObjectBase.objectIdPropertyKey:
|
||||||
case BlendAnimationBase.animationIdPropertyKey:
|
case BlendAnimationBase.animationIdPropertyKey:
|
||||||
case BlendAnimationDirectBase.inputIdPropertyKey:
|
case BlendAnimationDirectBase.inputIdPropertyKey:
|
||||||
@ -1222,6 +1248,7 @@ class RiveCoreContext {
|
|||||||
case CubicInterpolatorBase.x2PropertyKey:
|
case CubicInterpolatorBase.x2PropertyKey:
|
||||||
case CubicInterpolatorBase.y2PropertyKey:
|
case CubicInterpolatorBase.y2PropertyKey:
|
||||||
case KeyFrameDoubleBase.valuePropertyKey:
|
case KeyFrameDoubleBase.valuePropertyKey:
|
||||||
|
case NestedNumberBase.nestedValuePropertyKey:
|
||||||
case BlendAnimation1DBase.valuePropertyKey:
|
case BlendAnimation1DBase.valuePropertyKey:
|
||||||
case NestedRemapAnimationBase.timePropertyKey:
|
case NestedRemapAnimationBase.timePropertyKey:
|
||||||
case LinearGradientBase.startXPropertyKey:
|
case LinearGradientBase.startXPropertyKey:
|
||||||
@ -1293,6 +1320,7 @@ class RiveCoreContext {
|
|||||||
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
||||||
case NestedSimpleAnimationBase.isPlayingPropertyKey:
|
case NestedSimpleAnimationBase.isPlayingPropertyKey:
|
||||||
case KeyFrameBoolBase.valuePropertyKey:
|
case KeyFrameBoolBase.valuePropertyKey:
|
||||||
|
case NestedBoolBase.nestedValuePropertyKey:
|
||||||
case StateMachineBoolBase.valuePropertyKey:
|
case StateMachineBoolBase.valuePropertyKey:
|
||||||
case ShapePaintBase.isVisiblePropertyKey:
|
case ShapePaintBase.isVisiblePropertyKey:
|
||||||
case StrokeBase.transformAffectsStrokePropertyKey:
|
case StrokeBase.transformAffectsStrokePropertyKey:
|
||||||
@ -1369,6 +1397,8 @@ class RiveCoreContext {
|
|||||||
return (object as ListenerInputChangeBase).inputId;
|
return (object as ListenerInputChangeBase).inputId;
|
||||||
case AnimationStateBase.animationIdPropertyKey:
|
case AnimationStateBase.animationIdPropertyKey:
|
||||||
return (object as AnimationStateBase).animationId;
|
return (object as AnimationStateBase).animationId;
|
||||||
|
case NestedInputBase.inputIdPropertyKey:
|
||||||
|
return (object as NestedInputBase).inputId;
|
||||||
case KeyedObjectBase.objectIdPropertyKey:
|
case KeyedObjectBase.objectIdPropertyKey:
|
||||||
return (object as KeyedObjectBase).objectId;
|
return (object as KeyedObjectBase).objectId;
|
||||||
case BlendAnimationBase.animationIdPropertyKey:
|
case BlendAnimationBase.animationIdPropertyKey:
|
||||||
@ -1501,6 +1531,8 @@ class RiveCoreContext {
|
|||||||
return (object as CubicInterpolatorBase).y2;
|
return (object as CubicInterpolatorBase).y2;
|
||||||
case KeyFrameDoubleBase.valuePropertyKey:
|
case KeyFrameDoubleBase.valuePropertyKey:
|
||||||
return (object as KeyFrameDoubleBase).value;
|
return (object as KeyFrameDoubleBase).value;
|
||||||
|
case NestedNumberBase.nestedValuePropertyKey:
|
||||||
|
return (object as NestedNumberBase).nestedValue;
|
||||||
case BlendAnimation1DBase.valuePropertyKey:
|
case BlendAnimation1DBase.valuePropertyKey:
|
||||||
return (object as BlendAnimation1DBase).value;
|
return (object as BlendAnimation1DBase).value;
|
||||||
case NestedRemapAnimationBase.timePropertyKey:
|
case NestedRemapAnimationBase.timePropertyKey:
|
||||||
@ -1647,6 +1679,8 @@ class RiveCoreContext {
|
|||||||
return (object as NestedSimpleAnimationBase).isPlaying;
|
return (object as NestedSimpleAnimationBase).isPlaying;
|
||||||
case KeyFrameBoolBase.valuePropertyKey:
|
case KeyFrameBoolBase.valuePropertyKey:
|
||||||
return (object as KeyFrameBoolBase).value;
|
return (object as KeyFrameBoolBase).value;
|
||||||
|
case NestedBoolBase.nestedValuePropertyKey:
|
||||||
|
return (object as NestedBoolBase).nestedValue;
|
||||||
case StateMachineBoolBase.valuePropertyKey:
|
case StateMachineBoolBase.valuePropertyKey:
|
||||||
return (object as StateMachineBoolBase).value;
|
return (object as StateMachineBoolBase).value;
|
||||||
case ShapePaintBase.isVisiblePropertyKey:
|
case ShapePaintBase.isVisiblePropertyKey:
|
||||||
@ -1814,6 +1848,11 @@ class RiveCoreContext {
|
|||||||
object.animationId = value;
|
object.animationId = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NestedInputBase.inputIdPropertyKey:
|
||||||
|
if (object is NestedInputBase) {
|
||||||
|
object.inputId = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KeyedObjectBase.objectIdPropertyKey:
|
case KeyedObjectBase.objectIdPropertyKey:
|
||||||
if (object is KeyedObjectBase) {
|
if (object is KeyedObjectBase) {
|
||||||
object.objectId = value;
|
object.objectId = value;
|
||||||
@ -2134,6 +2173,11 @@ class RiveCoreContext {
|
|||||||
object.value = value;
|
object.value = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NestedNumberBase.nestedValuePropertyKey:
|
||||||
|
if (object is NestedNumberBase) {
|
||||||
|
object.nestedValue = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BlendAnimation1DBase.valuePropertyKey:
|
case BlendAnimation1DBase.valuePropertyKey:
|
||||||
if (object is BlendAnimation1DBase) {
|
if (object is BlendAnimation1DBase) {
|
||||||
object.value = value;
|
object.value = value;
|
||||||
@ -2489,6 +2533,11 @@ class RiveCoreContext {
|
|||||||
object.value = value;
|
object.value = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NestedBoolBase.nestedValuePropertyKey:
|
||||||
|
if (object is NestedBoolBase) {
|
||||||
|
object.nestedValue = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case StateMachineBoolBase.valuePropertyKey:
|
case StateMachineBoolBase.valuePropertyKey:
|
||||||
if (object is StateMachineBoolBase) {
|
if (object is StateMachineBoolBase) {
|
||||||
object.value = value;
|
object.value = value;
|
||||||
|
10
lib/src/rive_core/animation/nested_bool.dart
Normal file
10
lib/src/rive_core/animation/nested_bool.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import 'package:rive/src/generated/animation/nested_bool_base.dart';
|
||||||
|
export 'package:rive/src/generated/animation/nested_bool_base.dart';
|
||||||
|
|
||||||
|
class NestedBool extends NestedBoolBase {
|
||||||
|
@override
|
||||||
|
void nestedValueChanged(bool from, bool to) => updateValue();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void updateValue() => nestedStateMachine?.setInputValue(inputId, nestedValue);
|
||||||
|
}
|
32
lib/src/rive_core/animation/nested_input.dart
Normal file
32
lib/src/rive_core/animation/nested_input.dart
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/nested_input_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_state_machine.dart';
|
||||||
|
|
||||||
|
export 'package:rive/src/generated/animation/nested_input_base.dart';
|
||||||
|
|
||||||
|
abstract class NestedInput extends NestedInputBase {
|
||||||
|
@override
|
||||||
|
void inputIdChanged(int from, int to) {}
|
||||||
|
|
||||||
|
NestedStateMachine? get nestedStateMachine => parent as NestedStateMachine?;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool validate() => super.validate() && nestedStateMachine != null;
|
||||||
|
|
||||||
|
void updateValue();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void update(int dirt) {}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool import(ImportStack importStack) {
|
||||||
|
var importer = importStack
|
||||||
|
.latest<NestedStateMachineImporter>(NestedStateMachineBase.typeKey);
|
||||||
|
if (importer == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
importer.addNestedInput(this);
|
||||||
|
|
||||||
|
return super.import(importStack);
|
||||||
|
}
|
||||||
|
}
|
10
lib/src/rive_core/animation/nested_number.dart
Normal file
10
lib/src/rive_core/animation/nested_number.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import 'package:rive/src/generated/animation/nested_number_base.dart';
|
||||||
|
export 'package:rive/src/generated/animation/nested_number_base.dart';
|
||||||
|
|
||||||
|
class NestedNumber extends NestedNumberBase {
|
||||||
|
@override
|
||||||
|
void nestedValueChanged(double from, double to) => updateValue();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void updateValue() => nestedStateMachine?.setInputValue(inputId, nestedValue);
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:rive/src/core/core.dart';
|
||||||
import 'package:rive/src/generated/animation/nested_state_machine_base.dart';
|
import 'package:rive/src/generated/animation/nested_state_machine_base.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/rive_core/nested_artboard.dart';
|
import 'package:rive/src/rive_core/nested_artboard.dart';
|
||||||
@ -16,6 +17,8 @@ abstract class NestedStateMachineInstance {
|
|||||||
void pointerDown(Vec2D position);
|
void pointerDown(Vec2D position);
|
||||||
|
|
||||||
void pointerUp(Vec2D position);
|
void pointerUp(Vec2D position);
|
||||||
|
|
||||||
|
void setInputValue(int id, dynamic value);
|
||||||
}
|
}
|
||||||
|
|
||||||
class NestedStateMachine extends NestedStateMachineBase {
|
class NestedStateMachine extends NestedStateMachineBase {
|
||||||
@ -45,6 +48,12 @@ class NestedStateMachine extends NestedStateMachineBase {
|
|||||||
to?.isActiveChanged.addListener(_isActiveChanged);
|
to?.isActiveChanged.addListener(_isActiveChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setInputValue(int id, dynamic value) {
|
||||||
|
int inputId = id;
|
||||||
|
|
||||||
|
_stateMachineInstance?.setInputValue(inputId, value);
|
||||||
|
}
|
||||||
|
|
||||||
void pointerMove(Vec2D position) =>
|
void pointerMove(Vec2D position) =>
|
||||||
_stateMachineInstance?.pointerMove(position);
|
_stateMachineInstance?.pointerMove(position);
|
||||||
|
|
||||||
|
7
lib/src/rive_core/animation/nested_trigger.dart
Normal file
7
lib/src/rive_core/animation/nested_trigger.dart
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import 'package:rive/src/generated/animation/nested_trigger_base.dart';
|
||||||
|
export 'package:rive/src/generated/animation/nested_trigger_base.dart';
|
||||||
|
|
||||||
|
class NestedTrigger extends NestedTriggerBase {
|
||||||
|
@override
|
||||||
|
void updateValue() {}
|
||||||
|
}
|
@ -2,7 +2,7 @@ import 'package:rive/src/generated/assets/asset_base.dart';
|
|||||||
|
|
||||||
export 'package:rive/src/generated/assets/asset_base.dart';
|
export 'package:rive/src/generated/assets/asset_base.dart';
|
||||||
|
|
||||||
class Asset extends AssetBase {
|
abstract class Asset extends AssetBase {
|
||||||
@override
|
@override
|
||||||
void nameChanged(String from, String to) {}
|
void nameChanged(String from, String to) {}
|
||||||
|
|
||||||
@ -11,6 +11,4 @@ class Asset extends AssetBase {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onAddedDirty() {}
|
void onAddedDirty() {}
|
||||||
|
|
||||||
bool get isUsable => false;
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:rive/src/generated/assets/drawable_asset_base.dart';
|
import 'package:rive/src/generated/assets/drawable_asset_base.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/assets/drawable_asset_base.dart';
|
export 'package:rive/src/generated/assets/drawable_asset_base.dart';
|
||||||
|
|
||||||
abstract class DrawableAsset extends DrawableAssetBase {
|
abstract class DrawableAsset extends DrawableAssetBase {
|
||||||
@override
|
DrawableAsset();
|
||||||
bool get isUsable => width != 0 && height != 0;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void heightChanged(double from, double to) {}
|
void heightChanged(double from, double to) {}
|
||||||
|
@ -21,6 +21,7 @@ class ImageAsset extends ImageAssetBase {
|
|||||||
if (_image == image) {
|
if (_image == image) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_image = image;
|
_image = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ class ImageAsset extends ImageAssetBase {
|
|||||||
Future<void> decode(Uint8List bytes) {
|
Future<void> decode(Uint8List bytes) {
|
||||||
final completer = Completer<void>();
|
final completer = Completer<void>();
|
||||||
ui.decodeImageFromList(bytes, (value) {
|
ui.decodeImageFromList(bytes, (value) {
|
||||||
_image = value;
|
image = value;
|
||||||
completer.complete();
|
completer.complete();
|
||||||
});
|
});
|
||||||
return completer.future;
|
return completer.future;
|
||||||
|
@ -33,6 +33,17 @@ abstract class TransformComponent extends TransformComponentBase {
|
|||||||
final List<Constraint> _constraints = [];
|
final List<Constraint> _constraints = [];
|
||||||
Iterable<Constraint> get constraints => _constraints;
|
Iterable<Constraint> get constraints => _constraints;
|
||||||
|
|
||||||
|
bool get isConstrained {
|
||||||
|
Component? component = this;
|
||||||
|
while (component != null) {
|
||||||
|
if (component is TransformComponent && component.constraints.isNotEmpty) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
component = component.parent;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
double _renderOpacity = 1;
|
double _renderOpacity = 1;
|
||||||
double get renderOpacity => _renderOpacity;
|
double get renderOpacity => _renderOpacity;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import 'package:rive/src/rive_core/animation/keyed_object.dart';
|
|||||||
import 'package:rive/src/rive_core/animation/keyed_property.dart';
|
import 'package:rive/src/rive_core/animation/keyed_property.dart';
|
||||||
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/nested_state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_listener.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_listener.dart';
|
||||||
@ -163,6 +164,10 @@ class RiveFile {
|
|||||||
stackObject =
|
stackObject =
|
||||||
StateMachineListenerImporter(object as StateMachineListener);
|
StateMachineListenerImporter(object as StateMachineListener);
|
||||||
break;
|
break;
|
||||||
|
case NestedStateMachineBase.typeKey:
|
||||||
|
stackObject =
|
||||||
|
NestedStateMachineImporter(object as NestedStateMachine);
|
||||||
|
break;
|
||||||
case EntryStateBase.typeKey:
|
case EntryStateBase.typeKey:
|
||||||
case AnyStateBase.typeKey:
|
case AnyStateBase.typeKey:
|
||||||
case ExitStateBase.typeKey:
|
case ExitStateBase.typeKey:
|
||||||
|
@ -124,6 +124,14 @@ class RuntimeNestedStateMachineInstance extends NestedStateMachineInstance {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void pointerUp(Vec2D position) => stateMachineController.pointerUp(position);
|
void pointerUp(Vec2D position) => stateMachineController.pointerUp(position);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void setInputValue(int id, dynamic value) {
|
||||||
|
var inputs = stateMachineController.stateMachine.inputs;
|
||||||
|
if (id < inputs.length && id >= 0) {
|
||||||
|
stateMachineController.setInputValue(inputs[id].id, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RuntimeMountedArtboard extends MountedArtboard {
|
class RuntimeMountedArtboard extends MountedArtboard {
|
||||||
|
Reference in New Issue
Block a user