Don't apply id keyframes when mix value is 0 Addresses an issue where mixing animations of a nested artboard from it's parent artboard can produce unexpected results when dealing with id based keyframes (such as active solo or draw rules). The proposed solution ignores applying an id keyframe's value to an object if the mix value for that animation/keyframe is 0. This provides a way to turn "off" an id based keyframe during a mix. Behavior AFTER this update. This example has an artboard with 2 animations that each have different values for active solo and a draw rule that is on or off. This artboard is nested in another artboard which sets the animation mix as seen in the recording. https://github.com/rive-app/rive/assets/186340/b67e98c8-ab7c-4a92-ab3b-65d27b0eadbd Behavior BEFORE: https://github.com/rive-app/rive/assets/186340/c0a6c558-efc4-43ec-8974-57bf8f6ab3e8 Diffs= b9382846d Don't apply id keyframes when mix value is 0 (#5960) Co-authored-by: Philip Chung <philterdesign@gmail.com>
diff --git a/.rive_head b/.rive_head index e1220dc..69fa08c 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -f96c86fcc800a1fa2bec3e97be00cab395ea838d +b9382846d3152fd87ee8ffc8e7a86ea2b5933a9b
diff --git a/src/animation/keyframe_id.cpp b/src/animation/keyframe_id.cpp index dfa8fcc..81a0a9e 100644 --- a/src/animation/keyframe_id.cpp +++ b/src/animation/keyframe_id.cpp
@@ -5,7 +5,9 @@ void KeyFrameId::apply(Core* object, int propertyKey, float mix) { - CoreRegistry::setUint(object, propertyKey, value()); + if (mix > 0) { + CoreRegistry::setUint(object, propertyKey, value()); + } } void KeyFrameId::applyInterpolation(Core* object, @@ -14,5 +16,7 @@ const KeyFrame* nextFrame, float mix) { - CoreRegistry::setUint(object, propertyKey, value()); + if (mix > 0) { + CoreRegistry::setUint(object, propertyKey, value()); + } } \ No newline at end of file
diff --git a/src/animation/keyframe_string.cpp b/src/animation/keyframe_string.cpp index 7968dda..fdbdcc3 100644 --- a/src/animation/keyframe_string.cpp +++ b/src/animation/keyframe_string.cpp
@@ -5,7 +5,9 @@ void KeyFrameString::apply(Core* object, int propertyKey, float mix) { - CoreRegistry::setString(object, propertyKey, value()); + if (mix > 0) { + CoreRegistry::setString(object, propertyKey, value()); + } } void KeyFrameString::applyInterpolation(Core* object, @@ -14,5 +16,7 @@ const KeyFrame* nextFrame, float mix) { - CoreRegistry::setString(object, propertyKey, value()); + if (mix > 0) { + CoreRegistry::setString(object, propertyKey, value()); + } } \ No newline at end of file