Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Fixed rotation is lost during changing a mutable attribute (cvat-ai#5968
Browse files Browse the repository at this point in the history
)

<!-- Raise an issue to propose your change
(https://github.com/opencv/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution
guide](https://opencv.github.io/cvat/docs/contributing/). -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
Resolved cvat-ai#5966 

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [x] I have added a description of my changes into the
[CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the documentation accordingly
- [x] I have added tests to cover my changes
- [x] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [x] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/opencv/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/opencv/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/opencv/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Nikita Manovich <nikita@cvat.ai>
  • Loading branch information
2 people authored and mikhail-treskin committed Jul 1, 2023
1 parent 9c5da46 commit 08bf62c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Points missing when exporting tracked skeleton (<https://github.com/opencv/cvat/issues/5497>)
- Escaping in the `filter` parameter in generated URLs
(<https://github.com/opencv/cvat/issues/5566>)
- Rotation property lost during saving a mutable attribute (<https://github.com/opencv/cvat/pull/5968>)
- Incorrect calculation of working time in analytics (<https://github.com/opencv/cvat/pull/5973>)

### Security
Expand Down
11 changes: 2 additions & 9 deletions cvat-core/src/annotations-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ export class Track extends Drawn {
this.shapes[frame].attributes[attrID] !== attributes[attrID];
}
}
let redoShape;
let redoShape: TrackedShape | undefined;
if (mutableAttributesUpdated) {
if (wasKeyframe) {
redoShape = {
Expand All @@ -1112,14 +1112,7 @@ export class Track extends Drawn {
},
};
} else {
redoShape = {
frame,
zOrder: current.zOrder,
points: current.points,
outside: current.outside,
occluded: current.occluded,
attributes: {},
};
redoShape = copyShape(current);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.50.6",
"version": "1.50.7",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -7,8 +8,7 @@
import { taskName } from '../../support/const';

context('Mutable attribute.', () => {
const caseId = '70';
const labelTrack = `Case ${caseId}`;
const labelName = 'car';
const additionalAttrsLabelShape = [
{
additionalAttrName: 'tree', additionalValue: 'birch tree', typeAttribute: 'Text', mutable: true,
Expand All @@ -18,7 +18,7 @@ context('Mutable attribute.', () => {
const createRectangleTrack2Points = {
points: 'By 2 Points',
type: 'Track',
labelName: labelTrack,
labelName,
firstX: 260,
firstY: 200,
secondX: 360,
Expand All @@ -45,15 +45,15 @@ context('Mutable attribute.', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(labelTrack, additionalAttrsLabelShape);
cy.addNewLabel(labelName, additionalAttrsLabelShape);
cy.openJob();
cy.createRectangle(createRectangleTrack2Points);
});

describe(`Testing case "${caseId}"`, () => {
describe('Check different use-cases with mutable attributes', () => {
it('Go to AAM. For the 2nd and 3rd frames, change the attribute value.', () => {
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelTrack);
cy.changeLabelAAM(labelName);
testChangingAttributeValue(additionalAttrsLabelShape[0].additionalValue, attrValueSecondFrame);
testChangingAttributeValue(attrValueSecondFrame, attrValueThirdFrame);
});
Expand All @@ -76,5 +76,32 @@ context('Mutable attribute.', () => {
checkObjectDetailValue(num, val);
});
});

it('Test attribute can be changed between two keyframes and can be selected after', () => {
cy.goCheckFrameNumber(0);
cy.removeAnnotations();
cy.createRectangle(createRectangleTrack2Points);
cy.goCheckFrameNumber(2);

cy.get('#cvat-objects-sidebar-state-item-1')
.within(() => {
cy.get('.cvat-object-item-button-keyframe').click();
cy.get('span').contains('DETAILS').click();
});

cy.goCheckFrameNumber(1);

cy.get('#cvat-objects-sidebar-state-item-1')
.within(() => {
cy.get('.cvat-object-item-text-attribute').should('exist').and('be.visible').clear();
cy.get('.cvat-object-item-text-attribute').type('new attribute value');
});

cy.get('body').click(); // deactivate
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove')
.trigger('mouseover')
.should('have.class', 'cvat_canvas_shape_activated');
});
});
});

0 comments on commit 08bf62c

Please sign in to comment.