up-to-date submodule(rive-cpp) 55/256555/1
authorHermet Park <chuneon.park@samsung.com>
Wed, 7 Apr 2021 02:35:45 +0000 (11:35 +0900)
committerHermet Park <chuneon.park@samsung.com>
Wed, 7 Apr 2021 02:35:45 +0000 (11:35 +0900)
Change-Id: I4edd887343b9a76cc084da39b464684d7ee4d072

194 files changed:
meson.build
submodule/dev/core_generator/lib/src/definition.dart
submodule/dev/core_generator/lib/src/field_type.dart
submodule/dev/core_generator/lib/src/field_types/double_field_type.dart
submodule/dev/core_generator/lib/src/field_types/string_field_type.dart
submodule/dev/core_generator/lib/src/field_types/uint_field_type.dart
submodule/dev/core_generator/lib/src/property.dart
submodule/dev/defs/animation/animation.json
submodule/dev/defs/animation/animation_state.json [new file with mode: 0644]
submodule/dev/defs/animation/any_state.json [new file with mode: 0644]
submodule/dev/defs/animation/entry_state.json [new file with mode: 0644]
submodule/dev/defs/animation/exit_state.json [new file with mode: 0644]
submodule/dev/defs/animation/keyed_object.json
submodule/dev/defs/animation/keyed_property.json
submodule/dev/defs/animation/keyframe.json
submodule/dev/defs/animation/keyframe_color.json
submodule/dev/defs/animation/keyframe_double.json
submodule/dev/defs/animation/keyframe_id.json
submodule/dev/defs/animation/layer_state.json [new file with mode: 0644]
submodule/dev/defs/animation/linear_animation.json
submodule/dev/defs/animation/state_machine.json [new file with mode: 0644]
submodule/dev/defs/animation/state_machine_bool.json [new file with mode: 0644]
submodule/dev/defs/animation/state_machine_component.json [new file with mode: 0644]
submodule/dev/defs/animation/state_machine_double.json [new file with mode: 0644]
submodule/dev/defs/animation/state_machine_input.json [new file with mode: 0644]
submodule/dev/defs/animation/state_machine_layer.json [new file with mode: 0644]
submodule/dev/defs/animation/state_machine_layer_component.json [new file with mode: 0644]
submodule/dev/defs/animation/state_machine_trigger.json [new file with mode: 0644]
submodule/dev/defs/animation/state_transition.json [new file with mode: 0644]
submodule/dev/defs/animation/transition_bool_condition.json [new file with mode: 0644]
submodule/dev/defs/animation/transition_condition.json [new file with mode: 0644]
submodule/dev/defs/animation/transition_double_condition.json [new file with mode: 0644]
submodule/dev/defs/animation/transition_trigger_condition.json [new file with mode: 0644]
submodule/dev/defs/animation/transition_value_condition.json [new file with mode: 0644]
submodule/dev/defs/artboard.json
submodule/dev/defs/backboard.json
submodule/dev/defs/bones/tendon.json
submodule/dev/defs/component.json
submodule/dev/defs/draw_rules.json
submodule/dev/defs/draw_target.json
submodule/dev/defs/drawable.json
submodule/dev/defs/shapes/clipping_shape.json
submodule/dev/defs/shapes/path.json
submodule/dev/defs/shapes/path_composer.json [deleted file]
submodule/dev/defs/shapes/path_vertex.json
submodule/dev/defs/shapes/points_path.json
submodule/dev/defs/shapes/polygon.json
submodule/dev/defs/shapes/star.json
submodule/include/animation/animation_state.hpp [new file with mode: 0644]
submodule/include/animation/any_state.hpp [new file with mode: 0644]
submodule/include/animation/cubic_interpolator.hpp
submodule/include/animation/entry_state.hpp [new file with mode: 0644]
submodule/include/animation/exit_state.hpp [new file with mode: 0644]
submodule/include/animation/keyed_object.hpp
submodule/include/animation/keyed_property.hpp
submodule/include/animation/keyframe.hpp
submodule/include/animation/layer_state.hpp [new file with mode: 0644]
submodule/include/animation/linear_animation.hpp
submodule/include/animation/state_machine.hpp [new file with mode: 0644]
submodule/include/animation/state_machine_bool.hpp [new file with mode: 0644]
submodule/include/animation/state_machine_component.hpp [new file with mode: 0644]
submodule/include/animation/state_machine_double.hpp [new file with mode: 0644]
submodule/include/animation/state_machine_input.hpp [new file with mode: 0644]
submodule/include/animation/state_machine_layer.hpp [new file with mode: 0644]
submodule/include/animation/state_machine_layer_component.hpp [new file with mode: 0644]
submodule/include/animation/state_machine_trigger.hpp [new file with mode: 0644]
submodule/include/animation/state_transition.hpp [new file with mode: 0644]
submodule/include/animation/transition_bool_condition.hpp [new file with mode: 0644]
submodule/include/animation/transition_condition.hpp [new file with mode: 0644]
submodule/include/animation/transition_double_condition.hpp [new file with mode: 0644]
submodule/include/animation/transition_trigger_condition.hpp [new file with mode: 0644]
submodule/include/animation/transition_value_condition.hpp [new file with mode: 0644]
submodule/include/artboard.hpp
submodule/include/component.hpp
submodule/include/core.hpp
submodule/include/core/binary_reader.hpp
submodule/include/file.hpp
submodule/include/generated/animation/animation_base.hpp
submodule/include/generated/animation/animation_state_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/any_state_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/cubic_interpolator_base.hpp
submodule/include/generated/animation/entry_state_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/exit_state_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/keyed_object_base.hpp
submodule/include/generated/animation/keyed_property_base.hpp
submodule/include/generated/animation/keyframe_base.hpp
submodule/include/generated/animation/keyframe_color_base.hpp
submodule/include/generated/animation/keyframe_double_base.hpp
submodule/include/generated/animation/keyframe_id_base.hpp
submodule/include/generated/animation/layer_state_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/linear_animation_base.hpp
submodule/include/generated/animation/state_machine_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_machine_bool_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_machine_component_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_machine_double_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_machine_input_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_machine_layer_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_machine_layer_component_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_machine_trigger_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/state_transition_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/transition_bool_condition_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/transition_condition_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/transition_double_condition_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/transition_trigger_condition_base.hpp [new file with mode: 0644]
submodule/include/generated/animation/transition_value_condition_base.hpp [new file with mode: 0644]
submodule/include/generated/artboard_base.hpp
submodule/include/generated/backboard_base.hpp
submodule/include/generated/bones/bone_base.hpp
submodule/include/generated/bones/cubic_weight_base.hpp
submodule/include/generated/bones/root_bone_base.hpp
submodule/include/generated/bones/skeletal_component_base.hpp
submodule/include/generated/bones/skin_base.hpp
submodule/include/generated/bones/tendon_base.hpp
submodule/include/generated/bones/weight_base.hpp
submodule/include/generated/component_base.hpp
submodule/include/generated/container_component_base.hpp
submodule/include/generated/core_registry.hpp
submodule/include/generated/draw_rules_base.hpp
submodule/include/generated/draw_target_base.hpp
submodule/include/generated/drawable_base.hpp
submodule/include/generated/node_base.hpp
submodule/include/generated/shapes/clipping_shape_base.hpp
submodule/include/generated/shapes/cubic_asymmetric_vertex_base.hpp
submodule/include/generated/shapes/cubic_detached_vertex_base.hpp
submodule/include/generated/shapes/cubic_mirrored_vertex_base.hpp
submodule/include/generated/shapes/cubic_vertex_base.hpp
submodule/include/generated/shapes/ellipse_base.hpp
submodule/include/generated/shapes/paint/fill_base.hpp
submodule/include/generated/shapes/paint/gradient_stop_base.hpp
submodule/include/generated/shapes/paint/linear_gradient_base.hpp
submodule/include/generated/shapes/paint/radial_gradient_base.hpp
submodule/include/generated/shapes/paint/shape_paint_base.hpp
submodule/include/generated/shapes/paint/solid_color_base.hpp
submodule/include/generated/shapes/paint/stroke_base.hpp
submodule/include/generated/shapes/paint/trim_path_base.hpp
submodule/include/generated/shapes/parametric_path_base.hpp
submodule/include/generated/shapes/path_base.hpp
submodule/include/generated/shapes/path_composer_base.hpp [deleted file]
submodule/include/generated/shapes/path_vertex_base.hpp
submodule/include/generated/shapes/points_path_base.hpp
submodule/include/generated/shapes/polygon_base.hpp
submodule/include/generated/shapes/rectangle_base.hpp
submodule/include/generated/shapes/shape_base.hpp
submodule/include/generated/shapes/star_base.hpp
submodule/include/generated/shapes/straight_vertex_base.hpp
submodule/include/generated/shapes/triangle_base.hpp
submodule/include/generated/transform_component_base.hpp
submodule/include/importers/artboard_importer.hpp [new file with mode: 0644]
submodule/include/importers/import_stack.hpp [new file with mode: 0644]
submodule/include/importers/keyed_object_importer.hpp [new file with mode: 0644]
submodule/include/importers/keyed_property_importer.hpp [new file with mode: 0644]
submodule/include/importers/linear_animation_importer.hpp [new file with mode: 0644]
submodule/include/math/aabb.hpp
submodule/include/runtime_header.hpp
submodule/include/shapes/path_composer.hpp
submodule/include/shapes/shape.hpp
submodule/skia/recorder/src/extractor.cpp
submodule/skia/viewer/src/main.cpp
submodule/src/animation/cubic_interpolator.cpp
submodule/src/animation/keyed_object.cpp
submodule/src/animation/keyed_property.cpp
submodule/src/animation/keyframe.cpp
submodule/src/animation/layer_state.cpp [new file with mode: 0644]
submodule/src/animation/linear_animation.cpp
submodule/src/animation/state_machine_input.cpp [new file with mode: 0644]
submodule/src/animation/state_machine_layer.cpp [new file with mode: 0644]
submodule/src/animation/state_machine_trigger.cpp [new file with mode: 0644]
submodule/src/animation/state_transition.cpp [new file with mode: 0644]
submodule/src/animation/transition_condition.cpp [new file with mode: 0644]
submodule/src/artboard.cpp
submodule/src/component.cpp
submodule/src/core/binary_reader.cpp
submodule/src/file.cpp
submodule/src/importers/artboard_importer.cpp [new file with mode: 0644]
submodule/src/importers/keyed_object_importer.cpp [new file with mode: 0644]
submodule/src/importers/keyed_property_importer.cpp [new file with mode: 0644]
submodule/src/importers/linear_animation_importer.cpp [new file with mode: 0644]
submodule/src/math/aabb.cpp
submodule/src/shapes/clipping_shape.cpp
submodule/src/shapes/metrics_path.cpp
submodule/src/shapes/path_composer.cpp
submodule/src/shapes/shape.cpp
submodule/test/assets/circle_clips.riv
submodule/test/assets/dependency_test.riv
submodule/test/assets/draw_rule_cycle.riv
submodule/test/assets/fix_rectangle.riv
submodule/test/assets/juice.riv
submodule/test/assets/off_road_car.riv
submodule/test/assets/shapetest.riv
submodule/test/assets/trim_path_linear.riv [new file with mode: 0644]
submodule/test/assets/two_artboards.riv
submodule/test/bound_bones_test.cpp
submodule/test/file_test.cpp
submodule/test/path_test.cpp

index 57eb586..2e3f850 100644 (file)
@@ -125,7 +125,6 @@ install_headers([
    'submodule/include/generated/shapes/ellipse_base.hpp',
    'submodule/include/generated/shapes/parametric_path_base.hpp',
    'submodule/include/generated/shapes/path_base.hpp',
-   'submodule/include/generated/shapes/path_composer_base.hpp',
    'submodule/include/generated/shapes/path_vertex_base.hpp',
    'submodule/include/generated/shapes/points_path_base.hpp',
    'submodule/include/generated/shapes/polygon_base.hpp',
@@ -157,7 +156,6 @@ install_headers([
    'submodule/include/shapes/metrics_path.hpp',
    'submodule/include/shapes/parametric_path.hpp',
    'submodule/include/shapes/path.hpp',
-   'submodule/include/shapes/path_composer.hpp',
    'submodule/include/shapes/path_space.hpp',
    'submodule/include/shapes/path_vertex.hpp',
    'submodule/include/shapes/points_path.hpp',
index 6fde223..b8bbeb9 100644 (file)
@@ -130,13 +130,13 @@ class Definition {
     code.writeln('protected:');
     code.writeln('typedef $superTypeName Super;');
     code.writeln('public:');
-    code.writeln('static const int typeKey = ${_key.intValue};\n');
+    code.writeln('static const uint16_t typeKey = ${_key.intValue};\n');
 
     code.write(comment(
         'Helper to quickly determine if a core object extends another '
         'without RTTI at runtime.',
         indent: 1));
-    code.writeln('bool isTypeOf(int typeKey) const override {');
+    code.writeln('bool isTypeOf(uint16_t typeKey) const override {');
 
     code.writeln('switch(typeKey) {');
     code.writeln('case ${_name}Base::typeKey:');
@@ -148,10 +148,10 @@ class Definition {
 
     code.writeln('}\n');
 
-    code.writeln('int coreType() const override { return typeKey; }\n');
+    code.writeln('uint16_t coreType() const override { return typeKey; }\n');
     if (properties.isNotEmpty) {
       for (final property in properties) {
-        code.writeln('static const int ${property.name}PropertyKey = '
+        code.writeln('static const uint16_t ${property.name}PropertyKey = '
             '${property.key.intValue};');
       }
       code.writeln('private:');
@@ -160,9 +160,11 @@ class Definition {
       for (final property in properties) {
         code.writeln('${property.type.cppName} m_${property.capitalizedName}');
 
-        var initialize = property.initialValue ?? property.type.defaultValue;
+        var initialize = property.initialValueRuntime ??
+            property.initialValue ??
+            property.type.defaultValue;
         if (initialize != null) {
-          code.write(' = $initialize');
+          code.write(' = ${property.type.convertCpp(initialize)}');
         }
         code.write(';');
       }
@@ -189,7 +191,7 @@ class Definition {
     }
 
     if (properties.isNotEmpty || _extensionOf == null) {
-      code.writeln('bool deserialize(int propertyKey, '
+      code.writeln('bool deserialize(uint16_t propertyKey, '
           'BinaryReader& reader) override {');
 
       code.writeln('switch (propertyKey){');
index de33010..c04e77a 100644 (file)
@@ -59,4 +59,6 @@ abstract class FieldType {
   String get snakeRuntimeCoreName => _runtimeCoreType
       .replaceAllMapped(RegExp('(.+?)([A-Z])'), (Match m) => '${m[1]}_${m[2]}')
       .toLowerCase();
+
+  String convertCpp(String value) => value;
 }
index 145aa95..69e4f49 100644 (file)
@@ -1,13 +1,22 @@
 import '../field_type.dart';
 
 class DoubleFieldType extends FieldType {
-  DoubleFieldType()
-      : super(
-          'double',
-          'CoreDoubleType',
-          cppName: 'float'
-        );
+  DoubleFieldType() : super('double', 'CoreDoubleType', cppName: 'float');
 
   @override
   String get defaultValue => '0.0f';
+
+  @override
+  String convertCpp(String value) {
+    var result = value;
+    if (result.isNotEmpty) {
+      if (result[result.length - 1] != 'f') {
+        if (!result.contains('.')) {
+          result += '.0';
+        }
+        result += 'f';
+      }
+    }
+    return result;
+  }
 }
index 2e54aeb..c73ac48 100644 (file)
@@ -6,4 +6,18 @@ class StringFieldType extends FieldType {
             cppName: 'std::string', include: '<string>');
   @override
   String get defaultValue => '""';
+
+  @override
+  String convertCpp(String value) {
+    var result = value;
+    if (result.length > 1) {
+      if (result[0] == '\'') {
+        result = '"' + result.substring(1);
+      }
+      if (result[result.length - 1] == '\'') {
+        result = result.substring(0, result.length - 1) + '"';
+      }
+    }
+    return result;
+  }
 }
index 8de3a3d..2672ffa 100644 (file)
@@ -10,4 +10,8 @@ class UintFieldType extends FieldType {
 
   @override
   String get defaultValue => '0';
+
+  // We do this to fix up CoreContext.invalidProperyKey
+  @override
+  String convertCpp(String value) => value.replaceAll('CoreContext.', 'Core::');
 }
index 0366053..e12cd67 100644 (file)
@@ -9,6 +9,7 @@ class Property {
   final FieldType type;
   final Definition definition;
   String initialValue;
+  String initialValueRuntime;
   bool animates = false;
   String group;
   Key key;
@@ -49,6 +50,10 @@ class Property {
     if (init is String) {
       initialValue = init;
     }
+    dynamic initRuntime = data['initialValueRuntime'];
+    if (initRuntime is String) {
+      initialValueRuntime = initRuntime;
+    }
     dynamic overrideSet = data['overrideSet'];
     if (overrideSet is bool && overrideSet) {
       isSetOverride = true;
@@ -93,8 +98,9 @@ class Property {
     var code = StringBuffer('  /// ${'-' * 74}\n');
     code.write(comment('${capitalize(name)} field with key ${key.intValue}.',
         indent: 1));
-    if (initialValue != null) {
-      code.writeln('${exportType.cppName} _$name = $initialValue;');
+    if (initialValueRuntime != null || initialValue != null) {
+      code.writeln(
+          '${exportType.cppName} _$name = ${initialValueRuntime ?? initialValue};');
     } else {
       code.writeln('${exportType.cppName} _$name;');
     }
@@ -193,6 +199,9 @@ class Property {
     if (initialValue != null) {
       data['initialValue'] = initialValue;
     }
+    if (initialValueRuntime != null) {
+      data['initialValueRuntime'] = initialValueRuntime;
+    }
     if (isGetOverride) {
       data['overrideGet'] = true;
     }
index 90ba389..e3bdf9e 100644 (file)
@@ -7,6 +7,7 @@
   "properties": {
     "artboardId": {
       "type": "Id",
+      "initialValue": "Core.missingId",
       "key": {
         "int": 54,
         "string": "artboardid"
@@ -16,6 +17,7 @@
     },
     "name": {
       "type": "String",
+      "initialValue": "''",
       "key": {
         "int": 55,
         "string": "name"
@@ -24,6 +26,7 @@
     },
     "order": {
       "type": "FractionalIndex",
+      "initialValue": "FractionalIndex.invalid",
       "key": {
         "int": 73,
         "string": "order"
diff --git a/submodule/dev/defs/animation/animation_state.json b/submodule/dev/defs/animation/animation_state.json
new file mode 100644 (file)
index 0000000..adc334a
--- /dev/null
@@ -0,0 +1,21 @@
+{
+  "name": "AnimationState",
+  "key": {
+    "int": 61,
+    "string": "animationstate"
+  },
+  "extends": "animation/layer_state.json",
+  "properties": {
+    "animationId": {
+      "type": "Id",
+      "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
+      "key": {
+        "int": 149,
+        "string": "animationid"
+      },
+      "description": "Id of the animation this layer state refers to."
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/any_state.json b/submodule/dev/defs/animation/any_state.json
new file mode 100644 (file)
index 0000000..dd682b7
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "name": "AnyState",
+  "key": {
+    "int": 62,
+    "string": "anystate"
+  },
+  "extends": "animation/layer_state.json"
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/entry_state.json b/submodule/dev/defs/animation/entry_state.json
new file mode 100644 (file)
index 0000000..ef3f9c4
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "name": "EntryState",
+  "key": {
+    "int": 63,
+    "string": "entrystate"
+  },
+  "extends": "animation/layer_state.json"
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/exit_state.json b/submodule/dev/defs/animation/exit_state.json
new file mode 100644 (file)
index 0000000..06f16fc
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "name": "ExitState",
+  "key": {
+    "int": 64,
+    "string": "exitstate"
+  },
+  "extends": "animation/layer_state.json"
+}
\ No newline at end of file
index 631fba4..0eac2d7 100644 (file)
@@ -8,6 +8,8 @@
     "objectId": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "0",
       "key": {
         "int": 51,
         "string": "objectid"
@@ -16,6 +18,8 @@
     },
     "animationId": {
       "type": "Id",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "key": {
         "int": 52,
         "string": "animationid"
index 53d5259..20c678e 100644 (file)
@@ -7,6 +7,7 @@
   "properties": {
     "keyedObjectId": {
       "type": "Id",
+      "initialValue": "Core.missingId",
       "key": {
         "int": 71,
         "string": "keyedobjectid"
@@ -16,6 +17,7 @@
     },
     "propertyKey": {
       "type": "uint",
+      "initialValue": "CoreContext.invalidPropertyKey",
       "key": {
         "int": 53,
         "string": "propertykey"
index 4131dc3..1d22274 100644 (file)
@@ -8,6 +8,8 @@
   "properties": {
     "keyedPropertyId": {
       "type": "Id",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "key": {
         "int": 72,
         "string": "keyedpropertyid"
@@ -17,6 +19,7 @@
     },
     "frame": {
       "type": "uint",
+      "initialValue": "0",
       "key": {
         "int": 67,
         "string": "frame"
@@ -25,6 +28,7 @@
     },
     "interpolationType": {
       "type": "uint",
+      "initialValue": "0",
       "key": {
         "int": 68,
         "string": "interpolation"
     "interpolatorId": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "key": {
         "int": 69,
         "string": "interpolatorid"
       },
-      "description": "The id of the custom interpolator used when interpolation is Cubic.",
-      "nullable": true
+      "description": "The id of the custom interpolator used when interpolation is Cubic."
     }
   }
 }
\ No newline at end of file
index 0347b19..f13ab7b 100644 (file)
@@ -8,6 +8,7 @@
   "properties": {
     "value": {
       "type": "Color",
+      "initialValue": "0",
       "key": {
         "int": 88,
         "string": "value"
index e350e48..532976a 100644 (file)
@@ -8,6 +8,7 @@
   "properties": {
     "value": {
       "type": "double",
+      "initialValue": "0",
       "key": {
         "int": 70,
         "string": "value"
index f3f8fd7..421a34b 100644 (file)
@@ -9,6 +9,8 @@
     "value": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "key": {
         "int": 122,
         "string": "value"
diff --git a/submodule/dev/defs/animation/layer_state.json b/submodule/dev/defs/animation/layer_state.json
new file mode 100644 (file)
index 0000000..ce57d57
--- /dev/null
@@ -0,0 +1,39 @@
+{
+  "name": "LayerState",
+  "key": {
+    "int": 60,
+    "string": "layerstate"
+  },
+  "abstract": true,
+  "extends": "animation/state_machine_layer_component.json",
+  "properties": {
+    "layerId": {
+      "type": "Id",
+      "initialValue": "Core.missingId",
+      "key": {
+        "int": 146,
+        "string": "layerid"
+      },
+      "description": "Id of the state machine layer this state belongs to.",
+      "runtime": false
+    },
+    "x": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 147,
+        "string": "x"
+      },
+      "runtime": false
+    },
+    "y": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 148,
+        "string": "y"
+      },
+      "runtime": false
+    }
+  }
+}
\ No newline at end of file
index a008f75..f12b4ea 100644 (file)
@@ -44,6 +44,7 @@
     },
     "workStart": {
       "type": "uint",
+      "initialValue": "-1",
       "key": {
         "int": 60,
         "string": "workstart"
@@ -52,6 +53,7 @@
     },
     "workEnd": {
       "type": "uint",
+      "initialValue": "-1",
       "key": {
         "int": 61,
         "string": "workend"
         "string": "enableworkarea"
       },
       "description": "Whether or not the work area is enabled."
+    },
+    "playhead": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 132,
+        "string": "playhead"
+      },
+      "description": "Playhead position in frames.",
+      "runtime": false,
+      "coop": false
+    },
+    "viewStart": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 133,
+        "string": "viewstart"
+      },
+      "description": "Viewport start in frames.",
+      "runtime": false,
+      "coop": false
+    },
+    "viewEnd": {
+      "type": "uint",
+      "initialValue": "2147483648",
+      "key": {
+        "int": 134,
+        "string": "viewend"
+      },
+      "description": "Viewport end in frames.",
+      "runtime": false,
+      "coop": false
     }
   }
 }
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine.json b/submodule/dev/defs/animation/state_machine.json
new file mode 100644 (file)
index 0000000..c28736f
--- /dev/null
@@ -0,0 +1,32 @@
+{
+  "name": "StateMachine",
+  "key": {
+    "int": 53,
+    "string": "statemachine"
+  },
+  "extends": "animation/animation.json",
+  "properties": {
+    "editingListValue": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 136,
+        "string": "editinglistvalue"
+      },
+      "description": "Backing value for enum representing which list being edited.",
+      "runtime": false,
+      "coop": false
+    },
+    "editingLayerId": {
+      "type": "Id",
+      "initialValue": "Core.missingId",
+      "key": {
+        "int": 142,
+        "string": "editinglayer"
+      },
+      "description": "Id of the currently editing layer.",
+      "runtime": false,
+      "coop": false
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine_bool.json b/submodule/dev/defs/animation/state_machine_bool.json
new file mode 100644 (file)
index 0000000..75b3cd0
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "StateMachineBool",
+  "key": {
+    "int": 59,
+    "string": "statemachinebool"
+  },
+  "extends": "animation/state_machine_input.json",
+  "properties": {
+    "value": {
+      "type": "bool",
+      "initialValue": "false",
+      "key": {
+        "int": 141,
+        "string": "value"
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine_component.json b/submodule/dev/defs/animation/state_machine_component.json
new file mode 100644 (file)
index 0000000..0c6b927
--- /dev/null
@@ -0,0 +1,39 @@
+{
+  "name": "StateMachineComponent",
+  "key": {
+    "int": 54,
+    "string": "statemachinecomponent"
+  },
+  "abstract": true,
+  "properties": {
+    "machineId": {
+      "type": "Id",
+      "initialValue": "Core.missingId",
+      "key": {
+        "int": 137,
+        "string": "machineid"
+      },
+      "description": "Id of the state machine this component belongs to.",
+      "runtime": false
+    },
+    "name": {
+      "type": "String",
+      "initialValue": "''",
+      "key": {
+        "int": 138,
+        "string": "name"
+      },
+      "description": "Non-unique identifier, used to give friendly names to state machine components (like layers or inputs)."
+    },
+    "machineOrder": {
+      "type": "FractionalIndex",
+      "initialValue": "FractionalIndex.invalid",
+      "key": {
+        "int": 139,
+        "string": "machineorder"
+      },
+      "description": "Order of this component in the state machine. Exported in order for runtime",
+      "runtime": false
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine_double.json b/submodule/dev/defs/animation/state_machine_double.json
new file mode 100644 (file)
index 0000000..7ea0953
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "StateMachineDouble",
+  "key": {
+    "int": 56,
+    "string": "statemachinedouble"
+  },
+  "extends": "animation/state_machine_input.json",
+  "properties": {
+    "value": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 140,
+        "string": "value"
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine_input.json b/submodule/dev/defs/animation/state_machine_input.json
new file mode 100644 (file)
index 0000000..51d3b0f
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "name": "StateMachineInput",
+  "key": {
+    "int": 55,
+    "string": "statemachineinput"
+  },
+  "abstract": true,
+  "extends": "animation/state_machine_component.json"
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine_layer.json b/submodule/dev/defs/animation/state_machine_layer.json
new file mode 100644 (file)
index 0000000..0af17fc
--- /dev/null
@@ -0,0 +1,43 @@
+{
+  "name": "StateMachineLayer",
+  "key": {
+    "int": 57,
+    "string": "statemachinelayer"
+  },
+  "extends": "animation/state_machine_component.json",
+  "properties": {
+    "stageZoom": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 143,
+        "string": "stagezoom"
+      },
+      "description": "Zoom value of the stage in the editor. Initial value is 0 to indicate it is not set.",
+      "runtime": false,
+      "coop": false
+    },
+    "stageX": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 144,
+        "string": "stagex"
+      },
+      "description": "X translation value of the stage in the editor.",
+      "runtime": false,
+      "coop": false
+    },
+    "stageY": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 145,
+        "string": "stagey"
+      },
+      "description": "Y translation value of the stage in the editor.",
+      "runtime": false,
+      "coop": false
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine_layer_component.json b/submodule/dev/defs/animation/state_machine_layer_component.json
new file mode 100644 (file)
index 0000000..85f1593
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "name": "StateMachineLayerComponent",
+  "key": {
+    "int": 66,
+    "string": "statemachinelayercomponent"
+  },
+  "abstract": true
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_machine_trigger.json b/submodule/dev/defs/animation/state_machine_trigger.json
new file mode 100644 (file)
index 0000000..dddc51e
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "name": "StateMachineTrigger",
+  "key": {
+    "int": 58,
+    "string": "statemachinetrigger"
+  },
+  "extends": "animation/state_machine_input.json"
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/state_transition.json b/submodule/dev/defs/animation/state_transition.json
new file mode 100644 (file)
index 0000000..7553d35
--- /dev/null
@@ -0,0 +1,58 @@
+{
+  "name": "StateTransition",
+  "key": {
+    "int": 65,
+    "string": "statetransition"
+  },
+  "extends": "animation/state_machine_layer_component.json",
+  "properties": {
+    "stateFromId": {
+      "type": "Id",
+      "initialValue": "Core.missingId",
+      "key": {
+        "int": 150,
+        "string": "statefromid"
+      },
+      "description": "Id of the state this transition originates from.",
+      "runtime": false
+    },
+    "stateToId": {
+      "type": "Id",
+      "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
+      "key": {
+        "int": 151,
+        "string": "statetoid"
+      },
+      "description": "Id of the state this transition originates from."
+    },
+    "flags": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 152,
+        "string": "flags"
+      }
+    },
+    "duration": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 158,
+        "string": "duration"
+      },
+      "description": "Duration of the trasition (mix time) in milliseconds."
+    },
+    "transitionOrder": {
+      "type": "FractionalIndex",
+      "initialValue": "FractionalIndex.invalid",
+      "key": {
+        "int": 159,
+        "string": "transitionorder"
+      },
+      "description": "Order value for sorting transitions in states.",
+      "runtime": false
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/transition_bool_condition.json b/submodule/dev/defs/animation/transition_bool_condition.json
new file mode 100644 (file)
index 0000000..cc62cf1
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "name": "TransitionBoolCondition",
+  "key": {
+    "int": 71,
+    "string": "transitionboolcondition"
+  },
+  "extends": "animation/transition_value_condition.json"
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/transition_condition.json b/submodule/dev/defs/animation/transition_condition.json
new file mode 100644 (file)
index 0000000..83365b5
--- /dev/null
@@ -0,0 +1,44 @@
+{
+  "name": "TransitionCondition",
+  "key": {
+    "int": 67,
+    "string": "transitioncondition"
+  },
+  "abstract": true,
+  "properties": {
+    "transitionId": {
+      "type": "Id",
+      "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
+      "key": {
+        "int": 153,
+        "string": "transitionid"
+      },
+      "description": "Id of the transition this condition belongs to.",
+      "runtime": false
+    },
+    "conditionOrder": {
+      "type": "FractionalIndex",
+      "initialValue": "FractionalIndex.invalid",
+      "initialValueRuntime": "0",
+      "key": {
+        "int": 154,
+        "string": "conditionorder"
+      },
+      "description": "Order value for condition in a transition.",
+      "runtime": false
+    },
+    "inputId": {
+      "type": "Id",
+      "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
+      "key": {
+        "int": 155,
+        "string": "inputid"
+      },
+      "description": "Id of the StateMachineInput referenced."
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/transition_double_condition.json b/submodule/dev/defs/animation/transition_double_condition.json
new file mode 100644 (file)
index 0000000..7fa83ad
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "TransitionDoubleCondition",
+  "key": {
+    "int": 70,
+    "string": "transitiondoublecondition"
+  },
+  "extends": "animation/transition_value_condition.json",
+  "properties": {
+    "value": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 157,
+        "string": "value"
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/transition_trigger_condition.json b/submodule/dev/defs/animation/transition_trigger_condition.json
new file mode 100644 (file)
index 0000000..63c9e49
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "name": "TransitionTriggerCondition",
+  "key": {
+    "int": 68,
+    "string": "transitiontriggercondition"
+  },
+  "extends": "animation/transition_condition.json"
+}
\ No newline at end of file
diff --git a/submodule/dev/defs/animation/transition_value_condition.json b/submodule/dev/defs/animation/transition_value_condition.json
new file mode 100644 (file)
index 0000000..8f5a883
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "name": "TransitionValueCondition",
+  "key": {
+    "int": 69,
+    "string": "transitionvaluecondition"
+  },
+  "abstract": true,
+  "extends": "animation/transition_condition.json",
+  "properties": {
+    "opValue": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 156,
+        "string": "opvalue"
+      },
+      "description": "Integer representation of the StateMachineOp enum."
+    }
+  }
+}
\ No newline at end of file
index 46ce467..25e825d 100644 (file)
@@ -8,6 +8,7 @@
   "properties": {
     "width": {
       "type": "double",
+      "initialValue": "0",
       "key": {
         "int": 7,
         "string": "w"
@@ -16,6 +17,7 @@
     },
     "height": {
       "type": "double",
+      "initialValue": "0",
       "key": {
         "int": 8,
         "string": "h"
@@ -24,6 +26,7 @@
     },
     "x": {
       "type": "double",
+      "initialValue": "0",
       "key": {
         "int": 9,
         "string": "x"
@@ -32,6 +35,7 @@
     },
     "y": {
       "type": "double",
+      "initialValue": "0",
       "key": {
         "int": 10,
         "string": "y"
@@ -40,6 +44,7 @@
     },
     "originX": {
       "type": "double",
+      "initialValue": "0",
       "key": {
         "int": 11,
         "string": "ox"
     },
     "originY": {
       "type": "double",
+      "initialValue": "0",
       "key": {
         "int": 12,
         "string": "oy"
       },
       "description": "Origin y in normalized coordinates (0.5 = center, 0 = top, 1 = bottom)."
+    },
+    "editingAnimation": {
+      "type": "Id",
+      "initialValue": "Core.missingId",
+      "key": {
+        "int": 131,
+        "string": "editinganimation"
+      },
+      "description": "Id of the last open animation.",
+      "runtime": false,
+      "coop": false
     }
   }
 }
\ No newline at end of file
index 393e388..d2b1519 100644 (file)
@@ -7,6 +7,7 @@
   "properties": {
     "activeArtboardId": {
       "type": "Id",
+      "initialValue": "Core.missingId",
       "key": {
         "int": 43,
         "string": "activeArtboardId"
@@ -17,6 +18,7 @@
     },
     "mainArtboardId": {
       "type": "Id",
+      "initialValue": "Core.missingId",
       "key": {
         "int": 44,
         "string": "mainArtboardId"
       },
       "description": "The background color.",
       "runtime": false
+    },
+    "editorMode": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 135,
+        "string": "editormode"
+      },
+      "description": "Edit time mode.",
+      "runtime": false,
+      "coop": false
     }
   }
 }
\ No newline at end of file
index 6f22fba..6ec698e 100644 (file)
@@ -19,6 +19,8 @@
     "boneId": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "key": {
         "int": 95,
         "string": "boneid"
index d804f68..4d590a6 100644 (file)
@@ -8,6 +8,7 @@
   "properties": {
     "dependentIds": {
       "type": "List<Id>",
+      "initialValue": "[]",
       "key": {
         "int": 3,
         "string": "dependentIds"
     },
     "name": {
       "type": "String",
+      "initialValue": "''",
       "key": {
         "int": 4,
         "string": "name"
       },
-      "description": "Non-unique identifier, used to give friendly names to elements in the hierarchy. Runtimes provide an API for finding components by this [name].",
-      "nullable": true
+      "description": "Non-unique identifier, used to give friendly names to elements in the hierarchy. Runtimes provide an API for finding components by this [name]."
     },
     "parentId": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "0",
       "key": {
         "int": 5,
         "string": "parentId"
     },
     "childOrder": {
       "type": "FractionalIndex",
+      "initialValue": "FractionalIndex.invalid",
+      "initialValueRuntime": "0",
       "key": {
         "int": 6,
         "string": "childOrder"
       },
       "description": "Order value for sorting child elements in ContainerComponent parent.",
       "runtime": false
+    },
+    "flags": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 130,
+        "string": "flags"
+      },
+      "runtime": false
     }
   }
 }
\ No newline at end of file
index 8d4f082..a607dfc 100644 (file)
@@ -9,6 +9,8 @@
     "drawTargetId": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "animates": true,
       "key": {
         "int": 121,
index df60de7..9cb5df1 100644 (file)
@@ -9,6 +9,8 @@
     "drawableId": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "key": {
         "int": 119,
         "string": "drawableid"
index 404e907..6ee1d46 100644 (file)
         "int": 23,
         "string": "blendModeValue"
       }
+    },
+    "drawableFlags": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 129,
+        "string": "drawableflags"
+      },
+      "coop": false
     }
   }
 }
\ No newline at end of file
index f4355ca..5f95370 100644 (file)
@@ -9,6 +9,8 @@
     "sourceId": {
       "type": "Id",
       "typeRuntime": "uint",
+      "initialValue": "Core.missingId",
+      "initialValueRuntime": "-1",
       "key": {
         "int": 92,
         "string": "sourceid"
index 12d631e..6ad1dee 100644 (file)
@@ -5,5 +5,16 @@
     "string": "path"
   },
   "abstract": true,
-  "extends": "node.json"
+  "extends": "node.json",
+  "properties": {
+    "pathFlags": {
+      "type": "uint",
+      "initialValue": "0",
+      "key": {
+        "int": 128,
+        "string": "pathflags"
+      },
+      "coop": false
+    }
+  }
 }
\ No newline at end of file
diff --git a/submodule/dev/defs/shapes/path_composer.json b/submodule/dev/defs/shapes/path_composer.json
deleted file mode 100644 (file)
index 4e1002b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "name": "PathComposer",
-  "key": {
-    "int": 9,
-    "string": "pathcomposer"
-  },
-  "extends": "component.json"
-}
\ No newline at end of file
index 5751f3e..4995ace 100644 (file)
@@ -9,6 +9,7 @@
   "properties": {
     "x": {
       "type": "double",
+      "initialValue": "0",
       "animates": true,
       "group": "position",
       "key": {
@@ -19,6 +20,7 @@
     },
     "y": {
       "type": "double",
+      "initialValue": "0",
       "animates": true,
       "group": "position",
       "key": {
index dd6bee2..72862e6 100644 (file)
@@ -8,6 +8,7 @@
   "properties": {
     "isClosed": {
       "type": "bool",
+      "initialValue": "false",
       "key": {
         "int": 32,
         "string": "isclosed"
index 07c5ab9..864dbad 100644 (file)
@@ -1,28 +1,28 @@
 {
-    "name": "Polygon",
-    "key": {
-      "int": 51,
-      "string": "polygon"
+  "name": "Polygon",
+  "key": {
+    "int": 51,
+    "string": "polygon"
+  },
+  "extends": "shapes/parametric_path.json",
+  "properties": {
+    "points": {
+      "type": "uint",
+      "initialValue": "5",
+      "key": {
+        "int": 125,
+        "string": "points"
+      },
+      "description": "The number of points for the polygon."
     },
-    "extends": "shapes/parametric_path.json",
-    "properties": {
-      "points": {
-        "type": "uint",
-        "initialValue": "5",
-        "key": {
-          "int": 125,
-          "string": "points"
-        },
-        "description": "The number of points for the polygon."
+    "cornerRadius": {
+      "type": "double",
+      "initialValue": "0",
+      "key": {
+        "int": 126,
+        "string": "cornerradius"
       },
-      "cornerRadius": {
-        "type": "double",
-        "initialValue": "0",
-        "key": {
-          "int": 126,
-          "string": "cornerradius"
-        },
-        "description": "The corner radius."
-      }
+      "description": "The corner radius."
     }
-  }
\ No newline at end of file
+  }
+}
\ No newline at end of file
index d265f53..c80122a 100644 (file)
@@ -1,20 +1,20 @@
 {
-    "name": "Star",
-    "key": {
-      "int": 52,
-      "string": "star"
-    },
-    "extends": "shapes/polygon.json",
-    "properties": {
-      "innerRadius": {
-        "type": "double",
-        "initialValue": "0.5",
-        "animates": true,
-        "key": {
-          "int": 127,
-          "string": "inner_radius"
-        },
-        "description": "Percentage of width/height to project inner points of the star."
-      }
+  "name": "Star",
+  "key": {
+    "int": 52,
+    "string": "star"
+  },
+  "extends": "shapes/polygon.json",
+  "properties": {
+    "innerRadius": {
+      "type": "double",
+      "initialValue": "0.5",
+      "animates": true,
+      "key": {
+        "int": 127,
+        "string": "inner_radius"
+      },
+      "description": "Percentage of width/height to project inner points of the star."
     }
-  }
\ No newline at end of file
+  }
+}
\ No newline at end of file
diff --git a/submodule/include/animation/animation_state.hpp b/submodule/include/animation/animation_state.hpp
new file mode 100644 (file)
index 0000000..91fc866
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_ANIMATION_STATE_HPP_
+#define _RIVE_ANIMATION_STATE_HPP_
+#include "generated/animation/animation_state_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class AnimationState : public AnimationStateBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/any_state.hpp b/submodule/include/animation/any_state.hpp
new file mode 100644 (file)
index 0000000..5218629
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_ANY_STATE_HPP_
+#define _RIVE_ANY_STATE_HPP_
+#include "generated/animation/any_state_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class AnyState : public AnyStateBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index 7a87240..595b737 100644 (file)
@@ -21,6 +21,8 @@ namespace rive
 
                /// Convert a linear interpolation factor to an eased one.
                float transform(float value) const;
+
+               StatusCode import(ImportStack& importStack) override;
        };
 } // namespace rive
 
diff --git a/submodule/include/animation/entry_state.hpp b/submodule/include/animation/entry_state.hpp
new file mode 100644 (file)
index 0000000..4a91324
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_ENTRY_STATE_HPP_
+#define _RIVE_ENTRY_STATE_HPP_
+#include "generated/animation/entry_state_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class EntryState : public EntryStateBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/exit_state.hpp b/submodule/include/animation/exit_state.hpp
new file mode 100644 (file)
index 0000000..ea4b195
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_EXIT_STATE_HPP_
+#define _RIVE_EXIT_STATE_HPP_
+#include "generated/animation/exit_state_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class ExitState : public ExitStateBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index 5a689b0..a69c6f4 100644 (file)
@@ -18,6 +18,8 @@ namespace rive
                StatusCode onAddedDirty(CoreContext* context) override;
                StatusCode onAddedClean(CoreContext* context) override;
                void apply(Artboard* coreContext, float time, float mix);
+
+               StatusCode import(ImportStack& importStack) override;
        };
 } // namespace rive
 
index b7236fd..828be6c 100644 (file)
@@ -16,6 +16,8 @@ namespace rive
                StatusCode onAddedDirty(CoreContext* context) override;
 
                void apply(Core* object, float time, float mix);
+               
+               StatusCode import(ImportStack& importStack) override;
        };
 } // namespace rive
 
index 2db64c3..1ab0c86 100644 (file)
@@ -13,12 +13,18 @@ namespace rive
 
        public:
                inline float seconds() const { return m_Seconds; }
-               inline CubicInterpolator* interpolator() const { return m_Interpolator; }
+               inline CubicInterpolator* interpolator() const
+               {
+                       return m_Interpolator;
+               }
 
                void computeSeconds(int fps);
 
                StatusCode onAddedDirty(CoreContext* context) override;
-               StatusCode onAddedClean(CoreContext* context) override { return StatusCode::Ok; }
+               StatusCode onAddedClean(CoreContext* context) override
+               {
+                       return StatusCode::Ok;
+               }
 
                virtual void apply(Core* object, int propertyKey, float mix) = 0;
                virtual void applyInterpolation(Core* object,
@@ -26,6 +32,8 @@ namespace rive
                                                float seconds,
                                                const KeyFrame* nextFrame,
                                                float mix) = 0;
+                                                                               
+               StatusCode import(ImportStack& importStack) override;
        };
 } // namespace rive
 
diff --git a/submodule/include/animation/layer_state.hpp b/submodule/include/animation/layer_state.hpp
new file mode 100644 (file)
index 0000000..3bda97d
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _RIVE_LAYER_STATE_HPP_
+#define _RIVE_LAYER_STATE_HPP_
+#include "generated/animation/layer_state_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class LayerState : public LayerStateBase
+       {
+       public:
+               StatusCode onAddedDirty(CoreContext* context) override;
+               StatusCode onAddedClean(CoreContext* context) override;
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index c714847..f6eb78c 100644 (file)
@@ -21,6 +21,12 @@ namespace rive
                void apply(Artboard* artboard, float time, float mix = 1.0f);
 
                Loop loop() const { return (Loop)loopValue(); }
+
+               StatusCode import(ImportStack& importStack) override;
+
+#ifdef TESTING
+               size_t numKeyedObjects() { return m_KeyedObjects.size(); }
+#endif
        };
 } // namespace rive
 
diff --git a/submodule/include/animation/state_machine.hpp b/submodule/include/animation/state_machine.hpp
new file mode 100644 (file)
index 0000000..e532c3f
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_STATE_MACHINE_HPP_
+#define _RIVE_STATE_MACHINE_HPP_
+#include "generated/animation/state_machine_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachine : public StateMachineBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_machine_bool.hpp b/submodule/include/animation/state_machine_bool.hpp
new file mode 100644 (file)
index 0000000..10c89bf
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_STATE_MACHINE_BOOL_HPP_
+#define _RIVE_STATE_MACHINE_BOOL_HPP_
+#include "generated/animation/state_machine_bool_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachineBool : public StateMachineBoolBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_machine_component.hpp b/submodule/include/animation/state_machine_component.hpp
new file mode 100644 (file)
index 0000000..43b012a
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_STATE_MACHINE_COMPONENT_HPP_
+#define _RIVE_STATE_MACHINE_COMPONENT_HPP_
+#include "generated/animation/state_machine_component_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachineComponent : public StateMachineComponentBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_machine_double.hpp b/submodule/include/animation/state_machine_double.hpp
new file mode 100644 (file)
index 0000000..4a1a748
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_STATE_MACHINE_DOUBLE_HPP_
+#define _RIVE_STATE_MACHINE_DOUBLE_HPP_
+#include "generated/animation/state_machine_double_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachineDouble : public StateMachineDoubleBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_machine_input.hpp b/submodule/include/animation/state_machine_input.hpp
new file mode 100644 (file)
index 0000000..4b483ba
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _RIVE_STATE_MACHINE_INPUT_HPP_
+#define _RIVE_STATE_MACHINE_INPUT_HPP_
+#include "generated/animation/state_machine_input_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachineInput : public StateMachineInputBase
+       {
+       public:
+               StatusCode onAddedDirty(CoreContext* context) override;
+               StatusCode onAddedClean(CoreContext* context) override;
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_machine_layer.hpp b/submodule/include/animation/state_machine_layer.hpp
new file mode 100644 (file)
index 0000000..1345b43
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _RIVE_STATE_MACHINE_LAYER_HPP_
+#define _RIVE_STATE_MACHINE_LAYER_HPP_
+#include "generated/animation/state_machine_layer_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachineLayer : public StateMachineLayerBase
+       {
+       public:
+               StatusCode onAddedDirty(CoreContext* context) override;
+               StatusCode onAddedClean(CoreContext* context) override;
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_machine_layer_component.hpp b/submodule/include/animation/state_machine_layer_component.hpp
new file mode 100644 (file)
index 0000000..58a4750
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_STATE_MACHINE_LAYER_COMPONENT_HPP_
+#define _RIVE_STATE_MACHINE_LAYER_COMPONENT_HPP_
+#include "generated/animation/state_machine_layer_component_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachineLayerComponent : public StateMachineLayerComponentBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_machine_trigger.hpp b/submodule/include/animation/state_machine_trigger.hpp
new file mode 100644 (file)
index 0000000..a6fb10f
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _RIVE_STATE_MACHINE_TRIGGER_HPP_
+#define _RIVE_STATE_MACHINE_TRIGGER_HPP_
+#include "generated/animation/state_machine_trigger_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateMachineTrigger : public StateMachineTriggerBase
+       {
+       private: 
+               bool m_Fired = false;
+               void reset();
+
+       public:
+               void fire();
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/state_transition.hpp b/submodule/include/animation/state_transition.hpp
new file mode 100644 (file)
index 0000000..22e7423
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _RIVE_STATE_TRANSITION_HPP_
+#define _RIVE_STATE_TRANSITION_HPP_
+#include "generated/animation/state_transition_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class StateTransition : public StateTransitionBase
+       {
+       public:
+               StatusCode onAddedDirty(CoreContext* context) override;
+               StatusCode onAddedClean(CoreContext* context) override;
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/transition_bool_condition.hpp b/submodule/include/animation/transition_bool_condition.hpp
new file mode 100644 (file)
index 0000000..9062454
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_TRANSITION_BOOL_CONDITION_HPP_
+#define _RIVE_TRANSITION_BOOL_CONDITION_HPP_
+#include "generated/animation/transition_bool_condition_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class TransitionBoolCondition : public TransitionBoolConditionBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/transition_condition.hpp b/submodule/include/animation/transition_condition.hpp
new file mode 100644 (file)
index 0000000..df8af6e
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _RIVE_TRANSITION_CONDITION_HPP_
+#define _RIVE_TRANSITION_CONDITION_HPP_
+#include "generated/animation/transition_condition_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class TransitionCondition : public TransitionConditionBase
+       {
+       public:
+               StatusCode onAddedDirty(CoreContext* context) override;
+               StatusCode onAddedClean(CoreContext* context) override;
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/transition_double_condition.hpp b/submodule/include/animation/transition_double_condition.hpp
new file mode 100644 (file)
index 0000000..c6f8a7b
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_TRANSITION_DOUBLE_CONDITION_HPP_
+#define _RIVE_TRANSITION_DOUBLE_CONDITION_HPP_
+#include "generated/animation/transition_double_condition_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class TransitionDoubleCondition : public TransitionDoubleConditionBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/transition_trigger_condition.hpp b/submodule/include/animation/transition_trigger_condition.hpp
new file mode 100644 (file)
index 0000000..a820a6d
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_TRANSITION_TRIGGER_CONDITION_HPP_
+#define _RIVE_TRANSITION_TRIGGER_CONDITION_HPP_
+#include "generated/animation/transition_trigger_condition_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class TransitionTriggerCondition : public TransitionTriggerConditionBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/animation/transition_value_condition.hpp b/submodule/include/animation/transition_value_condition.hpp
new file mode 100644 (file)
index 0000000..28c8c54
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _RIVE_TRANSITION_VALUE_CONDITION_HPP_
+#define _RIVE_TRANSITION_VALUE_CONDITION_HPP_
+#include "generated/animation/transition_value_condition_base.hpp"
+#include <stdio.h>
+namespace rive
+{
+       class TransitionValueCondition : public TransitionValueConditionBase
+       {
+       public:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index 23110ac..dc4c4bd 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _RIVE_ARTBOARD_HPP_
 #define _RIVE_ARTBOARD_HPP_
-#include "animation/animation.hpp"
+#include "animation/linear_animation.hpp"
+#include "animation/state_machine.hpp"
 #include "core_context.hpp"
 #include "generated/artboard_base.hpp"
 #include "math/aabb.hpp"
@@ -22,7 +23,8 @@ namespace rive
 
        private:
                std::vector<Core*> m_Objects;
-               std::vector<Animation*> m_Animations;
+               std::vector<LinearAnimation*> m_Animations;
+               std::vector<StateMachine*> m_StateMachines;
                std::vector<Component*> m_DependencyOrder;
                std::vector<Drawable*> m_Drawables;
                std::vector<DrawTarget*> m_DrawTargets;
@@ -38,7 +40,8 @@ namespace rive
                ~Artboard();
                StatusCode initialize();
                void addObject(Core* object);
-               void addAnimation(Animation* object);
+               void addAnimation(LinearAnimation* object);
+               void addStateMachine(StateMachine* object);
 
                Core* resolve(int id) const override;
 
@@ -67,7 +70,8 @@ namespace rive
                {
                        for (auto object : m_Objects)
                        {
-                               if (object->is<T>() && object->as<T>()->name() == name)
+                               if (object != nullptr && object->is<T>() &&
+                                   object->as<T>()->name() == name)
                                {
                                        return reinterpret_cast<T*>(object);
                                }
@@ -75,40 +79,15 @@ namespace rive
                        return nullptr;
                }
 
-               template <typename T = Animation> T* firstAnimation()
-               {
-                       for (auto animation : m_Animations)
-                       {
-                               if (animation->is<T>())
-                               {
-                                       return reinterpret_cast<T*>(animation);
-                               }
-                       }
-                       return nullptr;
-               }
-
-               template <typename T = Animation> T* animation(std::string name)
-               {
-                       for (auto animation : m_Animations)
-                       {
-                               if (animation->is<T>() && animation->as<T>()->name() == name)
-                               {
-                                       return reinterpret_cast<T*>(animation);
-                               }
-                       }
-                       return nullptr;
-               }
-
-               template <typename T = Animation> T* animation(size_t index)
-               {
-                       if (index >= 0 && index >= m_Animations.size())
-                       {
-                               return nullptr;
-                       }
-                       return m_Animations[index]->as<T>();
-               }
-
+               LinearAnimation* firstAnimation();
+               LinearAnimation* animation(std::string name);
+               LinearAnimation* animation(size_t index);
                size_t animationCount() { return m_Animations.size(); }
+
+               StateMachine* firstStateMachine();
+               StateMachine* stateMachine(std::string name);
+               StateMachine* stateMachine(size_t index);
+               size_t stateMachineCount() { return m_StateMachines.size(); }
        };
 } // namespace rive
 
index aab4791..7a994f1 100644 (file)
@@ -52,6 +52,8 @@ namespace rive
                {
                        return (value & flag) != ComponentDirt::None;
                }
+
+               StatusCode import(ImportStack& importStack) override;
        };
 } // namespace rive
 
index e660e95..6ae1f5f 100644 (file)
@@ -8,13 +8,16 @@
 namespace rive
 {
        class CoreContext;
+       class ImportStack;
        class Core
        {
        public:
+               static const int invalidPropertyKey = 0;
                virtual ~Core() {}
-               virtual int coreType() const = 0;
-               virtual bool isTypeOf(int typeKey) const = 0;
-               virtual bool deserialize(int propertyKey, BinaryReader& reader) = 0;
+               virtual uint16_t coreType() const = 0;
+               virtual bool isTypeOf(uint16_t typeKey) const = 0;
+               virtual bool deserialize(uint16_t propertyKey,
+                                        BinaryReader& reader) = 0;
 
                template <typename T> bool is() const { return isTypeOf(T::typeKey); }
                template <typename T> T* as()
@@ -41,6 +44,11 @@ namespace rive
                /// dependencies. (A path should be able to find a Shape somewhere in
                /// its hierarchy, which may be multiple levels up).
                virtual StatusCode onAddedClean(CoreContext* context) = 0;
+
+               virtual StatusCode import(ImportStack& importStack)
+               {
+                       return StatusCode::Ok;
+               }
        };
 } // namespace rive
 #endif
\ No newline at end of file
index 6486dde..c148788 100644 (file)
@@ -19,6 +19,7 @@ namespace rive
     public:
         BinaryReader(uint8_t* bytes, size_t length);
         bool didOverflow() const;
+        bool reachedEnd() const;
 
         size_t lengthInBytes() const;
 
index 861de0a..a083153 100644 (file)
@@ -32,9 +32,9 @@ namespace rive
        {
        public:
                /// Major version number supported by the runtime.
-               static const int majorVersion = 6;
+               static const int majorVersion = 7;
                /// Minor version number supported by the runtime.
-               static const int minorVersion = 3;
+               static const int minorVersion = 0;
 
        private:
                /// The file's backboard. All Rive files have a single backboard
index 32850bd..6d96ebb 100644 (file)
@@ -11,11 +11,11 @@ namespace rive
                typedef Core Super;
 
        public:
-               static const int typeKey = 27;
+               static const uint16_t typeKey = 27;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -26,9 +26,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int namePropertyKey = 55;
+               static const uint16_t namePropertyKey = 55;
 
        private:
                std::string m_Name = "";
@@ -44,7 +44,7 @@ namespace rive
                        nameChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
diff --git a/submodule/include/generated/animation/animation_state_base.hpp b/submodule/include/generated/animation/animation_state_base.hpp
new file mode 100644 (file)
index 0000000..f56bbd4
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef _RIVE_ANIMATION_STATE_BASE_HPP_
+#define _RIVE_ANIMATION_STATE_BASE_HPP_
+#include "animation/layer_state.hpp"
+#include "core/field_types/core_uint_type.hpp"
+namespace rive
+{
+       class AnimationStateBase : public LayerState
+       {
+       protected:
+               typedef LayerState Super;
+
+       public:
+               static const uint16_t typeKey = 61;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case AnimationStateBase::typeKey:
+                               case LayerStateBase::typeKey:
+                               case StateMachineLayerComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t animationIdPropertyKey = 149;
+
+       private:
+               int m_AnimationId = -1;
+       public:
+               inline int animationId() const { return m_AnimationId; }
+               void animationId(int value)
+               {
+                       if (m_AnimationId == value)
+                       {
+                               return;
+                       }
+                       m_AnimationId = value;
+                       animationIdChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case animationIdPropertyKey:
+                                       m_AnimationId = CoreUintType::deserialize(reader);
+                                       return true;
+                       }
+                       return LayerState::deserialize(propertyKey, reader);
+               }
+
+       protected:
+               virtual void animationIdChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/any_state_base.hpp b/submodule/include/generated/animation/any_state_base.hpp
new file mode 100644 (file)
index 0000000..6fc6815
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _RIVE_ANY_STATE_BASE_HPP_
+#define _RIVE_ANY_STATE_BASE_HPP_
+#include "animation/layer_state.hpp"
+namespace rive
+{
+       class AnyStateBase : public LayerState
+       {
+       protected:
+               typedef LayerState Super;
+
+       public:
+               static const uint16_t typeKey = 62;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case AnyStateBase::typeKey:
+                               case LayerStateBase::typeKey:
+                               case StateMachineLayerComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index e0ce3eb..1373d5f 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Core Super;
 
        public:
-               static const int typeKey = 28;
+               static const uint16_t typeKey = 28;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -25,18 +25,18 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int x1PropertyKey = 63;
-               static const int y1PropertyKey = 64;
-               static const int x2PropertyKey = 65;
-               static const int y2PropertyKey = 66;
+               static const uint16_t x1PropertyKey = 63;
+               static const uint16_t y1PropertyKey = 64;
+               static const uint16_t x2PropertyKey = 65;
+               static const uint16_t y2PropertyKey = 66;
 
        private:
-               float m_X1 = 0.42;
-               float m_Y1 = 0;
-               float m_X2 = 0.58;
-               float m_Y2 = 1;
+               float m_X1 = 0.42f;
+               float m_Y1 = 0.0f;
+               float m_X2 = 0.58f;
+               float m_Y2 = 1.0f;
        public:
                inline float x1() const { return m_X1; }
                void x1(float value)
@@ -82,7 +82,7 @@ namespace rive
                        y2Changed();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
diff --git a/submodule/include/generated/animation/entry_state_base.hpp b/submodule/include/generated/animation/entry_state_base.hpp
new file mode 100644 (file)
index 0000000..e8c5b3e
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _RIVE_ENTRY_STATE_BASE_HPP_
+#define _RIVE_ENTRY_STATE_BASE_HPP_
+#include "animation/layer_state.hpp"
+namespace rive
+{
+       class EntryStateBase : public LayerState
+       {
+       protected:
+               typedef LayerState Super;
+
+       public:
+               static const uint16_t typeKey = 63;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case EntryStateBase::typeKey:
+                               case LayerStateBase::typeKey:
+                               case StateMachineLayerComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/exit_state_base.hpp b/submodule/include/generated/animation/exit_state_base.hpp
new file mode 100644 (file)
index 0000000..9b116c6
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _RIVE_EXIT_STATE_BASE_HPP_
+#define _RIVE_EXIT_STATE_BASE_HPP_
+#include "animation/layer_state.hpp"
+namespace rive
+{
+       class ExitStateBase : public LayerState
+       {
+       protected:
+               typedef LayerState Super;
+
+       public:
+               static const uint16_t typeKey = 64;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case ExitStateBase::typeKey:
+                               case LayerStateBase::typeKey:
+                               case StateMachineLayerComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index b6143f0..aa4f9c8 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Core Super;
 
        public:
-               static const int typeKey = 25;
+               static const uint16_t typeKey = 25;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -25,9 +25,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int objectIdPropertyKey = 51;
+               static const uint16_t objectIdPropertyKey = 51;
 
        private:
                int m_ObjectId = 0;
@@ -43,7 +43,7 @@ namespace rive
                        objectIdChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index b5af9c0..0cf9517 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Core Super;
 
        public:
-               static const int typeKey = 26;
+               static const uint16_t typeKey = 26;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -25,12 +25,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int propertyKeyPropertyKey = 53;
+               static const uint16_t propertyKeyPropertyKey = 53;
 
        private:
-               int m_PropertyKey = 0;
+               int m_PropertyKey = Core::invalidPropertyKey;
        public:
                inline int propertyKey() const { return m_PropertyKey; }
                void propertyKey(int value)
@@ -43,7 +43,7 @@ namespace rive
                        propertyKeyChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index d10330d..0481366 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Core Super;
 
        public:
-               static const int typeKey = 29;
+               static const uint16_t typeKey = 29;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -25,16 +25,16 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int framePropertyKey = 67;
-               static const int interpolationTypePropertyKey = 68;
-               static const int interpolatorIdPropertyKey = 69;
+               static const uint16_t framePropertyKey = 67;
+               static const uint16_t interpolationTypePropertyKey = 68;
+               static const uint16_t interpolatorIdPropertyKey = 69;
 
        private:
                int m_Frame = 0;
                int m_InterpolationType = 0;
-               int m_InterpolatorId = 0;
+               int m_InterpolatorId = -1;
        public:
                inline int frame() const { return m_Frame; }
                void frame(int value)
@@ -69,7 +69,7 @@ namespace rive
                        interpolatorIdChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index afed347..6d13842 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef KeyFrame Super;
 
        public:
-               static const int typeKey = 37;
+               static const uint16_t typeKey = 37;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -26,9 +26,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int valuePropertyKey = 88;
+               static const uint16_t valuePropertyKey = 88;
 
        private:
                int m_Value = 0;
@@ -44,7 +44,7 @@ namespace rive
                        valueChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index d8e7cfe..147b056 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef KeyFrame Super;
 
        public:
-               static const int typeKey = 30;
+               static const uint16_t typeKey = 30;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -26,9 +26,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int valuePropertyKey = 70;
+               static const uint16_t valuePropertyKey = 70;
 
        private:
                float m_Value = 0.0f;
@@ -44,7 +44,7 @@ namespace rive
                        valueChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 7cad2c1..0b5b241 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef KeyFrame Super;
 
        public:
-               static const int typeKey = 50;
+               static const uint16_t typeKey = 50;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -26,12 +26,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int valuePropertyKey = 122;
+               static const uint16_t valuePropertyKey = 122;
 
        private:
-               int m_Value = 0;
+               int m_Value = -1;
        public:
                inline int value() const { return m_Value; }
                void value(int value)
@@ -44,7 +44,7 @@ namespace rive
                        valueChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
diff --git a/submodule/include/generated/animation/layer_state_base.hpp b/submodule/include/generated/animation/layer_state_base.hpp
new file mode 100644 (file)
index 0000000..6058c97
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _RIVE_LAYER_STATE_BASE_HPP_
+#define _RIVE_LAYER_STATE_BASE_HPP_
+#include "animation/state_machine_layer_component.hpp"
+namespace rive
+{
+       class LayerStateBase : public StateMachineLayerComponent
+       {
+       protected:
+               typedef StateMachineLayerComponent Super;
+
+       public:
+               static const uint16_t typeKey = 60;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case LayerStateBase::typeKey:
+                               case StateMachineLayerComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index 316a034..50e76f0 100644 (file)
@@ -12,11 +12,11 @@ namespace rive
                typedef Animation Super;
 
        public:
-               static const int typeKey = 31;
+               static const uint16_t typeKey = 31;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -28,23 +28,23 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int fpsPropertyKey = 56;
-               static const int durationPropertyKey = 57;
-               static const int speedPropertyKey = 58;
-               static const int loopValuePropertyKey = 59;
-               static const int workStartPropertyKey = 60;
-               static const int workEndPropertyKey = 61;
-               static const int enableWorkAreaPropertyKey = 62;
+               static const uint16_t fpsPropertyKey = 56;
+               static const uint16_t durationPropertyKey = 57;
+               static const uint16_t speedPropertyKey = 58;
+               static const uint16_t loopValuePropertyKey = 59;
+               static const uint16_t workStartPropertyKey = 60;
+               static const uint16_t workEndPropertyKey = 61;
+               static const uint16_t enableWorkAreaPropertyKey = 62;
 
        private:
                int m_Fps = 60;
                int m_Duration = 60;
-               float m_Speed = 1;
+               float m_Speed = 1.0f;
                int m_LoopValue = 0;
-               int m_WorkStart = 0;
-               int m_WorkEnd = 0;
+               int m_WorkStart = -1;
+               int m_WorkEnd = -1;
                bool m_EnableWorkArea = false;
        public:
                inline int fps() const { return m_Fps; }
@@ -124,7 +124,7 @@ namespace rive
                        enableWorkAreaChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
diff --git a/submodule/include/generated/animation/state_machine_base.hpp b/submodule/include/generated/animation/state_machine_base.hpp
new file mode 100644 (file)
index 0000000..8385354
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _RIVE_STATE_MACHINE_BASE_HPP_
+#define _RIVE_STATE_MACHINE_BASE_HPP_
+#include "animation/animation.hpp"
+namespace rive
+{
+       class StateMachineBase : public Animation
+       {
+       protected:
+               typedef Animation Super;
+
+       public:
+               static const uint16_t typeKey = 53;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineBase::typeKey:
+                               case AnimationBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_machine_bool_base.hpp b/submodule/include/generated/animation/state_machine_bool_base.hpp
new file mode 100644 (file)
index 0000000..cb85b95
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef _RIVE_STATE_MACHINE_BOOL_BASE_HPP_
+#define _RIVE_STATE_MACHINE_BOOL_BASE_HPP_
+#include "animation/state_machine_input.hpp"
+#include "core/field_types/core_bool_type.hpp"
+namespace rive
+{
+       class StateMachineBoolBase : public StateMachineInput
+       {
+       protected:
+               typedef StateMachineInput Super;
+
+       public:
+               static const uint16_t typeKey = 59;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineBoolBase::typeKey:
+                               case StateMachineInputBase::typeKey:
+                               case StateMachineComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t valuePropertyKey = 141;
+
+       private:
+               bool m_Value = false;
+       public:
+               inline bool value() const { return m_Value; }
+               void value(bool value)
+               {
+                       if (m_Value == value)
+                       {
+                               return;
+                       }
+                       m_Value = value;
+                       valueChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case valuePropertyKey:
+                                       m_Value = CoreBoolType::deserialize(reader);
+                                       return true;
+                       }
+                       return StateMachineInput::deserialize(propertyKey, reader);
+               }
+
+       protected:
+               virtual void valueChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_machine_component_base.hpp b/submodule/include/generated/animation/state_machine_component_base.hpp
new file mode 100644 (file)
index 0000000..eacfe67
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef _RIVE_STATE_MACHINE_COMPONENT_BASE_HPP_
+#define _RIVE_STATE_MACHINE_COMPONENT_BASE_HPP_
+#include "core.hpp"
+#include "core/field_types/core_string_type.hpp"
+#include <string>
+namespace rive
+{
+       class StateMachineComponentBase : public Core
+       {
+       protected:
+               typedef Core Super;
+
+       public:
+               static const uint16_t typeKey = 54;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t namePropertyKey = 138;
+
+       private:
+               std::string m_Name = "";
+       public:
+               inline std::string name() const { return m_Name; }
+               void name(std::string value)
+               {
+                       if (m_Name == value)
+                       {
+                               return;
+                       }
+                       m_Name = value;
+                       nameChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case namePropertyKey:
+                                       m_Name = CoreStringType::deserialize(reader);
+                                       return true;
+                       }
+                       return false;
+               }
+
+       protected:
+               virtual void nameChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_machine_double_base.hpp b/submodule/include/generated/animation/state_machine_double_base.hpp
new file mode 100644 (file)
index 0000000..87528b5
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef _RIVE_STATE_MACHINE_DOUBLE_BASE_HPP_
+#define _RIVE_STATE_MACHINE_DOUBLE_BASE_HPP_
+#include "animation/state_machine_input.hpp"
+#include "core/field_types/core_double_type.hpp"
+namespace rive
+{
+       class StateMachineDoubleBase : public StateMachineInput
+       {
+       protected:
+               typedef StateMachineInput Super;
+
+       public:
+               static const uint16_t typeKey = 56;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineDoubleBase::typeKey:
+                               case StateMachineInputBase::typeKey:
+                               case StateMachineComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t valuePropertyKey = 140;
+
+       private:
+               float m_Value = 0.0f;
+       public:
+               inline float value() const { return m_Value; }
+               void value(float value)
+               {
+                       if (m_Value == value)
+                       {
+                               return;
+                       }
+                       m_Value = value;
+                       valueChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case valuePropertyKey:
+                                       m_Value = CoreDoubleType::deserialize(reader);
+                                       return true;
+                       }
+                       return StateMachineInput::deserialize(propertyKey, reader);
+               }
+
+       protected:
+               virtual void valueChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_machine_input_base.hpp b/submodule/include/generated/animation/state_machine_input_base.hpp
new file mode 100644 (file)
index 0000000..0c42473
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _RIVE_STATE_MACHINE_INPUT_BASE_HPP_
+#define _RIVE_STATE_MACHINE_INPUT_BASE_HPP_
+#include "animation/state_machine_component.hpp"
+namespace rive
+{
+       class StateMachineInputBase : public StateMachineComponent
+       {
+       protected:
+               typedef StateMachineComponent Super;
+
+       public:
+               static const uint16_t typeKey = 55;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineInputBase::typeKey:
+                               case StateMachineComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_machine_layer_base.hpp b/submodule/include/generated/animation/state_machine_layer_base.hpp
new file mode 100644 (file)
index 0000000..59daa16
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _RIVE_STATE_MACHINE_LAYER_BASE_HPP_
+#define _RIVE_STATE_MACHINE_LAYER_BASE_HPP_
+#include "animation/state_machine_component.hpp"
+namespace rive
+{
+       class StateMachineLayerBase : public StateMachineComponent
+       {
+       protected:
+               typedef StateMachineComponent Super;
+
+       public:
+               static const uint16_t typeKey = 57;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineLayerBase::typeKey:
+                               case StateMachineComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_machine_layer_component_base.hpp b/submodule/include/generated/animation/state_machine_layer_component_base.hpp
new file mode 100644 (file)
index 0000000..bb397be
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _RIVE_STATE_MACHINE_LAYER_COMPONENT_BASE_HPP_
+#define _RIVE_STATE_MACHINE_LAYER_COMPONENT_BASE_HPP_
+#include "core.hpp"
+namespace rive
+{
+       class StateMachineLayerComponentBase : public Core
+       {
+       protected:
+               typedef Core Super;
+
+       public:
+               static const uint16_t typeKey = 66;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineLayerComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                       }
+                       return false;
+               }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_machine_trigger_base.hpp b/submodule/include/generated/animation/state_machine_trigger_base.hpp
new file mode 100644 (file)
index 0000000..226815d
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _RIVE_STATE_MACHINE_TRIGGER_BASE_HPP_
+#define _RIVE_STATE_MACHINE_TRIGGER_BASE_HPP_
+#include "animation/state_machine_input.hpp"
+namespace rive
+{
+       class StateMachineTriggerBase : public StateMachineInput
+       {
+       protected:
+               typedef StateMachineInput Super;
+
+       public:
+               static const uint16_t typeKey = 58;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateMachineTriggerBase::typeKey:
+                               case StateMachineInputBase::typeKey:
+                               case StateMachineComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/state_transition_base.hpp b/submodule/include/generated/animation/state_transition_base.hpp
new file mode 100644 (file)
index 0000000..11aca40
--- /dev/null
@@ -0,0 +1,97 @@
+#ifndef _RIVE_STATE_TRANSITION_BASE_HPP_
+#define _RIVE_STATE_TRANSITION_BASE_HPP_
+#include "animation/state_machine_layer_component.hpp"
+#include "core/field_types/core_uint_type.hpp"
+namespace rive
+{
+       class StateTransitionBase : public StateMachineLayerComponent
+       {
+       protected:
+               typedef StateMachineLayerComponent Super;
+
+       public:
+               static const uint16_t typeKey = 65;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case StateTransitionBase::typeKey:
+                               case StateMachineLayerComponentBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t stateToIdPropertyKey = 151;
+               static const uint16_t flagsPropertyKey = 152;
+               static const uint16_t durationPropertyKey = 158;
+
+       private:
+               int m_StateToId = -1;
+               int m_Flags = 0;
+               int m_Duration = 0;
+       public:
+               inline int stateToId() const { return m_StateToId; }
+               void stateToId(int value)
+               {
+                       if (m_StateToId == value)
+                       {
+                               return;
+                       }
+                       m_StateToId = value;
+                       stateToIdChanged();
+               }
+
+               inline int flags() const { return m_Flags; }
+               void flags(int value)
+               {
+                       if (m_Flags == value)
+                       {
+                               return;
+                       }
+                       m_Flags = value;
+                       flagsChanged();
+               }
+
+               inline int duration() const { return m_Duration; }
+               void duration(int value)
+               {
+                       if (m_Duration == value)
+                       {
+                               return;
+                       }
+                       m_Duration = value;
+                       durationChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case stateToIdPropertyKey:
+                                       m_StateToId = CoreUintType::deserialize(reader);
+                                       return true;
+                               case flagsPropertyKey:
+                                       m_Flags = CoreUintType::deserialize(reader);
+                                       return true;
+                               case durationPropertyKey:
+                                       m_Duration = CoreUintType::deserialize(reader);
+                                       return true;
+                       }
+                       return StateMachineLayerComponent::deserialize(propertyKey, reader);
+               }
+
+       protected:
+               virtual void stateToIdChanged() {}
+               virtual void flagsChanged() {}
+               virtual void durationChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/transition_bool_condition_base.hpp b/submodule/include/generated/animation/transition_bool_condition_base.hpp
new file mode 100644 (file)
index 0000000..3cc0156
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _RIVE_TRANSITION_BOOL_CONDITION_BASE_HPP_
+#define _RIVE_TRANSITION_BOOL_CONDITION_BASE_HPP_
+#include "animation/transition_value_condition.hpp"
+namespace rive
+{
+       class TransitionBoolConditionBase : public TransitionValueCondition
+       {
+       protected:
+               typedef TransitionValueCondition Super;
+
+       public:
+               static const uint16_t typeKey = 71;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case TransitionBoolConditionBase::typeKey:
+                               case TransitionValueConditionBase::typeKey:
+                               case TransitionConditionBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/transition_condition_base.hpp b/submodule/include/generated/animation/transition_condition_base.hpp
new file mode 100644 (file)
index 0000000..dd67d06
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef _RIVE_TRANSITION_CONDITION_BASE_HPP_
+#define _RIVE_TRANSITION_CONDITION_BASE_HPP_
+#include "core.hpp"
+#include "core/field_types/core_uint_type.hpp"
+namespace rive
+{
+       class TransitionConditionBase : public Core
+       {
+       protected:
+               typedef Core Super;
+
+       public:
+               static const uint16_t typeKey = 67;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case TransitionConditionBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t inputIdPropertyKey = 155;
+
+       private:
+               int m_InputId = -1;
+       public:
+               inline int inputId() const { return m_InputId; }
+               void inputId(int value)
+               {
+                       if (m_InputId == value)
+                       {
+                               return;
+                       }
+                       m_InputId = value;
+                       inputIdChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case inputIdPropertyKey:
+                                       m_InputId = CoreUintType::deserialize(reader);
+                                       return true;
+                       }
+                       return false;
+               }
+
+       protected:
+               virtual void inputIdChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/transition_double_condition_base.hpp b/submodule/include/generated/animation/transition_double_condition_base.hpp
new file mode 100644 (file)
index 0000000..991b4cd
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef _RIVE_TRANSITION_DOUBLE_CONDITION_BASE_HPP_
+#define _RIVE_TRANSITION_DOUBLE_CONDITION_BASE_HPP_
+#include "animation/transition_value_condition.hpp"
+#include "core/field_types/core_double_type.hpp"
+namespace rive
+{
+       class TransitionDoubleConditionBase : public TransitionValueCondition
+       {
+       protected:
+               typedef TransitionValueCondition Super;
+
+       public:
+               static const uint16_t typeKey = 70;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case TransitionDoubleConditionBase::typeKey:
+                               case TransitionValueConditionBase::typeKey:
+                               case TransitionConditionBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t valuePropertyKey = 157;
+
+       private:
+               float m_Value = 0.0f;
+       public:
+               inline float value() const { return m_Value; }
+               void value(float value)
+               {
+                       if (m_Value == value)
+                       {
+                               return;
+                       }
+                       m_Value = value;
+                       valueChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case valuePropertyKey:
+                                       m_Value = CoreDoubleType::deserialize(reader);
+                                       return true;
+                       }
+                       return TransitionValueCondition::deserialize(propertyKey, reader);
+               }
+
+       protected:
+               virtual void valueChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/transition_trigger_condition_base.hpp b/submodule/include/generated/animation/transition_trigger_condition_base.hpp
new file mode 100644 (file)
index 0000000..bffc6a4
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _RIVE_TRANSITION_TRIGGER_CONDITION_BASE_HPP_
+#define _RIVE_TRANSITION_TRIGGER_CONDITION_BASE_HPP_
+#include "animation/transition_condition.hpp"
+namespace rive
+{
+       class TransitionTriggerConditionBase : public TransitionCondition
+       {
+       protected:
+               typedef TransitionCondition Super;
+
+       public:
+               static const uint16_t typeKey = 68;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case TransitionTriggerConditionBase::typeKey:
+                               case TransitionConditionBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+       protected:
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
diff --git a/submodule/include/generated/animation/transition_value_condition_base.hpp b/submodule/include/generated/animation/transition_value_condition_base.hpp
new file mode 100644 (file)
index 0000000..229daaf
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef _RIVE_TRANSITION_VALUE_CONDITION_BASE_HPP_
+#define _RIVE_TRANSITION_VALUE_CONDITION_BASE_HPP_
+#include "animation/transition_condition.hpp"
+#include "core/field_types/core_uint_type.hpp"
+namespace rive
+{
+       class TransitionValueConditionBase : public TransitionCondition
+       {
+       protected:
+               typedef TransitionCondition Super;
+
+       public:
+               static const uint16_t typeKey = 69;
+
+               /// Helper to quickly determine if a core object extends another without
+               /// RTTI at runtime.
+               bool isTypeOf(uint16_t typeKey) const override
+               {
+                       switch (typeKey)
+                       {
+                               case TransitionValueConditionBase::typeKey:
+                               case TransitionConditionBase::typeKey:
+                                       return true;
+                               default:
+                                       return false;
+                       }
+               }
+
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t opValuePropertyKey = 156;
+
+       private:
+               int m_OpValue = 0;
+       public:
+               inline int opValue() const { return m_OpValue; }
+               void opValue(int value)
+               {
+                       if (m_OpValue == value)
+                       {
+                               return;
+                       }
+                       m_OpValue = value;
+                       opValueChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case opValuePropertyKey:
+                                       m_OpValue = CoreUintType::deserialize(reader);
+                                       return true;
+                       }
+                       return TransitionCondition::deserialize(propertyKey, reader);
+               }
+
+       protected:
+               virtual void opValueChanged() {}
+       };
+} // namespace rive
+
+#endif
\ No newline at end of file
index 0e01415..4521f13 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ContainerComponent Super;
 
        public:
-               static const int typeKey = 1;
+               static const uint16_t typeKey = 1;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,14 +27,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int widthPropertyKey = 7;
-               static const int heightPropertyKey = 8;
-               static const int xPropertyKey = 9;
-               static const int yPropertyKey = 10;
-               static const int originXPropertyKey = 11;
-               static const int originYPropertyKey = 12;
+               static const uint16_t widthPropertyKey = 7;
+               static const uint16_t heightPropertyKey = 8;
+               static const uint16_t xPropertyKey = 9;
+               static const uint16_t yPropertyKey = 10;
+               static const uint16_t originXPropertyKey = 11;
+               static const uint16_t originYPropertyKey = 12;
 
        private:
                float m_Width = 0.0f;
@@ -110,7 +110,7 @@ namespace rive
                        originYChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 8e83e53..3d95815 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef Core Super;
 
        public:
-               static const int typeKey = 23;
+               static const uint16_t typeKey = 23;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -24,9 +24,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 095d42c..9d92a4d 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef SkeletalComponent Super;
 
        public:
-               static const int typeKey = 40;
+               static const uint16_t typeKey = 40;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -29,12 +29,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int lengthPropertyKey = 89;
+               static const uint16_t lengthPropertyKey = 89;
 
        private:
-               float m_Length = 0;
+               float m_Length = 0.0f;
        public:
                inline float length() const { return m_Length; }
                void length(float value)
@@ -47,7 +47,7 @@ namespace rive
                        lengthChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 672bad3..3669429 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Weight Super;
 
        public:
-               static const int typeKey = 46;
+               static const uint16_t typeKey = 46;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,12 +27,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int inValuesPropertyKey = 110;
-               static const int inIndicesPropertyKey = 111;
-               static const int outValuesPropertyKey = 112;
-               static const int outIndicesPropertyKey = 113;
+               static const uint16_t inValuesPropertyKey = 110;
+               static const uint16_t inIndicesPropertyKey = 111;
+               static const uint16_t outValuesPropertyKey = 112;
+               static const uint16_t outIndicesPropertyKey = 113;
 
        private:
                int m_InValues = 255;
@@ -84,7 +84,7 @@ namespace rive
                        outIndicesChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index fe785e9..bb0dba1 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Bone Super;
 
        public:
-               static const int typeKey = 41;
+               static const uint16_t typeKey = 41;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -30,14 +30,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int xPropertyKey = 90;
-               static const int yPropertyKey = 91;
+               static const uint16_t xPropertyKey = 90;
+               static const uint16_t yPropertyKey = 91;
 
        private:
-               float m_X = 0;
-               float m_Y = 0;
+               float m_X = 0.0f;
+               float m_Y = 0.0f;
        public:
                inline float x() const override { return m_X; }
                void x(float value)
@@ -61,7 +61,7 @@ namespace rive
                        yChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index f5cbfb0..36fb59b 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef TransformComponent Super;
 
        public:
-               static const int typeKey = 39;
+               static const uint16_t typeKey = 39;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,7 +27,7 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
        protected:
        };
index 654832f..d802325 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ContainerComponent Super;
 
        public:
-               static const int typeKey = 43;
+               static const uint16_t typeKey = 43;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,22 +27,22 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int xxPropertyKey = 104;
-               static const int yxPropertyKey = 105;
-               static const int xyPropertyKey = 106;
-               static const int yyPropertyKey = 107;
-               static const int txPropertyKey = 108;
-               static const int tyPropertyKey = 109;
+               static const uint16_t xxPropertyKey = 104;
+               static const uint16_t yxPropertyKey = 105;
+               static const uint16_t xyPropertyKey = 106;
+               static const uint16_t yyPropertyKey = 107;
+               static const uint16_t txPropertyKey = 108;
+               static const uint16_t tyPropertyKey = 109;
 
        private:
-               float m_Xx = 1;
-               float m_Yx = 0;
-               float m_Xy = 0;
-               float m_Yy = 1;
-               float m_Tx = 0;
-               float m_Ty = 0;
+               float m_Xx = 1.0f;
+               float m_Yx = 0.0f;
+               float m_Xy = 0.0f;
+               float m_Yy = 1.0f;
+               float m_Tx = 0.0f;
+               float m_Ty = 0.0f;
        public:
                inline float xx() const { return m_Xx; }
                void xx(float value)
@@ -110,7 +110,7 @@ namespace rive
                        tyChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index a349cc5..415e706 100644 (file)
@@ -11,11 +11,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 44;
+               static const uint16_t typeKey = 44;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,24 +27,24 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int boneIdPropertyKey = 95;
-               static const int xxPropertyKey = 96;
-               static const int yxPropertyKey = 97;
-               static const int xyPropertyKey = 98;
-               static const int yyPropertyKey = 99;
-               static const int txPropertyKey = 100;
-               static const int tyPropertyKey = 101;
+               static const uint16_t boneIdPropertyKey = 95;
+               static const uint16_t xxPropertyKey = 96;
+               static const uint16_t yxPropertyKey = 97;
+               static const uint16_t xyPropertyKey = 98;
+               static const uint16_t yyPropertyKey = 99;
+               static const uint16_t txPropertyKey = 100;
+               static const uint16_t tyPropertyKey = 101;
 
        private:
-               int m_BoneId = 0;
-               float m_Xx = 1;
-               float m_Yx = 0;
-               float m_Xy = 0;
-               float m_Yy = 1;
-               float m_Tx = 0;
-               float m_Ty = 0;
+               int m_BoneId = -1;
+               float m_Xx = 1.0f;
+               float m_Yx = 0.0f;
+               float m_Xy = 0.0f;
+               float m_Yy = 1.0f;
+               float m_Tx = 0.0f;
+               float m_Ty = 0.0f;
        public:
                inline int boneId() const { return m_BoneId; }
                void boneId(int value)
@@ -123,7 +123,7 @@ namespace rive
                        tyChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 5ec83aa..108ccb7 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 45;
+               static const uint16_t typeKey = 45;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -26,10 +26,10 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int valuesPropertyKey = 102;
-               static const int indicesPropertyKey = 103;
+               static const uint16_t valuesPropertyKey = 102;
+               static const uint16_t indicesPropertyKey = 103;
 
        private:
                int m_Values = 255;
@@ -57,7 +57,7 @@ namespace rive
                        indicesChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index d64eff6..a4b3176 100644 (file)
@@ -12,11 +12,11 @@ namespace rive
                typedef Core Super;
 
        public:
-               static const int typeKey = 10;
+               static const uint16_t typeKey = 10;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,10 +27,10 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int namePropertyKey = 4;
-               static const int parentIdPropertyKey = 5;
+               static const uint16_t namePropertyKey = 4;
+               static const uint16_t parentIdPropertyKey = 5;
 
        private:
                std::string m_Name = "";
@@ -58,7 +58,7 @@ namespace rive
                        parentIdChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 9087500..25cc2c0 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 11;
+               static const uint16_t typeKey = 11;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -25,7 +25,7 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
        protected:
        };
index 7acf1d4..00b0e91 100644 (file)
@@ -1,14 +1,33 @@
 #ifndef _RIVE_CORE_REGISTRY_HPP_
 #define _RIVE_CORE_REGISTRY_HPP_
 #include "animation/animation.hpp"
+#include "animation/animation_state.hpp"
+#include "animation/any_state.hpp"
 #include "animation/cubic_interpolator.hpp"
+#include "animation/entry_state.hpp"
+#include "animation/exit_state.hpp"
 #include "animation/keyed_object.hpp"
 #include "animation/keyed_property.hpp"
 #include "animation/keyframe.hpp"
 #include "animation/keyframe_color.hpp"
 #include "animation/keyframe_double.hpp"
 #include "animation/keyframe_id.hpp"
+#include "animation/layer_state.hpp"
 #include "animation/linear_animation.hpp"
+#include "animation/state_machine.hpp"
+#include "animation/state_machine_bool.hpp"
+#include "animation/state_machine_component.hpp"
+#include "animation/state_machine_double.hpp"
+#include "animation/state_machine_input.hpp"
+#include "animation/state_machine_layer.hpp"
+#include "animation/state_machine_layer_component.hpp"
+#include "animation/state_machine_trigger.hpp"
+#include "animation/state_transition.hpp"
+#include "animation/transition_bool_condition.hpp"
+#include "animation/transition_condition.hpp"
+#include "animation/transition_double_condition.hpp"
+#include "animation/transition_trigger_condition.hpp"
+#include "animation/transition_value_condition.hpp"
 #include "artboard.hpp"
 #include "backboard.hpp"
 #include "bones/bone.hpp"
@@ -40,7 +59,6 @@
 #include "shapes/paint/trim_path.hpp"
 #include "shapes/parametric_path.hpp"
 #include "shapes/path.hpp"
-#include "shapes/path_composer.hpp"
 #include "shapes/path_vertex.hpp"
 #include "shapes/points_path.hpp"
 #include "shapes/polygon.hpp"
@@ -61,22 +79,48 @@ namespace rive
                        {
                                case DrawTargetBase::typeKey:
                                        return new DrawTarget();
+                               case AnimationStateBase::typeKey:
+                                       return new AnimationState();
                                case KeyedObjectBase::typeKey:
                                        return new KeyedObject();
+                               case TransitionTriggerConditionBase::typeKey:
+                                       return new TransitionTriggerCondition();
                                case KeyedPropertyBase::typeKey:
                                        return new KeyedProperty();
+                               case StateMachineDoubleBase::typeKey:
+                                       return new StateMachineDouble();
                                case KeyFrameIdBase::typeKey:
                                        return new KeyFrameId();
+                               case AnyStateBase::typeKey:
+                                       return new AnyState();
+                               case StateMachineLayerBase::typeKey:
+                                       return new StateMachineLayer();
                                case AnimationBase::typeKey:
                                        return new Animation();
                                case CubicInterpolatorBase::typeKey:
                                        return new CubicInterpolator();
+                               case TransitionDoubleConditionBase::typeKey:
+                                       return new TransitionDoubleCondition();
+                               case StateTransitionBase::typeKey:
+                                       return new StateTransition();
                                case KeyFrameDoubleBase::typeKey:
                                        return new KeyFrameDouble();
                                case KeyFrameColorBase::typeKey:
                                        return new KeyFrameColor();
+                               case StateMachineBase::typeKey:
+                                       return new StateMachine();
+                               case EntryStateBase::typeKey:
+                                       return new EntryState();
                                case LinearAnimationBase::typeKey:
                                        return new LinearAnimation();
+                               case StateMachineTriggerBase::typeKey:
+                                       return new StateMachineTrigger();
+                               case ExitStateBase::typeKey:
+                                       return new ExitState();
+                               case TransitionBoolConditionBase::typeKey:
+                                       return new TransitionBoolCondition();
+                               case StateMachineBoolBase::typeKey:
+                                       return new StateMachineBool();
                                case LinearGradientBase::typeKey:
                                        return new LinearGradient();
                                case RadialGradientBase::typeKey:
@@ -115,8 +159,6 @@ namespace rive
                                        return new Polygon();
                                case StarBase::typeKey:
                                        return new Star();
-                               case PathComposerBase::typeKey:
-                                       return new PathComposer();
                                case CubicDetachedVertexBase::typeKey:
                                        return new CubicDetachedVertex();
                                case DrawRulesBase::typeKey:
@@ -147,6 +189,9 @@ namespace rive
                                case ComponentBase::namePropertyKey:
                                        object->as<ComponentBase>()->name(value);
                                        break;
+                               case StateMachineComponentBase::namePropertyKey:
+                                       object->as<StateMachineComponentBase>()->name(value);
+                                       break;
                                case AnimationBase::namePropertyKey:
                                        object->as<AnimationBase>()->name(value);
                                        break;
@@ -165,9 +210,15 @@ namespace rive
                                case DrawTargetBase::placementValuePropertyKey:
                                        object->as<DrawTargetBase>()->placementValue(value);
                                        break;
+                               case AnimationStateBase::animationIdPropertyKey:
+                                       object->as<AnimationStateBase>()->animationId(value);
+                                       break;
                                case KeyedObjectBase::objectIdPropertyKey:
                                        object->as<KeyedObjectBase>()->objectId(value);
                                        break;
+                               case TransitionConditionBase::inputIdPropertyKey:
+                                       object->as<TransitionConditionBase>()->inputId(value);
+                                       break;
                                case KeyedPropertyBase::propertyKeyPropertyKey:
                                        object->as<KeyedPropertyBase>()->propertyKey(value);
                                        break;
@@ -183,6 +234,18 @@ namespace rive
                                case KeyFrameIdBase::valuePropertyKey:
                                        object->as<KeyFrameIdBase>()->value(value);
                                        break;
+                               case TransitionValueConditionBase::opValuePropertyKey:
+                                       object->as<TransitionValueConditionBase>()->opValue(value);
+                                       break;
+                               case StateTransitionBase::stateToIdPropertyKey:
+                                       object->as<StateTransitionBase>()->stateToId(value);
+                                       break;
+                               case StateTransitionBase::flagsPropertyKey:
+                                       object->as<StateTransitionBase>()->flags(value);
+                                       break;
+                               case StateTransitionBase::durationPropertyKey:
+                                       object->as<StateTransitionBase>()->duration(value);
+                                       break;
                                case LinearAnimationBase::fpsPropertyKey:
                                        object->as<LinearAnimationBase>()->fps(value);
                                        break;
@@ -210,9 +273,15 @@ namespace rive
                                case FillBase::fillRulePropertyKey:
                                        object->as<FillBase>()->fillRule(value);
                                        break;
+                               case PathBase::pathFlagsPropertyKey:
+                                       object->as<PathBase>()->pathFlags(value);
+                                       break;
                                case DrawableBase::blendModeValuePropertyKey:
                                        object->as<DrawableBase>()->blendModeValue(value);
                                        break;
+                               case DrawableBase::drawableFlagsPropertyKey:
+                                       object->as<DrawableBase>()->drawableFlags(value);
+                                       break;
                                case ClippingShapeBase::sourceIdPropertyKey:
                                        object->as<ClippingShapeBase>()->sourceId(value);
                                        break;
@@ -252,6 +321,9 @@ namespace rive
                {
                        switch (propertyKey)
                        {
+                               case StateMachineDoubleBase::valuePropertyKey:
+                                       object->as<StateMachineDoubleBase>()->value(value);
+                                       break;
                                case CubicInterpolatorBase::x1PropertyKey:
                                        object->as<CubicInterpolatorBase>()->x1(value);
                                        break;
@@ -264,6 +336,9 @@ namespace rive
                                case CubicInterpolatorBase::y2PropertyKey:
                                        object->as<CubicInterpolatorBase>()->y2(value);
                                        break;
+                               case TransitionDoubleConditionBase::valuePropertyKey:
+                                       object->as<TransitionDoubleConditionBase>()->value(value);
+                                       break;
                                case KeyFrameDoubleBase::valuePropertyKey:
                                        object->as<KeyFrameDoubleBase>()->value(value);
                                        break;
@@ -462,6 +537,9 @@ namespace rive
                                case LinearAnimationBase::enableWorkAreaPropertyKey:
                                        object->as<LinearAnimationBase>()->enableWorkArea(value);
                                        break;
+                               case StateMachineBoolBase::valuePropertyKey:
+                                       object->as<StateMachineBoolBase>()->value(value);
+                                       break;
                                case ShapePaintBase::isVisiblePropertyKey:
                                        object->as<ShapePaintBase>()->isVisible(value);
                                        break;
@@ -482,6 +560,8 @@ namespace rive
                        {
                                case ComponentBase::namePropertyKey:
                                        return object->as<ComponentBase>()->name();
+                               case StateMachineComponentBase::namePropertyKey:
+                                       return object->as<StateMachineComponentBase>()->name();
                                case AnimationBase::namePropertyKey:
                                        return object->as<AnimationBase>()->name();
                        }
@@ -497,8 +577,12 @@ namespace rive
                                        return object->as<DrawTargetBase>()->drawableId();
                                case DrawTargetBase::placementValuePropertyKey:
                                        return object->as<DrawTargetBase>()->placementValue();
+                               case AnimationStateBase::animationIdPropertyKey:
+                                       return object->as<AnimationStateBase>()->animationId();
                                case KeyedObjectBase::objectIdPropertyKey:
                                        return object->as<KeyedObjectBase>()->objectId();
+                               case TransitionConditionBase::inputIdPropertyKey:
+                                       return object->as<TransitionConditionBase>()->inputId();
                                case KeyedPropertyBase::propertyKeyPropertyKey:
                                        return object->as<KeyedPropertyBase>()->propertyKey();
                                case KeyFrameBase::framePropertyKey:
@@ -509,6 +593,15 @@ namespace rive
                                        return object->as<KeyFrameBase>()->interpolatorId();
                                case KeyFrameIdBase::valuePropertyKey:
                                        return object->as<KeyFrameIdBase>()->value();
+                               case TransitionValueConditionBase::opValuePropertyKey:
+                                       return object->as<TransitionValueConditionBase>()
+                                           ->opValue();
+                               case StateTransitionBase::stateToIdPropertyKey:
+                                       return object->as<StateTransitionBase>()->stateToId();
+                               case StateTransitionBase::flagsPropertyKey:
+                                       return object->as<StateTransitionBase>()->flags();
+                               case StateTransitionBase::durationPropertyKey:
+                                       return object->as<StateTransitionBase>()->duration();
                                case LinearAnimationBase::fpsPropertyKey:
                                        return object->as<LinearAnimationBase>()->fps();
                                case LinearAnimationBase::durationPropertyKey:
@@ -527,8 +620,12 @@ namespace rive
                                        return object->as<TrimPathBase>()->modeValue();
                                case FillBase::fillRulePropertyKey:
                                        return object->as<FillBase>()->fillRule();
+                               case PathBase::pathFlagsPropertyKey:
+                                       return object->as<PathBase>()->pathFlags();
                                case DrawableBase::blendModeValuePropertyKey:
                                        return object->as<DrawableBase>()->blendModeValue();
+                               case DrawableBase::drawableFlagsPropertyKey:
+                                       return object->as<DrawableBase>()->drawableFlags();
                                case ClippingShapeBase::sourceIdPropertyKey:
                                        return object->as<ClippingShapeBase>()->sourceId();
                                case ClippingShapeBase::fillRulePropertyKey:
@@ -558,6 +655,8 @@ namespace rive
                {
                        switch (propertyKey)
                        {
+                               case StateMachineDoubleBase::valuePropertyKey:
+                                       return object->as<StateMachineDoubleBase>()->value();
                                case CubicInterpolatorBase::x1PropertyKey:
                                        return object->as<CubicInterpolatorBase>()->x1();
                                case CubicInterpolatorBase::y1PropertyKey:
@@ -566,6 +665,8 @@ namespace rive
                                        return object->as<CubicInterpolatorBase>()->x2();
                                case CubicInterpolatorBase::y2PropertyKey:
                                        return object->as<CubicInterpolatorBase>()->y2();
+                               case TransitionDoubleConditionBase::valuePropertyKey:
+                                       return object->as<TransitionDoubleConditionBase>()->value();
                                case KeyFrameDoubleBase::valuePropertyKey:
                                        return object->as<KeyFrameDoubleBase>()->value();
                                case LinearAnimationBase::speedPropertyKey:
@@ -706,6 +807,8 @@ namespace rive
                        {
                                case LinearAnimationBase::enableWorkAreaPropertyKey:
                                        return object->as<LinearAnimationBase>()->enableWorkArea();
+                               case StateMachineBoolBase::valuePropertyKey:
+                                       return object->as<StateMachineBoolBase>()->value();
                                case ShapePaintBase::isVisiblePropertyKey:
                                        return object->as<ShapePaintBase>()->isVisible();
                                case StrokeBase::transformAffectsStrokePropertyKey:
@@ -722,17 +825,24 @@ namespace rive
                        switch (propertyKey)
                        {
                                case ComponentBase::namePropertyKey:
+                               case StateMachineComponentBase::namePropertyKey:
                                case AnimationBase::namePropertyKey:
                                        return CoreStringType::id;
                                case ComponentBase::parentIdPropertyKey:
                                case DrawTargetBase::drawableIdPropertyKey:
                                case DrawTargetBase::placementValuePropertyKey:
+                               case AnimationStateBase::animationIdPropertyKey:
                                case KeyedObjectBase::objectIdPropertyKey:
+                               case TransitionConditionBase::inputIdPropertyKey:
                                case KeyedPropertyBase::propertyKeyPropertyKey:
                                case KeyFrameBase::framePropertyKey:
                                case KeyFrameBase::interpolationTypePropertyKey:
                                case KeyFrameBase::interpolatorIdPropertyKey:
                                case KeyFrameIdBase::valuePropertyKey:
+                               case TransitionValueConditionBase::opValuePropertyKey:
+                               case StateTransitionBase::stateToIdPropertyKey:
+                               case StateTransitionBase::flagsPropertyKey:
+                               case StateTransitionBase::durationPropertyKey:
                                case LinearAnimationBase::fpsPropertyKey:
                                case LinearAnimationBase::durationPropertyKey:
                                case LinearAnimationBase::loopValuePropertyKey:
@@ -742,9 +852,12 @@ namespace rive
                                case StrokeBase::joinPropertyKey:
                                case TrimPathBase::modeValuePropertyKey:
                                case FillBase::fillRulePropertyKey:
+                               case PathBase::pathFlagsPropertyKey:
                                case DrawableBase::blendModeValuePropertyKey:
+                               case DrawableBase::drawableFlagsPropertyKey:
                                case ClippingShapeBase::sourceIdPropertyKey:
                                case ClippingShapeBase::fillRulePropertyKey:
+                               case PolygonBase::pointsPropertyKey:
                                case DrawRulesBase::drawTargetIdPropertyKey:
                                case WeightBase::valuesPropertyKey:
                                case WeightBase::indicesPropertyKey:
@@ -754,10 +867,12 @@ namespace rive
                                case CubicWeightBase::outValuesPropertyKey:
                                case CubicWeightBase::outIndicesPropertyKey:
                                        return CoreUintType::id;
+                               case StateMachineDoubleBase::valuePropertyKey:
                                case CubicInterpolatorBase::x1PropertyKey:
                                case CubicInterpolatorBase::y1PropertyKey:
                                case CubicInterpolatorBase::x2PropertyKey:
                                case CubicInterpolatorBase::y2PropertyKey:
+                               case TransitionDoubleConditionBase::valuePropertyKey:
                                case KeyFrameDoubleBase::valuePropertyKey:
                                case LinearAnimationBase::speedPropertyKey:
                                case LinearGradientBase::startXPropertyKey:
@@ -789,6 +904,8 @@ namespace rive
                                case RectangleBase::cornerRadiusPropertyKey:
                                case CubicMirroredVertexBase::rotationPropertyKey:
                                case CubicMirroredVertexBase::distancePropertyKey:
+                               case PolygonBase::cornerRadiusPropertyKey:
+                               case StarBase::innerRadiusPropertyKey:
                                case CubicDetachedVertexBase::inRotationPropertyKey:
                                case CubicDetachedVertexBase::inDistancePropertyKey:
                                case CubicDetachedVertexBase::outRotationPropertyKey:
@@ -820,6 +937,7 @@ namespace rive
                                case GradientStopBase::colorValuePropertyKey:
                                        return CoreColorType::id;
                                case LinearAnimationBase::enableWorkAreaPropertyKey:
+                               case StateMachineBoolBase::valuePropertyKey:
                                case ShapePaintBase::isVisiblePropertyKey:
                                case StrokeBase::transformAffectsStrokePropertyKey:
                                case PointsPathBase::isClosedPropertyKey:
index a96e039..90f1f64 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ContainerComponent Super;
 
        public:
-               static const int typeKey = 49;
+               static const uint16_t typeKey = 49;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,12 +27,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int drawTargetIdPropertyKey = 121;
+               static const uint16_t drawTargetIdPropertyKey = 121;
 
        private:
-               int m_DrawTargetId = 0;
+               int m_DrawTargetId = -1;
        public:
                inline int drawTargetId() const { return m_DrawTargetId; }
                void drawTargetId(int value)
@@ -45,7 +45,7 @@ namespace rive
                        drawTargetIdChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 4c46318..3d54329 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 48;
+               static const uint16_t typeKey = 48;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -26,13 +26,13 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int drawableIdPropertyKey = 119;
-               static const int placementValuePropertyKey = 120;
+               static const uint16_t drawableIdPropertyKey = 119;
+               static const uint16_t placementValuePropertyKey = 120;
 
        private:
-               int m_DrawableId = 0;
+               int m_DrawableId = -1;
                int m_PlacementValue = 0;
        public:
                inline int drawableId() const { return m_DrawableId; }
@@ -57,7 +57,7 @@ namespace rive
                        placementValueChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 8f00524..5845776 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Node Super;
 
        public:
-               static const int typeKey = 13;
+               static const uint16_t typeKey = 13;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -29,12 +29,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int blendModeValuePropertyKey = 23;
+               static const uint16_t blendModeValuePropertyKey = 23;
+               static const uint16_t drawableFlagsPropertyKey = 129;
 
        private:
                int m_BlendModeValue = 3;
+               int m_DrawableFlags = 0;
        public:
                inline int blendModeValue() const { return m_BlendModeValue; }
                void blendModeValue(int value)
@@ -47,19 +49,34 @@ namespace rive
                        blendModeValueChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               inline int drawableFlags() const { return m_DrawableFlags; }
+               void drawableFlags(int value)
+               {
+                       if (m_DrawableFlags == value)
+                       {
+                               return;
+                       }
+                       m_DrawableFlags = value;
+                       drawableFlagsChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
                                case blendModeValuePropertyKey:
                                        m_BlendModeValue = CoreUintType::deserialize(reader);
                                        return true;
+                               case drawableFlagsPropertyKey:
+                                       m_DrawableFlags = CoreUintType::deserialize(reader);
+                                       return true;
                        }
                        return Node::deserialize(propertyKey, reader);
                }
 
        protected:
                virtual void blendModeValueChanged() {}
+               virtual void drawableFlagsChanged() {}
        };
 } // namespace rive
 
index 3f1782f..39c52c8 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef TransformComponent Super;
 
        public:
-               static const int typeKey = 2;
+               static const uint16_t typeKey = 2;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -28,14 +28,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int xPropertyKey = 13;
-               static const int yPropertyKey = 14;
+               static const uint16_t xPropertyKey = 13;
+               static const uint16_t yPropertyKey = 14;
 
        private:
-               float m_X = 0;
-               float m_Y = 0;
+               float m_X = 0.0f;
+               float m_Y = 0.0f;
        public:
                inline float x() const override { return m_X; }
                void x(float value)
@@ -59,7 +59,7 @@ namespace rive
                        yChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 761fd14..dc5cd7d 100644 (file)
@@ -11,11 +11,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 42;
+               static const uint16_t typeKey = 42;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,14 +27,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int sourceIdPropertyKey = 92;
-               static const int fillRulePropertyKey = 93;
-               static const int isVisiblePropertyKey = 94;
+               static const uint16_t sourceIdPropertyKey = 92;
+               static const uint16_t fillRulePropertyKey = 93;
+               static const uint16_t isVisiblePropertyKey = 94;
 
        private:
-               int m_SourceId = 0;
+               int m_SourceId = -1;
                int m_FillRule = 0;
                bool m_IsVisible = true;
        public:
@@ -71,7 +71,7 @@ namespace rive
                        isVisibleChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index e7501e8..b28cc6a 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef CubicVertex Super;
 
        public:
-               static const int typeKey = 34;
+               static const uint16_t typeKey = 34;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -29,16 +29,16 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int rotationPropertyKey = 79;
-               static const int inDistancePropertyKey = 80;
-               static const int outDistancePropertyKey = 81;
+               static const uint16_t rotationPropertyKey = 79;
+               static const uint16_t inDistancePropertyKey = 80;
+               static const uint16_t outDistancePropertyKey = 81;
 
        private:
-               float m_Rotation = 0;
-               float m_InDistance = 0;
-               float m_OutDistance = 0;
+               float m_Rotation = 0.0f;
+               float m_InDistance = 0.0f;
+               float m_OutDistance = 0.0f;
        public:
                inline float rotation() const { return m_Rotation; }
                void rotation(float value)
@@ -73,7 +73,7 @@ namespace rive
                        outDistanceChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 88be673..4b59696 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef CubicVertex Super;
 
        public:
-               static const int typeKey = 6;
+               static const uint16_t typeKey = 6;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -29,18 +29,18 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int inRotationPropertyKey = 84;
-               static const int inDistancePropertyKey = 85;
-               static const int outRotationPropertyKey = 86;
-               static const int outDistancePropertyKey = 87;
+               static const uint16_t inRotationPropertyKey = 84;
+               static const uint16_t inDistancePropertyKey = 85;
+               static const uint16_t outRotationPropertyKey = 86;
+               static const uint16_t outDistancePropertyKey = 87;
 
        private:
-               float m_InRotation = 0;
-               float m_InDistance = 0;
-               float m_OutRotation = 0;
-               float m_OutDistance = 0;
+               float m_InRotation = 0.0f;
+               float m_InDistance = 0.0f;
+               float m_OutRotation = 0.0f;
+               float m_OutDistance = 0.0f;
        public:
                inline float inRotation() const { return m_InRotation; }
                void inRotation(float value)
@@ -86,7 +86,7 @@ namespace rive
                        outDistanceChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index d74bbe9..aeb3fe5 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef CubicVertex Super;
 
        public:
-               static const int typeKey = 35;
+               static const uint16_t typeKey = 35;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -29,14 +29,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int rotationPropertyKey = 82;
-               static const int distancePropertyKey = 83;
+               static const uint16_t rotationPropertyKey = 82;
+               static const uint16_t distancePropertyKey = 83;
 
        private:
-               float m_Rotation = 0;
-               float m_Distance = 0;
+               float m_Rotation = 0.0f;
+               float m_Distance = 0.0f;
        public:
                inline float rotation() const { return m_Rotation; }
                void rotation(float value)
@@ -60,7 +60,7 @@ namespace rive
                        distanceChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 362ab20..fa739d9 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef PathVertex Super;
 
        public:
-               static const int typeKey = 36;
+               static const uint16_t typeKey = 36;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,7 +27,7 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
        protected:
        };
index d0b763b..484277b 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef ParametricPath Super;
 
        public:
-               static const int typeKey = 4;
+               static const uint16_t typeKey = 4;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -30,7 +30,7 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
        protected:
        };
index e07d325..9d5138c 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ShapePaint Super;
 
        public:
-               static const int typeKey = 20;
+               static const uint16_t typeKey = 20;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -28,9 +28,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int fillRulePropertyKey = 40;
+               static const uint16_t fillRulePropertyKey = 40;
 
        private:
                int m_FillRule = 0;
@@ -46,7 +46,7 @@ namespace rive
                        fillRuleChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index baeb204..41222dd 100644 (file)
@@ -11,11 +11,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 19;
+               static const uint16_t typeKey = 19;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,14 +27,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int colorValuePropertyKey = 38;
-               static const int positionPropertyKey = 39;
+               static const uint16_t colorValuePropertyKey = 38;
+               static const uint16_t positionPropertyKey = 39;
 
        private:
                int m_ColorValue = 0xFFFFFFFF;
-               float m_Position = 0;
+               float m_Position = 0.0f;
        public:
                inline int colorValue() const { return m_ColorValue; }
                void colorValue(int value)
@@ -58,7 +58,7 @@ namespace rive
                        positionChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index c217207..197c4db 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ContainerComponent Super;
 
        public:
-               static const int typeKey = 22;
+               static const uint16_t typeKey = 22;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,20 +27,20 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int startXPropertyKey = 42;
-               static const int startYPropertyKey = 33;
-               static const int endXPropertyKey = 34;
-               static const int endYPropertyKey = 35;
-               static const int opacityPropertyKey = 46;
+               static const uint16_t startXPropertyKey = 42;
+               static const uint16_t startYPropertyKey = 33;
+               static const uint16_t endXPropertyKey = 34;
+               static const uint16_t endYPropertyKey = 35;
+               static const uint16_t opacityPropertyKey = 46;
 
        private:
-               float m_StartX = 0;
-               float m_StartY = 0;
-               float m_EndX = 0;
-               float m_EndY = 0;
-               float m_Opacity = 1;
+               float m_StartX = 0.0f;
+               float m_StartY = 0.0f;
+               float m_EndX = 0.0f;
+               float m_EndY = 0.0f;
+               float m_Opacity = 1.0f;
        public:
                inline float startX() const { return m_StartX; }
                void startX(float value)
@@ -97,7 +97,7 @@ namespace rive
                        opacityChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 620f2d0..c0b8233 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef LinearGradient Super;
 
        public:
-               static const int typeKey = 17;
+               static const uint16_t typeKey = 17;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,7 +27,7 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
        protected:
        };
index 5b491ba..5179f11 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ContainerComponent Super;
 
        public:
-               static const int typeKey = 21;
+               static const uint16_t typeKey = 21;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,9 +27,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int isVisiblePropertyKey = 41;
+               static const uint16_t isVisiblePropertyKey = 41;
 
        private:
                bool m_IsVisible = true;
@@ -45,7 +45,7 @@ namespace rive
                        isVisibleChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 2341067..c05c918 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 18;
+               static const uint16_t typeKey = 18;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -26,9 +26,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int colorValuePropertyKey = 37;
+               static const uint16_t colorValuePropertyKey = 37;
 
        private:
                int m_ColorValue = 0xFF747474;
@@ -44,7 +44,7 @@ namespace rive
                        colorValueChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 39104c5..236e96d 100644 (file)
@@ -12,11 +12,11 @@ namespace rive
                typedef ShapePaint Super;
 
        public:
-               static const int typeKey = 24;
+               static const uint16_t typeKey = 24;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -30,15 +30,15 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int thicknessPropertyKey = 47;
-               static const int capPropertyKey = 48;
-               static const int joinPropertyKey = 49;
-               static const int transformAffectsStrokePropertyKey = 50;
+               static const uint16_t thicknessPropertyKey = 47;
+               static const uint16_t capPropertyKey = 48;
+               static const uint16_t joinPropertyKey = 49;
+               static const uint16_t transformAffectsStrokePropertyKey = 50;
 
        private:
-               float m_Thickness = 1;
+               float m_Thickness = 1.0f;
                int m_Cap = 0;
                int m_Join = 0;
                bool m_TransformAffectsStroke = true;
@@ -90,7 +90,7 @@ namespace rive
                        transformAffectsStrokeChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index ee5c03d..6274e8d 100644 (file)
@@ -11,11 +11,11 @@ namespace rive
                typedef Component Super;
 
        public:
-               static const int typeKey = 47;
+               static const uint16_t typeKey = 47;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,17 +27,17 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int startPropertyKey = 114;
-               static const int endPropertyKey = 115;
-               static const int offsetPropertyKey = 116;
-               static const int modeValuePropertyKey = 117;
+               static const uint16_t startPropertyKey = 114;
+               static const uint16_t endPropertyKey = 115;
+               static const uint16_t offsetPropertyKey = 116;
+               static const uint16_t modeValuePropertyKey = 117;
 
        private:
-               float m_Start = 0;
-               float m_End = 0;
-               float m_Offset = 0;
+               float m_Start = 0.0f;
+               float m_End = 0.0f;
+               float m_Offset = 0.0f;
                int m_ModeValue = 0;
        public:
                inline float start() const { return m_Start; }
@@ -84,7 +84,7 @@ namespace rive
                        modeValueChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 1bb823c..7f955ce 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Path Super;
 
        public:
-               static const int typeKey = 15;
+               static const uint16_t typeKey = 15;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -30,18 +30,18 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int widthPropertyKey = 20;
-               static const int heightPropertyKey = 21;
-               static const int originXPropertyKey = 123;
-               static const int originYPropertyKey = 124;
+               static const uint16_t widthPropertyKey = 20;
+               static const uint16_t heightPropertyKey = 21;
+               static const uint16_t originXPropertyKey = 123;
+               static const uint16_t originYPropertyKey = 124;
 
        private:
-               float m_Width = 0;
-               float m_Height = 0;
-               float m_OriginX = 0.5;
-               float m_OriginY = 0.5;
+               float m_Width = 0.0f;
+               float m_Height = 0.0f;
+               float m_OriginX = 0.5f;
+               float m_OriginY = 0.5f;
        public:
                inline float width() const { return m_Width; }
                void width(float value)
@@ -87,7 +87,7 @@ namespace rive
                        originYChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 9693df5..b881932 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef _RIVE_PATH_BASE_HPP_
 #define _RIVE_PATH_BASE_HPP_
+#include "core/field_types/core_uint_type.hpp"
 #include "node.hpp"
 namespace rive
 {
@@ -9,11 +10,11 @@ namespace rive
                typedef Node Super;
 
        public:
-               static const int typeKey = 12;
+               static const uint16_t typeKey = 12;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -28,9 +29,37 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
+
+               static const uint16_t pathFlagsPropertyKey = 128;
+
+       private:
+               int m_PathFlags = 0;
+       public:
+               inline int pathFlags() const { return m_PathFlags; }
+               void pathFlags(int value)
+               {
+                       if (m_PathFlags == value)
+                       {
+                               return;
+                       }
+                       m_PathFlags = value;
+                       pathFlagsChanged();
+               }
+
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
+               {
+                       switch (propertyKey)
+                       {
+                               case pathFlagsPropertyKey:
+                                       m_PathFlags = CoreUintType::deserialize(reader);
+                                       return true;
+                       }
+                       return Node::deserialize(propertyKey, reader);
+               }
 
        protected:
+               virtual void pathFlagsChanged() {}
        };
 } // namespace rive
 
diff --git a/submodule/include/generated/shapes/path_composer_base.hpp b/submodule/include/generated/shapes/path_composer_base.hpp
deleted file mode 100644 (file)
index cf56b7a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _RIVE_PATH_COMPOSER_BASE_HPP_
-#define _RIVE_PATH_COMPOSER_BASE_HPP_
-#include "component.hpp"
-namespace rive
-{
-       class PathComposerBase : public Component
-       {
-       protected:
-               typedef Component Super;
-
-       public:
-               static const int typeKey = 9;
-
-               /// Helper to quickly determine if a core object extends another without
-               /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
-               {
-                       switch (typeKey)
-                       {
-                               case PathComposerBase::typeKey:
-                               case ComponentBase::typeKey:
-                                       return true;
-                               default:
-                                       return false;
-                       }
-               }
-
-               int coreType() const override { return typeKey; }
-
-       protected:
-       };
-} // namespace rive
-
-#endif
\ No newline at end of file
index af226c9..80b929b 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ContainerComponent Super;
 
        public:
-               static const int typeKey = 14;
+               static const uint16_t typeKey = 14;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,10 +27,10 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int xPropertyKey = 24;
-               static const int yPropertyKey = 25;
+               static const uint16_t xPropertyKey = 24;
+               static const uint16_t yPropertyKey = 25;
 
        private:
                float m_X = 0.0f;
@@ -58,7 +58,7 @@ namespace rive
                        yChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 6a286f0..2359c89 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Path Super;
 
        public:
-               static const int typeKey = 16;
+               static const uint16_t typeKey = 16;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -30,9 +30,9 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int isClosedPropertyKey = 32;
+               static const uint16_t isClosedPropertyKey = 32;
 
        private:
                bool m_IsClosed = false;
@@ -48,7 +48,7 @@ namespace rive
                        isClosedChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index a92c47a..9adb1aa 100644 (file)
@@ -11,11 +11,11 @@ namespace rive
                typedef ParametricPath Super;
 
        public:
-               static const int typeKey = 51;
+               static const uint16_t typeKey = 51;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -32,14 +32,14 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int pointsPropertyKey = 125;
-               static const int cornerRadiusPropertyKey = 126;
+               static const uint16_t pointsPropertyKey = 125;
+               static const uint16_t cornerRadiusPropertyKey = 126;
 
        private:
                int m_Points = 5;
-               float m_CornerRadius = 0;
+               float m_CornerRadius = 0.0f;
        public:
                inline int points() const { return m_Points; }
                void points(int value)
@@ -63,7 +63,7 @@ namespace rive
                        cornerRadiusChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 1109812..46e42f0 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ParametricPath Super;
 
        public:
-               static const int typeKey = 7;
+               static const uint16_t typeKey = 7;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -31,12 +31,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int cornerRadiusPropertyKey = 31;
+               static const uint16_t cornerRadiusPropertyKey = 31;
 
        private:
-               float m_CornerRadius = 0;
+               float m_CornerRadius = 0.0f;
        public:
                inline float cornerRadius() const { return m_CornerRadius; }
                void cornerRadius(float value)
@@ -49,7 +49,7 @@ namespace rive
                        cornerRadiusChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index e64afb9..f5d6d28 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef Drawable Super;
 
        public:
-               static const int typeKey = 3;
+               static const uint16_t typeKey = 3;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -29,7 +29,7 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
        protected:
        };
index 58b1af5..1051458 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef Polygon Super;
 
        public:
-               static const int typeKey = 52;
+               static const uint16_t typeKey = 52;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -32,13 +32,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int innerRadiusPropertyKey = 127;
+               static const uint16_t innerRadiusPropertyKey = 127;
 
        private:
-               float m_InnerRadius = 0.5;
-
+               float m_InnerRadius = 0.5f;
        public:
                inline float innerRadius() const { return m_InnerRadius; }
                void innerRadius(float value)
@@ -51,7 +50,7 @@ namespace rive
                        innerRadiusChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index 144eb11..242accc 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef PathVertex Super;
 
        public:
-               static const int typeKey = 5;
+               static const uint16_t typeKey = 5;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -28,12 +28,12 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int radiusPropertyKey = 26;
+               static const uint16_t radiusPropertyKey = 26;
 
        private:
-               float m_Radius = 0;
+               float m_Radius = 0.0f;
        public:
                inline float radius() const { return m_Radius; }
                void radius(float value)
@@ -46,7 +46,7 @@ namespace rive
                        radiusChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
index c5921c1..a2075d1 100644 (file)
@@ -9,11 +9,11 @@ namespace rive
                typedef ParametricPath Super;
 
        public:
-               static const int typeKey = 8;
+               static const uint16_t typeKey = 8;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -30,7 +30,7 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
        protected:
        };
index a7c688d..d84c421 100644 (file)
@@ -10,11 +10,11 @@ namespace rive
                typedef ContainerComponent Super;
 
        public:
-               static const int typeKey = 38;
+               static const uint16_t typeKey = 38;
 
                /// Helper to quickly determine if a core object extends another without
                /// RTTI at runtime.
-               bool isTypeOf(int typeKey) const override
+               bool isTypeOf(uint16_t typeKey) const override
                {
                        switch (typeKey)
                        {
@@ -27,18 +27,18 @@ namespace rive
                        }
                }
 
-               int coreType() const override { return typeKey; }
+               uint16_t coreType() const override { return typeKey; }
 
-               static const int rotationPropertyKey = 15;
-               static const int scaleXPropertyKey = 16;
-               static const int scaleYPropertyKey = 17;
-               static const int opacityPropertyKey = 18;
+               static const uint16_t rotationPropertyKey = 15;
+               static const uint16_t scaleXPropertyKey = 16;
+               static const uint16_t scaleYPropertyKey = 17;
+               static const uint16_t opacityPropertyKey = 18;
 
        private:
-               float m_Rotation = 0;
-               float m_ScaleX = 1;
-               float m_ScaleY = 1;
-               float m_Opacity = 1;
+               float m_Rotation = 0.0f;
+               float m_ScaleX = 1.0f;
+               float m_ScaleY = 1.0f;
+               float m_Opacity = 1.0f;
        public:
                inline float rotation() const { return m_Rotation; }
                void rotation(float value)
@@ -84,7 +84,7 @@ namespace rive
                        opacityChanged();
                }
 
-               bool deserialize(int propertyKey, BinaryReader& reader) override
+               bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
                {
                        switch (propertyKey)
                        {
diff --git a/submodule/include/importers/artboard_importer.hpp b/submodule/include/importers/artboard_importer.hpp
new file mode 100644 (file)
index 0000000..ee7ad8b
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef _RIVE_ARTBOARD_IMPORTER_HPP_
+#define _RIVE_ARTBOARD_IMPORTER_HPP_
+
+#include "importers/import_stack.hpp"
+
+namespace rive
+{
+    class Core;
+    class Artboard;
+    class LinearAnimation;
+    class StateMachine;
+       class ArtboardImporter : public ImportStackObject
+       {
+       private:
+               Artboard* m_Artboard;
+
+       public:
+               ArtboardImporter(Artboard* artboard);
+        void addComponent(Core* object);
+        void addAnimation(LinearAnimation* animation);
+        void addStateMachine(StateMachine* stateMachine);
+               StatusCode resolve() override;
+       };
+} // namespace rive
+#endif
diff --git a/submodule/include/importers/import_stack.hpp b/submodule/include/importers/import_stack.hpp
new file mode 100644 (file)
index 0000000..c380745
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef _RIVE_IMPORT_STACK_HPP_
+#define _RIVE_IMPORT_STACK_HPP_
+#include "status_code.hpp"
+#include <unordered_map>
+
+namespace rive
+{
+       class ImportStackObject
+       {
+       public:
+               virtual ~ImportStackObject() {}
+               virtual StatusCode resolve() { return StatusCode::Ok; }
+       };
+
+       class ImportStack
+       {
+       private:
+               std::unordered_map<uint16_t, ImportStackObject*> m_Latests;
+
+       public:
+               template <typename T = ImportStackObject> T* latest(uint16_t coreType)
+               {
+                       auto itr = m_Latests.find(coreType);
+                       if (itr == m_Latests.end())
+                       {
+                               return nullptr;
+                       }
+                       return reinterpret_cast<T*>(itr->second);
+               }
+
+               StatusCode makeLatest(uint16_t coreType, ImportStackObject* object)
+               {
+                       // Clean up the old object in the stack.
+                       auto itr = m_Latests.find(coreType);
+                       if (itr != m_Latests.end())
+                       {
+                               auto stackObject = itr->second;
+                               StatusCode code = stackObject->resolve();
+                               delete stackObject;
+                               if (code != StatusCode::Ok)
+                               {
+                                       m_Latests.erase(coreType);
+                                       return code;
+                               }
+                       }
+
+                       // Set the new one.
+                       if (object == nullptr)
+                       {
+                               m_Latests.erase(coreType);
+                       }
+                       else
+                       {
+                               m_Latests[coreType] = object;
+                       }
+                       return StatusCode::Ok;
+               }
+
+               StatusCode resolve()
+               {
+                       for (auto& pair : m_Latests)
+                       {
+                               StatusCode code = pair.second->resolve();
+                               if (code != StatusCode::Ok)
+                               {
+                                       return code;
+                               }
+                       }
+                       return StatusCode::Ok;
+               }
+
+               ~ImportStack()
+               {
+                       for (auto& pair : m_Latests)
+                       {
+                               delete pair.second;
+                       }
+               }
+       };
+} // namespace rive
+#endif
\ No newline at end of file
diff --git a/submodule/include/importers/keyed_object_importer.hpp b/submodule/include/importers/keyed_object_importer.hpp
new file mode 100644 (file)
index 0000000..57845e8
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef _RIVE_KEYED_OBJECT_IMPORTER_HPP_
+#define _RIVE_KEYED_OBJECT_IMPORTER_HPP_
+
+#include "importers/import_stack.hpp"
+
+namespace rive
+{
+       class Core;
+       class KeyedObject;
+       class KeyedProperty;
+       class KeyedObjectImporter : public ImportStackObject
+       {
+       private:
+               KeyedObject* m_KeyedObject;
+
+       public:
+               KeyedObjectImporter(KeyedObject* keyedObject);
+               void addKeyedProperty(KeyedProperty* property);
+       };
+} // namespace rive
+#endif
diff --git a/submodule/include/importers/keyed_property_importer.hpp b/submodule/include/importers/keyed_property_importer.hpp
new file mode 100644 (file)
index 0000000..2a14a90
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef _RIVE_KEYED_PROPERTY_IMPORTER_HPP_
+#define _RIVE_KEYED_PROPERTY_IMPORTER_HPP_
+
+#include "importers/import_stack.hpp"
+
+namespace rive
+{
+       class Core;
+       class KeyFrame;
+       class KeyedProperty;
+       class LinearAnimation;
+       class KeyedPropertyImporter : public ImportStackObject
+       {
+       private:
+               LinearAnimation* m_Animation;
+               KeyedProperty* m_KeyedProperty;
+
+       public:
+               KeyedPropertyImporter(LinearAnimation* animation,
+                                     KeyedProperty* keyedProperty);
+               void addKeyFrame(KeyFrame* keyFrame);
+       };
+} // namespace rive
+#endif
diff --git a/submodule/include/importers/linear_animation_importer.hpp b/submodule/include/importers/linear_animation_importer.hpp
new file mode 100644 (file)
index 0000000..09ee94c
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _RIVE_LINEAR_ANIMATION_IMPORTER_HPP_
+#define _RIVE_LINEAR_ANIMATION_IMPORTER_HPP_
+
+#include "importers/import_stack.hpp"
+
+namespace rive
+{
+       class Core;
+       class LinearAnimation;
+       class KeyedObject;
+       class LinearAnimationImporter : public ImportStackObject
+       {
+       private:
+               LinearAnimation* m_Animation;
+
+       public:
+               LinearAnimation* animation() const { return m_Animation; };
+               LinearAnimationImporter(LinearAnimation* animation);
+               void addKeyedObject(KeyedObject* object);
+       };
+} // namespace rive
+#endif
index 6e5114e..1824756 100644 (file)
@@ -15,10 +15,6 @@ namespace rive
                        float buffer[4];
                        struct
                        {
-                               Vec2D min, max;
-                       };
-                       struct
-                       {
                                float minX, minY, maxX, maxY;
                        };
                };
@@ -48,4 +44,4 @@ namespace rive
                float perimeter() const;
        };
 } // namespace rive
-#endif
\ No newline at end of file
+#endif
index 73d22aa..d298b85 100644 (file)
@@ -18,7 +18,6 @@ namespace rive
 
                int m_MajorVersion;
                int m_MinorVersion;
-               int m_OwnerId;
                int m_FileId;
                std::unordered_map<int, int> m_PropertyToFieldIndex;
 
@@ -27,8 +26,6 @@ namespace rive
                int majorVersion() const { return m_MajorVersion; }
                /// @returns the file's minor version
                int minorVersion() const { return m_MinorVersion; }
-               /// @returns the id of the file's owner; may be zero
-               int ownerId() const { return m_OwnerId; }
                /// @returns the file's id; may be zero
                int fileId() const { return m_FileId; }
 
@@ -58,25 +55,33 @@ namespace rive
                                }
                        }
 
-                       header.m_MajorVersion = (int) reader.readVarUint();
+                       header.m_MajorVersion = (int)reader.readVarUint();
                        if (reader.didOverflow())
                        {
                                return false;
                        }
-                       header.m_MinorVersion = (int) reader.readVarUint();
+                       header.m_MinorVersion = (int)reader.readVarUint();
                        if (reader.didOverflow())
                        {
                                return false;
                        }
 
-                       header.m_OwnerId = (int) reader.readVarUint();
-                       header.m_FileId = (int) reader.readVarUint();
+                       header.m_FileId = (int)reader.readVarUint();
+
+                       if (reader.didOverflow())
+                       {
+                               return false;
+                       }
 
                        std::vector<int> propertyKeys;
-                       for (int propertyKey = (int) reader.readVarUint(); propertyKey != 0;
-                            propertyKey = (int) reader.readVarUint())
+                       for (int propertyKey = (int)reader.readVarUint(); propertyKey != 0;
+                            propertyKey = (int)reader.readVarUint())
                        {
                                propertyKeys.push_back(propertyKey);
+                               if (reader.didOverflow())
+                               {
+                                       return false;
+                               }
                        }
 
                        int currentInt = 0;
@@ -91,6 +96,10 @@ namespace rive
                                int fieldIndex = (currentInt >> currentBit) & 3;
                                header.m_PropertyToFieldIndex[propertyKey] = fieldIndex;
                                currentBit += 2;
+                               if (reader.didOverflow())
+                               {
+                                       return false;
+                               }
                        }
 
                        return true;
index 87cae4a..03ae5aa 100644 (file)
@@ -1,22 +1,26 @@
 #ifndef _RIVE_PATH_COMPOSER_HPP_
 #define _RIVE_PATH_COMPOSER_HPP_
-#include "generated/shapes/path_composer_base.hpp"
+#include "component.hpp"
 namespace rive
 {
        class Shape;
        class CommandPath;
        class RenderPath;
-       class PathComposer : public PathComposerBase
+       class PathComposer : public Component
        {
        private:
-               Shape* m_Shape = nullptr;
+               Shape* m_Shape;
                CommandPath* m_LocalPath = nullptr;
                CommandPath* m_WorldPath = nullptr;
 
        public:
+               PathComposer(Shape* shape);
                ~PathComposer();
                Shape* shape() const { return m_Shape; }
-               StatusCode onAddedClean(CoreContext* context) override;
+               StatusCode onAddedClean(CoreContext* context) override
+               {
+                       return StatusCode::Ok;
+               }
                void buildDependencies() override;
                void update(ComponentDirt value) override;
 
index ea228d0..b3c03a9 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _RIVE_SHAPE_HPP_
 #define _RIVE_SHAPE_HPP_
 #include "generated/shapes/shape_base.hpp"
+#include "shapes/path_composer.hpp"
 #include "shapes/shape_paint_container.hpp"
 #include <vector>
 
@@ -11,12 +12,13 @@ namespace rive
        class Shape : public ShapeBase, public ShapePaintContainer
        {
        private:
-               PathComposer* m_PathComposer = nullptr;
+               PathComposer m_PathComposer;
                std::vector<Path*> m_Paths;
 
                bool m_WantDifferencePath = false;
 
        public:
+               Shape();
                void buildDependencies() override;
                void addPath(Path* path);
                std::vector<Path*>& paths() { return m_Paths; }
@@ -26,11 +28,14 @@ namespace rive
                void update(ComponentDirt value) override;
                void draw(Renderer* renderer) override;
 
-               void pathComposer(PathComposer* value);
-               PathComposer* pathComposer() const { return m_PathComposer; }
+               PathComposer* pathComposer() const
+               {
+                       return (PathComposer*)&m_PathComposer;
+               }
 
                void pathChanged();
                void addDefaultPathSpace(PathSpace space);
+               StatusCode onAddedDirty(CoreContext* context) override;
        };
 } // namespace rive
 
index 7c3af8c..9b6c2d5 100644 (file)
@@ -223,8 +223,7 @@ RiveFrameExtractor::getAnimation(const char* animation_name)
        rive::LinearAnimation* animation;
        if (animation_name != NULL && animation_name[0] != '\0')
        {
-               if ((animation = artboard->animation<rive::LinearAnimation>(
-                        animation_name)) == nullptr)
+               if ((animation = artboard->animation(animation_name)) == nullptr)
                {
 
                        fprintf(stderr,
@@ -234,7 +233,7 @@ RiveFrameExtractor::getAnimation(const char* animation_name)
        }
        else
        {
-               animation = artboard->firstAnimation<rive::LinearAnimation>();
+               animation = artboard->firstAnimation();
                if (animation == nullptr)
                {
                        throw std::invalid_argument(
index ba19881..9744628 100644 (file)
@@ -58,7 +58,7 @@ void glfwDropCallback(GLFWwindow* window, int count, const char** paths)
        delete animationInstance;
        delete currentFile;
 
-       auto animation = artboard->firstAnimation<rive::LinearAnimation>();
+       auto animation = artboard->firstAnimation();
        if (animation != nullptr)
        {
                animationInstance = new rive::LinearAnimationInstance(animation);
index 8aff1b8..7de6139 100644 (file)
@@ -1,4 +1,7 @@
 #include "animation/cubic_interpolator.hpp"
+#include "artboard.hpp"
+#include "importers/artboard_importer.hpp"
+#include "importers/import_stack.hpp"
 #include <cmath>
 
 using namespace rive;
@@ -99,4 +102,16 @@ float CubicInterpolator::getT(float x) const
 float CubicInterpolator::transform(float mix) const
 {
        return calcBezier(getT(mix), y1(), y2());
+}
+
+StatusCode CubicInterpolator::import(ImportStack& importStack)
+{
+       auto artboardImporter =
+           importStack.latest<ArtboardImporter>(ArtboardBase::typeKey);
+       if (artboardImporter == nullptr)
+       {
+               return StatusCode::MissingObject;
+       }
+       artboardImporter->addComponent(this);
+       return Super::import(importStack);
 }
\ No newline at end of file
index 7b0ec59..73738a2 100644 (file)
@@ -1,6 +1,8 @@
 #include "animation/keyed_object.hpp"
 #include "animation/keyed_property.hpp"
+#include "animation/linear_animation.hpp"
 #include "artboard.hpp"
+#include "importers/linear_animation_importer.hpp"
 
 using namespace rive;
 
@@ -26,7 +28,11 @@ StatusCode KeyedObject::onAddedDirty(CoreContext* context)
 
        for (auto property : m_KeyedProperties)
        {
-               property->onAddedDirty(context);
+               StatusCode code;
+               if ((code = property->onAddedDirty(context)) != StatusCode::Ok)
+               {
+                       return code;
+               }
        }
        return StatusCode::Ok;
 }
@@ -51,4 +57,16 @@ void KeyedObject::apply(Artboard* artboard, float time, float mix)
        {
                property->apply(object, time, mix);
        }
+}
+
+StatusCode KeyedObject::import(ImportStack& importStack)
+{
+       auto importer = importStack.latest<LinearAnimationImporter>(
+           LinearAnimationBase::typeKey);
+       if (importer == nullptr)
+       {
+               return StatusCode::MissingObject;
+       }
+       importer->addKeyedObject(this);
+       return Super::import(importStack);
 }
\ No newline at end of file
index 3e77a0a..a312946 100644 (file)
@@ -1,5 +1,8 @@
 #include "animation/keyed_property.hpp"
+#include "animation/keyed_object.hpp"
 #include "animation/keyframe.hpp"
+#include "importers/import_stack.hpp"
+#include "importers/keyed_object_importer.hpp"
 
 using namespace rive;
 
@@ -46,6 +49,7 @@ void KeyedProperty::apply(Core* object, float seconds, float mix)
                idx = start;
        }
        int pk = propertyKey();
+
        if (idx == 0)
        {
                m_KeyFrames[0]->apply(object, pk, mix);
@@ -104,4 +108,16 @@ StatusCode KeyedProperty::onAddedClean(CoreContext* context)
                }
        }
        return StatusCode::Ok;
+}
+
+StatusCode KeyedProperty::import(ImportStack& importStack)
+{
+       auto importer =
+           importStack.latest<KeyedObjectImporter>(KeyedObjectBase::typeKey);
+       if (importer == nullptr)
+       {
+               return StatusCode::MissingObject;
+       }
+       importer->addKeyedProperty(this);
+       return Super::import(importStack);
 }
\ No newline at end of file
index 42f7bae..b25cdf9 100644 (file)
@@ -1,23 +1,37 @@
 #include "animation/keyframe.hpp"
 #include "animation/cubic_interpolator.hpp"
+#include "animation/keyed_property.hpp"
 #include "core_context.hpp"
+#include "importers/import_stack.hpp"
+#include "importers/keyed_property_importer.hpp"
 
 using namespace rive;
 
 StatusCode KeyFrame::onAddedDirty(CoreContext* context)
 {
-       if (interpolatorId() != 0)
+       if (interpolatorId() > 0)
        {
                auto coreObject = context->resolve(interpolatorId());
                if (coreObject == nullptr || !coreObject->is<CubicInterpolator>())
                {
                        return StatusCode::MissingObject;
                }
-
                m_Interpolator = coreObject->as<CubicInterpolator>();
        }
 
        return StatusCode::Ok;
 }
 
-void KeyFrame::computeSeconds(int fps) { m_Seconds = frame() / (float)fps; }
\ No newline at end of file
+void KeyFrame::computeSeconds(int fps) { m_Seconds = frame() / (float)fps; }
+
+StatusCode KeyFrame::import(ImportStack& importStack)
+{
+       auto importer =
+           importStack.latest<KeyedPropertyImporter>(KeyedProperty::typeKey);
+       if (importer == nullptr)
+       {
+               return StatusCode::MissingObject;
+       }
+       importer->addKeyFrame(this);
+       return Super::import(importStack);
+}
\ No newline at end of file
diff --git a/submodule/src/animation/layer_state.cpp b/submodule/src/animation/layer_state.cpp
new file mode 100644 (file)
index 0000000..e4be101
--- /dev/null
@@ -0,0 +1,15 @@
+#include "animation/layer_state.hpp"
+using namespace rive;
+#include "animation/transition_bool_condition.hpp"
+
+using namespace rive;
+
+StatusCode LayerState::onAddedDirty(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
+
+StatusCode LayerState::onAddedClean(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
\ No newline at end of file
index 9750d65..c3d8fb0 100644 (file)
@@ -1,5 +1,8 @@
 #include "animation/linear_animation.hpp"
 #include "animation/keyed_object.hpp"
+#include "artboard.hpp"
+#include "importers/artboard_importer.hpp"
+#include "importers/import_stack.hpp"
 
 using namespace rive;
 
@@ -23,6 +26,7 @@ StatusCode LinearAnimation::onAddedDirty(CoreContext* context)
        }
        return StatusCode::Ok;
 }
+
 StatusCode LinearAnimation::onAddedClean(CoreContext* context)
 {
        StatusCode code;
@@ -47,4 +51,16 @@ void LinearAnimation::apply(Artboard* artboard, float time, float mix)
        {
                object->apply(artboard, time, mix);
        }
+}
+
+StatusCode LinearAnimation::import(ImportStack& importStack)
+{
+       auto artboardImporter =
+           importStack.latest<ArtboardImporter>(ArtboardBase::typeKey);
+       if (artboardImporter == nullptr)
+       {
+               return StatusCode::MissingObject;
+       }
+       artboardImporter->addAnimation(this);
+       return Super::import(importStack);
 }
\ No newline at end of file
diff --git a/submodule/src/animation/state_machine_input.cpp b/submodule/src/animation/state_machine_input.cpp
new file mode 100644 (file)
index 0000000..f7dd778
--- /dev/null
@@ -0,0 +1,13 @@
+#include "animation/state_machine_input.hpp"
+
+using namespace rive;
+
+StatusCode StateMachineInput::onAddedDirty(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
+
+StatusCode StateMachineInput::onAddedClean(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
\ No newline at end of file
diff --git a/submodule/src/animation/state_machine_layer.cpp b/submodule/src/animation/state_machine_layer.cpp
new file mode 100644 (file)
index 0000000..90cdc93
--- /dev/null
@@ -0,0 +1,13 @@
+#include "animation/state_machine_layer.hpp"
+
+using namespace rive;
+
+StatusCode StateMachineLayer::onAddedDirty(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
+
+StatusCode StateMachineLayer::onAddedClean(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
\ No newline at end of file
diff --git a/submodule/src/animation/state_machine_trigger.cpp b/submodule/src/animation/state_machine_trigger.cpp
new file mode 100644 (file)
index 0000000..122efc5
--- /dev/null
@@ -0,0 +1,7 @@
+#include "animation/state_machine_trigger.hpp"
+
+using namespace rive;
+
+void StateMachineTrigger::fire() { m_Fired = true; }
+
+void StateMachineTrigger::reset() { m_Fired = false; }
\ No newline at end of file
diff --git a/submodule/src/animation/state_transition.cpp b/submodule/src/animation/state_transition.cpp
new file mode 100644 (file)
index 0000000..7f39b27
--- /dev/null
@@ -0,0 +1,13 @@
+#include "animation/state_transition.hpp"
+
+using namespace rive;
+
+StatusCode StateTransition::onAddedDirty(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
+
+StatusCode StateTransition::onAddedClean(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
\ No newline at end of file
diff --git a/submodule/src/animation/transition_condition.cpp b/submodule/src/animation/transition_condition.cpp
new file mode 100644 (file)
index 0000000..34737c6
--- /dev/null
@@ -0,0 +1,13 @@
+#include "animation/transition_bool_condition.hpp"
+
+using namespace rive;
+
+StatusCode TransitionCondition::onAddedDirty(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
+
+StatusCode TransitionCondition::onAddedClean(CoreContext* context)
+{
+       return StatusCode::Ok;
+}
\ No newline at end of file
index f5f52e9..5fae92f 100644 (file)
@@ -27,11 +27,15 @@ Artboard::~Artboard()
        {
                delete object;
        }
+       for (auto object : m_StateMachines)
+       {
+               delete object;
+       }
        delete m_ClipPath;
        delete m_BackgroundPath;
 }
 
-static bool canContinue(StatusCode code) 
+static bool canContinue(StatusCode code)
 {
        // We currently only cease loading on invalid object.
        return code != StatusCode::InvalidObject;
@@ -49,7 +53,7 @@ StatusCode Artboard::initialize()
        // can't assume that their parent's parent will have resolved yet.
        for (auto object : m_Objects)
        {
-               if(object == nullptr) 
+               if (object == nullptr)
                {
                        // objects can be null if they were not understood by this runtime.
                        continue;
@@ -68,6 +72,14 @@ StatusCode Artboard::initialize()
                }
        }
 
+       for (auto object : m_StateMachines)
+       {
+               if (!canContinue(code = object->onAddedDirty(this)))
+               {
+                       return code;
+               }
+       }
+
        // Store a map of the drawRules to make it easier to lookup the matching
        // rule for a transform component.
        std::unordered_map<Core*, DrawRules*> componentDrawRules;
@@ -79,7 +91,7 @@ StatusCode Artboard::initialize()
        // parent should be type X can be checked now).
        for (auto object : m_Objects)
        {
-               if(object == nullptr) 
+               if (object == nullptr)
                {
                        continue;
                }
@@ -95,12 +107,16 @@ StatusCode Artboard::initialize()
                        {
                                componentDrawRules[component] = rules;
                        }
-                       else 
+                       else
                        {
-                               fprintf(stderr, "Artboard::initialize - Draw rule targets missing component width id %d\n", rules->parentId());
+                               fprintf(stderr,
+                                       "Artboard::initialize - Draw rule targets missing "
+                                       "component width id %d\n",
+                                       rules->parentId());
                        }
                }
        }
+
        for (auto object : m_Animations)
        {
                if (!canContinue(code = object->onAddedClean(this)))
@@ -108,11 +124,20 @@ StatusCode Artboard::initialize()
                        return code;
                }
        }
+
+       for (auto object : m_StateMachines)
+       {
+               if (!canContinue(code = object->onAddedClean(this)))
+               {
+                       return code;
+               }
+       }
+
        // Multi-level references have been built up, now we can actually mark
        // what's dependent on what.
        for (auto object : m_Objects)
        {
-               if(object == nullptr) 
+               if (object == nullptr)
                {
                        continue;
                }
@@ -145,7 +170,7 @@ StatusCode Artboard::initialize()
        // dependencies.
        for (auto object : m_Objects)
        {
-               if(object == nullptr) 
+               if (object == nullptr)
                {
                        continue;
                }
@@ -161,7 +186,7 @@ StatusCode Artboard::initialize()
                                // targets that belong to this rule here.
                                for (auto object : m_Objects)
                                {
-                                       if (object->is<DrawTarget>())
+                                       if (object != nullptr && object->is<DrawTarget>())
                                        {
                                                DrawTarget* dependentTarget = object->as<DrawTarget>();
                                                if (dependentTarget->parent() == dependentRules)
@@ -173,7 +198,6 @@ StatusCode Artboard::initialize()
                        }
                }
        }
-
        DependencySorter sorter;
        std::vector<Component*> drawTargetOrder;
        sorter.sort(&root, drawTargetOrder);
@@ -291,11 +315,16 @@ void Artboard::sortDependencies()
 
 void Artboard::addObject(Core* object) { m_Objects.push_back(object); }
 
-void Artboard::addAnimation(Animation* object)
+void Artboard::addAnimation(LinearAnimation* object)
 {
        m_Animations.push_back(object);
 }
 
+void Artboard::addStateMachine(StateMachine* object)
+{
+       m_StateMachines.push_back(object);
+}
+
 Core* Artboard::resolve(int id) const
 {
        if (id < 0 || id >= m_Objects.size())
@@ -333,7 +362,8 @@ void Artboard::update(ComponentDirt value)
        {
                m_ClipPath->reset();
                m_ClipPath->addRect(0.0f, 0.0f, width(), height());
-               m_BackgroundPath->addRect(-width() * originX(), -height() * originY(), width(), height());
+               m_BackgroundPath->addRect(
+                   -width() * originX(), -height() * originY(), width(), height());
        }
 }
 
@@ -405,4 +435,64 @@ void Artboard::draw(Renderer* renderer)
        renderer->restore();
 }
 
-AABB Artboard::bounds() const { return AABB(0.0f, 0.0f, width(), height()); }
\ No newline at end of file
+AABB Artboard::bounds() const { return AABB(0.0f, 0.0f, width(), height()); }
+
+LinearAnimation* Artboard::firstAnimation()
+{
+       if (m_Animations.empty())
+       {
+               return nullptr;
+       }
+       return m_Animations.front();
+}
+
+LinearAnimation* Artboard::animation(std::string name)
+{
+       for (auto animation : m_Animations)
+       {
+               if (animation->name() == name)
+               {
+                       return animation;
+               }
+       }
+       return nullptr;
+}
+
+LinearAnimation* Artboard::animation(size_t index)
+{
+       if (index < 0 || index >= m_Animations.size())
+       {
+               return nullptr;
+       }
+       return m_Animations[index];
+}
+
+StateMachine* Artboard::firstStateMachine()
+{
+       if (m_StateMachines.empty())
+       {
+               return nullptr;
+       }
+       return m_StateMachines.front();
+}
+
+StateMachine* Artboard::stateMachine(std::string name)
+{
+       for (auto machine : m_StateMachines)
+       {
+               if (machine->name() == name)
+               {
+                       return machine;
+               }
+       }
+       return nullptr;
+}
+
+StateMachine* Artboard::stateMachine(size_t index)
+{
+       if (index < 0 || index >= m_StateMachines.size())
+       {
+               return nullptr;
+       }
+       return m_StateMachines[index];
+}
\ No newline at end of file
index 4564903..a03ed25 100644 (file)
@@ -2,6 +2,8 @@
 #include "artboard.hpp"
 #include "container_component.hpp"
 #include "core_context.hpp"
+#include "importers/artboard_importer.hpp"
+#include "importers/import_stack.hpp"
 #include <algorithm>
 
 using namespace rive;
@@ -56,4 +58,16 @@ bool Component::addDirt(ComponentDirt value, bool recurse)
                d->addDirt(value, true);
        }
        return true;
+}
+
+StatusCode Component::import(ImportStack& importStack)
+{
+       auto artboardImporter =
+           importStack.latest<ArtboardImporter>(ArtboardBase::typeKey);
+       if (artboardImporter == nullptr)
+       {
+               return StatusCode::MissingObject;
+       }
+       artboardImporter->addComponent(this);
+       return Super::import(importStack);
 }
\ No newline at end of file
index 8bb0ba7..e0725b3 100644 (file)
@@ -11,6 +11,8 @@ BinaryReader::BinaryReader(uint8_t* bytes, size_t length) :
 {
 }
 
+bool BinaryReader::reachedEnd() const { return m_Position == m_End || didOverflow(); }
+
 size_t BinaryReader::lengthInBytes() const { return m_Length; }
 
 bool BinaryReader::didOverflow() const { return m_Overflowed; }
@@ -42,7 +44,7 @@ std::string BinaryReader::readString()
                return std::string();
        }
 
-       char rawValue[length];
+       char rawValue[length + 1];
        auto readBytes = decode_string(length, m_Position, m_End, &rawValue[0]);
        if (readBytes != length)
        {
@@ -89,7 +91,7 @@ uint8_t BinaryReader::readByte()
        return *m_Position++;
 }
 
-uint32_t BinaryReader::readUint32() 
+uint32_t BinaryReader::readUint32()
 {
        uint32_t value;
        auto readBytes = decode_uint_32(m_Position, m_End, &value);
@@ -100,4 +102,4 @@ uint32_t BinaryReader::readUint32()
        }
        m_Position += readBytes;
        return value;
-}
\ No newline at end of file
+}
index 7f47c64..cdfe615 100644 (file)
@@ -5,14 +5,19 @@
 #include "core/field_types/core_string_type.hpp"
 #include "core/field_types/core_uint_type.hpp"
 #include "generated/core_registry.hpp"
+#include "importers/artboard_importer.hpp"
+#include "importers/import_stack.hpp"
+#include "importers/keyed_object_importer.hpp"
+#include "importers/keyed_property_importer.hpp"
+#include "importers/linear_animation_importer.hpp"
 
 // Default namespace for Rive Cpp code
 using namespace rive;
 
 // Import a single Rive runtime object.
 // Used by the file importer.
-template <typename T = Core>
-static T* readRuntimeObject(BinaryReader& reader, const RuntimeHeader& header)
+static Core* readRuntimeObject(BinaryReader& reader,
+                               const RuntimeHeader& header)
 {
        auto coreObjectKey = reader.readVarUint();
        auto object = CoreRegistry::makeCoreInstance((int)coreObjectKey);
@@ -69,47 +74,15 @@ static T* readRuntimeObject(BinaryReader& reader, const RuntimeHeader& header)
                        }
                }
        }
-
-       // This is evaluated at compile time based on how the templated method
-       // is called. This means that it'll get optimized out when calling with
-       // type Core (which is the default). The type checking is skipped in
-       // this case.
-       if constexpr (!std::is_same<T, Core>::value)
-       {
-               // Concrete Core object couldn't be read.
-               if (object == nullptr)
-               {
-                       fprintf(stderr,
-                               "Expected object of type %d but found %llu, which this "
-                               "runtime doesn't understand.\n",
-                               T::typeKey,
-                               coreObjectKey);
-                       return nullptr;
-               }
-               // Ensure the object is of the provided type, if not, return null
-               // and delete the object. Note that we read in the properties
-               // regardless of whether or not this object is the expected one.
-               // This ensures our reader has advanced past the object.
-               if (!object->is<T>())
-               {
-                       fprintf(stderr,
-                               "Expected object of type %d but found %d.\n",
-                               T::typeKey,
-                               object->coreType());
-                       delete object;
-                       return nullptr;
-               }
-       }
-       // Core object couldn't be read.
-       else if (object == nullptr)
+       if (object == nullptr)
        {
                fprintf(stderr,
-                       "Expected a Core object but found %llu, which this runtime "
-                       "doesn't understand.\n",
+                       "File contains an unknown object with coreType %llu, which "
+                       "this runtime doesn't understand.\n",
                        coreObjectKey);
                return nullptr;
        }
-       return reinterpret_cast<T*>(object);
+       return object;
 }
 
 File::~File()
@@ -130,7 +103,7 @@ ImportResult File::import(BinaryReader& reader, File** importedFile)
                fprintf(stderr, "Bad header\n");
                return ImportResult::malformed;
        }
-       if (header.majorVersion() > majorVersion)
+       if (header.majorVersion() != majorVersion)
        {
                fprintf(stderr,
                        "Unsupported version %u.%u expected %u.%u.\n",
@@ -153,103 +126,73 @@ ImportResult File::import(BinaryReader& reader, File** importedFile)
 
 ImportResult File::read(BinaryReader& reader, const RuntimeHeader& header)
 {
-       m_Backboard = readRuntimeObject<Backboard>(reader, header);
-       if (m_Backboard == nullptr)
-       {
-               fprintf(stderr, "Expected first object to be the backboard.\n");
-               return ImportResult::malformed;
-       }
-
-       auto numArtboards = reader.readVarUint();
-       for (int i = 0; i < numArtboards; i++)
+       ImportStack importStack;
+       while (!reader.reachedEnd())
        {
-               auto numObjects = reader.readVarUint();
-               if (numObjects == 0)
-               {
-                       fprintf(stderr,
-                               "Artboards must contain at least one object "
-                               "(themselves).\n");
-                       return ImportResult::malformed;
-               }
-               auto artboard = readRuntimeObject<Artboard>(reader, header);
-               if (artboard == nullptr)
-               {
-                       fprintf(stderr, "Found non-artboard in artboard list.\n");
-                       return ImportResult::malformed;
-               }
-               m_Artboards.push_back(artboard);
-
-               artboard->addObject(artboard);
-
-               for (int i = 1; i < numObjects; i++)
+               auto object = readRuntimeObject(reader, header);
+               if (object == nullptr)
                {
-                       auto object = readRuntimeObject(reader, header);
-                       // N.B. we add objects that don't load (null) too as we need to
-                       // look them up by index.
-                       artboard->addObject(object);
+                       // See if there's an artboard on the stack, need to track the null
+                       // object as it'll still hold an id.
+                       auto importer =
+                           importStack.latest<ArtboardImporter>(Artboard::typeKey);
+                       if (importer == nullptr)
+                       {
+                               return ImportResult::malformed;
+                       }
+                       importer->addComponent(object);
+                       continue;
                }
+               ImportStackObject* stackObject = nullptr;
+               auto stackType = object->coreType();
 
-               // Animations also need to reference objects, so make sure they get
-               // read in before the hierarchy resolves (batch add completes).
-               auto numAnimations = reader.readVarUint();
-               for (int i = 0; i < numAnimations; i++)
+               switch (stackType)
                {
-                       auto animation = readRuntimeObject<Animation>(reader, header);
-                       if (animation == nullptr)
+                       case Artboard::typeKey:
+                               stackObject = new ArtboardImporter(object->as<Artboard>());
+                               break;
+                       case LinearAnimation::typeKey:
+                               stackObject =
+                                   new LinearAnimationImporter(object->as<LinearAnimation>());
+                               break;
+                       case KeyedObject::typeKey:
+                               stackObject =
+                                   new KeyedObjectImporter(object->as<KeyedObject>());
+                               break;
+                       case KeyedProperty::typeKey:
                        {
-                               continue;
-                       }
-                       artboard->addAnimation(animation);
-                       if (animation->coreType() == LinearAnimationBase::typeKey)
-                       {
-                               auto linearAnimation =
-                                   reinterpret_cast<LinearAnimation*>(animation);
-                               auto numKeyedObjects = reader.readVarUint();
-                               for (int j = 0; j < numKeyedObjects; j++)
+                               auto importer = importStack.latest<LinearAnimationImporter>(
+                                   LinearAnimation::typeKey);
+                               if (importer == nullptr)
                                {
-                                       auto keyedObject =
-                                           readRuntimeObject<KeyedObject>(reader, header);
-                                       if (keyedObject == nullptr)
-                                       {
-                                               continue;
-                                       }
-                                       linearAnimation->addKeyedObject(keyedObject);
-
-                                       int numKeyedProperties = (int)reader.readVarUint();
-                                       for (int k = 0; k < numKeyedProperties; k++)
-                                       {
-                                               auto keyedProperty =
-                                                   readRuntimeObject<KeyedProperty>(reader, header);
-                                               if (keyedProperty == nullptr)
-                                               {
-                                                       continue;
-                                               }
-                                               keyedObject->addKeyedProperty(keyedProperty);
-
-                                               auto numKeyframes = reader.readVarUint();
-                                               for (int l = 0; l < numKeyframes; l++)
-                                               {
-                                                       auto keyframe =
-                                                           readRuntimeObject<KeyFrame>(reader, header);
-                                                       if (keyframe == nullptr)
-                                                       {
-                                                               continue;
-                                                       }
-                                                       keyframe->computeSeconds(linearAnimation->fps());
-                                                       keyedProperty->addKeyFrame(keyframe);
-                                               }
-                                       }
+                                       return ImportResult::malformed;
                                }
+                               stackObject = new KeyedPropertyImporter(
+                                   importer->animation(), object->as<KeyedProperty>());
+                               break;
                        }
                }
-
-               // Artboard has been read in.
-               if (artboard->initialize() != StatusCode::Ok)
+               if (importStack.makeLatest(stackType, stackObject) != StatusCode::Ok)
                {
+                       // Some previous stack item didn't resolve.
                        return ImportResult::malformed;
                }
+               if (object->import(importStack) == StatusCode::Ok)
+               {
+                       switch (object->coreType())
+                       {
+                               case Backboard::typeKey:
+                                       m_Backboard = object->as<Backboard>();
+                                       break;
+                               case Artboard::typeKey:
+                                       m_Artboards.push_back(object->as<Artboard>());
+                                       break;
+                       }
+               }
        }
-       return ImportResult::success;
+
+       return importStack.resolve() == StatusCode::Ok ? ImportResult::success
+                                                      : ImportResult::malformed;
 }
 
 Backboard* File::backboard() const { return m_Backboard; }
diff --git a/submodule/src/importers/artboard_importer.cpp b/submodule/src/importers/artboard_importer.cpp
new file mode 100644 (file)
index 0000000..41b0719
--- /dev/null
@@ -0,0 +1,26 @@
+#include "artboard.hpp"
+#include "importers/artboard_importer.hpp"
+#include "animation/linear_animation.hpp"
+#include "animation/state_machine.hpp"
+#include "artboard.hpp"
+
+using namespace rive;
+
+ArtboardImporter::ArtboardImporter(Artboard* artboard) : m_Artboard(artboard) {}
+
+void ArtboardImporter::addComponent(Core* object)
+{
+       m_Artboard->addObject(object);
+}
+
+void ArtboardImporter::addAnimation(LinearAnimation* animation)
+{
+       m_Artboard->addAnimation(animation);
+}
+
+void ArtboardImporter::addStateMachine(StateMachine* stateMachine)
+{
+       m_Artboard->addStateMachine(stateMachine);
+}
+
+StatusCode ArtboardImporter::resolve() { return m_Artboard->initialize(); }
\ No newline at end of file
diff --git a/submodule/src/importers/keyed_object_importer.cpp b/submodule/src/importers/keyed_object_importer.cpp
new file mode 100644 (file)
index 0000000..e7ec3aa
--- /dev/null
@@ -0,0 +1,16 @@
+#include "importers/keyed_object_importer.hpp"
+#include "animation/keyed_object.hpp"
+#include "animation/keyed_property.hpp"
+#include "artboard.hpp"
+
+using namespace rive;
+
+KeyedObjectImporter::KeyedObjectImporter(KeyedObject* keyedObject) :
+    m_KeyedObject(keyedObject)
+{
+}
+
+void KeyedObjectImporter::addKeyedProperty(KeyedProperty* property)
+{
+       m_KeyedObject->addKeyedProperty(property);
+}
\ No newline at end of file
diff --git a/submodule/src/importers/keyed_property_importer.cpp b/submodule/src/importers/keyed_property_importer.cpp
new file mode 100644 (file)
index 0000000..ac917c7
--- /dev/null
@@ -0,0 +1,18 @@
+#include "importers/keyed_property_importer.hpp"
+#include "animation/keyed_property.hpp"
+#include "animation/keyframe.hpp"
+#include "animation/linear_animation.hpp"
+
+using namespace rive;
+
+KeyedPropertyImporter::KeyedPropertyImporter(LinearAnimation* animation,
+                                             KeyedProperty* keyedProperty) :
+    m_Animation(animation), m_KeyedProperty(keyedProperty)
+{
+}
+
+void KeyedPropertyImporter::addKeyFrame(KeyFrame* keyFrame)
+{
+       keyFrame->computeSeconds(m_Animation->fps());
+       m_KeyedProperty->addKeyFrame(keyFrame);
+}
\ No newline at end of file
diff --git a/submodule/src/importers/linear_animation_importer.cpp b/submodule/src/importers/linear_animation_importer.cpp
new file mode 100644 (file)
index 0000000..37d9607
--- /dev/null
@@ -0,0 +1,16 @@
+#include "importers/linear_animation_importer.hpp"
+#include "animation/keyed_object.hpp"
+#include "animation/linear_animation.hpp"
+#include "artboard.hpp"
+
+using namespace rive;
+
+LinearAnimationImporter::LinearAnimationImporter(LinearAnimation* animation) :
+    m_Animation(animation)
+{
+}
+
+void LinearAnimationImporter::addKeyedObject(KeyedObject* object)
+{
+       m_Animation->addKeyedObject(object);
+}
\ No newline at end of file
index 94de5d0..c170f8b 100644 (file)
@@ -77,9 +77,9 @@ bool AABB::areIdentical(const AABB& a, const AABB& b)
        return a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3];
 }
 
-float AABB::width() const { return max[0] - min[0]; }
+float AABB::width() const { return buffer[2] - buffer[0]; }
 
-float AABB::height() const { return max[1] - min[1]; }
+float AABB::height() const { return buffer[3] - buffer[1]; }
 
 float AABB::perimeter() const
 {
@@ -104,4 +104,4 @@ void AABB::transform(AABB& out, const AABB& a, const Mat2D& matrix)
        out[1] = std::fmin(p1[1], std::fmin(p2[1], std::fmin(p3[1], p4[1])));
        out[2] = std::fmax(p1[0], std::fmax(p2[0], std::fmax(p3[0], p4[0])));
        out[3] = std::fmax(p1[1], std::fmax(p2[1], std::fmax(p3[1], p4[1])));
-}
\ No newline at end of file
+}
index eb33bbf..f4d68ee 100644 (file)
@@ -15,6 +15,10 @@ StatusCode ClippingShape::onAddedClean(CoreContext* context)
        auto artboard = static_cast<Artboard*>(context);
        for (auto core : artboard->objects())
        {
+               if (core == nullptr)
+               {
+                       continue;
+               }
                // Iterate artboard to find drawables that are parented to this clipping
                // shape, they need to know they'll be clipped by this shape.
                if (core->is<Drawable>())
index 4be260a..b4ebde2 100644 (file)
@@ -4,6 +4,19 @@
 
 using namespace rive;
 
+float clamp(float v, float lo, float hi)
+{
+       if (v < lo)
+       {
+               return lo;
+       }
+       else if (v > hi)
+       {
+               return hi;
+       }
+       return v;
+}
+
 void MetricsPath::reset()
 {
        m_ComputedLength = 0.0f;
@@ -254,6 +267,10 @@ void MetricsPath::trim(float startLength,
                length += partLength;
        }
 
+       // Lets make sur we're between 0 & 1f on both start & end.
+       startT = clamp(startT, 0.0f, 1.0f);
+       endT = clamp(endT, 0.0f, 1.0f);
+
        if (firstPartIndex == lastPartIndex)
        {
                extractSubPart(firstPartIndex, startT, endT, moveTo, result);
index f94d0e2..d1415ec 100644 (file)
@@ -8,28 +8,13 @@ using namespace rive;
 
 static Mat2D identity;
 
+PathComposer::PathComposer(Shape* shape) : m_Shape(shape) {}
 PathComposer::~PathComposer()
 {
        delete m_LocalPath;
        delete m_WorldPath;
 }
 
-StatusCode PathComposer::onAddedClean(CoreContext* context)
-{
-       // Find the shape.
-       for (auto currentParent = parent(); currentParent != nullptr;
-            currentParent = currentParent->parent())
-       {
-               if (currentParent->is<Shape>())
-               {
-                       m_Shape = currentParent->as<Shape>();
-                       m_Shape->pathComposer(this);
-                       return StatusCode::Ok;
-               }
-       }
-       return StatusCode::MissingObject;
-}
-
 void PathComposer::buildDependencies()
 {
        assert(m_Shape != nullptr);
index 7ee7614..8ad26f1 100644 (file)
@@ -7,6 +7,8 @@
 
 using namespace rive;
 
+Shape::Shape() : m_PathComposer(this) {}
+
 void Shape::addPath(Path* path)
 {
        // Make sure the path is not already in the shape.
@@ -29,11 +31,10 @@ void Shape::update(ComponentDirt value)
 
 void Shape::pathChanged()
 {
-       m_PathComposer->addDirt(ComponentDirt::Path, true);
+       m_PathComposer.addDirt(ComponentDirt::Path, true);
        invalidateStrokeEffects();
 }
 
-void Shape::pathComposer(PathComposer* value) { m_PathComposer = value; }
 void Shape::draw(Renderer* renderer)
 {
        auto shouldRestore = clip(renderer);
@@ -53,8 +54,8 @@ void Shape::draw(Renderer* renderer)
                        renderer->transform(transform);
                }
                shapePaint->draw(renderer,
-                                paintsInLocal ? m_PathComposer->localPath()
-                                              : m_PathComposer->worldPath());
+                                paintsInLocal ? m_PathComposer.localPath()
+                                              : m_PathComposer.worldPath());
                renderer->restore();
        }
 
@@ -66,6 +67,10 @@ void Shape::draw(Renderer* renderer)
 
 void Shape::buildDependencies()
 {
+       // Make sure to propagate the call to PathComposer as it's no longer part of
+       // Core and owned only by the Shape.
+       m_PathComposer.buildDependencies();
+
        Super::buildDependencies();
 
        // Set the blend mode on all the shape paints. If we ever animate this
@@ -80,4 +85,15 @@ void Shape::buildDependencies()
 void Shape::addDefaultPathSpace(PathSpace space)
 {
        m_DefaultPathSpace |= space;
+}
+
+StatusCode Shape::onAddedDirty(CoreContext* context)
+{
+       auto code = Super::onAddedDirty(context);
+       if (code != StatusCode::Ok)
+       {
+               return code;
+       }
+       // This ensures context propagates to path composer too.
+       return m_PathComposer.onAddedDirty(context);
 }
\ No newline at end of file
index d4b27d6..62ba568 100644 (file)
Binary files a/submodule/test/assets/circle_clips.riv and b/submodule/test/assets/circle_clips.riv differ
index 37f3aca..fedb586 100644 (file)
Binary files a/submodule/test/assets/dependency_test.riv and b/submodule/test/assets/dependency_test.riv differ
index 987d876..380d59a 100644 (file)
Binary files a/submodule/test/assets/draw_rule_cycle.riv and b/submodule/test/assets/draw_rule_cycle.riv differ
index 66901ac..d5319c5 100644 (file)
Binary files a/submodule/test/assets/fix_rectangle.riv and b/submodule/test/assets/fix_rectangle.riv differ
index 06f109a..5ae8503 100644 (file)
Binary files a/submodule/test/assets/juice.riv and b/submodule/test/assets/juice.riv differ
index 9b37795..e60182c 100644 (file)
Binary files a/submodule/test/assets/off_road_car.riv and b/submodule/test/assets/off_road_car.riv differ
index 50821ea..a0cd2cf 100644 (file)
Binary files a/submodule/test/assets/shapetest.riv and b/submodule/test/assets/shapetest.riv differ
diff --git a/submodule/test/assets/trim_path_linear.riv b/submodule/test/assets/trim_path_linear.riv
new file mode 100644 (file)
index 0000000..d07120f
Binary files /dev/null and b/submodule/test/assets/trim_path_linear.riv differ
index 2984cc6..eda06e7 100644 (file)
Binary files a/submodule/test/assets/two_artboards.riv and b/submodule/test/assets/two_artboards.riv differ
index 62a5c1a..7aa312c 100644 (file)
@@ -1,15 +1,15 @@
+#include "bones/skin.hpp"
+#include "bones/tendon.hpp"
 #include "catch.hpp"
 #include "core/binary_reader.hpp"
 #include "file.hpp"
 #include "no_op_renderer.hpp"
 #include "node.hpp"
 #include "shapes/clipping_shape.hpp"
+#include "shapes/path_vertex.hpp"
+#include "shapes/points_path.hpp"
 #include "shapes/rectangle.hpp"
 #include "shapes/shape.hpp"
-#include "shapes/points_path.hpp"
-#include "bones/skin.hpp"
-#include "bones/tendon.hpp"
-#include "shapes/path_vertex.hpp"
 #include <cstdio>
 
 TEST_CASE("bound bones load correctly", "[bones]")
@@ -24,30 +24,32 @@ TEST_CASE("bound bones load correctly", "[bones]")
        REQUIRE(fread(bytes, 1, length, fp) == length);
        auto reader = rive::BinaryReader(bytes, length);
        rive::File* file = nullptr;
+
        auto result = rive::File::import(reader, &file);
 
        REQUIRE(result == rive::ImportResult::success);
+
        REQUIRE(file != nullptr);
        REQUIRE(file->artboard() != nullptr);
 
        auto node = file->artboard()->find("transmission_front_testing");
        REQUIRE(node != nullptr);
        REQUIRE(node->is<rive::Shape>());
-    REQUIRE(node->as<rive::Shape>()->paths().size() == 1);
-    auto path = node->as<rive::Shape>()->paths()[0];
-    REQUIRE(path->is<rive::PointsPath>());
-    auto pointsPath = path->as<rive::PointsPath>();
-    REQUIRE(pointsPath->skin() != nullptr);
-    REQUIRE(pointsPath->skin()->tendons().size() == 2);
-    REQUIRE(pointsPath->skin()->tendons()[0]->bone() != nullptr);
-    REQUIRE(pointsPath->skin()->tendons()[1]->bone() != nullptr);
-
-    for(auto vertex : path->vertices()) {
-        REQUIRE(vertex->weight() != nullptr);
-    }
-
-    // Ok seems like bones are set up ok.
-
+       REQUIRE(node->as<rive::Shape>()->paths().size() == 1);
+       auto path = node->as<rive::Shape>()->paths()[0];
+       REQUIRE(path->is<rive::PointsPath>());
+       auto pointsPath = path->as<rive::PointsPath>();
+       REQUIRE(pointsPath->skin() != nullptr);
+       REQUIRE(pointsPath->skin()->tendons().size() == 2);
+       REQUIRE(pointsPath->skin()->tendons()[0]->bone() != nullptr);
+       REQUIRE(pointsPath->skin()->tendons()[1]->bone() != nullptr);
+
+       for (auto vertex : path->vertices())
+       {
+               REQUIRE(vertex->weight() != nullptr);
+       }
+
+       // Ok seems like bones are set up ok.
 
        delete file;
        delete[] bytes;
index c03bab3..9215d7f 100644 (file)
@@ -25,11 +25,11 @@ TEST_CASE("file can be read", "[file]")
        REQUIRE(file != nullptr);
        REQUIRE(file->artboard() != nullptr);
 
-       // Default artboard should be named One.
-       REQUIRE(file->artboard()->name() == "One");
+       // Default artboard should be named Two.
+       REQUIRE(file->artboard()->name() == "Two");
 
-       // There should be a second artboard named Two.
-       REQUIRE(file->artboard("Two") != nullptr);
+       // There should be a second artboard named One.
+       REQUIRE(file->artboard("One") != nullptr);
 
        delete file;
        delete[] bytes;
@@ -69,6 +69,11 @@ TEST_CASE("file with animation can be read", "[file]")
        REQUIRE(shinNode->parent()->parent()->parent() != nullptr);
        REQUIRE(shinNode->parent()->parent()->parent() == artboard);
 
+       auto walkAnimation = artboard->animation("walk");
+       REQUIRE(walkAnimation != nullptr);
+       REQUIRE(walkAnimation->numKeyedObjects() == 22);
+       
+
        delete file;
        delete[] bytes;
 }
index d43882c..94ae9d2 100644 (file)
@@ -15,7 +15,6 @@ TEST_CASE("rectangle path builds expected commands", "[path]")
 {
        rive::Artboard* artboard = new rive::Artboard();
        rive::Shape* shape = new rive::Shape();
-       rive::PathComposer* composer = new rive::PathComposer();
        rive::Rectangle* rectangle = new rive::Rectangle();
 
        rectangle->x(0.0f);
@@ -26,10 +25,8 @@ TEST_CASE("rectangle path builds expected commands", "[path]")
 
        artboard->addObject(artboard);
        artboard->addObject(shape);
-       artboard->addObject(composer);
        artboard->addObject(rectangle);
        rectangle->parentId(1);
-       composer->parentId(1);
 
        REQUIRE(artboard->initialize() == rive::StatusCode::Ok);
 
@@ -55,7 +52,6 @@ TEST_CASE("rounded rectangle path builds expected commands", "[path]")
 {
        rive::Artboard* artboard = new rive::Artboard();
        rive::Shape* shape = new rive::Shape();
-       rive::PathComposer* composer = new rive::PathComposer();
        rive::Rectangle* rectangle = new rive::Rectangle();
 
        rectangle->x(0.0f);
@@ -66,10 +62,8 @@ TEST_CASE("rounded rectangle path builds expected commands", "[path]")
 
        artboard->addObject(artboard);
        artboard->addObject(shape);
-       artboard->addObject(composer);
        artboard->addObject(rectangle);
        rectangle->parentId(1);
-       composer->parentId(1);
 
        artboard->initialize();
 
@@ -121,7 +115,6 @@ TEST_CASE("ellipse path builds expected commands", "[path]")
        rive::Artboard* artboard = new rive::Artboard();
        rive::Ellipse* ellipse = new rive::Ellipse();
        rive::Shape* shape = new rive::Shape();
-       rive::PathComposer* composer = new rive::PathComposer();
 
        ellipse->x(0.0f);
        ellipse->y(0.0f);
@@ -130,10 +123,8 @@ TEST_CASE("ellipse path builds expected commands", "[path]")
 
        artboard->addObject(artboard);
        artboard->addObject(shape);
-       artboard->addObject(composer);
        artboard->addObject(ellipse);
        ellipse->parentId(1);
-       composer->parentId(1);
 
        artboard->initialize();