Skip to content

Commit

Permalink
use varuint for writing/reading objectid, total properties and proper…
Browse files Browse the repository at this point in the history
…ty key in animation reset

objectId, propertykey are definitely written as varuint, not sure if properties total needs to be, but doesn't hurt to have it that way either I think.

I'm not sure if this is everything that needs to be updated. I tried to use `generate_core_runtime` to update the flutter runtime but that made a bunch of changes like unused imports all over the place...

Diffs=
07cbce551 use varuint for writing/reading objectid, total properties and property key in animation reset (#7510)

Co-authored-by: Arthur Vivian <[email protected]>
Co-authored-by: Hernan Torrisi <[email protected]>
  • Loading branch information
3 people committed Jul 2, 2024
1 parent 532ad4f commit baa1811
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f9b1e8ec2ff7960990f87ef855c669f6a4a86b1d
07cbce5511e451396513f9d092a72193d41844f5
12 changes: 6 additions & 6 deletions lib/src/rive_core/animation/animation_reset_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class AnimationReset {
}

void writeObjectId(int id) {
_writer.writeInt8(id);
_writer.writeVarUint(id);
}

void writeTotalProperties(int totalProperties) {
_writer.writeInt8(totalProperties);
_writer.writeVarUint(totalProperties);
}

void writePropertyKey(int propertyKey) {
_writer.writeInt8(propertyKey);
_writer.writeVarUint(propertyKey);
}

void writeColor(int value) {
Expand Down Expand Up @@ -74,15 +74,15 @@ class AnimationReset {
reader.readIndex = 0;
while (reader.readIndex < _dataSize) {
// First we read the object's id
final objectIntId = reader.readInt8();
final objectIntId = reader.readVarUint();
final objectId = resolveId(objectIntId);
final object = core.resolve<Core>(objectId);
// Second we read how many keyframed properties it has
final totalProperties = reader.readInt8();
final totalProperties = reader.readVarUint();
int currentPropertyIndex = 0;
while (currentPropertyIndex < totalProperties) {
// Third we read the property key for each property
final propertyKey = reader.readInt8();
final propertyKey = reader.readVarUint();
// Fourth we read the property value for each property
if (_isDouble(propertyKey, object!)) {
double value = reader.readFloat32();
Expand Down

0 comments on commit baa1811

Please sign in to comment.