Skip to content
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

CVAT-3D - Part1 #3738

Closed
wants to merge 3 commits into from
Closed

CVAT-3D - Part1 #3738

wants to merge 3 commits into from

Conversation

manasars
Copy link
Contributor

Changes Include:

  1. Fix for Frame manipulation by mouse isn't activated by default in "select" mode
  2. Fix for Shape selection works with a significant delay
  3. Fix for cuboid draw issue
  • I submit my changes into the develop branch
  • I have added description of my changes into CHANGELOG file

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)

…e,shape selection and cuboid draw issue fixes
@bsekachev bsekachev self-assigned this Sep 29, 2021
@nmanovic
Copy link
Contributor

@manasars , could you please merge the latest develop branch? It has some fixes to make the tests more stable. After that the PR should be green.

@manasars
Copy link
Contributor Author

manasars commented Sep 30, 2021

@manasars , could you please merge the latest develop branch? It has some fixes to make the tests more stable. After that the PR should be green.

Hi @nmanovic : I merged the latest develop code , but now I see below error in tests:
Error: No such container: cvat

Looks like its the same behaviour in other PRs as well.

Comment on lines +70 to +71
resetZoom: boolean;
canvasBackgroundColor: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand how opacity, outlined, colorBy relates to shapes. But I don't really understand why resetZoom and canvasBackgroundColor are shape properties.

}

export enum UpdateReasons {
IMAGE_CHANGED = 'image_changed',
OBJECTS_UPDATED = 'objects_updated',
UPDATE_CANVAS_BACKGROUND = 'update_canvas_background',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see any notifications with UPDATE_CANVAS_BACKGROUND. How is it used?

this.data.drawData.enabled = false;
this.data.mode = Mode.IDLE;
this.cancel();
this.data.shapeProperties = {
...shapeProperties,
};
this.notify(UpdateReasons.OBJECTS_UPDATED);
if (opacity !== shapeProperties.opacity || selectedOpacity !== shapeProperties.selectedOpacity) {
this.notify(UpdateReasons.UPDATE_OPACITY);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need separated notify for opacity?
What if in one canvas request we push opacity, selectedOpacity for example with outlineColor?

canvasPerspectiveView.addEventListener('mouseleave', (event: MouseEvent): void => {
if (this.mode === Mode.DRAW) {
event.preventDefault();
this.cancelDraw();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need stop drawing when mouse gets out of the canvas?

@@ -396,6 +401,7 @@ const CanvasWrapperComponent = (props: Props): ReactElement => {
canvasInstanceDOM.perspective.removeEventListener('click', onCanvasClick);
canvasInstanceDOM.perspective.removeEventListener('canvas.fit', onResize);
canvasInstanceDOM.perspective.removeEventListener('canvas.groupped', onCanvasObjectsGroupped);
canvasInstanceDOM.perspective.removeEventListener('canvas.settings', onCanvasShapeDrawn);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to call onCanvasShapeDrawn (which is literally should be called after an object is drawn on 3D canvas) after constructor() of Canvas3DView? Could you explain logic?

} else if (reason === UpdateReasons.SHAPE_ACTIVATED) {
const { clientID } = this.model.data.activeElement;
this.setupObjects();
if (clientID !== 'null') {
this.setupObjects(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to pass the argument here (based on this.model.data.activeElement)? In this.setupObjects we also get access to this.model.data.activeElement (right in the first line)

this.setHelperVisibility(false);
for (let i = 0; i < this.model.data.objects.length; i++) {
const object = this.model.data.objects[i];
if (selected) {
const target = this.views.perspective.scene.getObjectByName(clientID);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clientID is not changed in the loop, why do we get target identifier in the loop?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If target is const, than line:

```this.views.perspective.scene.children[0].remove(target);`` tries to remove the same element a lot of times.
Please, correct me if I am wrong

Comment on lines +773 to +775
this.views.side.scene.children[0].children = [];
this.views.front.scene.children[0].children = [];
this.views.top.scene.children[0].children = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to clear side/front/top scenes a lot of times if only one object can be there at the same time?

Comment on lines +820 to +824
const { canvasBackgroundColor } = this.model.data.shapeProperties;
this.views.top.scene.background = new THREE.Color(canvasBackgroundColor);
this.views.perspective.scene.background = new THREE.Color(canvasBackgroundColor);
this.views.side.scene.background = new THREE.Color(canvasBackgroundColor);
this.views.front.scene.background = new THREE.Color(canvasBackgroundColor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try to test this code?

@nmanovic
Copy link
Contributor

@manasars , we are not going to access these changes. Too many new comments from our team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants