-
Notifications
You must be signed in to change notification settings - Fork 47
[DAR-6533][External] Do not store duplicate attributes in keyframes #1069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DAR-6533][External] Do not store duplicate attributes in keyframes #1069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where attribute data was being stored on keyframes unnecessarily during import, leading to duplicate key subframes. The changes update both the test expectations and the payload processing so that attributes are only stored if they have changed compared to the previous keyframe.
- Updated test cases to check that duplicate attribute data are omitted.
- Modified payload generation in datatypes.py to remove the attributes field when it remains unchanged.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/darwin/importer/importer_test.py | Updated test function name and assertions to reflect desired behavior |
| darwin/datatypes.py | Added logic to remove duplicate attribute data in keyframes |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
AndriiKlymchuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the same issue also applies to other sub annotation types like text and directional vector. Would be good to make behavior consistent across all of them.
…, drop all otherwise
Problem
In DAR-5605 we started properly handling the case when attributes are unset during import, by passing an empty list of attributes in the payload for the unset frame.
In DAR-5903 we made sure unsetting attributes by passing an empty list happened only to keyframes, not to all frames.
The remaining problem is:
Changes in attributes between subframes are presented correctly, however the user ends up with more key subframes than in the original item: 2, 3 vs 1, 2, 3, 4.
Notice that keyframes are created even for key subframes in the original item: if we change an attribute, and the annotation itself doesn't change, it creates a key subframe, but after export-import we get both a key frame and a key subframe (see 2 in the example).
Solution
When importing annotations we avoid storing attributes in a keyframe (creating a key subframe) if the attributes have not changed since last keyframe.
All attributes in the frame are treated as a set. If the set changes, the whole set is included in the payload for the keyframe, if the set remains the same nothing is included for the keyframe. This way we avoid creating extra key subframes where not neccessary.
Changelog
Fix annotation attributes not populating correctly upon re-import, create key subframes only if the attributes change.