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

Fix node duplication/removal behaviour #1738

Merged
merged 3 commits into from
Aug 1, 2022
Merged

Conversation

cbentejac
Copy link
Contributor

Description

Fix corner cases that could lead to some errors when duplicating or removing nodes:

  • a node could be duplicated several times at once but only the first duplicate was stored, causing the "undo" operation to not remove any of the duplicates for that specific node beyond the first one; additionally, duplicated nodes could get stacked on top of other nodes, "hiding" them.
  • there could be attempts to remove a single nodes several times at once, causing errors.

Change the ambiguous behaviour of the "duplicate node(s) from here" action that could lead to duplicating several times the same node unwillingly.

Features list

  • Store correctly all the duplicated nodes: ensures that a duplication operation can be undone/redone properly, with all the duplicated nodes removed/re-duplicated.
  • Vertically align the duplicated nodes correctly: make sure there cannot be any duplicated node stacked on top of another.
  • Prevent the duplication/removal of a node more than once in the same action: ensures a node cannot be duplicated more. than once during a duplication operation, and fixes the cases where a same node was attempted to be removed several times during the same operation (thus raising errors).

@cbentejac cbentejac changed the title Fix/undo duplicated nodes Fix node duplication/removal behaviour Jul 22, 2022
@fabiencastan fabiencastan added this to the Meshroom 2022.1.0 milestone Jul 28, 2022
Duplicates used to be stored in a dictionary with an entry being
"parent node": "duplicated node". On occasions where a single
parent node was duplicated more than once, the latest duplicated
 node erased the previous one(s), and these older ones were
"lost": after being created, there was no trace left of their
existence in the duplication operation. Undoing that duplication
operation was thus leaving these duplicated nodes out and not
removing them.

Duplicated nodes are now stored as "parent node": [list of
duplicated nodes] to keep track of all the created nodes,
effectively removing them upon an "undo".
When a node is duplicated more than once in a single "duplicate"
operation, it happens that several of the duplicated nodes
overlap. This patch takes into account all the newly duplicated
(and already moved) nodes before moving them into their final
position.
@cbentejac cbentejac force-pushed the fix/undoDuplicatedNodes branch from 6435551 to 819d9e3 Compare July 28, 2022 12:14
Copy link
Member

@fabiencastan fabiencastan left a comment

Choose a reason for hiding this comment

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

Good job!

@fabiencastan fabiencastan merged commit dd5aadd into develop Aug 1, 2022
@fabiencastan fabiencastan deleted the fix/undoDuplicatedNodes branch August 1, 2022 13:56
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.

2 participants