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

After deleting a node, cannot create node with same name #732

Closed
devernay opened this issue Dec 23, 2021 · 4 comments
Closed

After deleting a node, cannot create node with same name #732

devernay opened this issue Dec 23, 2021 · 4 comments
Labels
difficulty:medium Medium difficulty bug/issue func:gui
Milestone

Comments

@devernay
Copy link
Member

On behalf of @xcelente (#702 (comment))

So sorry for posting this here as it is entirely unrelated to this post... but I have tried numerous times to create a new issue and I'm always getting a blank page on submit. This post may also not work, I will only know when I hit submit.

Bug: A node with the script-name Text1_2 already exists.

Steps:

Create new text node.
copy node “Text1” to clipboard, CTRL + C
paste below first text node, CTRL + V
delete second text node, DELETE
paste below first text node again, CTRL + V
rename text node to “Test1_2”

“Could not set node script-name to Text1_2: A node with the script-name Text1_2 already exists.”

@devernay
Copy link
Member Author

Explanation: the nodes are not deleted while they're still in the Undo stack (which has a depth of 20 actions by default). You'll notice that if you do 20 actions (move 20 times a node in the graph), you will be able to do that rename.

I have a proposed change, which allows using the name of an existing deactivated node. To reactivate the deactivated node, the name change would be reverted by RenameNodeUndoRedoCommand::undo() anyway. I had to add a few checks in the code, where the node name could only be used if it's activated, and it seems ok so far, but I'll wait for a review

@devernay devernay added difficulty:medium Medium difficulty bug/issue func:gui labels Dec 23, 2021
@devernay devernay added this to the 2.4 milestone Dec 23, 2021
devernay added a commit that referenced this issue Dec 23, 2021
@devernay
Copy link
Member Author

PR #733 submitted, waiting for review

@Shrinks99
Copy link
Contributor

Unsure if this warrants a separate issue but as a bonus hopefully small fix that could maybe be bundled into this: When you copy and paste a node it doesn't up the number on the end but instead adds "_2". This can result in really long names with a bunch of underscores if you copy things repeatedly.

Screenshot 2021-12-24 030232

I ran into this a few times while working on Perfect Restaurant and while obviously not a huge deal it would be helpful if it searched the graph for the largest number and upped it by 1 in the same way that adding a new node does.

@devernay
Copy link
Member Author

@Shrinks99 updated PR #733 to include this proposed change

devernay added a commit that referenced this issue Dec 24, 2021
* Allow node name reuse after delete

fixes #732

* when creating/pasting nodes, don't add more underscores than necessary.

addresses #732 (comment)
devernay added a commit that referenced this issue Dec 25, 2021
* Allow node name reuse after delete

fixes #732

* when creating/pasting nodes, don't add more underscores than necessary.

addresses #732 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:medium Medium difficulty bug/issue func:gui
Projects
None yet
Development

No branches or pull requests

2 participants